// Generated by Futhark 0.20.0
// git: 5cc4d4b (Tue Jul 6 11:53:53 2021 -0700)
#ifndef _GNU_SOURCE
#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

#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_size(struct futhark_context_config *cfg, const
                                    char *size_name, size_t size_value);
int futhark_get_num_sizes(void);
const char *futhark_get_size_name(int);
const char *futhark_get_size_class(int);

// Arrays

struct futhark_f32_2d;
struct futhark_f32_2d *futhark_new_f32_2d(struct futhark_context *ctx, const
                                          float *data, int64_t dim0,
                                          int64_t dim1);
struct futhark_f32_2d *futhark_new_raw_f32_2d(struct futhark_context *ctx, const
                                              char *data, int offset,
                                              int64_t dim0, int64_t dim1);
int futhark_free_f32_2d(struct futhark_context *ctx,
                        struct futhark_f32_2d *arr);
int futhark_values_f32_2d(struct futhark_context *ctx,
                          struct futhark_f32_2d *arr, float *data);
char *futhark_values_raw_f32_2d(struct futhark_context *ctx,
                                struct futhark_f32_2d *arr);
const int64_t *futhark_shape_f32_2d(struct futhark_context *ctx,
                                    struct futhark_f32_2d *arr);

// Opaque values


// Entry points

int futhark_entry_main(struct futhark_context *ctx,
                       struct futhark_f32_2d **out0,
                       struct futhark_f32_2d **out1,
                       struct futhark_f32_2d **out2, const
                       struct futhark_f32_2d *in0, const int64_t in1, const
                       int64_t in2, const int64_t in3, const int64_t in4, const
                       int64_t in5, const int64_t in6, const int64_t in7, const
                       int64_t in8, const int64_t in9, const int64_t in10, const
                       int64_t in11);

// 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>
#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, ...) {
  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, msg...) check_err(err, 0, __func__, __LINE__, msg)
#define CHECK_ERRNO(err, msg...) check_err(err, 1, __func__, __LINE__, msg)

// 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) {
  size_t start = ftell(f);
  fseek(f, 0, SEEK_END);
  size_t src_size = ftell(f)-start;
  fseek(f, start, SEEK_SET);
  unsigned char *s = (unsigned char*) malloc(src_size + 1);
  if (fread(s, 1, src_size, f) != src_size) {
    free(s);
    s = NULL;
  } else {
    s[src_size] = '\0';
  }

  if (size) {
    *size = 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 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.

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 x << y;
}
static inline uint16_t shl16(uint16_t x, uint16_t y)
{
    return 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 int8_t pow8(int8_t x, int8_t y)
{
    int8_t res = 1, rem = y;
    
    while (rem != 0) {
        if (rem & 1)
            res *= x;
        rem >>= 1;
        x *= x;
    }
    return res;
}
static inline int16_t pow16(int16_t x, int16_t y)
{
    int16_t res = 1, rem = y;
    
    while (rem != 0) {
        if (rem & 1)
            res *= x;
        rem >>= 1;
        x *= x;
    }
    return res;
}
static inline int32_t pow32(int32_t x, int32_t y)
{
    int32_t res = 1, rem = y;
    
    while (rem != 0) {
        if (rem & 1)
            res *= x;
        rem >>= 1;
        x *= x;
    }
    return res;
}
static inline int64_t pow64(int64_t x, int64_t y)
{
    int64_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)
#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
static int32_t futrts_popc8(int8_t x)
{
    int c = 0;
    
    for (; x; ++c)
        x &= x - 1;
    return c;
}
static int32_t futrts_popc16(int16_t x)
{
    int c = 0;
    
    for (; x; ++c)
        x &= x - 1;
    return c;
}
static int32_t futrts_popc32(int32_t x)
{
    int c = 0;
    
    for (; x; ++c)
        x &= x - 1;
    return c;
}
static int32_t futrts_popc64(int64_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
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
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
static int32_t futrts_clzz8(int8_t x)
{
    int n = 0;
    int bits = sizeof(x) * 8;
    
    for (int i = 0; i < bits; i++) {
        if (x < 0)
            break;
        n++;
        x <<= 1;
    }
    return n;
}
static int32_t futrts_clzz16(int16_t x)
{
    int n = 0;
    int bits = sizeof(x) * 8;
    
    for (int i = 0; i < bits; i++) {
        if (x < 0)
            break;
        n++;
        x <<= 1;
    }
    return n;
}
static int32_t futrts_clzz32(int32_t x)
{
    int n = 0;
    int bits = sizeof(x) * 8;
    
    for (int i = 0; i < bits; i++) {
        if (x < 0)
            break;
        n++;
        x <<= 1;
    }
    return n;
}
static int32_t futrts_clzz64(int64_t x)
{
    int n = 0;
    int bits = sizeof(x) * 8;
    
    for (int i = 0; i < bits; i++) {
        if (x < 0)
            break;
        n++;
        x <<= 1;
    }
    return n;
}
#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
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(x);
}
static int32_t futrts_ctzz64(int64_t x)
{
    return x == 0 ? 64 : __builtin_ctzll(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 float fmin32(float x, float y)
{
    return fmin(x, y);
}
static inline float fmax32(float x, float y)
{
    return fmax(x, y);
}
static inline float fpow32(float x, float y)
{
    return pow(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;
}
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 double fmin64(double x, double y)
{
    return fmin(x, y);
}
static inline double fmax64(double x, double y)
{
    return fmax(x, y);
}
static inline double fpow64(double x, double y)
{
    return pow(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 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;
}
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
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);
}
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);
}
#ifdef __OPENCL_VERSION__
static inline double futrts_lerp64(double v0, double v1, double t)
{
    return mix(v0, v1, t);
}
static inline double futrts_mad64(double a, double b, double c)
{
    return mad(a, b, c);
}
#else
static inline double futrts_lerp64(double v0, double v1, double t)
{
    return v0 + (v1 - v0) * t;
}
static inline double futrts_mad64(double a, double b, double c)
{
    return a * b + c;
}
#endif
static int init_constants(struct futhark_context *);
static int free_constants(struct futhark_context *);
struct memblock {
    int *references;
    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>
#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__)
    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();
#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->chunkable ? worker->tid : 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) {
  // 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");
  }

  free(scheduler->workers);

  return 0;
}

// End of scheduler.h

struct futhark_context_config {
    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->debugging = 0;
    cfg->profiling = 0;
    cfg->num_threads = 0;
    return cfg;
}
void futhark_context_config_free(struct futhark_context_config *cfg)
{
    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 scheduler scheduler;
    int detail_memory;
    int debugging;
    int profiling;
    int profiling_paused;
    int logging;
    lock_t lock;
    char *error;
    FILE *log;
    int total_runs;
    long total_runtime;
    int64_t peak_mem_usage_default;
    int64_t cur_mem_usage_default;
    struct {
        int dummy;
    } constants;
    int64_t *futhark_mc_segmap_parloop_131129_total_runtime;
    int *futhark_mc_segmap_parloop_131129_runs;
    int64_t *futhark_mc_segmap_parloop_131129_iter;
    int64_t futhark_mc_segmap_parloop_131129_total_total_runtime;
    int futhark_mc_segmap_parloop_131129_total_runs;
    int64_t futhark_mc_segmap_parloop_131129_total_iter;
    int64_t *futhark_mc_segmap_task_131127_total_runtime;
    int *futhark_mc_segmap_task_131127_runs;
    int64_t *futhark_mc_segmap_task_131127_iter;
    int64_t futhark_mc_segmap_task_131127_total_time;
    int64_t futhark_mc_segmap_task_131127_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_131141_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_131141_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_131141_iter;
    int64_t futhark_mc_scan_stage_1_parloop_131141_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_131141_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_131141_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_131143_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_131143_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_131143_iter;
    int64_t futhark_mc_scan_stage_3_parloop_131143_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_131143_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_131143_total_iter;
    int64_t *futhark_mc_segscan_task_131138_total_runtime;
    int *futhark_mc_segscan_task_131138_runs;
    int64_t *futhark_mc_segscan_task_131138_iter;
    int64_t futhark_mc_segscan_task_131138_total_time;
    int64_t futhark_mc_segscan_task_131138_total_iter;
    int64_t *futhark_mc_segmap_parloop_131147_total_runtime;
    int *futhark_mc_segmap_parloop_131147_runs;
    int64_t *futhark_mc_segmap_parloop_131147_iter;
    int64_t futhark_mc_segmap_parloop_131147_total_total_runtime;
    int futhark_mc_segmap_parloop_131147_total_runs;
    int64_t futhark_mc_segmap_parloop_131147_total_iter;
    int64_t *futhark_mc_segmap_task_131145_total_runtime;
    int *futhark_mc_segmap_task_131145_runs;
    int64_t *futhark_mc_segmap_task_131145_iter;
    int64_t futhark_mc_segmap_task_131145_total_time;
    int64_t futhark_mc_segmap_task_131145_total_iter;
    int64_t *futhark_mc_segmap_parloop_131134_total_runtime;
    int *futhark_mc_segmap_parloop_131134_runs;
    int64_t *futhark_mc_segmap_parloop_131134_iter;
    int64_t futhark_mc_segmap_parloop_131134_total_total_runtime;
    int futhark_mc_segmap_parloop_131134_total_runs;
    int64_t futhark_mc_segmap_parloop_131134_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131132_total_runtime;
    int *futhark_mc_segmap_nested_task_131132_runs;
    int64_t *futhark_mc_segmap_nested_task_131132_iter;
    int64_t *futhark_mc_segmap_parloop_131151_total_runtime;
    int *futhark_mc_segmap_parloop_131151_runs;
    int64_t *futhark_mc_segmap_parloop_131151_iter;
    int64_t futhark_mc_segmap_parloop_131151_total_total_runtime;
    int futhark_mc_segmap_parloop_131151_total_runs;
    int64_t futhark_mc_segmap_parloop_131151_total_iter;
    int64_t *futhark_mc_segmap_task_131149_total_runtime;
    int *futhark_mc_segmap_task_131149_runs;
    int64_t *futhark_mc_segmap_task_131149_iter;
    int64_t futhark_mc_segmap_task_131149_total_time;
    int64_t futhark_mc_segmap_task_131149_total_iter;
    int64_t *futhark_mc_segmap_parloop_131160_total_runtime;
    int *futhark_mc_segmap_parloop_131160_runs;
    int64_t *futhark_mc_segmap_parloop_131160_iter;
    int64_t futhark_mc_segmap_parloop_131160_total_total_runtime;
    int futhark_mc_segmap_parloop_131160_total_runs;
    int64_t futhark_mc_segmap_parloop_131160_total_iter;
    int64_t *futhark_mc_segmap_task_131158_total_runtime;
    int *futhark_mc_segmap_task_131158_runs;
    int64_t *futhark_mc_segmap_task_131158_iter;
    int64_t futhark_mc_segmap_task_131158_total_time;
    int64_t futhark_mc_segmap_task_131158_total_iter;
    int64_t *futhark_mc_segmap_parloop_131155_total_runtime;
    int *futhark_mc_segmap_parloop_131155_runs;
    int64_t *futhark_mc_segmap_parloop_131155_iter;
    int64_t futhark_mc_segmap_parloop_131155_total_total_runtime;
    int futhark_mc_segmap_parloop_131155_total_runs;
    int64_t futhark_mc_segmap_parloop_131155_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131153_total_runtime;
    int *futhark_mc_segmap_nested_task_131153_runs;
    int64_t *futhark_mc_segmap_nested_task_131153_iter;
    int64_t *futhark_mc_segmap_parloop_131164_total_runtime;
    int *futhark_mc_segmap_parloop_131164_runs;
    int64_t *futhark_mc_segmap_parloop_131164_iter;
    int64_t futhark_mc_segmap_parloop_131164_total_total_runtime;
    int futhark_mc_segmap_parloop_131164_total_runs;
    int64_t futhark_mc_segmap_parloop_131164_total_iter;
    int64_t *futhark_mc_segmap_task_131162_total_runtime;
    int *futhark_mc_segmap_task_131162_runs;
    int64_t *futhark_mc_segmap_task_131162_iter;
    int64_t futhark_mc_segmap_task_131162_total_time;
    int64_t futhark_mc_segmap_task_131162_total_iter;
    int64_t *futhark_mc_segmap_parloop_131173_total_runtime;
    int *futhark_mc_segmap_parloop_131173_runs;
    int64_t *futhark_mc_segmap_parloop_131173_iter;
    int64_t futhark_mc_segmap_parloop_131173_total_total_runtime;
    int futhark_mc_segmap_parloop_131173_total_runs;
    int64_t futhark_mc_segmap_parloop_131173_total_iter;
    int64_t *futhark_mc_segmap_task_131171_total_runtime;
    int *futhark_mc_segmap_task_131171_runs;
    int64_t *futhark_mc_segmap_task_131171_iter;
    int64_t futhark_mc_segmap_task_131171_total_time;
    int64_t futhark_mc_segmap_task_131171_total_iter;
    int64_t *futhark_mc_segmap_parloop_131168_total_runtime;
    int *futhark_mc_segmap_parloop_131168_runs;
    int64_t *futhark_mc_segmap_parloop_131168_iter;
    int64_t futhark_mc_segmap_parloop_131168_total_total_runtime;
    int futhark_mc_segmap_parloop_131168_total_runs;
    int64_t futhark_mc_segmap_parloop_131168_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131166_total_runtime;
    int *futhark_mc_segmap_nested_task_131166_runs;
    int64_t *futhark_mc_segmap_nested_task_131166_iter;
    int64_t *futhark_mc_segmap_parloop_131177_total_runtime;
    int *futhark_mc_segmap_parloop_131177_runs;
    int64_t *futhark_mc_segmap_parloop_131177_iter;
    int64_t futhark_mc_segmap_parloop_131177_total_total_runtime;
    int futhark_mc_segmap_parloop_131177_total_runs;
    int64_t futhark_mc_segmap_parloop_131177_total_iter;
    int64_t *futhark_mc_segmap_task_131175_total_runtime;
    int *futhark_mc_segmap_task_131175_runs;
    int64_t *futhark_mc_segmap_task_131175_iter;
    int64_t futhark_mc_segmap_task_131175_total_time;
    int64_t futhark_mc_segmap_task_131175_total_iter;
    int64_t *futhark_mc_segmap_parloop_131186_total_runtime;
    int *futhark_mc_segmap_parloop_131186_runs;
    int64_t *futhark_mc_segmap_parloop_131186_iter;
    int64_t futhark_mc_segmap_parloop_131186_total_total_runtime;
    int futhark_mc_segmap_parloop_131186_total_runs;
    int64_t futhark_mc_segmap_parloop_131186_total_iter;
    int64_t *futhark_mc_segmap_task_131184_total_runtime;
    int *futhark_mc_segmap_task_131184_runs;
    int64_t *futhark_mc_segmap_task_131184_iter;
    int64_t futhark_mc_segmap_task_131184_total_time;
    int64_t futhark_mc_segmap_task_131184_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131194_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131194_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131194_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131194_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131194_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131194_total_iter;
    int64_t *futhark_mc_segred_task_131191_total_runtime;
    int *futhark_mc_segred_task_131191_runs;
    int64_t *futhark_mc_segred_task_131191_iter;
    int64_t futhark_mc_segred_task_131191_total_time;
    int64_t futhark_mc_segred_task_131191_total_iter;
    int64_t *futhark_mc_segmap_parloop_131189_total_runtime;
    int *futhark_mc_segmap_parloop_131189_runs;
    int64_t *futhark_mc_segmap_parloop_131189_iter;
    int64_t futhark_mc_segmap_parloop_131189_total_total_runtime;
    int futhark_mc_segmap_parloop_131189_total_runs;
    int64_t futhark_mc_segmap_parloop_131189_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131187_total_runtime;
    int *futhark_mc_segmap_nested_task_131187_runs;
    int64_t *futhark_mc_segmap_nested_task_131187_iter;
    int64_t *futhark_mc_segmap_parloop_131181_total_runtime;
    int *futhark_mc_segmap_parloop_131181_runs;
    int64_t *futhark_mc_segmap_parloop_131181_iter;
    int64_t futhark_mc_segmap_parloop_131181_total_total_runtime;
    int futhark_mc_segmap_parloop_131181_total_runs;
    int64_t futhark_mc_segmap_parloop_131181_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131179_total_runtime;
    int *futhark_mc_segmap_nested_task_131179_runs;
    int64_t *futhark_mc_segmap_nested_task_131179_iter;
    int64_t *futhark_mc_segmap_parloop_131198_total_runtime;
    int *futhark_mc_segmap_parloop_131198_runs;
    int64_t *futhark_mc_segmap_parloop_131198_iter;
    int64_t futhark_mc_segmap_parloop_131198_total_total_runtime;
    int futhark_mc_segmap_parloop_131198_total_runs;
    int64_t futhark_mc_segmap_parloop_131198_total_iter;
    int64_t *futhark_mc_segmap_task_131196_total_runtime;
    int *futhark_mc_segmap_task_131196_runs;
    int64_t *futhark_mc_segmap_task_131196_iter;
    int64_t futhark_mc_segmap_task_131196_total_time;
    int64_t futhark_mc_segmap_task_131196_total_iter;
    int64_t *futhark_mc_segmap_parloop_131213_total_runtime;
    int *futhark_mc_segmap_parloop_131213_runs;
    int64_t *futhark_mc_segmap_parloop_131213_iter;
    int64_t futhark_mc_segmap_parloop_131213_total_total_runtime;
    int futhark_mc_segmap_parloop_131213_total_runs;
    int64_t futhark_mc_segmap_parloop_131213_total_iter;
    int64_t *futhark_mc_segmap_task_131211_total_runtime;
    int *futhark_mc_segmap_task_131211_runs;
    int64_t *futhark_mc_segmap_task_131211_iter;
    int64_t futhark_mc_segmap_task_131211_total_time;
    int64_t futhark_mc_segmap_task_131211_total_iter;
    int64_t *futhark_mc_segmap_parloop_131217_total_runtime;
    int *futhark_mc_segmap_parloop_131217_runs;
    int64_t *futhark_mc_segmap_parloop_131217_iter;
    int64_t futhark_mc_segmap_parloop_131217_total_total_runtime;
    int futhark_mc_segmap_parloop_131217_total_runs;
    int64_t futhark_mc_segmap_parloop_131217_total_iter;
    int64_t *futhark_mc_segmap_task_131215_total_runtime;
    int *futhark_mc_segmap_task_131215_runs;
    int64_t *futhark_mc_segmap_task_131215_iter;
    int64_t futhark_mc_segmap_task_131215_total_time;
    int64_t futhark_mc_segmap_task_131215_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131225_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131225_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131225_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131225_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131225_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131225_total_iter;
    int64_t *futhark_mc_segred_task_131222_total_runtime;
    int *futhark_mc_segred_task_131222_runs;
    int64_t *futhark_mc_segred_task_131222_iter;
    int64_t futhark_mc_segred_task_131222_total_time;
    int64_t futhark_mc_segred_task_131222_total_iter;
    int64_t *futhark_mc_segmap_parloop_131220_total_runtime;
    int *futhark_mc_segmap_parloop_131220_runs;
    int64_t *futhark_mc_segmap_parloop_131220_iter;
    int64_t futhark_mc_segmap_parloop_131220_total_total_runtime;
    int futhark_mc_segmap_parloop_131220_total_runs;
    int64_t futhark_mc_segmap_parloop_131220_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131218_total_runtime;
    int *futhark_mc_segmap_nested_task_131218_runs;
    int64_t *futhark_mc_segmap_nested_task_131218_iter;
    int64_t *futhark_mc_segmap_parloop_131205_total_runtime;
    int *futhark_mc_segmap_parloop_131205_runs;
    int64_t *futhark_mc_segmap_parloop_131205_iter;
    int64_t futhark_mc_segmap_parloop_131205_total_total_runtime;
    int futhark_mc_segmap_parloop_131205_total_runs;
    int64_t futhark_mc_segmap_parloop_131205_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131203_total_runtime;
    int *futhark_mc_segmap_nested_task_131203_runs;
    int64_t *futhark_mc_segmap_nested_task_131203_iter;
    int64_t *futhark_mc_segmap_parloop_131229_total_runtime;
    int *futhark_mc_segmap_parloop_131229_runs;
    int64_t *futhark_mc_segmap_parloop_131229_iter;
    int64_t futhark_mc_segmap_parloop_131229_total_total_runtime;
    int futhark_mc_segmap_parloop_131229_total_runs;
    int64_t futhark_mc_segmap_parloop_131229_total_iter;
    int64_t *futhark_mc_segmap_task_131227_total_runtime;
    int *futhark_mc_segmap_task_131227_runs;
    int64_t *futhark_mc_segmap_task_131227_iter;
    int64_t futhark_mc_segmap_task_131227_total_time;
    int64_t futhark_mc_segmap_task_131227_total_iter;
    int64_t *futhark_mc_segmap_parloop_131244_total_runtime;
    int *futhark_mc_segmap_parloop_131244_runs;
    int64_t *futhark_mc_segmap_parloop_131244_iter;
    int64_t futhark_mc_segmap_parloop_131244_total_total_runtime;
    int futhark_mc_segmap_parloop_131244_total_runs;
    int64_t futhark_mc_segmap_parloop_131244_total_iter;
    int64_t *futhark_mc_segmap_task_131242_total_runtime;
    int *futhark_mc_segmap_task_131242_runs;
    int64_t *futhark_mc_segmap_task_131242_iter;
    int64_t futhark_mc_segmap_task_131242_total_time;
    int64_t futhark_mc_segmap_task_131242_total_iter;
    int64_t *futhark_mc_segmap_parloop_131248_total_runtime;
    int *futhark_mc_segmap_parloop_131248_runs;
    int64_t *futhark_mc_segmap_parloop_131248_iter;
    int64_t futhark_mc_segmap_parloop_131248_total_total_runtime;
    int futhark_mc_segmap_parloop_131248_total_runs;
    int64_t futhark_mc_segmap_parloop_131248_total_iter;
    int64_t *futhark_mc_segmap_task_131246_total_runtime;
    int *futhark_mc_segmap_task_131246_runs;
    int64_t *futhark_mc_segmap_task_131246_iter;
    int64_t futhark_mc_segmap_task_131246_total_time;
    int64_t futhark_mc_segmap_task_131246_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131256_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131256_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131256_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131256_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131256_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131256_total_iter;
    int64_t *futhark_mc_segred_task_131253_total_runtime;
    int *futhark_mc_segred_task_131253_runs;
    int64_t *futhark_mc_segred_task_131253_iter;
    int64_t futhark_mc_segred_task_131253_total_time;
    int64_t futhark_mc_segred_task_131253_total_iter;
    int64_t *futhark_mc_segmap_parloop_131251_total_runtime;
    int *futhark_mc_segmap_parloop_131251_runs;
    int64_t *futhark_mc_segmap_parloop_131251_iter;
    int64_t futhark_mc_segmap_parloop_131251_total_total_runtime;
    int futhark_mc_segmap_parloop_131251_total_runs;
    int64_t futhark_mc_segmap_parloop_131251_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131249_total_runtime;
    int *futhark_mc_segmap_nested_task_131249_runs;
    int64_t *futhark_mc_segmap_nested_task_131249_iter;
    int64_t *futhark_mc_segmap_parloop_131236_total_runtime;
    int *futhark_mc_segmap_parloop_131236_runs;
    int64_t *futhark_mc_segmap_parloop_131236_iter;
    int64_t futhark_mc_segmap_parloop_131236_total_total_runtime;
    int futhark_mc_segmap_parloop_131236_total_runs;
    int64_t futhark_mc_segmap_parloop_131236_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131234_total_runtime;
    int *futhark_mc_segmap_nested_task_131234_runs;
    int64_t *futhark_mc_segmap_nested_task_131234_iter;
    int64_t *futhark_mc_segmap_parloop_131260_total_runtime;
    int *futhark_mc_segmap_parloop_131260_runs;
    int64_t *futhark_mc_segmap_parloop_131260_iter;
    int64_t futhark_mc_segmap_parloop_131260_total_total_runtime;
    int futhark_mc_segmap_parloop_131260_total_runs;
    int64_t futhark_mc_segmap_parloop_131260_total_iter;
    int64_t *futhark_mc_segmap_task_131258_total_runtime;
    int *futhark_mc_segmap_task_131258_runs;
    int64_t *futhark_mc_segmap_task_131258_iter;
    int64_t futhark_mc_segmap_task_131258_total_time;
    int64_t futhark_mc_segmap_task_131258_total_iter;
    int64_t *futhark_mc_segmap_parloop_131269_total_runtime;
    int *futhark_mc_segmap_parloop_131269_runs;
    int64_t *futhark_mc_segmap_parloop_131269_iter;
    int64_t futhark_mc_segmap_parloop_131269_total_total_runtime;
    int futhark_mc_segmap_parloop_131269_total_runs;
    int64_t futhark_mc_segmap_parloop_131269_total_iter;
    int64_t *futhark_mc_segmap_task_131267_total_runtime;
    int *futhark_mc_segmap_task_131267_runs;
    int64_t *futhark_mc_segmap_task_131267_iter;
    int64_t futhark_mc_segmap_task_131267_total_time;
    int64_t futhark_mc_segmap_task_131267_total_iter;
    int64_t *futhark_mc_segmap_parloop_131264_total_runtime;
    int *futhark_mc_segmap_parloop_131264_runs;
    int64_t *futhark_mc_segmap_parloop_131264_iter;
    int64_t futhark_mc_segmap_parloop_131264_total_total_runtime;
    int futhark_mc_segmap_parloop_131264_total_runs;
    int64_t futhark_mc_segmap_parloop_131264_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131262_total_runtime;
    int *futhark_mc_segmap_nested_task_131262_runs;
    int64_t *futhark_mc_segmap_nested_task_131262_iter;
    int64_t *futhark_mc_segmap_parloop_131273_total_runtime;
    int *futhark_mc_segmap_parloop_131273_runs;
    int64_t *futhark_mc_segmap_parloop_131273_iter;
    int64_t futhark_mc_segmap_parloop_131273_total_total_runtime;
    int futhark_mc_segmap_parloop_131273_total_runs;
    int64_t futhark_mc_segmap_parloop_131273_total_iter;
    int64_t *futhark_mc_segmap_task_131271_total_runtime;
    int *futhark_mc_segmap_task_131271_runs;
    int64_t *futhark_mc_segmap_task_131271_iter;
    int64_t futhark_mc_segmap_task_131271_total_time;
    int64_t futhark_mc_segmap_task_131271_total_iter;
    int64_t *futhark_mc_segmap_parloop_131282_total_runtime;
    int *futhark_mc_segmap_parloop_131282_runs;
    int64_t *futhark_mc_segmap_parloop_131282_iter;
    int64_t futhark_mc_segmap_parloop_131282_total_total_runtime;
    int futhark_mc_segmap_parloop_131282_total_runs;
    int64_t futhark_mc_segmap_parloop_131282_total_iter;
    int64_t *futhark_mc_segmap_task_131280_total_runtime;
    int *futhark_mc_segmap_task_131280_runs;
    int64_t *futhark_mc_segmap_task_131280_iter;
    int64_t futhark_mc_segmap_task_131280_total_time;
    int64_t futhark_mc_segmap_task_131280_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131290_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131290_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131290_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131290_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131290_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131290_total_iter;
    int64_t *futhark_mc_segred_task_131287_total_runtime;
    int *futhark_mc_segred_task_131287_runs;
    int64_t *futhark_mc_segred_task_131287_iter;
    int64_t futhark_mc_segred_task_131287_total_time;
    int64_t futhark_mc_segred_task_131287_total_iter;
    int64_t *futhark_mc_segmap_parloop_131285_total_runtime;
    int *futhark_mc_segmap_parloop_131285_runs;
    int64_t *futhark_mc_segmap_parloop_131285_iter;
    int64_t futhark_mc_segmap_parloop_131285_total_total_runtime;
    int futhark_mc_segmap_parloop_131285_total_runs;
    int64_t futhark_mc_segmap_parloop_131285_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131283_total_runtime;
    int *futhark_mc_segmap_nested_task_131283_runs;
    int64_t *futhark_mc_segmap_nested_task_131283_iter;
    int64_t *futhark_mc_segmap_parloop_131277_total_runtime;
    int *futhark_mc_segmap_parloop_131277_runs;
    int64_t *futhark_mc_segmap_parloop_131277_iter;
    int64_t futhark_mc_segmap_parloop_131277_total_total_runtime;
    int futhark_mc_segmap_parloop_131277_total_runs;
    int64_t futhark_mc_segmap_parloop_131277_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131275_total_runtime;
    int *futhark_mc_segmap_nested_task_131275_runs;
    int64_t *futhark_mc_segmap_nested_task_131275_iter;
    int64_t *futhark_mc_segmap_parloop_131294_total_runtime;
    int *futhark_mc_segmap_parloop_131294_runs;
    int64_t *futhark_mc_segmap_parloop_131294_iter;
    int64_t futhark_mc_segmap_parloop_131294_total_total_runtime;
    int futhark_mc_segmap_parloop_131294_total_runs;
    int64_t futhark_mc_segmap_parloop_131294_total_iter;
    int64_t *futhark_mc_segmap_task_131292_total_runtime;
    int *futhark_mc_segmap_task_131292_runs;
    int64_t *futhark_mc_segmap_task_131292_iter;
    int64_t futhark_mc_segmap_task_131292_total_time;
    int64_t futhark_mc_segmap_task_131292_total_iter;
    int64_t *futhark_mc_segmap_parloop_131303_total_runtime;
    int *futhark_mc_segmap_parloop_131303_runs;
    int64_t *futhark_mc_segmap_parloop_131303_iter;
    int64_t futhark_mc_segmap_parloop_131303_total_total_runtime;
    int futhark_mc_segmap_parloop_131303_total_runs;
    int64_t futhark_mc_segmap_parloop_131303_total_iter;
    int64_t *futhark_mc_segmap_task_131301_total_runtime;
    int *futhark_mc_segmap_task_131301_runs;
    int64_t *futhark_mc_segmap_task_131301_iter;
    int64_t futhark_mc_segmap_task_131301_total_time;
    int64_t futhark_mc_segmap_task_131301_total_iter;
    int64_t *futhark_mc_segmap_parloop_131298_total_runtime;
    int *futhark_mc_segmap_parloop_131298_runs;
    int64_t *futhark_mc_segmap_parloop_131298_iter;
    int64_t futhark_mc_segmap_parloop_131298_total_total_runtime;
    int futhark_mc_segmap_parloop_131298_total_runs;
    int64_t futhark_mc_segmap_parloop_131298_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131296_total_runtime;
    int *futhark_mc_segmap_nested_task_131296_runs;
    int64_t *futhark_mc_segmap_nested_task_131296_iter;
    int64_t *futhark_mc_segmap_parloop_131307_total_runtime;
    int *futhark_mc_segmap_parloop_131307_runs;
    int64_t *futhark_mc_segmap_parloop_131307_iter;
    int64_t futhark_mc_segmap_parloop_131307_total_total_runtime;
    int futhark_mc_segmap_parloop_131307_total_runs;
    int64_t futhark_mc_segmap_parloop_131307_total_iter;
    int64_t *futhark_mc_segmap_task_131305_total_runtime;
    int *futhark_mc_segmap_task_131305_runs;
    int64_t *futhark_mc_segmap_task_131305_iter;
    int64_t futhark_mc_segmap_task_131305_total_time;
    int64_t futhark_mc_segmap_task_131305_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131321_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131321_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131321_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131321_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131321_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131321_total_iter;
    int64_t *futhark_mc_segred_task_131318_total_runtime;
    int *futhark_mc_segred_task_131318_runs;
    int64_t *futhark_mc_segred_task_131318_iter;
    int64_t futhark_mc_segred_task_131318_total_time;
    int64_t futhark_mc_segred_task_131318_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_131326_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_131326_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_131326_iter;
    int64_t futhark_mc_scan_stage_1_parloop_131326_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_131326_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_131326_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_131328_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_131328_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_131328_iter;
    int64_t futhark_mc_scan_stage_3_parloop_131328_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_131328_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_131328_total_iter;
    int64_t *futhark_mc_segscan_task_131323_total_runtime;
    int *futhark_mc_segscan_task_131323_runs;
    int64_t *futhark_mc_segscan_task_131323_iter;
    int64_t futhark_mc_segscan_task_131323_total_time;
    int64_t futhark_mc_segscan_task_131323_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131333_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131333_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131333_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131333_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131333_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131333_total_iter;
    int64_t *futhark_mc_segred_task_131330_total_runtime;
    int *futhark_mc_segred_task_131330_runs;
    int64_t *futhark_mc_segred_task_131330_iter;
    int64_t futhark_mc_segred_task_131330_total_time;
    int64_t futhark_mc_segred_task_131330_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_131338_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_131338_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_131338_iter;
    int64_t futhark_mc_scan_stage_1_parloop_131338_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_131338_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_131338_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_131340_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_131340_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_131340_iter;
    int64_t futhark_mc_scan_stage_3_parloop_131340_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_131340_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_131340_total_iter;
    int64_t *futhark_mc_segscan_task_131335_total_runtime;
    int *futhark_mc_segscan_task_131335_runs;
    int64_t *futhark_mc_segscan_task_131335_iter;
    int64_t futhark_mc_segscan_task_131335_total_time;
    int64_t futhark_mc_segscan_task_131335_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131345_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131345_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131345_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131345_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131345_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131345_total_iter;
    int64_t *futhark_mc_segred_task_131342_total_runtime;
    int *futhark_mc_segred_task_131342_runs;
    int64_t *futhark_mc_segred_task_131342_iter;
    int64_t futhark_mc_segred_task_131342_total_time;
    int64_t futhark_mc_segred_task_131342_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_131350_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_131350_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_131350_iter;
    int64_t futhark_mc_scan_stage_1_parloop_131350_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_131350_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_131350_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_131352_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_131352_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_131352_iter;
    int64_t futhark_mc_scan_stage_3_parloop_131352_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_131352_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_131352_total_iter;
    int64_t *futhark_mc_segscan_task_131347_total_runtime;
    int *futhark_mc_segscan_task_131347_runs;
    int64_t *futhark_mc_segscan_task_131347_iter;
    int64_t futhark_mc_segscan_task_131347_total_time;
    int64_t futhark_mc_segscan_task_131347_total_iter;
    int64_t *futhark_mc_segmap_parloop_131313_total_runtime;
    int *futhark_mc_segmap_parloop_131313_runs;
    int64_t *futhark_mc_segmap_parloop_131313_iter;
    int64_t futhark_mc_segmap_parloop_131313_total_total_runtime;
    int futhark_mc_segmap_parloop_131313_total_runs;
    int64_t futhark_mc_segmap_parloop_131313_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131311_total_runtime;
    int *futhark_mc_segmap_nested_task_131311_runs;
    int64_t *futhark_mc_segmap_nested_task_131311_iter;
    int64_t *futhark_mc_segmap_parloop_131356_total_runtime;
    int *futhark_mc_segmap_parloop_131356_runs;
    int64_t *futhark_mc_segmap_parloop_131356_iter;
    int64_t futhark_mc_segmap_parloop_131356_total_total_runtime;
    int futhark_mc_segmap_parloop_131356_total_runs;
    int64_t futhark_mc_segmap_parloop_131356_total_iter;
    int64_t *futhark_mc_segmap_task_131354_total_runtime;
    int *futhark_mc_segmap_task_131354_runs;
    int64_t *futhark_mc_segmap_task_131354_iter;
    int64_t futhark_mc_segmap_task_131354_total_time;
    int64_t futhark_mc_segmap_task_131354_total_iter;
    int64_t *futhark_mc_segmap_parloop_131367_total_runtime;
    int *futhark_mc_segmap_parloop_131367_runs;
    int64_t *futhark_mc_segmap_parloop_131367_iter;
    int64_t futhark_mc_segmap_parloop_131367_total_total_runtime;
    int futhark_mc_segmap_parloop_131367_total_runs;
    int64_t futhark_mc_segmap_parloop_131367_total_iter;
    int64_t *futhark_mc_segmap_task_131365_total_runtime;
    int *futhark_mc_segmap_task_131365_runs;
    int64_t *futhark_mc_segmap_task_131365_iter;
    int64_t futhark_mc_segmap_task_131365_total_time;
    int64_t futhark_mc_segmap_task_131365_total_iter;
    int64_t *futhark_mc_segmap_parloop_131361_total_runtime;
    int *futhark_mc_segmap_parloop_131361_runs;
    int64_t *futhark_mc_segmap_parloop_131361_iter;
    int64_t futhark_mc_segmap_parloop_131361_total_total_runtime;
    int futhark_mc_segmap_parloop_131361_total_runs;
    int64_t futhark_mc_segmap_parloop_131361_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131359_total_runtime;
    int *futhark_mc_segmap_nested_task_131359_runs;
    int64_t *futhark_mc_segmap_nested_task_131359_iter;
    int64_t *futhark_mc_segmap_parloop_131371_total_runtime;
    int *futhark_mc_segmap_parloop_131371_runs;
    int64_t *futhark_mc_segmap_parloop_131371_iter;
    int64_t futhark_mc_segmap_parloop_131371_total_total_runtime;
    int futhark_mc_segmap_parloop_131371_total_runs;
    int64_t futhark_mc_segmap_parloop_131371_total_iter;
    int64_t *futhark_mc_segmap_task_131369_total_runtime;
    int *futhark_mc_segmap_task_131369_runs;
    int64_t *futhark_mc_segmap_task_131369_iter;
    int64_t futhark_mc_segmap_task_131369_total_time;
    int64_t futhark_mc_segmap_task_131369_total_iter;
    int64_t *futhark_mc_segmap_parloop_131380_total_runtime;
    int *futhark_mc_segmap_parloop_131380_runs;
    int64_t *futhark_mc_segmap_parloop_131380_iter;
    int64_t futhark_mc_segmap_parloop_131380_total_total_runtime;
    int futhark_mc_segmap_parloop_131380_total_runs;
    int64_t futhark_mc_segmap_parloop_131380_total_iter;
    int64_t *futhark_mc_segmap_task_131378_total_runtime;
    int *futhark_mc_segmap_task_131378_runs;
    int64_t *futhark_mc_segmap_task_131378_iter;
    int64_t futhark_mc_segmap_task_131378_total_time;
    int64_t futhark_mc_segmap_task_131378_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131388_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131388_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131388_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131388_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131388_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131388_total_iter;
    int64_t *futhark_mc_segred_task_131385_total_runtime;
    int *futhark_mc_segred_task_131385_runs;
    int64_t *futhark_mc_segred_task_131385_iter;
    int64_t futhark_mc_segred_task_131385_total_time;
    int64_t futhark_mc_segred_task_131385_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131393_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131393_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131393_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131393_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131393_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131393_total_iter;
    int64_t *futhark_mc_segred_task_131390_total_runtime;
    int *futhark_mc_segred_task_131390_runs;
    int64_t *futhark_mc_segred_task_131390_iter;
    int64_t futhark_mc_segred_task_131390_total_time;
    int64_t futhark_mc_segred_task_131390_total_iter;
    int64_t *futhark_mc_segmap_parloop_131383_total_runtime;
    int *futhark_mc_segmap_parloop_131383_runs;
    int64_t *futhark_mc_segmap_parloop_131383_iter;
    int64_t futhark_mc_segmap_parloop_131383_total_total_runtime;
    int futhark_mc_segmap_parloop_131383_total_runs;
    int64_t futhark_mc_segmap_parloop_131383_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131381_total_runtime;
    int *futhark_mc_segmap_nested_task_131381_runs;
    int64_t *futhark_mc_segmap_nested_task_131381_iter;
    int64_t *futhark_mc_segmap_parloop_131375_total_runtime;
    int *futhark_mc_segmap_parloop_131375_runs;
    int64_t *futhark_mc_segmap_parloop_131375_iter;
    int64_t futhark_mc_segmap_parloop_131375_total_total_runtime;
    int futhark_mc_segmap_parloop_131375_total_runs;
    int64_t futhark_mc_segmap_parloop_131375_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131373_total_runtime;
    int *futhark_mc_segmap_nested_task_131373_runs;
    int64_t *futhark_mc_segmap_nested_task_131373_iter;
    int64_t *futhark_mc_segmap_parloop_131397_total_runtime;
    int *futhark_mc_segmap_parloop_131397_runs;
    int64_t *futhark_mc_segmap_parloop_131397_iter;
    int64_t futhark_mc_segmap_parloop_131397_total_total_runtime;
    int futhark_mc_segmap_parloop_131397_total_runs;
    int64_t futhark_mc_segmap_parloop_131397_total_iter;
    int64_t *futhark_mc_segmap_task_131395_total_runtime;
    int *futhark_mc_segmap_task_131395_runs;
    int64_t *futhark_mc_segmap_task_131395_iter;
    int64_t futhark_mc_segmap_task_131395_total_time;
    int64_t futhark_mc_segmap_task_131395_total_iter;
    int64_t *futhark_mc_segmap_parloop_131408_total_runtime;
    int *futhark_mc_segmap_parloop_131408_runs;
    int64_t *futhark_mc_segmap_parloop_131408_iter;
    int64_t futhark_mc_segmap_parloop_131408_total_total_runtime;
    int futhark_mc_segmap_parloop_131408_total_runs;
    int64_t futhark_mc_segmap_parloop_131408_total_iter;
    int64_t *futhark_mc_segmap_task_131406_total_runtime;
    int *futhark_mc_segmap_task_131406_runs;
    int64_t *futhark_mc_segmap_task_131406_iter;
    int64_t futhark_mc_segmap_task_131406_total_time;
    int64_t futhark_mc_segmap_task_131406_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131418_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131418_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131418_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131418_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131418_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131418_total_iter;
    int64_t *futhark_mc_segred_task_131413_total_runtime;
    int *futhark_mc_segred_task_131413_runs;
    int64_t *futhark_mc_segred_task_131413_iter;
    int64_t futhark_mc_segred_task_131413_total_time;
    int64_t futhark_mc_segred_task_131413_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131424_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131424_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131424_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131424_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131424_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131424_total_iter;
    int64_t *futhark_mc_segred_task_131420_total_runtime;
    int *futhark_mc_segred_task_131420_runs;
    int64_t *futhark_mc_segred_task_131420_iter;
    int64_t futhark_mc_segred_task_131420_total_time;
    int64_t futhark_mc_segred_task_131420_total_iter;
    int64_t *futhark_mc_segmap_parloop_131411_total_runtime;
    int *futhark_mc_segmap_parloop_131411_runs;
    int64_t *futhark_mc_segmap_parloop_131411_iter;
    int64_t futhark_mc_segmap_parloop_131411_total_total_runtime;
    int futhark_mc_segmap_parloop_131411_total_runs;
    int64_t futhark_mc_segmap_parloop_131411_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131409_total_runtime;
    int *futhark_mc_segmap_nested_task_131409_runs;
    int64_t *futhark_mc_segmap_nested_task_131409_iter;
    int64_t *futhark_mc_segmap_parloop_131402_total_runtime;
    int *futhark_mc_segmap_parloop_131402_runs;
    int64_t *futhark_mc_segmap_parloop_131402_iter;
    int64_t futhark_mc_segmap_parloop_131402_total_total_runtime;
    int futhark_mc_segmap_parloop_131402_total_runs;
    int64_t futhark_mc_segmap_parloop_131402_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131400_total_runtime;
    int *futhark_mc_segmap_nested_task_131400_runs;
    int64_t *futhark_mc_segmap_nested_task_131400_iter;
    int64_t *futhark_mc_segmap_parloop_131428_total_runtime;
    int *futhark_mc_segmap_parloop_131428_runs;
    int64_t *futhark_mc_segmap_parloop_131428_iter;
    int64_t futhark_mc_segmap_parloop_131428_total_total_runtime;
    int futhark_mc_segmap_parloop_131428_total_runs;
    int64_t futhark_mc_segmap_parloop_131428_total_iter;
    int64_t *futhark_mc_segmap_task_131426_total_runtime;
    int *futhark_mc_segmap_task_131426_runs;
    int64_t *futhark_mc_segmap_task_131426_iter;
    int64_t futhark_mc_segmap_task_131426_total_time;
    int64_t futhark_mc_segmap_task_131426_total_iter;
    int64_t *futhark_mc_segmap_parloop_131439_total_runtime;
    int *futhark_mc_segmap_parloop_131439_runs;
    int64_t *futhark_mc_segmap_parloop_131439_iter;
    int64_t futhark_mc_segmap_parloop_131439_total_total_runtime;
    int futhark_mc_segmap_parloop_131439_total_runs;
    int64_t futhark_mc_segmap_parloop_131439_total_iter;
    int64_t *futhark_mc_segmap_task_131437_total_runtime;
    int *futhark_mc_segmap_task_131437_runs;
    int64_t *futhark_mc_segmap_task_131437_iter;
    int64_t futhark_mc_segmap_task_131437_total_time;
    int64_t futhark_mc_segmap_task_131437_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131451_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131451_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131451_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131451_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131451_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131451_total_iter;
    int64_t *futhark_mc_segred_task_131444_total_runtime;
    int *futhark_mc_segred_task_131444_runs;
    int64_t *futhark_mc_segred_task_131444_iter;
    int64_t futhark_mc_segred_task_131444_total_time;
    int64_t futhark_mc_segred_task_131444_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131457_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131457_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131457_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131457_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131457_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131457_total_iter;
    int64_t *futhark_mc_segred_task_131453_total_runtime;
    int *futhark_mc_segred_task_131453_runs;
    int64_t *futhark_mc_segred_task_131453_iter;
    int64_t futhark_mc_segred_task_131453_total_time;
    int64_t futhark_mc_segred_task_131453_total_iter;
    int64_t *futhark_mc_segmap_parloop_131442_total_runtime;
    int *futhark_mc_segmap_parloop_131442_runs;
    int64_t *futhark_mc_segmap_parloop_131442_iter;
    int64_t futhark_mc_segmap_parloop_131442_total_total_runtime;
    int futhark_mc_segmap_parloop_131442_total_runs;
    int64_t futhark_mc_segmap_parloop_131442_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131440_total_runtime;
    int *futhark_mc_segmap_nested_task_131440_runs;
    int64_t *futhark_mc_segmap_nested_task_131440_iter;
    int64_t *futhark_mc_segmap_parloop_131433_total_runtime;
    int *futhark_mc_segmap_parloop_131433_runs;
    int64_t *futhark_mc_segmap_parloop_131433_iter;
    int64_t futhark_mc_segmap_parloop_131433_total_total_runtime;
    int futhark_mc_segmap_parloop_131433_total_runs;
    int64_t futhark_mc_segmap_parloop_131433_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131431_total_runtime;
    int *futhark_mc_segmap_nested_task_131431_runs;
    int64_t *futhark_mc_segmap_nested_task_131431_iter;
    int64_t *futhark_mc_segmap_parloop_131461_total_runtime;
    int *futhark_mc_segmap_parloop_131461_runs;
    int64_t *futhark_mc_segmap_parloop_131461_iter;
    int64_t futhark_mc_segmap_parloop_131461_total_total_runtime;
    int futhark_mc_segmap_parloop_131461_total_runs;
    int64_t futhark_mc_segmap_parloop_131461_total_iter;
    int64_t *futhark_mc_segmap_task_131459_total_runtime;
    int *futhark_mc_segmap_task_131459_runs;
    int64_t *futhark_mc_segmap_task_131459_iter;
    int64_t futhark_mc_segmap_task_131459_total_time;
    int64_t futhark_mc_segmap_task_131459_total_iter;
    int64_t *futhark_mc_segmap_parloop_131471_total_runtime;
    int *futhark_mc_segmap_parloop_131471_runs;
    int64_t *futhark_mc_segmap_parloop_131471_iter;
    int64_t futhark_mc_segmap_parloop_131471_total_total_runtime;
    int futhark_mc_segmap_parloop_131471_total_runs;
    int64_t futhark_mc_segmap_parloop_131471_total_iter;
    int64_t *futhark_mc_segmap_task_131469_total_runtime;
    int *futhark_mc_segmap_task_131469_runs;
    int64_t *futhark_mc_segmap_task_131469_iter;
    int64_t futhark_mc_segmap_task_131469_total_time;
    int64_t futhark_mc_segmap_task_131469_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131481_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131481_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131481_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131481_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131481_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131481_total_iter;
    int64_t *futhark_mc_segred_task_131478_total_runtime;
    int *futhark_mc_segred_task_131478_runs;
    int64_t *futhark_mc_segred_task_131478_iter;
    int64_t futhark_mc_segred_task_131478_total_time;
    int64_t futhark_mc_segred_task_131478_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131486_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131486_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131486_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131486_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131486_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131486_total_iter;
    int64_t *futhark_mc_segred_task_131483_total_runtime;
    int *futhark_mc_segred_task_131483_runs;
    int64_t *futhark_mc_segred_task_131483_iter;
    int64_t futhark_mc_segred_task_131483_total_time;
    int64_t futhark_mc_segred_task_131483_total_iter;
    int64_t *futhark_mc_segmap_parloop_131475_total_runtime;
    int *futhark_mc_segmap_parloop_131475_runs;
    int64_t *futhark_mc_segmap_parloop_131475_iter;
    int64_t futhark_mc_segmap_parloop_131475_total_total_runtime;
    int futhark_mc_segmap_parloop_131475_total_runs;
    int64_t futhark_mc_segmap_parloop_131475_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131473_total_runtime;
    int *futhark_mc_segmap_nested_task_131473_runs;
    int64_t *futhark_mc_segmap_nested_task_131473_iter;
    int64_t *futhark_mc_segmap_parloop_131466_total_runtime;
    int *futhark_mc_segmap_parloop_131466_runs;
    int64_t *futhark_mc_segmap_parloop_131466_iter;
    int64_t futhark_mc_segmap_parloop_131466_total_total_runtime;
    int futhark_mc_segmap_parloop_131466_total_runs;
    int64_t futhark_mc_segmap_parloop_131466_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131464_total_runtime;
    int *futhark_mc_segmap_nested_task_131464_runs;
    int64_t *futhark_mc_segmap_nested_task_131464_iter;
    int64_t *futhark_mc_segmap_parloop_131490_total_runtime;
    int *futhark_mc_segmap_parloop_131490_runs;
    int64_t *futhark_mc_segmap_parloop_131490_iter;
    int64_t futhark_mc_segmap_parloop_131490_total_total_runtime;
    int futhark_mc_segmap_parloop_131490_total_runs;
    int64_t futhark_mc_segmap_parloop_131490_total_iter;
    int64_t *futhark_mc_segmap_task_131488_total_runtime;
    int *futhark_mc_segmap_task_131488_runs;
    int64_t *futhark_mc_segmap_task_131488_iter;
    int64_t futhark_mc_segmap_task_131488_total_time;
    int64_t futhark_mc_segmap_task_131488_total_iter;
    int64_t *futhark_mc_segmap_parloop_131503_total_runtime;
    int *futhark_mc_segmap_parloop_131503_runs;
    int64_t *futhark_mc_segmap_parloop_131503_iter;
    int64_t futhark_mc_segmap_parloop_131503_total_total_runtime;
    int futhark_mc_segmap_parloop_131503_total_runs;
    int64_t futhark_mc_segmap_parloop_131503_total_iter;
    int64_t *futhark_mc_segmap_task_131501_total_runtime;
    int *futhark_mc_segmap_task_131501_runs;
    int64_t *futhark_mc_segmap_task_131501_iter;
    int64_t futhark_mc_segmap_task_131501_total_time;
    int64_t futhark_mc_segmap_task_131501_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131517_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131517_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131517_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131517_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131517_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131517_total_iter;
    int64_t *futhark_mc_segred_task_131512_total_runtime;
    int *futhark_mc_segred_task_131512_runs;
    int64_t *futhark_mc_segred_task_131512_iter;
    int64_t futhark_mc_segred_task_131512_total_time;
    int64_t futhark_mc_segred_task_131512_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131523_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131523_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131523_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131523_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131523_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131523_total_iter;
    int64_t *futhark_mc_segred_task_131519_total_runtime;
    int *futhark_mc_segred_task_131519_runs;
    int64_t *futhark_mc_segred_task_131519_iter;
    int64_t futhark_mc_segred_task_131519_total_time;
    int64_t futhark_mc_segred_task_131519_total_iter;
    int64_t *futhark_mc_segmap_parloop_131508_total_runtime;
    int *futhark_mc_segmap_parloop_131508_runs;
    int64_t *futhark_mc_segmap_parloop_131508_iter;
    int64_t futhark_mc_segmap_parloop_131508_total_total_runtime;
    int futhark_mc_segmap_parloop_131508_total_runs;
    int64_t futhark_mc_segmap_parloop_131508_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131506_total_runtime;
    int *futhark_mc_segmap_nested_task_131506_runs;
    int64_t *futhark_mc_segmap_nested_task_131506_iter;
    int64_t *futhark_mc_segmap_parloop_131497_total_runtime;
    int *futhark_mc_segmap_parloop_131497_runs;
    int64_t *futhark_mc_segmap_parloop_131497_iter;
    int64_t futhark_mc_segmap_parloop_131497_total_total_runtime;
    int futhark_mc_segmap_parloop_131497_total_runs;
    int64_t futhark_mc_segmap_parloop_131497_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131495_total_runtime;
    int *futhark_mc_segmap_nested_task_131495_runs;
    int64_t *futhark_mc_segmap_nested_task_131495_iter;
    int64_t *futhark_mc_segmap_parloop_131527_total_runtime;
    int *futhark_mc_segmap_parloop_131527_runs;
    int64_t *futhark_mc_segmap_parloop_131527_iter;
    int64_t futhark_mc_segmap_parloop_131527_total_total_runtime;
    int futhark_mc_segmap_parloop_131527_total_runs;
    int64_t futhark_mc_segmap_parloop_131527_total_iter;
    int64_t *futhark_mc_segmap_task_131525_total_runtime;
    int *futhark_mc_segmap_task_131525_runs;
    int64_t *futhark_mc_segmap_task_131525_iter;
    int64_t futhark_mc_segmap_task_131525_total_time;
    int64_t futhark_mc_segmap_task_131525_total_iter;
    int64_t *futhark_mc_segmap_parloop_131542_total_runtime;
    int *futhark_mc_segmap_parloop_131542_runs;
    int64_t *futhark_mc_segmap_parloop_131542_iter;
    int64_t futhark_mc_segmap_parloop_131542_total_total_runtime;
    int futhark_mc_segmap_parloop_131542_total_runs;
    int64_t futhark_mc_segmap_parloop_131542_total_iter;
    int64_t *futhark_mc_segmap_task_131540_total_runtime;
    int *futhark_mc_segmap_task_131540_runs;
    int64_t *futhark_mc_segmap_task_131540_iter;
    int64_t futhark_mc_segmap_task_131540_total_time;
    int64_t futhark_mc_segmap_task_131540_total_iter;
    int64_t *futhark_mc_segmap_parloop_131557_total_runtime;
    int *futhark_mc_segmap_parloop_131557_runs;
    int64_t *futhark_mc_segmap_parloop_131557_iter;
    int64_t futhark_mc_segmap_parloop_131557_total_total_runtime;
    int futhark_mc_segmap_parloop_131557_total_runs;
    int64_t futhark_mc_segmap_parloop_131557_total_iter;
    int64_t *futhark_mc_segmap_task_131555_total_runtime;
    int *futhark_mc_segmap_task_131555_runs;
    int64_t *futhark_mc_segmap_task_131555_iter;
    int64_t futhark_mc_segmap_task_131555_total_time;
    int64_t futhark_mc_segmap_task_131555_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131566_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131566_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131566_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131566_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131566_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131566_total_iter;
    int64_t *futhark_mc_segred_task_131559_total_runtime;
    int *futhark_mc_segred_task_131559_runs;
    int64_t *futhark_mc_segred_task_131559_iter;
    int64_t futhark_mc_segred_task_131559_total_time;
    int64_t futhark_mc_segred_task_131559_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131572_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131572_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131572_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131572_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131572_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131572_total_iter;
    int64_t *futhark_mc_segred_task_131568_total_runtime;
    int *futhark_mc_segred_task_131568_runs;
    int64_t *futhark_mc_segred_task_131568_iter;
    int64_t futhark_mc_segred_task_131568_total_time;
    int64_t futhark_mc_segred_task_131568_total_iter;
    int64_t *futhark_mc_segmap_parloop_131549_total_runtime;
    int *futhark_mc_segmap_parloop_131549_runs;
    int64_t *futhark_mc_segmap_parloop_131549_iter;
    int64_t futhark_mc_segmap_parloop_131549_total_total_runtime;
    int futhark_mc_segmap_parloop_131549_total_runs;
    int64_t futhark_mc_segmap_parloop_131549_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131547_total_runtime;
    int *futhark_mc_segmap_nested_task_131547_runs;
    int64_t *futhark_mc_segmap_nested_task_131547_iter;
    int64_t *futhark_mc_segmap_parloop_131536_total_runtime;
    int *futhark_mc_segmap_parloop_131536_runs;
    int64_t *futhark_mc_segmap_parloop_131536_iter;
    int64_t futhark_mc_segmap_parloop_131536_total_total_runtime;
    int futhark_mc_segmap_parloop_131536_total_runs;
    int64_t futhark_mc_segmap_parloop_131536_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131534_total_runtime;
    int *futhark_mc_segmap_nested_task_131534_runs;
    int64_t *futhark_mc_segmap_nested_task_131534_iter;
    int64_t *futhark_mc_segmap_parloop_131576_total_runtime;
    int *futhark_mc_segmap_parloop_131576_runs;
    int64_t *futhark_mc_segmap_parloop_131576_iter;
    int64_t futhark_mc_segmap_parloop_131576_total_total_runtime;
    int futhark_mc_segmap_parloop_131576_total_runs;
    int64_t futhark_mc_segmap_parloop_131576_total_iter;
    int64_t *futhark_mc_segmap_task_131574_total_runtime;
    int *futhark_mc_segmap_task_131574_runs;
    int64_t *futhark_mc_segmap_task_131574_iter;
    int64_t futhark_mc_segmap_task_131574_total_time;
    int64_t futhark_mc_segmap_task_131574_total_iter;
    int64_t *futhark_mc_segmap_parloop_131585_total_runtime;
    int *futhark_mc_segmap_parloop_131585_runs;
    int64_t *futhark_mc_segmap_parloop_131585_iter;
    int64_t futhark_mc_segmap_parloop_131585_total_total_runtime;
    int futhark_mc_segmap_parloop_131585_total_runs;
    int64_t futhark_mc_segmap_parloop_131585_total_iter;
    int64_t *futhark_mc_segmap_task_131583_total_runtime;
    int *futhark_mc_segmap_task_131583_runs;
    int64_t *futhark_mc_segmap_task_131583_iter;
    int64_t futhark_mc_segmap_task_131583_total_time;
    int64_t futhark_mc_segmap_task_131583_total_iter;
    int64_t *futhark_mc_segmap_parloop_131580_total_runtime;
    int *futhark_mc_segmap_parloop_131580_runs;
    int64_t *futhark_mc_segmap_parloop_131580_iter;
    int64_t futhark_mc_segmap_parloop_131580_total_total_runtime;
    int futhark_mc_segmap_parloop_131580_total_runs;
    int64_t futhark_mc_segmap_parloop_131580_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131578_total_runtime;
    int *futhark_mc_segmap_nested_task_131578_runs;
    int64_t *futhark_mc_segmap_nested_task_131578_iter;
    int64_t *futhark_mc_segmap_parloop_131589_total_runtime;
    int *futhark_mc_segmap_parloop_131589_runs;
    int64_t *futhark_mc_segmap_parloop_131589_iter;
    int64_t futhark_mc_segmap_parloop_131589_total_total_runtime;
    int futhark_mc_segmap_parloop_131589_total_runs;
    int64_t futhark_mc_segmap_parloop_131589_total_iter;
    int64_t *futhark_mc_segmap_task_131587_total_runtime;
    int *futhark_mc_segmap_task_131587_runs;
    int64_t *futhark_mc_segmap_task_131587_iter;
    int64_t futhark_mc_segmap_task_131587_total_time;
    int64_t futhark_mc_segmap_task_131587_total_iter;
    int64_t *futhark_mc_segmap_parloop_131598_total_runtime;
    int *futhark_mc_segmap_parloop_131598_runs;
    int64_t *futhark_mc_segmap_parloop_131598_iter;
    int64_t futhark_mc_segmap_parloop_131598_total_total_runtime;
    int futhark_mc_segmap_parloop_131598_total_runs;
    int64_t futhark_mc_segmap_parloop_131598_total_iter;
    int64_t *futhark_mc_segmap_task_131596_total_runtime;
    int *futhark_mc_segmap_task_131596_runs;
    int64_t *futhark_mc_segmap_task_131596_iter;
    int64_t futhark_mc_segmap_task_131596_total_time;
    int64_t futhark_mc_segmap_task_131596_total_iter;
    int64_t *futhark_mc_segmap_parloop_131593_total_runtime;
    int *futhark_mc_segmap_parloop_131593_runs;
    int64_t *futhark_mc_segmap_parloop_131593_iter;
    int64_t futhark_mc_segmap_parloop_131593_total_total_runtime;
    int futhark_mc_segmap_parloop_131593_total_runs;
    int64_t futhark_mc_segmap_parloop_131593_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131591_total_runtime;
    int *futhark_mc_segmap_nested_task_131591_runs;
    int64_t *futhark_mc_segmap_nested_task_131591_iter;
    int64_t *futhark_mc_segmap_parloop_131602_total_runtime;
    int *futhark_mc_segmap_parloop_131602_runs;
    int64_t *futhark_mc_segmap_parloop_131602_iter;
    int64_t futhark_mc_segmap_parloop_131602_total_total_runtime;
    int futhark_mc_segmap_parloop_131602_total_runs;
    int64_t futhark_mc_segmap_parloop_131602_total_iter;
    int64_t *futhark_mc_segmap_task_131600_total_runtime;
    int *futhark_mc_segmap_task_131600_runs;
    int64_t *futhark_mc_segmap_task_131600_iter;
    int64_t futhark_mc_segmap_task_131600_total_time;
    int64_t futhark_mc_segmap_task_131600_total_iter;
    int64_t *futhark_mc_segmap_parloop_131613_total_runtime;
    int *futhark_mc_segmap_parloop_131613_runs;
    int64_t *futhark_mc_segmap_parloop_131613_iter;
    int64_t futhark_mc_segmap_parloop_131613_total_total_runtime;
    int futhark_mc_segmap_parloop_131613_total_runs;
    int64_t futhark_mc_segmap_parloop_131613_total_iter;
    int64_t *futhark_mc_segmap_task_131611_total_runtime;
    int *futhark_mc_segmap_task_131611_runs;
    int64_t *futhark_mc_segmap_task_131611_iter;
    int64_t futhark_mc_segmap_task_131611_total_time;
    int64_t futhark_mc_segmap_task_131611_total_iter;
    int64_t *futhark_mc_segmap_parloop_131617_total_runtime;
    int *futhark_mc_segmap_parloop_131617_runs;
    int64_t *futhark_mc_segmap_parloop_131617_iter;
    int64_t futhark_mc_segmap_parloop_131617_total_total_runtime;
    int futhark_mc_segmap_parloop_131617_total_runs;
    int64_t futhark_mc_segmap_parloop_131617_total_iter;
    int64_t *futhark_mc_segmap_task_131615_total_runtime;
    int *futhark_mc_segmap_task_131615_runs;
    int64_t *futhark_mc_segmap_task_131615_iter;
    int64_t futhark_mc_segmap_task_131615_total_time;
    int64_t futhark_mc_segmap_task_131615_total_iter;
    int64_t *futhark_mc_segmap_parloop_131607_total_runtime;
    int *futhark_mc_segmap_parloop_131607_runs;
    int64_t *futhark_mc_segmap_parloop_131607_iter;
    int64_t futhark_mc_segmap_parloop_131607_total_total_runtime;
    int futhark_mc_segmap_parloop_131607_total_runs;
    int64_t futhark_mc_segmap_parloop_131607_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131605_total_runtime;
    int *futhark_mc_segmap_nested_task_131605_runs;
    int64_t *futhark_mc_segmap_nested_task_131605_iter;
    int64_t *futhark_mc_segmap_parloop_131621_total_runtime;
    int *futhark_mc_segmap_parloop_131621_runs;
    int64_t *futhark_mc_segmap_parloop_131621_iter;
    int64_t futhark_mc_segmap_parloop_131621_total_total_runtime;
    int futhark_mc_segmap_parloop_131621_total_runs;
    int64_t futhark_mc_segmap_parloop_131621_total_iter;
    int64_t *futhark_mc_segmap_task_131619_total_runtime;
    int *futhark_mc_segmap_task_131619_runs;
    int64_t *futhark_mc_segmap_task_131619_iter;
    int64_t futhark_mc_segmap_task_131619_total_time;
    int64_t futhark_mc_segmap_task_131619_total_iter;
    int64_t *futhark_mc_segmap_parloop_131630_total_runtime;
    int *futhark_mc_segmap_parloop_131630_runs;
    int64_t *futhark_mc_segmap_parloop_131630_iter;
    int64_t futhark_mc_segmap_parloop_131630_total_total_runtime;
    int futhark_mc_segmap_parloop_131630_total_runs;
    int64_t futhark_mc_segmap_parloop_131630_total_iter;
    int64_t *futhark_mc_segmap_task_131628_total_runtime;
    int *futhark_mc_segmap_task_131628_runs;
    int64_t *futhark_mc_segmap_task_131628_iter;
    int64_t futhark_mc_segmap_task_131628_total_time;
    int64_t futhark_mc_segmap_task_131628_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131638_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131638_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131638_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131638_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131638_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131638_total_iter;
    int64_t *futhark_mc_segred_task_131635_total_runtime;
    int *futhark_mc_segred_task_131635_runs;
    int64_t *futhark_mc_segred_task_131635_iter;
    int64_t futhark_mc_segred_task_131635_total_time;
    int64_t futhark_mc_segred_task_131635_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131643_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131643_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131643_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131643_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131643_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131643_total_iter;
    int64_t *futhark_mc_segred_task_131640_total_runtime;
    int *futhark_mc_segred_task_131640_runs;
    int64_t *futhark_mc_segred_task_131640_iter;
    int64_t futhark_mc_segred_task_131640_total_time;
    int64_t futhark_mc_segred_task_131640_total_iter;
    int64_t *futhark_mc_segmap_parloop_131633_total_runtime;
    int *futhark_mc_segmap_parloop_131633_runs;
    int64_t *futhark_mc_segmap_parloop_131633_iter;
    int64_t futhark_mc_segmap_parloop_131633_total_total_runtime;
    int futhark_mc_segmap_parloop_131633_total_runs;
    int64_t futhark_mc_segmap_parloop_131633_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131631_total_runtime;
    int *futhark_mc_segmap_nested_task_131631_runs;
    int64_t *futhark_mc_segmap_nested_task_131631_iter;
    int64_t *futhark_mc_segmap_parloop_131625_total_runtime;
    int *futhark_mc_segmap_parloop_131625_runs;
    int64_t *futhark_mc_segmap_parloop_131625_iter;
    int64_t futhark_mc_segmap_parloop_131625_total_total_runtime;
    int futhark_mc_segmap_parloop_131625_total_runs;
    int64_t futhark_mc_segmap_parloop_131625_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131623_total_runtime;
    int *futhark_mc_segmap_nested_task_131623_runs;
    int64_t *futhark_mc_segmap_nested_task_131623_iter;
    int64_t *futhark_mc_segmap_parloop_131647_total_runtime;
    int *futhark_mc_segmap_parloop_131647_runs;
    int64_t *futhark_mc_segmap_parloop_131647_iter;
    int64_t futhark_mc_segmap_parloop_131647_total_total_runtime;
    int futhark_mc_segmap_parloop_131647_total_runs;
    int64_t futhark_mc_segmap_parloop_131647_total_iter;
    int64_t *futhark_mc_segmap_task_131645_total_runtime;
    int *futhark_mc_segmap_task_131645_runs;
    int64_t *futhark_mc_segmap_task_131645_iter;
    int64_t futhark_mc_segmap_task_131645_total_time;
    int64_t futhark_mc_segmap_task_131645_total_iter;
    int64_t *futhark_mc_segmap_parloop_131658_total_runtime;
    int *futhark_mc_segmap_parloop_131658_runs;
    int64_t *futhark_mc_segmap_parloop_131658_iter;
    int64_t futhark_mc_segmap_parloop_131658_total_total_runtime;
    int futhark_mc_segmap_parloop_131658_total_runs;
    int64_t futhark_mc_segmap_parloop_131658_total_iter;
    int64_t *futhark_mc_segmap_task_131656_total_runtime;
    int *futhark_mc_segmap_task_131656_runs;
    int64_t *futhark_mc_segmap_task_131656_iter;
    int64_t futhark_mc_segmap_task_131656_total_time;
    int64_t futhark_mc_segmap_task_131656_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131668_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131668_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131668_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131668_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131668_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131668_total_iter;
    int64_t *futhark_mc_segred_task_131663_total_runtime;
    int *futhark_mc_segred_task_131663_runs;
    int64_t *futhark_mc_segred_task_131663_iter;
    int64_t futhark_mc_segred_task_131663_total_time;
    int64_t futhark_mc_segred_task_131663_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131674_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131674_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131674_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131674_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131674_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131674_total_iter;
    int64_t *futhark_mc_segred_task_131670_total_runtime;
    int *futhark_mc_segred_task_131670_runs;
    int64_t *futhark_mc_segred_task_131670_iter;
    int64_t futhark_mc_segred_task_131670_total_time;
    int64_t futhark_mc_segred_task_131670_total_iter;
    int64_t *futhark_mc_segmap_parloop_131661_total_runtime;
    int *futhark_mc_segmap_parloop_131661_runs;
    int64_t *futhark_mc_segmap_parloop_131661_iter;
    int64_t futhark_mc_segmap_parloop_131661_total_total_runtime;
    int futhark_mc_segmap_parloop_131661_total_runs;
    int64_t futhark_mc_segmap_parloop_131661_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131659_total_runtime;
    int *futhark_mc_segmap_nested_task_131659_runs;
    int64_t *futhark_mc_segmap_nested_task_131659_iter;
    int64_t *futhark_mc_segmap_parloop_131652_total_runtime;
    int *futhark_mc_segmap_parloop_131652_runs;
    int64_t *futhark_mc_segmap_parloop_131652_iter;
    int64_t futhark_mc_segmap_parloop_131652_total_total_runtime;
    int futhark_mc_segmap_parloop_131652_total_runs;
    int64_t futhark_mc_segmap_parloop_131652_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131650_total_runtime;
    int *futhark_mc_segmap_nested_task_131650_runs;
    int64_t *futhark_mc_segmap_nested_task_131650_iter;
    int64_t *futhark_mc_segmap_parloop_131678_total_runtime;
    int *futhark_mc_segmap_parloop_131678_runs;
    int64_t *futhark_mc_segmap_parloop_131678_iter;
    int64_t futhark_mc_segmap_parloop_131678_total_total_runtime;
    int futhark_mc_segmap_parloop_131678_total_runs;
    int64_t futhark_mc_segmap_parloop_131678_total_iter;
    int64_t *futhark_mc_segmap_task_131676_total_runtime;
    int *futhark_mc_segmap_task_131676_runs;
    int64_t *futhark_mc_segmap_task_131676_iter;
    int64_t futhark_mc_segmap_task_131676_total_time;
    int64_t futhark_mc_segmap_task_131676_total_iter;
    int64_t *futhark_mc_segmap_parloop_131689_total_runtime;
    int *futhark_mc_segmap_parloop_131689_runs;
    int64_t *futhark_mc_segmap_parloop_131689_iter;
    int64_t futhark_mc_segmap_parloop_131689_total_total_runtime;
    int futhark_mc_segmap_parloop_131689_total_runs;
    int64_t futhark_mc_segmap_parloop_131689_total_iter;
    int64_t *futhark_mc_segmap_task_131687_total_runtime;
    int *futhark_mc_segmap_task_131687_runs;
    int64_t *futhark_mc_segmap_task_131687_iter;
    int64_t futhark_mc_segmap_task_131687_total_time;
    int64_t futhark_mc_segmap_task_131687_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131701_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131701_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131701_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131701_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131701_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131701_total_iter;
    int64_t *futhark_mc_segred_task_131694_total_runtime;
    int *futhark_mc_segred_task_131694_runs;
    int64_t *futhark_mc_segred_task_131694_iter;
    int64_t futhark_mc_segred_task_131694_total_time;
    int64_t futhark_mc_segred_task_131694_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131707_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131707_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131707_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131707_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131707_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131707_total_iter;
    int64_t *futhark_mc_segred_task_131703_total_runtime;
    int *futhark_mc_segred_task_131703_runs;
    int64_t *futhark_mc_segred_task_131703_iter;
    int64_t futhark_mc_segred_task_131703_total_time;
    int64_t futhark_mc_segred_task_131703_total_iter;
    int64_t *futhark_mc_segmap_parloop_131692_total_runtime;
    int *futhark_mc_segmap_parloop_131692_runs;
    int64_t *futhark_mc_segmap_parloop_131692_iter;
    int64_t futhark_mc_segmap_parloop_131692_total_total_runtime;
    int futhark_mc_segmap_parloop_131692_total_runs;
    int64_t futhark_mc_segmap_parloop_131692_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131690_total_runtime;
    int *futhark_mc_segmap_nested_task_131690_runs;
    int64_t *futhark_mc_segmap_nested_task_131690_iter;
    int64_t *futhark_mc_segmap_parloop_131683_total_runtime;
    int *futhark_mc_segmap_parloop_131683_runs;
    int64_t *futhark_mc_segmap_parloop_131683_iter;
    int64_t futhark_mc_segmap_parloop_131683_total_total_runtime;
    int futhark_mc_segmap_parloop_131683_total_runs;
    int64_t futhark_mc_segmap_parloop_131683_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131681_total_runtime;
    int *futhark_mc_segmap_nested_task_131681_runs;
    int64_t *futhark_mc_segmap_nested_task_131681_iter;
    int64_t *futhark_mc_segmap_parloop_131711_total_runtime;
    int *futhark_mc_segmap_parloop_131711_runs;
    int64_t *futhark_mc_segmap_parloop_131711_iter;
    int64_t futhark_mc_segmap_parloop_131711_total_total_runtime;
    int futhark_mc_segmap_parloop_131711_total_runs;
    int64_t futhark_mc_segmap_parloop_131711_total_iter;
    int64_t *futhark_mc_segmap_task_131709_total_runtime;
    int *futhark_mc_segmap_task_131709_runs;
    int64_t *futhark_mc_segmap_task_131709_iter;
    int64_t futhark_mc_segmap_task_131709_total_time;
    int64_t futhark_mc_segmap_task_131709_total_iter;
    int64_t *futhark_mc_segmap_parloop_131721_total_runtime;
    int *futhark_mc_segmap_parloop_131721_runs;
    int64_t *futhark_mc_segmap_parloop_131721_iter;
    int64_t futhark_mc_segmap_parloop_131721_total_total_runtime;
    int futhark_mc_segmap_parloop_131721_total_runs;
    int64_t futhark_mc_segmap_parloop_131721_total_iter;
    int64_t *futhark_mc_segmap_task_131719_total_runtime;
    int *futhark_mc_segmap_task_131719_runs;
    int64_t *futhark_mc_segmap_task_131719_iter;
    int64_t futhark_mc_segmap_task_131719_total_time;
    int64_t futhark_mc_segmap_task_131719_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131731_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131731_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131731_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131731_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131731_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131731_total_iter;
    int64_t *futhark_mc_segred_task_131728_total_runtime;
    int *futhark_mc_segred_task_131728_runs;
    int64_t *futhark_mc_segred_task_131728_iter;
    int64_t futhark_mc_segred_task_131728_total_time;
    int64_t futhark_mc_segred_task_131728_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131736_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131736_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131736_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131736_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131736_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131736_total_iter;
    int64_t *futhark_mc_segred_task_131733_total_runtime;
    int *futhark_mc_segred_task_131733_runs;
    int64_t *futhark_mc_segred_task_131733_iter;
    int64_t futhark_mc_segred_task_131733_total_time;
    int64_t futhark_mc_segred_task_131733_total_iter;
    int64_t *futhark_mc_segmap_parloop_131725_total_runtime;
    int *futhark_mc_segmap_parloop_131725_runs;
    int64_t *futhark_mc_segmap_parloop_131725_iter;
    int64_t futhark_mc_segmap_parloop_131725_total_total_runtime;
    int futhark_mc_segmap_parloop_131725_total_runs;
    int64_t futhark_mc_segmap_parloop_131725_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131723_total_runtime;
    int *futhark_mc_segmap_nested_task_131723_runs;
    int64_t *futhark_mc_segmap_nested_task_131723_iter;
    int64_t *futhark_mc_segmap_parloop_131716_total_runtime;
    int *futhark_mc_segmap_parloop_131716_runs;
    int64_t *futhark_mc_segmap_parloop_131716_iter;
    int64_t futhark_mc_segmap_parloop_131716_total_total_runtime;
    int futhark_mc_segmap_parloop_131716_total_runs;
    int64_t futhark_mc_segmap_parloop_131716_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131714_total_runtime;
    int *futhark_mc_segmap_nested_task_131714_runs;
    int64_t *futhark_mc_segmap_nested_task_131714_iter;
    int64_t *futhark_mc_segmap_parloop_131740_total_runtime;
    int *futhark_mc_segmap_parloop_131740_runs;
    int64_t *futhark_mc_segmap_parloop_131740_iter;
    int64_t futhark_mc_segmap_parloop_131740_total_total_runtime;
    int futhark_mc_segmap_parloop_131740_total_runs;
    int64_t futhark_mc_segmap_parloop_131740_total_iter;
    int64_t *futhark_mc_segmap_task_131738_total_runtime;
    int *futhark_mc_segmap_task_131738_runs;
    int64_t *futhark_mc_segmap_task_131738_iter;
    int64_t futhark_mc_segmap_task_131738_total_time;
    int64_t futhark_mc_segmap_task_131738_total_iter;
    int64_t *futhark_mc_segmap_parloop_131753_total_runtime;
    int *futhark_mc_segmap_parloop_131753_runs;
    int64_t *futhark_mc_segmap_parloop_131753_iter;
    int64_t futhark_mc_segmap_parloop_131753_total_total_runtime;
    int futhark_mc_segmap_parloop_131753_total_runs;
    int64_t futhark_mc_segmap_parloop_131753_total_iter;
    int64_t *futhark_mc_segmap_task_131751_total_runtime;
    int *futhark_mc_segmap_task_131751_runs;
    int64_t *futhark_mc_segmap_task_131751_iter;
    int64_t futhark_mc_segmap_task_131751_total_time;
    int64_t futhark_mc_segmap_task_131751_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131767_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131767_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131767_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131767_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131767_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131767_total_iter;
    int64_t *futhark_mc_segred_task_131762_total_runtime;
    int *futhark_mc_segred_task_131762_runs;
    int64_t *futhark_mc_segred_task_131762_iter;
    int64_t futhark_mc_segred_task_131762_total_time;
    int64_t futhark_mc_segred_task_131762_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131773_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131773_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131773_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131773_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131773_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131773_total_iter;
    int64_t *futhark_mc_segred_task_131769_total_runtime;
    int *futhark_mc_segred_task_131769_runs;
    int64_t *futhark_mc_segred_task_131769_iter;
    int64_t futhark_mc_segred_task_131769_total_time;
    int64_t futhark_mc_segred_task_131769_total_iter;
    int64_t *futhark_mc_segmap_parloop_131758_total_runtime;
    int *futhark_mc_segmap_parloop_131758_runs;
    int64_t *futhark_mc_segmap_parloop_131758_iter;
    int64_t futhark_mc_segmap_parloop_131758_total_total_runtime;
    int futhark_mc_segmap_parloop_131758_total_runs;
    int64_t futhark_mc_segmap_parloop_131758_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131756_total_runtime;
    int *futhark_mc_segmap_nested_task_131756_runs;
    int64_t *futhark_mc_segmap_nested_task_131756_iter;
    int64_t *futhark_mc_segmap_parloop_131747_total_runtime;
    int *futhark_mc_segmap_parloop_131747_runs;
    int64_t *futhark_mc_segmap_parloop_131747_iter;
    int64_t futhark_mc_segmap_parloop_131747_total_total_runtime;
    int futhark_mc_segmap_parloop_131747_total_runs;
    int64_t futhark_mc_segmap_parloop_131747_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131745_total_runtime;
    int *futhark_mc_segmap_nested_task_131745_runs;
    int64_t *futhark_mc_segmap_nested_task_131745_iter;
    int64_t *futhark_mc_segmap_parloop_131777_total_runtime;
    int *futhark_mc_segmap_parloop_131777_runs;
    int64_t *futhark_mc_segmap_parloop_131777_iter;
    int64_t futhark_mc_segmap_parloop_131777_total_total_runtime;
    int futhark_mc_segmap_parloop_131777_total_runs;
    int64_t futhark_mc_segmap_parloop_131777_total_iter;
    int64_t *futhark_mc_segmap_task_131775_total_runtime;
    int *futhark_mc_segmap_task_131775_runs;
    int64_t *futhark_mc_segmap_task_131775_iter;
    int64_t futhark_mc_segmap_task_131775_total_time;
    int64_t futhark_mc_segmap_task_131775_total_iter;
    int64_t *futhark_mc_segmap_parloop_131792_total_runtime;
    int *futhark_mc_segmap_parloop_131792_runs;
    int64_t *futhark_mc_segmap_parloop_131792_iter;
    int64_t futhark_mc_segmap_parloop_131792_total_total_runtime;
    int futhark_mc_segmap_parloop_131792_total_runs;
    int64_t futhark_mc_segmap_parloop_131792_total_iter;
    int64_t *futhark_mc_segmap_task_131790_total_runtime;
    int *futhark_mc_segmap_task_131790_runs;
    int64_t *futhark_mc_segmap_task_131790_iter;
    int64_t futhark_mc_segmap_task_131790_total_time;
    int64_t futhark_mc_segmap_task_131790_total_iter;
    int64_t *futhark_mc_segmap_parloop_131807_total_runtime;
    int *futhark_mc_segmap_parloop_131807_runs;
    int64_t *futhark_mc_segmap_parloop_131807_iter;
    int64_t futhark_mc_segmap_parloop_131807_total_total_runtime;
    int futhark_mc_segmap_parloop_131807_total_runs;
    int64_t futhark_mc_segmap_parloop_131807_total_iter;
    int64_t *futhark_mc_segmap_task_131805_total_runtime;
    int *futhark_mc_segmap_task_131805_runs;
    int64_t *futhark_mc_segmap_task_131805_iter;
    int64_t futhark_mc_segmap_task_131805_total_time;
    int64_t futhark_mc_segmap_task_131805_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131816_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131816_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131816_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131816_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131816_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131816_total_iter;
    int64_t *futhark_mc_segred_task_131809_total_runtime;
    int *futhark_mc_segred_task_131809_runs;
    int64_t *futhark_mc_segred_task_131809_iter;
    int64_t futhark_mc_segred_task_131809_total_time;
    int64_t futhark_mc_segred_task_131809_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131822_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131822_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131822_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131822_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131822_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131822_total_iter;
    int64_t *futhark_mc_segred_task_131818_total_runtime;
    int *futhark_mc_segred_task_131818_runs;
    int64_t *futhark_mc_segred_task_131818_iter;
    int64_t futhark_mc_segred_task_131818_total_time;
    int64_t futhark_mc_segred_task_131818_total_iter;
    int64_t *futhark_mc_segmap_parloop_131799_total_runtime;
    int *futhark_mc_segmap_parloop_131799_runs;
    int64_t *futhark_mc_segmap_parloop_131799_iter;
    int64_t futhark_mc_segmap_parloop_131799_total_total_runtime;
    int futhark_mc_segmap_parloop_131799_total_runs;
    int64_t futhark_mc_segmap_parloop_131799_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131797_total_runtime;
    int *futhark_mc_segmap_nested_task_131797_runs;
    int64_t *futhark_mc_segmap_nested_task_131797_iter;
    int64_t *futhark_mc_segmap_parloop_131786_total_runtime;
    int *futhark_mc_segmap_parloop_131786_runs;
    int64_t *futhark_mc_segmap_parloop_131786_iter;
    int64_t futhark_mc_segmap_parloop_131786_total_total_runtime;
    int futhark_mc_segmap_parloop_131786_total_runs;
    int64_t futhark_mc_segmap_parloop_131786_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131784_total_runtime;
    int *futhark_mc_segmap_nested_task_131784_runs;
    int64_t *futhark_mc_segmap_nested_task_131784_iter;
    int64_t *futhark_mc_segmap_parloop_131826_total_runtime;
    int *futhark_mc_segmap_parloop_131826_runs;
    int64_t *futhark_mc_segmap_parloop_131826_iter;
    int64_t futhark_mc_segmap_parloop_131826_total_total_runtime;
    int futhark_mc_segmap_parloop_131826_total_runs;
    int64_t futhark_mc_segmap_parloop_131826_total_iter;
    int64_t *futhark_mc_segmap_task_131824_total_runtime;
    int *futhark_mc_segmap_task_131824_runs;
    int64_t *futhark_mc_segmap_task_131824_iter;
    int64_t futhark_mc_segmap_task_131824_total_time;
    int64_t futhark_mc_segmap_task_131824_total_iter;
    int64_t *futhark_mc_segmap_parloop_131835_total_runtime;
    int *futhark_mc_segmap_parloop_131835_runs;
    int64_t *futhark_mc_segmap_parloop_131835_iter;
    int64_t futhark_mc_segmap_parloop_131835_total_total_runtime;
    int futhark_mc_segmap_parloop_131835_total_runs;
    int64_t futhark_mc_segmap_parloop_131835_total_iter;
    int64_t *futhark_mc_segmap_task_131833_total_runtime;
    int *futhark_mc_segmap_task_131833_runs;
    int64_t *futhark_mc_segmap_task_131833_iter;
    int64_t futhark_mc_segmap_task_131833_total_time;
    int64_t futhark_mc_segmap_task_131833_total_iter;
    int64_t *futhark_mc_segmap_parloop_131830_total_runtime;
    int *futhark_mc_segmap_parloop_131830_runs;
    int64_t *futhark_mc_segmap_parloop_131830_iter;
    int64_t futhark_mc_segmap_parloop_131830_total_total_runtime;
    int futhark_mc_segmap_parloop_131830_total_runs;
    int64_t futhark_mc_segmap_parloop_131830_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131828_total_runtime;
    int *futhark_mc_segmap_nested_task_131828_runs;
    int64_t *futhark_mc_segmap_nested_task_131828_iter;
    int64_t *futhark_mc_segmap_parloop_131839_total_runtime;
    int *futhark_mc_segmap_parloop_131839_runs;
    int64_t *futhark_mc_segmap_parloop_131839_iter;
    int64_t futhark_mc_segmap_parloop_131839_total_total_runtime;
    int futhark_mc_segmap_parloop_131839_total_runs;
    int64_t futhark_mc_segmap_parloop_131839_total_iter;
    int64_t *futhark_mc_segmap_task_131837_total_runtime;
    int *futhark_mc_segmap_task_131837_runs;
    int64_t *futhark_mc_segmap_task_131837_iter;
    int64_t futhark_mc_segmap_task_131837_total_time;
    int64_t futhark_mc_segmap_task_131837_total_iter;
    int64_t *futhark_mc_segmap_parloop_131848_total_runtime;
    int *futhark_mc_segmap_parloop_131848_runs;
    int64_t *futhark_mc_segmap_parloop_131848_iter;
    int64_t futhark_mc_segmap_parloop_131848_total_total_runtime;
    int futhark_mc_segmap_parloop_131848_total_runs;
    int64_t futhark_mc_segmap_parloop_131848_total_iter;
    int64_t *futhark_mc_segmap_task_131846_total_runtime;
    int *futhark_mc_segmap_task_131846_runs;
    int64_t *futhark_mc_segmap_task_131846_iter;
    int64_t futhark_mc_segmap_task_131846_total_time;
    int64_t futhark_mc_segmap_task_131846_total_iter;
    int64_t *futhark_mc_segmap_parloop_131843_total_runtime;
    int *futhark_mc_segmap_parloop_131843_runs;
    int64_t *futhark_mc_segmap_parloop_131843_iter;
    int64_t futhark_mc_segmap_parloop_131843_total_total_runtime;
    int futhark_mc_segmap_parloop_131843_total_runs;
    int64_t futhark_mc_segmap_parloop_131843_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131841_total_runtime;
    int *futhark_mc_segmap_nested_task_131841_runs;
    int64_t *futhark_mc_segmap_nested_task_131841_iter;
    int64_t *futhark_mc_segmap_parloop_131852_total_runtime;
    int *futhark_mc_segmap_parloop_131852_runs;
    int64_t *futhark_mc_segmap_parloop_131852_iter;
    int64_t futhark_mc_segmap_parloop_131852_total_total_runtime;
    int futhark_mc_segmap_parloop_131852_total_runs;
    int64_t futhark_mc_segmap_parloop_131852_total_iter;
    int64_t *futhark_mc_segmap_task_131850_total_runtime;
    int *futhark_mc_segmap_task_131850_runs;
    int64_t *futhark_mc_segmap_task_131850_iter;
    int64_t futhark_mc_segmap_task_131850_total_time;
    int64_t futhark_mc_segmap_task_131850_total_iter;
    int64_t *futhark_mc_segmap_parloop_131861_total_runtime;
    int *futhark_mc_segmap_parloop_131861_runs;
    int64_t *futhark_mc_segmap_parloop_131861_iter;
    int64_t futhark_mc_segmap_parloop_131861_total_total_runtime;
    int futhark_mc_segmap_parloop_131861_total_runs;
    int64_t futhark_mc_segmap_parloop_131861_total_iter;
    int64_t *futhark_mc_segmap_task_131859_total_runtime;
    int *futhark_mc_segmap_task_131859_runs;
    int64_t *futhark_mc_segmap_task_131859_iter;
    int64_t futhark_mc_segmap_task_131859_total_time;
    int64_t futhark_mc_segmap_task_131859_total_iter;
    int64_t *futhark_mc_segmap_parloop_131856_total_runtime;
    int *futhark_mc_segmap_parloop_131856_runs;
    int64_t *futhark_mc_segmap_parloop_131856_iter;
    int64_t futhark_mc_segmap_parloop_131856_total_total_runtime;
    int futhark_mc_segmap_parloop_131856_total_runs;
    int64_t futhark_mc_segmap_parloop_131856_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131854_total_runtime;
    int *futhark_mc_segmap_nested_task_131854_runs;
    int64_t *futhark_mc_segmap_nested_task_131854_iter;
    int64_t *futhark_mc_segmap_parloop_131865_total_runtime;
    int *futhark_mc_segmap_parloop_131865_runs;
    int64_t *futhark_mc_segmap_parloop_131865_iter;
    int64_t futhark_mc_segmap_parloop_131865_total_total_runtime;
    int futhark_mc_segmap_parloop_131865_total_runs;
    int64_t futhark_mc_segmap_parloop_131865_total_iter;
    int64_t *futhark_mc_segmap_task_131863_total_runtime;
    int *futhark_mc_segmap_task_131863_runs;
    int64_t *futhark_mc_segmap_task_131863_iter;
    int64_t futhark_mc_segmap_task_131863_total_time;
    int64_t futhark_mc_segmap_task_131863_total_iter;
    int64_t *futhark_mc_scan_stage_1_parloop_131890_total_runtime;
    int *futhark_mc_scan_stage_1_parloop_131890_runs;
    int64_t *futhark_mc_scan_stage_1_parloop_131890_iter;
    int64_t futhark_mc_scan_stage_1_parloop_131890_total_total_runtime;
    int futhark_mc_scan_stage_1_parloop_131890_total_runs;
    int64_t futhark_mc_scan_stage_1_parloop_131890_total_iter;
    int64_t *futhark_mc_scan_stage_3_parloop_131892_total_runtime;
    int *futhark_mc_scan_stage_3_parloop_131892_runs;
    int64_t *futhark_mc_scan_stage_3_parloop_131892_iter;
    int64_t futhark_mc_scan_stage_3_parloop_131892_total_total_runtime;
    int futhark_mc_scan_stage_3_parloop_131892_total_runs;
    int64_t futhark_mc_scan_stage_3_parloop_131892_total_iter;
    int64_t *futhark_mc_segscan_task_131884_total_runtime;
    int *futhark_mc_segscan_task_131884_runs;
    int64_t *futhark_mc_segscan_task_131884_iter;
    int64_t futhark_mc_segscan_task_131884_total_time;
    int64_t futhark_mc_segscan_task_131884_total_iter;
    int64_t *futhark_mc_segmap_parloop_131896_total_runtime;
    int *futhark_mc_segmap_parloop_131896_runs;
    int64_t *futhark_mc_segmap_parloop_131896_iter;
    int64_t futhark_mc_segmap_parloop_131896_total_total_runtime;
    int futhark_mc_segmap_parloop_131896_total_runs;
    int64_t futhark_mc_segmap_parloop_131896_total_iter;
    int64_t *futhark_mc_segmap_task_131894_total_runtime;
    int *futhark_mc_segmap_task_131894_runs;
    int64_t *futhark_mc_segmap_task_131894_iter;
    int64_t futhark_mc_segmap_task_131894_total_time;
    int64_t futhark_mc_segmap_task_131894_total_iter;
    int64_t *futhark_mc_segmap_parloop_131875_total_runtime;
    int *futhark_mc_segmap_parloop_131875_runs;
    int64_t *futhark_mc_segmap_parloop_131875_iter;
    int64_t futhark_mc_segmap_parloop_131875_total_total_runtime;
    int futhark_mc_segmap_parloop_131875_total_runs;
    int64_t futhark_mc_segmap_parloop_131875_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131873_total_runtime;
    int *futhark_mc_segmap_nested_task_131873_runs;
    int64_t *futhark_mc_segmap_nested_task_131873_iter;
    int64_t *futhark_mc_segmap_parloop_131900_total_runtime;
    int *futhark_mc_segmap_parloop_131900_runs;
    int64_t *futhark_mc_segmap_parloop_131900_iter;
    int64_t futhark_mc_segmap_parloop_131900_total_total_runtime;
    int futhark_mc_segmap_parloop_131900_total_runs;
    int64_t futhark_mc_segmap_parloop_131900_total_iter;
    int64_t *futhark_mc_segmap_task_131898_total_runtime;
    int *futhark_mc_segmap_task_131898_runs;
    int64_t *futhark_mc_segmap_task_131898_iter;
    int64_t futhark_mc_segmap_task_131898_total_time;
    int64_t futhark_mc_segmap_task_131898_total_iter;
    int64_t *futhark_mc_segred_stage_1_parloop_131908_total_runtime;
    int *futhark_mc_segred_stage_1_parloop_131908_runs;
    int64_t *futhark_mc_segred_stage_1_parloop_131908_iter;
    int64_t futhark_mc_segred_stage_1_parloop_131908_total_total_runtime;
    int futhark_mc_segred_stage_1_parloop_131908_total_runs;
    int64_t futhark_mc_segred_stage_1_parloop_131908_total_iter;
    int64_t *futhark_mc_segred_task_131905_total_runtime;
    int *futhark_mc_segred_task_131905_runs;
    int64_t *futhark_mc_segred_task_131905_iter;
    int64_t futhark_mc_segred_task_131905_total_time;
    int64_t futhark_mc_segred_task_131905_total_iter;
    int64_t *futhark_mc_segmap_parloop_131903_total_runtime;
    int *futhark_mc_segmap_parloop_131903_runs;
    int64_t *futhark_mc_segmap_parloop_131903_iter;
    int64_t futhark_mc_segmap_parloop_131903_total_total_runtime;
    int futhark_mc_segmap_parloop_131903_total_runs;
    int64_t futhark_mc_segmap_parloop_131903_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131901_total_runtime;
    int *futhark_mc_segmap_nested_task_131901_runs;
    int64_t *futhark_mc_segmap_nested_task_131901_iter;
    int64_t *futhark_mc_segmap_parloop_131912_total_runtime;
    int *futhark_mc_segmap_parloop_131912_runs;
    int64_t *futhark_mc_segmap_parloop_131912_iter;
    int64_t futhark_mc_segmap_parloop_131912_total_total_runtime;
    int futhark_mc_segmap_parloop_131912_total_runs;
    int64_t futhark_mc_segmap_parloop_131912_total_iter;
    int64_t *futhark_mc_segmap_task_131910_total_runtime;
    int *futhark_mc_segmap_task_131910_runs;
    int64_t *futhark_mc_segmap_task_131910_iter;
    int64_t futhark_mc_segmap_task_131910_total_time;
    int64_t futhark_mc_segmap_task_131910_total_iter;
    int64_t *futhark_mc_segmap_parloop_131921_total_runtime;
    int *futhark_mc_segmap_parloop_131921_runs;
    int64_t *futhark_mc_segmap_parloop_131921_iter;
    int64_t futhark_mc_segmap_parloop_131921_total_total_runtime;
    int futhark_mc_segmap_parloop_131921_total_runs;
    int64_t futhark_mc_segmap_parloop_131921_total_iter;
    int64_t *futhark_mc_segmap_task_131919_total_runtime;
    int *futhark_mc_segmap_task_131919_runs;
    int64_t *futhark_mc_segmap_task_131919_iter;
    int64_t futhark_mc_segmap_task_131919_total_time;
    int64_t futhark_mc_segmap_task_131919_total_iter;
    int64_t *futhark_mc_segmap_parloop_131916_total_runtime;
    int *futhark_mc_segmap_parloop_131916_runs;
    int64_t *futhark_mc_segmap_parloop_131916_iter;
    int64_t futhark_mc_segmap_parloop_131916_total_total_runtime;
    int futhark_mc_segmap_parloop_131916_total_runs;
    int64_t futhark_mc_segmap_parloop_131916_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131914_total_runtime;
    int *futhark_mc_segmap_nested_task_131914_runs;
    int64_t *futhark_mc_segmap_nested_task_131914_iter;
    int64_t *futhark_mc_segmap_parloop_131925_total_runtime;
    int *futhark_mc_segmap_parloop_131925_runs;
    int64_t *futhark_mc_segmap_parloop_131925_iter;
    int64_t futhark_mc_segmap_parloop_131925_total_total_runtime;
    int futhark_mc_segmap_parloop_131925_total_runs;
    int64_t futhark_mc_segmap_parloop_131925_total_iter;
    int64_t *futhark_mc_segmap_task_131923_total_runtime;
    int *futhark_mc_segmap_task_131923_runs;
    int64_t *futhark_mc_segmap_task_131923_iter;
    int64_t futhark_mc_segmap_task_131923_total_time;
    int64_t futhark_mc_segmap_task_131923_total_iter;
    int64_t *futhark_mc_segmap_parloop_131934_total_runtime;
    int *futhark_mc_segmap_parloop_131934_runs;
    int64_t *futhark_mc_segmap_parloop_131934_iter;
    int64_t futhark_mc_segmap_parloop_131934_total_total_runtime;
    int futhark_mc_segmap_parloop_131934_total_runs;
    int64_t futhark_mc_segmap_parloop_131934_total_iter;
    int64_t *futhark_mc_segmap_task_131932_total_runtime;
    int *futhark_mc_segmap_task_131932_runs;
    int64_t *futhark_mc_segmap_task_131932_iter;
    int64_t futhark_mc_segmap_task_131932_total_time;
    int64_t futhark_mc_segmap_task_131932_total_iter;
    int64_t *futhark_mc_segmap_parloop_131929_total_runtime;
    int *futhark_mc_segmap_parloop_131929_runs;
    int64_t *futhark_mc_segmap_parloop_131929_iter;
    int64_t futhark_mc_segmap_parloop_131929_total_total_runtime;
    int futhark_mc_segmap_parloop_131929_total_runs;
    int64_t futhark_mc_segmap_parloop_131929_total_iter;
    int64_t *futhark_mc_segmap_nested_task_131927_total_runtime;
    int *futhark_mc_segmap_nested_task_131927_runs;
    int64_t *futhark_mc_segmap_nested_task_131927_iter;
    int64_t tuning_timing;
    int64_t tuning_iter;
};
struct futhark_context *futhark_context_new(struct futhark_context_config *cfg)
{
    struct futhark_context *ctx =
                           (struct futhark_context *) malloc(sizeof(struct futhark_context));
    
    if (ctx == NULL)
        return NULL;
    fast_srand(time(0));
    ctx->detail_memory = cfg->debugging;
    ctx->debugging = cfg->debugging;
    ctx->profiling = cfg->profiling;
    ctx->profiling_paused = 0;
    ctx->logging = 0;
    ctx->error = NULL;
    ctx->log = stderr;
    create_lock(&ctx->lock);
    
    int tune_kappa = 0;
    double kappa = 5.1f * 1000;
    
    if (tune_kappa) {
        if (determine_kappa(&kappa) != 0)
            return NULL;
    }
    if (scheduler_init(&ctx->scheduler, cfg->num_threads >
                       0 ? cfg->num_threads : num_processors(), kappa) != 0)
        return NULL;
    ctx->peak_mem_usage_default = 0;
    ctx->cur_mem_usage_default = 0;
    ctx->futhark_mc_segmap_parloop_131129_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131129_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131129_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131129_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131129_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131129_total_iter = 0;
    ctx->futhark_mc_segmap_task_131127_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131127_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131127_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131127_total_time = 0;
    ctx->futhark_mc_segmap_task_131127_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131141_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131141_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131141_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131141_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131141_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131141_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131143_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131143_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131143_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131143_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131143_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131143_total_iter = 0;
    ctx->futhark_mc_segscan_task_131138_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131138_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131138_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131138_total_time = 0;
    ctx->futhark_mc_segscan_task_131138_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131147_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131147_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131147_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131147_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131147_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131147_total_iter = 0;
    ctx->futhark_mc_segmap_task_131145_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131145_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131145_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131145_total_time = 0;
    ctx->futhark_mc_segmap_task_131145_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131134_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131134_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131134_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131134_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131134_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131134_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131132_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131132_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131132_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131151_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131151_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131151_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131151_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131151_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131151_total_iter = 0;
    ctx->futhark_mc_segmap_task_131149_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131149_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131149_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131149_total_time = 0;
    ctx->futhark_mc_segmap_task_131149_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131160_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131160_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131160_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131160_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131160_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131160_total_iter = 0;
    ctx->futhark_mc_segmap_task_131158_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131158_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131158_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131158_total_time = 0;
    ctx->futhark_mc_segmap_task_131158_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131155_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131155_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131155_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131155_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131155_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131155_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131153_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131153_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131153_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131164_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131164_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131164_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131164_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131164_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131164_total_iter = 0;
    ctx->futhark_mc_segmap_task_131162_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131162_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131162_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131162_total_time = 0;
    ctx->futhark_mc_segmap_task_131162_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131173_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131173_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131173_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131173_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131173_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131173_total_iter = 0;
    ctx->futhark_mc_segmap_task_131171_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131171_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131171_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131171_total_time = 0;
    ctx->futhark_mc_segmap_task_131171_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131168_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131168_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131168_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131168_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131168_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131168_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131166_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131166_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131166_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131177_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131177_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131177_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131177_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131177_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131177_total_iter = 0;
    ctx->futhark_mc_segmap_task_131175_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131175_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131175_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131175_total_time = 0;
    ctx->futhark_mc_segmap_task_131175_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131186_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131186_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131186_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131186_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131186_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131186_total_iter = 0;
    ctx->futhark_mc_segmap_task_131184_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131184_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131184_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131184_total_time = 0;
    ctx->futhark_mc_segmap_task_131184_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131194_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131194_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131194_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131194_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131194_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131194_total_iter = 0;
    ctx->futhark_mc_segred_task_131191_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131191_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131191_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131191_total_time = 0;
    ctx->futhark_mc_segred_task_131191_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131189_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131189_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131189_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131189_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131189_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131189_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131187_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131187_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131187_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131181_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131181_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131181_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131181_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131181_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131181_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131179_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131179_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131179_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131198_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131198_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131198_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131198_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131198_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131198_total_iter = 0;
    ctx->futhark_mc_segmap_task_131196_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131196_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131196_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131196_total_time = 0;
    ctx->futhark_mc_segmap_task_131196_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131213_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131213_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131213_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131213_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131213_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131213_total_iter = 0;
    ctx->futhark_mc_segmap_task_131211_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131211_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131211_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131211_total_time = 0;
    ctx->futhark_mc_segmap_task_131211_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131217_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131217_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131217_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131217_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131217_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131217_total_iter = 0;
    ctx->futhark_mc_segmap_task_131215_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131215_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131215_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131215_total_time = 0;
    ctx->futhark_mc_segmap_task_131215_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131225_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131225_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131225_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131225_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131225_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131225_total_iter = 0;
    ctx->futhark_mc_segred_task_131222_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131222_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131222_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131222_total_time = 0;
    ctx->futhark_mc_segred_task_131222_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131220_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131220_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131220_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131220_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131220_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131220_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131218_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131218_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131218_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131205_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131205_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131205_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131205_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131205_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131205_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131203_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131203_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131203_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131229_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131229_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131229_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131229_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131229_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131229_total_iter = 0;
    ctx->futhark_mc_segmap_task_131227_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131227_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131227_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131227_total_time = 0;
    ctx->futhark_mc_segmap_task_131227_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131244_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131244_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131244_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131244_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131244_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131244_total_iter = 0;
    ctx->futhark_mc_segmap_task_131242_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131242_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131242_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131242_total_time = 0;
    ctx->futhark_mc_segmap_task_131242_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131248_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131248_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131248_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131248_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131248_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131248_total_iter = 0;
    ctx->futhark_mc_segmap_task_131246_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131246_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131246_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131246_total_time = 0;
    ctx->futhark_mc_segmap_task_131246_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131256_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131256_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131256_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131256_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131256_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131256_total_iter = 0;
    ctx->futhark_mc_segred_task_131253_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131253_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131253_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131253_total_time = 0;
    ctx->futhark_mc_segred_task_131253_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131251_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131251_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131251_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131251_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131251_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131251_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131249_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131249_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131249_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131236_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131236_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131236_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131236_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131236_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131236_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131234_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131234_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131234_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131260_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131260_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131260_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131260_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131260_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131260_total_iter = 0;
    ctx->futhark_mc_segmap_task_131258_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131258_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131258_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131258_total_time = 0;
    ctx->futhark_mc_segmap_task_131258_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131269_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131269_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131269_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131269_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131269_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131269_total_iter = 0;
    ctx->futhark_mc_segmap_task_131267_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131267_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131267_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131267_total_time = 0;
    ctx->futhark_mc_segmap_task_131267_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131264_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131264_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131264_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131264_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131264_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131264_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131262_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131262_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131262_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131273_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131273_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131273_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131273_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131273_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131273_total_iter = 0;
    ctx->futhark_mc_segmap_task_131271_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131271_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131271_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131271_total_time = 0;
    ctx->futhark_mc_segmap_task_131271_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131282_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131282_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131282_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131282_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131282_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131282_total_iter = 0;
    ctx->futhark_mc_segmap_task_131280_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131280_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131280_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131280_total_time = 0;
    ctx->futhark_mc_segmap_task_131280_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131290_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131290_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131290_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131290_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131290_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131290_total_iter = 0;
    ctx->futhark_mc_segred_task_131287_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131287_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131287_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131287_total_time = 0;
    ctx->futhark_mc_segred_task_131287_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131285_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131285_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131285_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131285_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131285_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131285_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131283_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131283_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131283_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131277_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131277_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131277_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131277_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131277_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131277_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131275_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131275_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131275_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131294_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131294_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131294_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131294_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131294_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131294_total_iter = 0;
    ctx->futhark_mc_segmap_task_131292_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131292_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131292_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131292_total_time = 0;
    ctx->futhark_mc_segmap_task_131292_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131303_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131303_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131303_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131303_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131303_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131303_total_iter = 0;
    ctx->futhark_mc_segmap_task_131301_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131301_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131301_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131301_total_time = 0;
    ctx->futhark_mc_segmap_task_131301_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131298_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131298_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131298_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131298_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131298_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131298_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131296_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131296_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131296_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131307_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131307_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131307_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131307_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131307_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131307_total_iter = 0;
    ctx->futhark_mc_segmap_task_131305_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131305_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131305_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131305_total_time = 0;
    ctx->futhark_mc_segmap_task_131305_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131321_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131321_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131321_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131321_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131321_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131321_total_iter = 0;
    ctx->futhark_mc_segred_task_131318_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131318_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131318_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131318_total_time = 0;
    ctx->futhark_mc_segred_task_131318_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131326_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131326_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131326_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131326_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131326_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131326_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131328_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131328_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131328_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131328_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131328_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131328_total_iter = 0;
    ctx->futhark_mc_segscan_task_131323_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131323_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131323_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131323_total_time = 0;
    ctx->futhark_mc_segscan_task_131323_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131333_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131333_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131333_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131333_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131333_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131333_total_iter = 0;
    ctx->futhark_mc_segred_task_131330_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131330_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131330_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131330_total_time = 0;
    ctx->futhark_mc_segred_task_131330_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131338_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131338_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131338_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131338_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131338_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131338_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131340_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131340_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131340_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131340_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131340_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131340_total_iter = 0;
    ctx->futhark_mc_segscan_task_131335_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131335_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131335_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131335_total_time = 0;
    ctx->futhark_mc_segscan_task_131335_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131345_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131345_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131345_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131345_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131345_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131345_total_iter = 0;
    ctx->futhark_mc_segred_task_131342_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131342_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131342_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131342_total_time = 0;
    ctx->futhark_mc_segred_task_131342_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131350_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131350_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131350_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131350_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131350_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131350_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131352_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131352_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131352_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131352_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131352_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131352_total_iter = 0;
    ctx->futhark_mc_segscan_task_131347_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131347_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131347_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131347_total_time = 0;
    ctx->futhark_mc_segscan_task_131347_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131313_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131313_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131313_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131313_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131313_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131313_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131311_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131311_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131311_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131356_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131356_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131356_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131356_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131356_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131356_total_iter = 0;
    ctx->futhark_mc_segmap_task_131354_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131354_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131354_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131354_total_time = 0;
    ctx->futhark_mc_segmap_task_131354_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131367_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131367_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131367_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131367_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131367_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131367_total_iter = 0;
    ctx->futhark_mc_segmap_task_131365_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131365_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131365_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131365_total_time = 0;
    ctx->futhark_mc_segmap_task_131365_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131361_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131361_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131361_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131361_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131361_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131361_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131359_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131359_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131359_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131371_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131371_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131371_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131371_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131371_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131371_total_iter = 0;
    ctx->futhark_mc_segmap_task_131369_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131369_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131369_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131369_total_time = 0;
    ctx->futhark_mc_segmap_task_131369_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131380_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131380_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131380_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131380_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131380_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131380_total_iter = 0;
    ctx->futhark_mc_segmap_task_131378_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131378_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131378_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131378_total_time = 0;
    ctx->futhark_mc_segmap_task_131378_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131388_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131388_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131388_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131388_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131388_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131388_total_iter = 0;
    ctx->futhark_mc_segred_task_131385_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131385_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131385_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131385_total_time = 0;
    ctx->futhark_mc_segred_task_131385_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131393_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131393_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131393_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131393_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131393_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131393_total_iter = 0;
    ctx->futhark_mc_segred_task_131390_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131390_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131390_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131390_total_time = 0;
    ctx->futhark_mc_segred_task_131390_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131383_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131383_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131383_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131383_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131383_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131383_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131381_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131381_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131381_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131375_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131375_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131375_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131375_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131375_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131375_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131373_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131373_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131373_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131397_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131397_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131397_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131397_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131397_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131397_total_iter = 0;
    ctx->futhark_mc_segmap_task_131395_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131395_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131395_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131395_total_time = 0;
    ctx->futhark_mc_segmap_task_131395_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131408_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131408_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131408_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131408_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131408_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131408_total_iter = 0;
    ctx->futhark_mc_segmap_task_131406_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131406_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131406_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131406_total_time = 0;
    ctx->futhark_mc_segmap_task_131406_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131418_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131418_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131418_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131418_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131418_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131418_total_iter = 0;
    ctx->futhark_mc_segred_task_131413_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131413_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131413_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131413_total_time = 0;
    ctx->futhark_mc_segred_task_131413_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131424_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131424_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131424_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131424_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131424_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131424_total_iter = 0;
    ctx->futhark_mc_segred_task_131420_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131420_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131420_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131420_total_time = 0;
    ctx->futhark_mc_segred_task_131420_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131411_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131411_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131411_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131411_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131411_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131411_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131409_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131409_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131409_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131402_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131402_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131402_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131402_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131402_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131402_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131400_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131400_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131400_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131428_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131428_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131428_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131428_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131428_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131428_total_iter = 0;
    ctx->futhark_mc_segmap_task_131426_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131426_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131426_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131426_total_time = 0;
    ctx->futhark_mc_segmap_task_131426_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131439_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131439_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131439_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131439_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131439_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131439_total_iter = 0;
    ctx->futhark_mc_segmap_task_131437_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131437_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131437_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131437_total_time = 0;
    ctx->futhark_mc_segmap_task_131437_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131451_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131451_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131451_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131451_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131451_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131451_total_iter = 0;
    ctx->futhark_mc_segred_task_131444_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131444_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131444_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131444_total_time = 0;
    ctx->futhark_mc_segred_task_131444_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131457_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131457_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131457_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131457_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131457_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131457_total_iter = 0;
    ctx->futhark_mc_segred_task_131453_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131453_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131453_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131453_total_time = 0;
    ctx->futhark_mc_segred_task_131453_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131442_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131442_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131442_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131442_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131442_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131442_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131440_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131440_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131440_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131433_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131433_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131433_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131433_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131433_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131433_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131431_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131431_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131431_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131461_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131461_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131461_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131461_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131461_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131461_total_iter = 0;
    ctx->futhark_mc_segmap_task_131459_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131459_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131459_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131459_total_time = 0;
    ctx->futhark_mc_segmap_task_131459_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131471_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131471_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131471_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131471_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131471_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131471_total_iter = 0;
    ctx->futhark_mc_segmap_task_131469_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131469_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131469_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131469_total_time = 0;
    ctx->futhark_mc_segmap_task_131469_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131481_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131481_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131481_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131481_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131481_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131481_total_iter = 0;
    ctx->futhark_mc_segred_task_131478_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131478_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131478_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131478_total_time = 0;
    ctx->futhark_mc_segred_task_131478_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131486_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131486_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131486_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131486_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131486_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131486_total_iter = 0;
    ctx->futhark_mc_segred_task_131483_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131483_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131483_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131483_total_time = 0;
    ctx->futhark_mc_segred_task_131483_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131475_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131475_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131475_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131475_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131475_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131475_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131473_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131473_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131473_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131466_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131466_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131466_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131466_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131466_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131466_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131464_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131464_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131464_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131490_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131490_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131490_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131490_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131490_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131490_total_iter = 0;
    ctx->futhark_mc_segmap_task_131488_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131488_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131488_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131488_total_time = 0;
    ctx->futhark_mc_segmap_task_131488_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131503_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131503_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131503_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131503_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131503_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131503_total_iter = 0;
    ctx->futhark_mc_segmap_task_131501_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131501_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131501_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131501_total_time = 0;
    ctx->futhark_mc_segmap_task_131501_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131517_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131517_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131517_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131517_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131517_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131517_total_iter = 0;
    ctx->futhark_mc_segred_task_131512_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131512_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131512_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131512_total_time = 0;
    ctx->futhark_mc_segred_task_131512_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131523_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131523_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131523_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131523_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131523_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131523_total_iter = 0;
    ctx->futhark_mc_segred_task_131519_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131519_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131519_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131519_total_time = 0;
    ctx->futhark_mc_segred_task_131519_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131508_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131508_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131508_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131508_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131508_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131508_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131506_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131506_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131506_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131497_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131497_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131497_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131497_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131497_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131497_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131495_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131495_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131495_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131527_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131527_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131527_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131527_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131527_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131527_total_iter = 0;
    ctx->futhark_mc_segmap_task_131525_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131525_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131525_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131525_total_time = 0;
    ctx->futhark_mc_segmap_task_131525_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131542_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131542_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131542_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131542_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131542_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131542_total_iter = 0;
    ctx->futhark_mc_segmap_task_131540_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131540_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131540_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131540_total_time = 0;
    ctx->futhark_mc_segmap_task_131540_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131557_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131557_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131557_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131557_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131557_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131557_total_iter = 0;
    ctx->futhark_mc_segmap_task_131555_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131555_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131555_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131555_total_time = 0;
    ctx->futhark_mc_segmap_task_131555_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131566_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131566_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131566_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131566_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131566_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131566_total_iter = 0;
    ctx->futhark_mc_segred_task_131559_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131559_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131559_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131559_total_time = 0;
    ctx->futhark_mc_segred_task_131559_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131572_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131572_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131572_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131572_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131572_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131572_total_iter = 0;
    ctx->futhark_mc_segred_task_131568_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131568_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131568_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131568_total_time = 0;
    ctx->futhark_mc_segred_task_131568_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131549_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131549_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131549_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131549_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131549_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131549_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131547_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131547_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131547_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131536_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131536_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131536_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131536_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131536_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131536_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131534_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131534_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131534_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131576_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131576_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131576_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131576_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131576_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131576_total_iter = 0;
    ctx->futhark_mc_segmap_task_131574_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131574_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131574_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131574_total_time = 0;
    ctx->futhark_mc_segmap_task_131574_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131585_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131585_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131585_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131585_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131585_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131585_total_iter = 0;
    ctx->futhark_mc_segmap_task_131583_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131583_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131583_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131583_total_time = 0;
    ctx->futhark_mc_segmap_task_131583_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131580_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131580_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131580_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131580_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131580_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131580_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131578_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131578_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131578_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131589_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131589_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131589_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131589_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131589_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131589_total_iter = 0;
    ctx->futhark_mc_segmap_task_131587_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131587_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131587_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131587_total_time = 0;
    ctx->futhark_mc_segmap_task_131587_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131598_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131598_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131598_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131598_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131598_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131598_total_iter = 0;
    ctx->futhark_mc_segmap_task_131596_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131596_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131596_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131596_total_time = 0;
    ctx->futhark_mc_segmap_task_131596_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131593_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131593_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131593_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131593_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131593_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131593_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131591_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131591_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131591_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131602_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131602_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131602_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131602_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131602_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131602_total_iter = 0;
    ctx->futhark_mc_segmap_task_131600_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131600_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131600_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131600_total_time = 0;
    ctx->futhark_mc_segmap_task_131600_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131613_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131613_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131613_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131613_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131613_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131613_total_iter = 0;
    ctx->futhark_mc_segmap_task_131611_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131611_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131611_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131611_total_time = 0;
    ctx->futhark_mc_segmap_task_131611_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131617_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131617_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131617_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131617_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131617_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131617_total_iter = 0;
    ctx->futhark_mc_segmap_task_131615_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131615_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131615_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131615_total_time = 0;
    ctx->futhark_mc_segmap_task_131615_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131607_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131607_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131607_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131607_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131607_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131607_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131605_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131605_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131605_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131621_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131621_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131621_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131621_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131621_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131621_total_iter = 0;
    ctx->futhark_mc_segmap_task_131619_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131619_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131619_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131619_total_time = 0;
    ctx->futhark_mc_segmap_task_131619_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131630_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131630_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131630_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131630_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131630_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131630_total_iter = 0;
    ctx->futhark_mc_segmap_task_131628_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131628_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131628_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131628_total_time = 0;
    ctx->futhark_mc_segmap_task_131628_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131638_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131638_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131638_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131638_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131638_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131638_total_iter = 0;
    ctx->futhark_mc_segred_task_131635_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131635_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131635_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131635_total_time = 0;
    ctx->futhark_mc_segred_task_131635_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131643_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131643_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131643_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131643_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131643_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131643_total_iter = 0;
    ctx->futhark_mc_segred_task_131640_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131640_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131640_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131640_total_time = 0;
    ctx->futhark_mc_segred_task_131640_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131633_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131633_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131633_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131633_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131633_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131633_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131631_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131631_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131631_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131625_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131625_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131625_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131625_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131625_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131625_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131623_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131623_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131623_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131647_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131647_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131647_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131647_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131647_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131647_total_iter = 0;
    ctx->futhark_mc_segmap_task_131645_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131645_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131645_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131645_total_time = 0;
    ctx->futhark_mc_segmap_task_131645_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131658_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131658_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131658_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131658_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131658_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131658_total_iter = 0;
    ctx->futhark_mc_segmap_task_131656_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131656_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131656_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131656_total_time = 0;
    ctx->futhark_mc_segmap_task_131656_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131668_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131668_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131668_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131668_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131668_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131668_total_iter = 0;
    ctx->futhark_mc_segred_task_131663_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131663_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131663_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131663_total_time = 0;
    ctx->futhark_mc_segred_task_131663_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131674_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131674_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131674_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131674_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131674_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131674_total_iter = 0;
    ctx->futhark_mc_segred_task_131670_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131670_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131670_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131670_total_time = 0;
    ctx->futhark_mc_segred_task_131670_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131661_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131661_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131661_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131661_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131661_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131661_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131659_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131659_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131659_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131652_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131652_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131652_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131652_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131652_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131652_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131650_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131650_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131650_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131678_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131678_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131678_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131678_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131678_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131678_total_iter = 0;
    ctx->futhark_mc_segmap_task_131676_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131676_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131676_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131676_total_time = 0;
    ctx->futhark_mc_segmap_task_131676_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131689_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131689_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131689_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131689_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131689_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131689_total_iter = 0;
    ctx->futhark_mc_segmap_task_131687_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131687_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131687_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131687_total_time = 0;
    ctx->futhark_mc_segmap_task_131687_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131701_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131701_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131701_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131701_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131701_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131701_total_iter = 0;
    ctx->futhark_mc_segred_task_131694_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131694_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131694_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131694_total_time = 0;
    ctx->futhark_mc_segred_task_131694_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131707_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131707_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131707_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131707_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131707_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131707_total_iter = 0;
    ctx->futhark_mc_segred_task_131703_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131703_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131703_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131703_total_time = 0;
    ctx->futhark_mc_segred_task_131703_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131692_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131692_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131692_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131692_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131692_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131692_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131690_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131690_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131690_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131683_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131683_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131683_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131683_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131683_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131683_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131681_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131681_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131681_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131711_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131711_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131711_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131711_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131711_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131711_total_iter = 0;
    ctx->futhark_mc_segmap_task_131709_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131709_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131709_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131709_total_time = 0;
    ctx->futhark_mc_segmap_task_131709_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131721_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131721_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131721_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131721_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131721_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131721_total_iter = 0;
    ctx->futhark_mc_segmap_task_131719_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131719_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131719_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131719_total_time = 0;
    ctx->futhark_mc_segmap_task_131719_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131731_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131731_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131731_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131731_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131731_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131731_total_iter = 0;
    ctx->futhark_mc_segred_task_131728_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131728_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131728_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131728_total_time = 0;
    ctx->futhark_mc_segred_task_131728_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131736_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131736_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131736_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131736_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131736_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131736_total_iter = 0;
    ctx->futhark_mc_segred_task_131733_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131733_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131733_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131733_total_time = 0;
    ctx->futhark_mc_segred_task_131733_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131725_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131725_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131725_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131725_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131725_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131725_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131723_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131723_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131723_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131716_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131716_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131716_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131716_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131716_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131716_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131714_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131714_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131714_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131740_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131740_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131740_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131740_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131740_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131740_total_iter = 0;
    ctx->futhark_mc_segmap_task_131738_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131738_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131738_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131738_total_time = 0;
    ctx->futhark_mc_segmap_task_131738_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131753_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131753_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131753_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131753_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131753_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131753_total_iter = 0;
    ctx->futhark_mc_segmap_task_131751_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131751_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131751_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131751_total_time = 0;
    ctx->futhark_mc_segmap_task_131751_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131767_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131767_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131767_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131767_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131767_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131767_total_iter = 0;
    ctx->futhark_mc_segred_task_131762_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131762_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131762_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131762_total_time = 0;
    ctx->futhark_mc_segred_task_131762_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131773_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131773_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131773_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131773_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131773_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131773_total_iter = 0;
    ctx->futhark_mc_segred_task_131769_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131769_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131769_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131769_total_time = 0;
    ctx->futhark_mc_segred_task_131769_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131758_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131758_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131758_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131758_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131758_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131758_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131756_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131756_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131756_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131747_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131747_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131747_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131747_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131747_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131747_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131745_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131745_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131745_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131777_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131777_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131777_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131777_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131777_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131777_total_iter = 0;
    ctx->futhark_mc_segmap_task_131775_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131775_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131775_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131775_total_time = 0;
    ctx->futhark_mc_segmap_task_131775_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131792_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131792_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131792_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131792_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131792_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131792_total_iter = 0;
    ctx->futhark_mc_segmap_task_131790_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131790_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131790_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131790_total_time = 0;
    ctx->futhark_mc_segmap_task_131790_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131807_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131807_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131807_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131807_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131807_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131807_total_iter = 0;
    ctx->futhark_mc_segmap_task_131805_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131805_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131805_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131805_total_time = 0;
    ctx->futhark_mc_segmap_task_131805_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131816_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131816_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131816_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131816_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131816_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131816_total_iter = 0;
    ctx->futhark_mc_segred_task_131809_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131809_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131809_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131809_total_time = 0;
    ctx->futhark_mc_segred_task_131809_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131822_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131822_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131822_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131822_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131822_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131822_total_iter = 0;
    ctx->futhark_mc_segred_task_131818_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131818_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131818_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131818_total_time = 0;
    ctx->futhark_mc_segred_task_131818_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131799_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131799_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131799_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131799_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131799_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131799_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131797_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131797_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131797_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131786_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131786_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131786_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131786_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131786_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131786_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131784_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131784_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131784_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131826_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131826_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131826_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131826_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131826_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131826_total_iter = 0;
    ctx->futhark_mc_segmap_task_131824_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131824_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131824_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131824_total_time = 0;
    ctx->futhark_mc_segmap_task_131824_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131835_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131835_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131835_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131835_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131835_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131835_total_iter = 0;
    ctx->futhark_mc_segmap_task_131833_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131833_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131833_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131833_total_time = 0;
    ctx->futhark_mc_segmap_task_131833_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131830_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131830_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131830_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131830_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131830_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131830_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131828_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131828_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131828_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131839_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131839_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131839_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131839_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131839_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131839_total_iter = 0;
    ctx->futhark_mc_segmap_task_131837_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131837_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131837_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131837_total_time = 0;
    ctx->futhark_mc_segmap_task_131837_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131848_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131848_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131848_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131848_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131848_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131848_total_iter = 0;
    ctx->futhark_mc_segmap_task_131846_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131846_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131846_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131846_total_time = 0;
    ctx->futhark_mc_segmap_task_131846_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131843_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131843_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131843_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131843_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131843_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131843_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131841_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131841_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131841_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131852_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131852_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131852_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131852_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131852_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131852_total_iter = 0;
    ctx->futhark_mc_segmap_task_131850_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131850_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131850_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131850_total_time = 0;
    ctx->futhark_mc_segmap_task_131850_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131861_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131861_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131861_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131861_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131861_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131861_total_iter = 0;
    ctx->futhark_mc_segmap_task_131859_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131859_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131859_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131859_total_time = 0;
    ctx->futhark_mc_segmap_task_131859_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131856_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131856_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131856_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131856_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131856_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131856_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131854_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131854_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131854_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131865_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131865_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131865_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131865_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131865_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131865_total_iter = 0;
    ctx->futhark_mc_segmap_task_131863_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131863_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131863_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131863_total_time = 0;
    ctx->futhark_mc_segmap_task_131863_total_iter = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131890_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131890_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131890_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_1_parloop_131890_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131890_total_runs = 0;
    ctx->futhark_mc_scan_stage_1_parloop_131890_total_iter = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131892_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131892_runs = calloc(sizeof(int),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131892_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_scan_stage_3_parloop_131892_total_total_runtime = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131892_total_runs = 0;
    ctx->futhark_mc_scan_stage_3_parloop_131892_total_iter = 0;
    ctx->futhark_mc_segscan_task_131884_total_runtime = calloc(sizeof(int64_t),
                                                               ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131884_runs = calloc(sizeof(int),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131884_iter = calloc(sizeof(sizeof(int64_t)),
                                                      ctx->scheduler.num_threads);
    ctx->futhark_mc_segscan_task_131884_total_time = 0;
    ctx->futhark_mc_segscan_task_131884_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131896_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131896_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131896_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131896_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131896_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131896_total_iter = 0;
    ctx->futhark_mc_segmap_task_131894_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131894_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131894_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131894_total_time = 0;
    ctx->futhark_mc_segmap_task_131894_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131875_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131875_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131875_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131875_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131875_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131875_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131873_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131873_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131873_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131900_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131900_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131900_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131900_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131900_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131900_total_iter = 0;
    ctx->futhark_mc_segmap_task_131898_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131898_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131898_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131898_total_time = 0;
    ctx->futhark_mc_segmap_task_131898_total_iter = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131908_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131908_runs = calloc(sizeof(int),
                                                                ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131908_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_stage_1_parloop_131908_total_total_runtime = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131908_total_runs = 0;
    ctx->futhark_mc_segred_stage_1_parloop_131908_total_iter = 0;
    ctx->futhark_mc_segred_task_131905_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131905_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131905_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segred_task_131905_total_time = 0;
    ctx->futhark_mc_segred_task_131905_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131903_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131903_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131903_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131903_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131903_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131903_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131901_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131901_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131901_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131912_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131912_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131912_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131912_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131912_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131912_total_iter = 0;
    ctx->futhark_mc_segmap_task_131910_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131910_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131910_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131910_total_time = 0;
    ctx->futhark_mc_segmap_task_131910_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131921_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131921_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131921_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131921_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131921_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131921_total_iter = 0;
    ctx->futhark_mc_segmap_task_131919_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131919_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131919_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131919_total_time = 0;
    ctx->futhark_mc_segmap_task_131919_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131916_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131916_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131916_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131916_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131916_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131916_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131914_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131914_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131914_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131925_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131925_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131925_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131925_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131925_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131925_total_iter = 0;
    ctx->futhark_mc_segmap_task_131923_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131923_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131923_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131923_total_time = 0;
    ctx->futhark_mc_segmap_task_131923_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131934_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131934_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131934_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131934_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131934_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131934_total_iter = 0;
    ctx->futhark_mc_segmap_task_131932_total_runtime = calloc(sizeof(int64_t),
                                                              ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131932_runs = calloc(sizeof(int),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131932_iter = calloc(sizeof(sizeof(int64_t)),
                                                     ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_task_131932_total_time = 0;
    ctx->futhark_mc_segmap_task_131932_total_iter = 0;
    ctx->futhark_mc_segmap_parloop_131929_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131929_runs = calloc(sizeof(int),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131929_iter = calloc(sizeof(sizeof(int64_t)),
                                                        ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_parloop_131929_total_total_runtime = 0;
    ctx->futhark_mc_segmap_parloop_131929_total_runs = 0;
    ctx->futhark_mc_segmap_parloop_131929_total_iter = 0;
    ctx->futhark_mc_segmap_nested_task_131927_total_runtime =
        calloc(sizeof(int64_t), ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131927_runs = calloc(sizeof(int),
                                                            ctx->scheduler.num_threads);
    ctx->futhark_mc_segmap_nested_task_131927_iter =
        calloc(sizeof(sizeof(int64_t)), ctx->scheduler.num_threads);
    init_constants(ctx);
    return ctx;
}
void futhark_context_free(struct futhark_context *ctx)
{
    free_constants(ctx);
    (void) scheduler_destroy(&ctx->scheduler);
    free_lock(&ctx->lock);
    free(ctx);
}
int futhark_context_sync(struct futhark_context *ctx)
{
    (void) ctx;
    return 0;
}
static const char *size_names[0];
static const char *size_vars[0];
static const char *size_classes[0];
int futhark_context_config_set_size(struct futhark_context_config *cfg, const
                                    char *size_name, size_t size_value)
{
    (void) cfg;
    (void) size_name;
    (void) size_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 = (char *) malloc(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_num_sizes(void)
{
    return sizeof(size_names) / sizeof(size_names[0]);
}
const char *futhark_get_size_name(int i)
{
    return size_names[i];
}
const char *futhark_get_size_class(int i)
{
    return size_classes[i];
}
char *futhark_context_report(struct futhark_context *ctx)
{
    if (futhark_context_sync(ctx) != 0)
        return NULL;
    
    struct str_builder builder;
    
    str_builder_init(&builder);
    if (ctx->detail_memory || ctx->profiling || ctx->logging) {
        { }
    }
    if (ctx->profiling) {
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131129         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131129_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131129_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131129_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131129_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131129_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131129_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131129_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131129_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131129_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131129_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131129_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131129_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131129_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131129_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131129_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131129_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131129_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131129_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131129_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131129_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131129_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131129_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131129_total_iter /
                (ctx->futhark_mc_segmap_parloop_131129_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131129_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131129_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131129_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_131141   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_131141_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131141_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131141_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_131141_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131141_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_131141_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131141_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_131141_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131141_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131141_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131141_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_131141_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_131141_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_131141_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_131141_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_131141_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_131141_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_131141_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_131141_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_131141_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_131141_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_131141_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_131141_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_131141_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_131141_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_131141_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_131141_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_131143   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_131143_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131143_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131143_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_131143_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131143_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_131143_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131143_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_131143_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131143_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131143_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131143_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_131143_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_131143_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_131143_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_131143_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_131143_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_131143_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_131143_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_131143_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_131143_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_131143_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_131143_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_131143_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_131143_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_131143_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_131143_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_131143_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_131138           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_131138_runs[i],
                    (long) ctx->futhark_mc_segscan_task_131138_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_131138_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_131138_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_131138_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_131138_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_131138_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_131138_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_131138_iter[i],
                    (long) ctx->futhark_mc_segscan_task_131138_iter[i] /
                    (ctx->futhark_mc_segscan_task_131138_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_131138_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131147         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131147_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131147_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131147_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131147_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131147_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131147_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131147_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131147_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131147_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131147_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131147_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131147_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131147_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131147_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131147_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131147_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131147_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131147_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131147_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131147_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131147_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131147_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131147_total_iter /
                (ctx->futhark_mc_segmap_parloop_131147_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131147_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131147_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131147_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131145            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131145_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131145_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131145_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131145_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131145_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131145_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131145_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131145_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131145_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131145_iter[i] /
                    (ctx->futhark_mc_segmap_task_131145_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131145_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131134         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131134_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131134_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131134_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131134_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131134_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131134_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131134_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131134_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131134_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131134_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131134_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131134_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131134_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131134_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131134_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131134_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131134_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131134_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131134_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131134_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131134_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131134_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131134_total_iter /
                (ctx->futhark_mc_segmap_parloop_131134_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131134_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131134_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131134_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131127            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131127_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131127_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131127_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131127_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131127_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131127_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131127_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131127_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131127_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131127_iter[i] /
                    (ctx->futhark_mc_segmap_task_131127_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131127_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131132     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131132_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131132_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131132_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131132_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131132_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131132_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131132_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131132_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131132_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131132_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131132_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131132_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131151         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131151_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131151_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131151_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131151_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131151_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131151_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131151_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131151_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131151_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131151_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131151_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131151_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131151_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131151_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131151_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131151_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131151_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131151_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131151_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131151_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131151_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131151_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131151_total_iter /
                (ctx->futhark_mc_segmap_parloop_131151_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131151_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131151_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131151_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131160         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131160_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131160_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131160_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131160_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131160_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131160_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131160_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131160_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131160_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131160_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131160_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131160_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131160_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131160_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131160_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131160_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131160_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131160_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131160_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131160_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131160_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131160_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131160_total_iter /
                (ctx->futhark_mc_segmap_parloop_131160_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131160_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131160_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131160_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131158            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131158_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131158_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131158_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131158_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131158_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131158_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131158_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131158_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131158_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131158_iter[i] /
                    (ctx->futhark_mc_segmap_task_131158_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131158_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131155         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131155_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131155_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131155_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131155_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131155_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131155_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131155_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131155_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131155_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131155_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131155_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131155_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131155_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131155_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131155_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131155_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131155_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131155_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131155_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131155_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131155_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131155_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131155_total_iter /
                (ctx->futhark_mc_segmap_parloop_131155_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131155_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131155_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131155_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131149            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131149_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131149_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131149_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131149_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131149_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131149_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131149_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131149_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131149_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131149_iter[i] /
                    (ctx->futhark_mc_segmap_task_131149_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131149_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131153     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131153_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131153_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131153_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131153_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131153_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131153_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131153_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131153_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131153_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131153_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131153_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131153_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131164         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131164_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131164_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131164_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131164_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131164_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131164_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131164_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131164_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131164_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131164_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131164_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131164_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131164_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131164_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131164_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131164_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131164_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131164_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131164_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131164_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131164_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131164_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131164_total_iter /
                (ctx->futhark_mc_segmap_parloop_131164_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131164_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131164_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131164_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131173         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131173_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131173_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131173_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131173_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131173_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131173_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131173_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131173_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131173_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131173_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131173_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131173_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131173_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131173_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131173_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131173_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131173_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131173_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131173_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131173_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131173_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131173_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131173_total_iter /
                (ctx->futhark_mc_segmap_parloop_131173_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131173_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131173_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131173_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131171            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131171_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131171_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131171_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131171_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131171_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131171_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131171_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131171_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131171_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131171_iter[i] /
                    (ctx->futhark_mc_segmap_task_131171_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131171_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131168         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131168_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131168_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131168_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131168_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131168_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131168_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131168_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131168_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131168_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131168_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131168_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131168_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131168_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131168_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131168_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131168_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131168_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131168_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131168_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131168_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131168_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131168_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131168_total_iter /
                (ctx->futhark_mc_segmap_parloop_131168_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131168_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131168_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131168_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131162            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131162_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131162_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131162_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131162_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131162_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131162_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131162_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131162_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131162_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131162_iter[i] /
                    (ctx->futhark_mc_segmap_task_131162_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131162_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131166     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131166_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131166_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131166_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131166_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131166_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131166_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131166_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131166_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131166_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131166_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131166_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131166_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131177         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131177_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131177_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131177_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131177_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131177_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131177_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131177_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131177_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131177_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131177_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131177_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131177_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131177_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131177_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131177_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131177_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131177_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131177_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131177_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131177_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131177_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131177_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131177_total_iter /
                (ctx->futhark_mc_segmap_parloop_131177_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131177_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131177_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131177_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131186         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131186_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131186_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131186_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131186_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131186_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131186_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131186_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131186_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131186_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131186_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131186_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131186_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131186_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131186_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131186_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131186_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131186_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131186_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131186_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131186_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131186_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131186_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131186_total_iter /
                (ctx->futhark_mc_segmap_parloop_131186_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131186_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131186_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131186_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131194 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_131194_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131194_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131194_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131194_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131194_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131194_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131194_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131194_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131194_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131194_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131194_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131194_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131194_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_131194_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131194_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131194_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131194_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131194_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131194_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131194_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131194_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131194_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131194_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131194_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131194_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131194_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131194_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131191            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131191_runs[i],
                    (long) ctx->futhark_mc_segred_task_131191_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131191_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131191_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131191_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131191_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131191_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131191_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131191_iter[i],
                    (long) ctx->futhark_mc_segred_task_131191_iter[i] /
                    (ctx->futhark_mc_segred_task_131191_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131191_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131189         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131189_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131189_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131189_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131189_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131189_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131189_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131189_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131189_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131189_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131189_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131189_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131189_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131189_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131189_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131189_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131189_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131189_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131189_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131189_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131189_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131189_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131189_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131189_total_iter /
                (ctx->futhark_mc_segmap_parloop_131189_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131189_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131189_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131189_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131184            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131184_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131184_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131184_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131184_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131184_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131184_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131184_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131184_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131184_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131184_iter[i] /
                    (ctx->futhark_mc_segmap_task_131184_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131184_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131187     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131187_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131187_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131187_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131187_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131187_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131187_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131187_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131187_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131187_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131187_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131187_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131187_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131181         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131181_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131181_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131181_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131181_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131181_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131181_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131181_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131181_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131181_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131181_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131181_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131181_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131181_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131181_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131181_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131181_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131181_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131181_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131181_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131181_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131181_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131181_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131181_total_iter /
                (ctx->futhark_mc_segmap_parloop_131181_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131181_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131181_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131181_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131175            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131175_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131175_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131175_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131175_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131175_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131175_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131175_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131175_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131175_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131175_iter[i] /
                    (ctx->futhark_mc_segmap_task_131175_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131175_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131179     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131179_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131179_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131179_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131179_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131179_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131179_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131179_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131179_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131179_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131179_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131179_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131179_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131198         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131198_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131198_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131198_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131198_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131198_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131198_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131198_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131198_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131198_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131198_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131198_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131198_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131198_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131198_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131198_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131198_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131198_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131198_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131198_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131198_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131198_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131198_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131198_total_iter /
                (ctx->futhark_mc_segmap_parloop_131198_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131198_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131198_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131198_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131213         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131213_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131213_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131213_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131213_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131213_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131213_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131213_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131213_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131213_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131213_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131213_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131213_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131213_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131213_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131213_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131213_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131213_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131213_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131213_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131213_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131213_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131213_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131213_total_iter /
                (ctx->futhark_mc_segmap_parloop_131213_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131213_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131213_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131213_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131211            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131211_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131211_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131211_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131211_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131211_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131211_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131211_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131211_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131211_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131211_iter[i] /
                    (ctx->futhark_mc_segmap_task_131211_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131211_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131217         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131217_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131217_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131217_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131217_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131217_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131217_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131217_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131217_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131217_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131217_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131217_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131217_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131217_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131217_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131217_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131217_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131217_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131217_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131217_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131217_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131217_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131217_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131217_total_iter /
                (ctx->futhark_mc_segmap_parloop_131217_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131217_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131217_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131217_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131225 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_131225_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131225_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131225_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131225_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131225_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131225_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131225_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131225_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131225_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131225_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131225_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131225_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131225_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_131225_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131225_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131225_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131225_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131225_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131225_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131225_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131225_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131225_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131225_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131225_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131225_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131225_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131225_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131222            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131222_runs[i],
                    (long) ctx->futhark_mc_segred_task_131222_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131222_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131222_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131222_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131222_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131222_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131222_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131222_iter[i],
                    (long) ctx->futhark_mc_segred_task_131222_iter[i] /
                    (ctx->futhark_mc_segred_task_131222_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131222_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131220         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131220_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131220_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131220_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131220_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131220_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131220_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131220_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131220_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131220_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131220_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131220_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131220_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131220_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131220_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131220_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131220_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131220_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131220_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131220_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131220_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131220_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131220_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131220_total_iter /
                (ctx->futhark_mc_segmap_parloop_131220_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131220_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131220_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131220_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131215            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131215_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131215_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131215_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131215_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131215_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131215_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131215_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131215_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131215_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131215_iter[i] /
                    (ctx->futhark_mc_segmap_task_131215_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131215_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131218     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131218_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131218_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131218_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131218_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131218_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131218_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131218_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131218_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131218_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131218_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131218_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131218_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131205         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131205_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131205_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131205_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131205_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131205_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131205_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131205_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131205_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131205_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131205_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131205_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131205_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131205_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131205_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131205_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131205_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131205_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131205_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131205_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131205_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131205_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131205_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131205_total_iter /
                (ctx->futhark_mc_segmap_parloop_131205_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131205_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131205_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131205_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131196            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131196_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131196_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131196_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131196_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131196_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131196_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131196_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131196_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131196_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131196_iter[i] /
                    (ctx->futhark_mc_segmap_task_131196_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131196_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131203     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131203_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131203_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131203_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131203_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131203_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131203_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131203_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131203_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131203_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131203_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131203_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131203_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131229         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131229_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131229_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131229_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131229_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131229_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131229_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131229_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131229_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131229_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131229_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131229_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131229_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131229_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131229_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131229_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131229_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131229_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131229_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131229_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131229_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131229_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131229_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131229_total_iter /
                (ctx->futhark_mc_segmap_parloop_131229_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131229_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131229_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131229_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131244         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131244_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131244_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131244_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131244_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131244_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131244_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131244_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131244_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131244_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131244_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131244_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131244_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131244_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131244_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131244_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131244_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131244_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131244_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131244_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131244_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131244_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131244_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131244_total_iter /
                (ctx->futhark_mc_segmap_parloop_131244_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131244_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131244_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131244_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131242            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131242_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131242_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131242_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131242_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131242_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131242_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131242_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131242_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131242_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131242_iter[i] /
                    (ctx->futhark_mc_segmap_task_131242_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131242_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131248         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131248_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131248_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131248_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131248_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131248_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131248_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131248_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131248_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131248_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131248_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131248_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131248_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131248_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131248_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131248_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131248_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131248_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131248_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131248_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131248_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131248_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131248_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131248_total_iter /
                (ctx->futhark_mc_segmap_parloop_131248_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131248_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131248_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131248_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131256 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_131256_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131256_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131256_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131256_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131256_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131256_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131256_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131256_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131256_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131256_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131256_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131256_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131256_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_131256_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131256_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131256_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131256_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131256_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131256_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131256_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131256_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131256_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131256_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131256_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131256_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131256_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131256_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131253            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131253_runs[i],
                    (long) ctx->futhark_mc_segred_task_131253_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131253_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131253_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131253_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131253_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131253_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131253_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131253_iter[i],
                    (long) ctx->futhark_mc_segred_task_131253_iter[i] /
                    (ctx->futhark_mc_segred_task_131253_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131253_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131251         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131251_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131251_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131251_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131251_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131251_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131251_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131251_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131251_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131251_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131251_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131251_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131251_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131251_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131251_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131251_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131251_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131251_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131251_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131251_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131251_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131251_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131251_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131251_total_iter /
                (ctx->futhark_mc_segmap_parloop_131251_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131251_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131251_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131251_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131246            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131246_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131246_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131246_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131246_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131246_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131246_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131246_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131246_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131246_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131246_iter[i] /
                    (ctx->futhark_mc_segmap_task_131246_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131246_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131249     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131249_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131249_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131249_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131249_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131249_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131249_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131249_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131249_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131249_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131249_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131249_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131249_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131236         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131236_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131236_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131236_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131236_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131236_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131236_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131236_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131236_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131236_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131236_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131236_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131236_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131236_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131236_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131236_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131236_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131236_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131236_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131236_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131236_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131236_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131236_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131236_total_iter /
                (ctx->futhark_mc_segmap_parloop_131236_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131236_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131236_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131236_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131227            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131227_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131227_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131227_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131227_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131227_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131227_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131227_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131227_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131227_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131227_iter[i] /
                    (ctx->futhark_mc_segmap_task_131227_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131227_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131234     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131234_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131234_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131234_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131234_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131234_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131234_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131234_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131234_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131234_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131234_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131234_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131234_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131260         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131260_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131260_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131260_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131260_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131260_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131260_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131260_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131260_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131260_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131260_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131260_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131260_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131260_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131260_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131260_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131260_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131260_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131260_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131260_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131260_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131260_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131260_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131260_total_iter /
                (ctx->futhark_mc_segmap_parloop_131260_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131260_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131260_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131260_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131269         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131269_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131269_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131269_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131269_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131269_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131269_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131269_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131269_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131269_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131269_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131269_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131269_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131269_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131269_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131269_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131269_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131269_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131269_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131269_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131269_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131269_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131269_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131269_total_iter /
                (ctx->futhark_mc_segmap_parloop_131269_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131269_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131269_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131269_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131267            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131267_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131267_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131267_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131267_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131267_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131267_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131267_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131267_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131267_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131267_iter[i] /
                    (ctx->futhark_mc_segmap_task_131267_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131267_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131264         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131264_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131264_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131264_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131264_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131264_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131264_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131264_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131264_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131264_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131264_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131264_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131264_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131264_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131264_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131264_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131264_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131264_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131264_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131264_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131264_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131264_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131264_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131264_total_iter /
                (ctx->futhark_mc_segmap_parloop_131264_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131264_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131264_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131264_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131258            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131258_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131258_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131258_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131258_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131258_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131258_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131258_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131258_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131258_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131258_iter[i] /
                    (ctx->futhark_mc_segmap_task_131258_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131258_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131262     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131262_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131262_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131262_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131262_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131262_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131262_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131262_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131262_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131262_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131262_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131262_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131262_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131273         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131273_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131273_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131273_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131273_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131273_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131273_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131273_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131273_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131273_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131273_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131273_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131273_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131273_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131273_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131273_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131273_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131273_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131273_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131273_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131273_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131273_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131273_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131273_total_iter /
                (ctx->futhark_mc_segmap_parloop_131273_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131273_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131273_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131273_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131282         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131282_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131282_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131282_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131282_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131282_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131282_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131282_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131282_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131282_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131282_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131282_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131282_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131282_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131282_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131282_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131282_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131282_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131282_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131282_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131282_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131282_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131282_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131282_total_iter /
                (ctx->futhark_mc_segmap_parloop_131282_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131282_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131282_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131282_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131290 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_131290_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131290_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131290_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131290_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131290_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131290_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131290_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131290_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131290_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131290_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131290_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131290_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131290_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_131290_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131290_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131290_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131290_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131290_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131290_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131290_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131290_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131290_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131290_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131290_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131290_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131290_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131290_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131287            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131287_runs[i],
                    (long) ctx->futhark_mc_segred_task_131287_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131287_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131287_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131287_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131287_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131287_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131287_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131287_iter[i],
                    (long) ctx->futhark_mc_segred_task_131287_iter[i] /
                    (ctx->futhark_mc_segred_task_131287_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131287_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131285         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131285_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131285_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131285_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131285_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131285_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131285_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131285_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131285_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131285_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131285_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131285_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131285_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131285_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131285_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131285_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131285_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131285_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131285_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131285_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131285_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131285_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131285_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131285_total_iter /
                (ctx->futhark_mc_segmap_parloop_131285_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131285_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131285_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131285_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131280            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131280_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131280_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131280_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131280_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131280_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131280_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131280_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131280_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131280_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131280_iter[i] /
                    (ctx->futhark_mc_segmap_task_131280_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131280_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131283     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131283_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131283_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131283_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131283_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131283_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131283_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131283_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131283_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131283_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131283_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131283_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131283_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131277         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131277_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131277_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131277_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131277_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131277_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131277_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131277_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131277_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131277_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131277_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131277_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131277_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131277_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131277_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131277_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131277_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131277_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131277_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131277_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131277_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131277_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131277_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131277_total_iter /
                (ctx->futhark_mc_segmap_parloop_131277_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131277_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131277_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131277_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131271            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131271_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131271_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131271_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131271_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131271_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131271_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131271_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131271_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131271_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131271_iter[i] /
                    (ctx->futhark_mc_segmap_task_131271_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131271_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131275     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131275_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131275_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131275_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131275_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131275_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131275_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131275_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131275_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131275_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131275_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131275_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131275_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131294         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131294_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131294_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131294_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131294_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131294_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131294_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131294_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131294_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131294_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131294_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131294_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131294_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131294_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131294_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131294_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131294_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131294_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131294_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131294_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131294_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131294_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131294_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131294_total_iter /
                (ctx->futhark_mc_segmap_parloop_131294_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131294_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131294_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131294_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131303         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131303_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131303_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131303_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131303_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131303_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131303_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131303_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131303_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131303_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131303_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131303_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131303_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131303_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131303_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131303_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131303_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131303_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131303_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131303_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131303_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131303_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131303_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131303_total_iter /
                (ctx->futhark_mc_segmap_parloop_131303_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131303_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131303_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131303_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131301            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131301_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131301_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131301_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131301_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131301_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131301_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131301_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131301_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131301_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131301_iter[i] /
                    (ctx->futhark_mc_segmap_task_131301_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131301_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131298         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131298_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131298_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131298_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131298_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131298_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131298_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131298_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131298_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131298_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131298_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131298_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131298_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131298_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131298_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131298_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131298_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131298_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131298_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131298_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131298_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131298_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131298_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131298_total_iter /
                (ctx->futhark_mc_segmap_parloop_131298_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131298_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131298_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131298_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131292            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131292_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131292_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131292_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131292_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131292_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131292_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131292_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131292_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131292_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131292_iter[i] /
                    (ctx->futhark_mc_segmap_task_131292_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131292_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131296     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131296_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131296_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131296_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131296_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131296_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131296_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131296_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131296_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131296_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131296_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131296_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131296_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131307         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131307_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131307_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131307_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131307_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131307_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131307_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131307_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131307_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131307_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131307_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131307_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131307_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131307_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131307_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131307_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131307_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131307_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131307_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131307_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131307_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131307_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131307_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131307_total_iter /
                (ctx->futhark_mc_segmap_parloop_131307_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131307_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131307_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131307_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131321 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_131321_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131321_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131321_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131321_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131321_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131321_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131321_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131321_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131321_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131321_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131321_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131321_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131321_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_131321_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131321_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131321_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131321_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131321_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131321_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131321_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131321_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131321_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131321_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131321_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131321_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131321_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131321_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131318            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131318_runs[i],
                    (long) ctx->futhark_mc_segred_task_131318_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131318_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131318_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131318_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131318_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131318_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131318_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131318_iter[i],
                    (long) ctx->futhark_mc_segred_task_131318_iter[i] /
                    (ctx->futhark_mc_segred_task_131318_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131318_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_131326   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_131326_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131326_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131326_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_131326_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131326_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_131326_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131326_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_131326_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131326_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131326_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131326_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_131326_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_131326_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_131326_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_131326_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_131326_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_131326_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_131326_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_131326_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_131326_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_131326_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_131326_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_131326_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_131326_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_131326_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_131326_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_131326_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_131328   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_131328_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131328_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131328_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_131328_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131328_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_131328_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131328_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_131328_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131328_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131328_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131328_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_131328_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_131328_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_131328_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_131328_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_131328_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_131328_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_131328_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_131328_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_131328_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_131328_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_131328_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_131328_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_131328_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_131328_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_131328_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_131328_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_131323           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_131323_runs[i],
                    (long) ctx->futhark_mc_segscan_task_131323_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_131323_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_131323_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_131323_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_131323_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_131323_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_131323_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_131323_iter[i],
                    (long) ctx->futhark_mc_segscan_task_131323_iter[i] /
                    (ctx->futhark_mc_segscan_task_131323_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_131323_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131333 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_131333_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131333_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131333_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131333_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131333_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131333_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131333_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131333_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131333_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131333_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131333_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131333_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131333_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_131333_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131333_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131333_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131333_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131333_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131333_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131333_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131333_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131333_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131333_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131333_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131333_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131333_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131333_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131330            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131330_runs[i],
                    (long) ctx->futhark_mc_segred_task_131330_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131330_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131330_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131330_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131330_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131330_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131330_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131330_iter[i],
                    (long) ctx->futhark_mc_segred_task_131330_iter[i] /
                    (ctx->futhark_mc_segred_task_131330_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131330_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_131338   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_131338_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131338_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131338_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_131338_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131338_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_131338_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131338_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_131338_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131338_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131338_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131338_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_131338_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_131338_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_131338_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_131338_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_131338_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_131338_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_131338_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_131338_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_131338_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_131338_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_131338_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_131338_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_131338_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_131338_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_131338_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_131338_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_131340   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_131340_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131340_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131340_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_131340_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131340_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_131340_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131340_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_131340_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131340_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131340_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131340_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_131340_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_131340_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_131340_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_131340_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_131340_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_131340_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_131340_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_131340_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_131340_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_131340_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_131340_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_131340_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_131340_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_131340_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_131340_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_131340_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_131335           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_131335_runs[i],
                    (long) ctx->futhark_mc_segscan_task_131335_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_131335_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_131335_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_131335_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_131335_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_131335_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_131335_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_131335_iter[i],
                    (long) ctx->futhark_mc_segscan_task_131335_iter[i] /
                    (ctx->futhark_mc_segscan_task_131335_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_131335_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131345 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_131345_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131345_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131345_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131345_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131345_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131345_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131345_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131345_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131345_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131345_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131345_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131345_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131345_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_131345_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131345_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131345_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131345_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131345_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131345_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131345_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131345_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131345_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131345_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131345_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131345_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131345_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131345_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131342            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131342_runs[i],
                    (long) ctx->futhark_mc_segred_task_131342_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131342_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131342_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131342_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131342_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131342_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131342_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131342_iter[i],
                    (long) ctx->futhark_mc_segred_task_131342_iter[i] /
                    (ctx->futhark_mc_segred_task_131342_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131342_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_131350   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_131350_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131350_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131350_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_131350_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131350_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_131350_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131350_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_131350_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131350_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131350_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131350_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_131350_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_131350_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_131350_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_131350_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_131350_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_131350_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_131350_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_131350_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_131350_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_131350_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_131350_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_131350_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_131350_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_131350_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_131350_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_131350_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_131352   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_131352_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131352_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131352_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_131352_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131352_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_131352_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131352_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_131352_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131352_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131352_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131352_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_131352_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_131352_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_131352_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_131352_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_131352_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_131352_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_131352_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_131352_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_131352_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_131352_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_131352_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_131352_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_131352_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_131352_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_131352_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_131352_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_131347           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_131347_runs[i],
                    (long) ctx->futhark_mc_segscan_task_131347_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_131347_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_131347_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_131347_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_131347_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_131347_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_131347_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_131347_iter[i],
                    (long) ctx->futhark_mc_segscan_task_131347_iter[i] /
                    (ctx->futhark_mc_segscan_task_131347_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_131347_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131313         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131313_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131313_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131313_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131313_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131313_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131313_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131313_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131313_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131313_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131313_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131313_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131313_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131313_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131313_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131313_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131313_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131313_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131313_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131313_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131313_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131313_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131313_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131313_total_iter /
                (ctx->futhark_mc_segmap_parloop_131313_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131313_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131313_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131313_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131305            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131305_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131305_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131305_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131305_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131305_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131305_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131305_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131305_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131305_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131305_iter[i] /
                    (ctx->futhark_mc_segmap_task_131305_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131305_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131311     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131311_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131311_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131311_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131311_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131311_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131311_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131311_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131311_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131311_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131311_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131311_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131311_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131356         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131356_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131356_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131356_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131356_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131356_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131356_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131356_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131356_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131356_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131356_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131356_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131356_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131356_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131356_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131356_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131356_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131356_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131356_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131356_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131356_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131356_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131356_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131356_total_iter /
                (ctx->futhark_mc_segmap_parloop_131356_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131356_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131356_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131356_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131367         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131367_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131367_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131367_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131367_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131367_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131367_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131367_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131367_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131367_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131367_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131367_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131367_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131367_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131367_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131367_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131367_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131367_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131367_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131367_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131367_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131367_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131367_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131367_total_iter /
                (ctx->futhark_mc_segmap_parloop_131367_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131367_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131367_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131367_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131365            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131365_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131365_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131365_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131365_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131365_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131365_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131365_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131365_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131365_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131365_iter[i] /
                    (ctx->futhark_mc_segmap_task_131365_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131365_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131361         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131361_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131361_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131361_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131361_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131361_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131361_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131361_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131361_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131361_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131361_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131361_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131361_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131361_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131361_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131361_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131361_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131361_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131361_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131361_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131361_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131361_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131361_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131361_total_iter /
                (ctx->futhark_mc_segmap_parloop_131361_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131361_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131361_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131361_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131354            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131354_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131354_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131354_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131354_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131354_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131354_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131354_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131354_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131354_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131354_iter[i] /
                    (ctx->futhark_mc_segmap_task_131354_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131354_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131359     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131359_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131359_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131359_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131359_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131359_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131359_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131359_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131359_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131359_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131359_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131359_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131359_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131371         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131371_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131371_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131371_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131371_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131371_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131371_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131371_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131371_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131371_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131371_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131371_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131371_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131371_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131371_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131371_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131371_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131371_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131371_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131371_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131371_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131371_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131371_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131371_total_iter /
                (ctx->futhark_mc_segmap_parloop_131371_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131371_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131371_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131371_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131380         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131380_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131380_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131380_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131380_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131380_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131380_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131380_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131380_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131380_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131380_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131380_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131380_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131380_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131380_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131380_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131380_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131380_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131380_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131380_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131380_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131380_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131380_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131380_total_iter /
                (ctx->futhark_mc_segmap_parloop_131380_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131380_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131380_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131380_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131388 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_131388_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131388_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131388_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131388_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131388_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131388_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131388_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131388_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131388_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131388_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131388_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131388_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131388_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_131388_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131388_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131388_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131388_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131388_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131388_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131388_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131388_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131388_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131388_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131388_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131388_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131388_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131388_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131385            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131385_runs[i],
                    (long) ctx->futhark_mc_segred_task_131385_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131385_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131385_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131385_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131385_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131385_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131385_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131385_iter[i],
                    (long) ctx->futhark_mc_segred_task_131385_iter[i] /
                    (ctx->futhark_mc_segred_task_131385_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131385_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131393 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_131393_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131393_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131393_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131393_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131393_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131393_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131393_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131393_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131393_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131393_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131393_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131393_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131393_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_131393_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131393_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131393_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131393_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131393_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131393_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131393_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131393_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131393_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131393_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131393_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131393_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131393_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131393_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131390            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131390_runs[i],
                    (long) ctx->futhark_mc_segred_task_131390_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131390_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131390_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131390_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131390_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131390_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131390_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131390_iter[i],
                    (long) ctx->futhark_mc_segred_task_131390_iter[i] /
                    (ctx->futhark_mc_segred_task_131390_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131390_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131383         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131383_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131383_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131383_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131383_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131383_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131383_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131383_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131383_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131383_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131383_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131383_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131383_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131383_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131383_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131383_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131383_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131383_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131383_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131383_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131383_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131383_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131383_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131383_total_iter /
                (ctx->futhark_mc_segmap_parloop_131383_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131383_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131383_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131383_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131378            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131378_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131378_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131378_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131378_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131378_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131378_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131378_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131378_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131378_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131378_iter[i] /
                    (ctx->futhark_mc_segmap_task_131378_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131378_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131381     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131381_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131381_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131381_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131381_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131381_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131381_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131381_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131381_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131381_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131381_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131381_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131381_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131375         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131375_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131375_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131375_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131375_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131375_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131375_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131375_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131375_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131375_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131375_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131375_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131375_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131375_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131375_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131375_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131375_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131375_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131375_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131375_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131375_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131375_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131375_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131375_total_iter /
                (ctx->futhark_mc_segmap_parloop_131375_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131375_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131375_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131375_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131369            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131369_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131369_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131369_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131369_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131369_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131369_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131369_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131369_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131369_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131369_iter[i] /
                    (ctx->futhark_mc_segmap_task_131369_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131369_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131373     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131373_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131373_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131373_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131373_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131373_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131373_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131373_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131373_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131373_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131373_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131373_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131373_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131397         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131397_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131397_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131397_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131397_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131397_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131397_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131397_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131397_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131397_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131397_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131397_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131397_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131397_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131397_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131397_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131397_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131397_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131397_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131397_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131397_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131397_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131397_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131397_total_iter /
                (ctx->futhark_mc_segmap_parloop_131397_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131397_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131397_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131397_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131408         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131408_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131408_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131408_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131408_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131408_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131408_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131408_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131408_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131408_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131408_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131408_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131408_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131408_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131408_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131408_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131408_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131408_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131408_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131408_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131408_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131408_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131408_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131408_total_iter /
                (ctx->futhark_mc_segmap_parloop_131408_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131408_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131408_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131408_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131418 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_131418_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131418_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131418_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131418_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131418_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131418_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131418_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131418_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131418_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131418_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131418_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131418_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131418_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_131418_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131418_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131418_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131418_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131418_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131418_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131418_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131418_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131418_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131418_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131418_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131418_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131418_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131418_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131413            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131413_runs[i],
                    (long) ctx->futhark_mc_segred_task_131413_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131413_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131413_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131413_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131413_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131413_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131413_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131413_iter[i],
                    (long) ctx->futhark_mc_segred_task_131413_iter[i] /
                    (ctx->futhark_mc_segred_task_131413_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131413_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131424 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_131424_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131424_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131424_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131424_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131424_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131424_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131424_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131424_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131424_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131424_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131424_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131424_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131424_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_131424_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131424_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131424_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131424_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131424_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131424_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131424_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131424_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131424_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131424_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131424_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131424_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131424_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131424_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131420            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131420_runs[i],
                    (long) ctx->futhark_mc_segred_task_131420_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131420_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131420_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131420_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131420_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131420_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131420_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131420_iter[i],
                    (long) ctx->futhark_mc_segred_task_131420_iter[i] /
                    (ctx->futhark_mc_segred_task_131420_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131420_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131411         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131411_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131411_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131411_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131411_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131411_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131411_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131411_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131411_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131411_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131411_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131411_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131411_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131411_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131411_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131411_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131411_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131411_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131411_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131411_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131411_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131411_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131411_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131411_total_iter /
                (ctx->futhark_mc_segmap_parloop_131411_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131411_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131411_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131411_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131406            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131406_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131406_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131406_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131406_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131406_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131406_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131406_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131406_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131406_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131406_iter[i] /
                    (ctx->futhark_mc_segmap_task_131406_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131406_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131409     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131409_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131409_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131409_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131409_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131409_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131409_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131409_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131409_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131409_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131409_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131409_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131409_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131402         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131402_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131402_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131402_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131402_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131402_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131402_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131402_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131402_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131402_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131402_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131402_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131402_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131402_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131402_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131402_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131402_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131402_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131402_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131402_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131402_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131402_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131402_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131402_total_iter /
                (ctx->futhark_mc_segmap_parloop_131402_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131402_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131402_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131402_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131395            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131395_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131395_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131395_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131395_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131395_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131395_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131395_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131395_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131395_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131395_iter[i] /
                    (ctx->futhark_mc_segmap_task_131395_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131395_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131400     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131400_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131400_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131400_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131400_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131400_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131400_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131400_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131400_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131400_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131400_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131400_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131400_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131428         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131428_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131428_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131428_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131428_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131428_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131428_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131428_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131428_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131428_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131428_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131428_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131428_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131428_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131428_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131428_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131428_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131428_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131428_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131428_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131428_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131428_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131428_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131428_total_iter /
                (ctx->futhark_mc_segmap_parloop_131428_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131428_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131428_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131428_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131439         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131439_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131439_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131439_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131439_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131439_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131439_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131439_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131439_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131439_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131439_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131439_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131439_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131439_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131439_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131439_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131439_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131439_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131439_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131439_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131439_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131439_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131439_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131439_total_iter /
                (ctx->futhark_mc_segmap_parloop_131439_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131439_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131439_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131439_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131451 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_131451_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131451_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131451_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131451_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131451_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131451_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131451_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131451_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131451_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131451_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131451_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131451_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131451_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_131451_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131451_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131451_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131451_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131451_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131451_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131451_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131451_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131451_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131451_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131451_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131451_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131451_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131451_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131444            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131444_runs[i],
                    (long) ctx->futhark_mc_segred_task_131444_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131444_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131444_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131444_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131444_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131444_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131444_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131444_iter[i],
                    (long) ctx->futhark_mc_segred_task_131444_iter[i] /
                    (ctx->futhark_mc_segred_task_131444_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131444_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131457 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_131457_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131457_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131457_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131457_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131457_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131457_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131457_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131457_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131457_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131457_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131457_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131457_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131457_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_131457_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131457_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131457_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131457_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131457_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131457_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131457_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131457_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131457_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131457_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131457_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131457_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131457_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131457_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131453            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131453_runs[i],
                    (long) ctx->futhark_mc_segred_task_131453_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131453_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131453_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131453_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131453_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131453_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131453_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131453_iter[i],
                    (long) ctx->futhark_mc_segred_task_131453_iter[i] /
                    (ctx->futhark_mc_segred_task_131453_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131453_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131442         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131442_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131442_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131442_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131442_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131442_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131442_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131442_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131442_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131442_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131442_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131442_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131442_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131442_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131442_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131442_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131442_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131442_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131442_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131442_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131442_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131442_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131442_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131442_total_iter /
                (ctx->futhark_mc_segmap_parloop_131442_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131442_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131442_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131442_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131437            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131437_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131437_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131437_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131437_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131437_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131437_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131437_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131437_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131437_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131437_iter[i] /
                    (ctx->futhark_mc_segmap_task_131437_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131437_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131440     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131440_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131440_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131440_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131440_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131440_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131440_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131440_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131440_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131440_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131440_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131440_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131440_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131433         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131433_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131433_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131433_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131433_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131433_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131433_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131433_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131433_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131433_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131433_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131433_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131433_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131433_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131433_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131433_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131433_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131433_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131433_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131433_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131433_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131433_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131433_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131433_total_iter /
                (ctx->futhark_mc_segmap_parloop_131433_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131433_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131433_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131433_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131426            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131426_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131426_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131426_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131426_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131426_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131426_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131426_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131426_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131426_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131426_iter[i] /
                    (ctx->futhark_mc_segmap_task_131426_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131426_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131431     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131431_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131431_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131431_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131431_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131431_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131431_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131431_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131431_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131431_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131431_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131431_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131431_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131461         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131461_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131461_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131461_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131461_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131461_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131461_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131461_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131461_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131461_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131461_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131461_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131461_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131461_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131461_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131461_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131461_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131461_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131461_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131461_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131461_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131461_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131461_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131461_total_iter /
                (ctx->futhark_mc_segmap_parloop_131461_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131461_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131461_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131461_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131471         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131471_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131471_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131471_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131471_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131471_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131471_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131471_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131471_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131471_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131471_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131471_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131471_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131471_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131471_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131471_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131471_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131471_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131471_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131471_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131471_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131471_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131471_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131471_total_iter /
                (ctx->futhark_mc_segmap_parloop_131471_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131471_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131471_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131471_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131481 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_131481_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131481_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131481_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131481_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131481_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131481_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131481_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131481_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131481_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131481_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131481_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131481_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131481_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_131481_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131481_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131481_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131481_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131481_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131481_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131481_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131481_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131481_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131481_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131481_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131481_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131481_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131481_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131478            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131478_runs[i],
                    (long) ctx->futhark_mc_segred_task_131478_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131478_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131478_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131478_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131478_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131478_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131478_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131478_iter[i],
                    (long) ctx->futhark_mc_segred_task_131478_iter[i] /
                    (ctx->futhark_mc_segred_task_131478_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131478_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131486 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_131486_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131486_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131486_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131486_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131486_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131486_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131486_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131486_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131486_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131486_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131486_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131486_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131486_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_131486_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131486_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131486_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131486_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131486_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131486_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131486_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131486_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131486_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131486_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131486_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131486_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131486_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131486_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131483            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131483_runs[i],
                    (long) ctx->futhark_mc_segred_task_131483_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131483_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131483_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131483_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131483_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131483_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131483_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131483_iter[i],
                    (long) ctx->futhark_mc_segred_task_131483_iter[i] /
                    (ctx->futhark_mc_segred_task_131483_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131483_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131475         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131475_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131475_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131475_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131475_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131475_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131475_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131475_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131475_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131475_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131475_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131475_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131475_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131475_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131475_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131475_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131475_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131475_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131475_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131475_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131475_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131475_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131475_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131475_total_iter /
                (ctx->futhark_mc_segmap_parloop_131475_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131475_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131475_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131475_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131469            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131469_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131469_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131469_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131469_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131469_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131469_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131469_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131469_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131469_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131469_iter[i] /
                    (ctx->futhark_mc_segmap_task_131469_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131469_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131473     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131473_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131473_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131473_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131473_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131473_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131473_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131473_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131473_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131473_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131473_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131473_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131473_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131466         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131466_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131466_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131466_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131466_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131466_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131466_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131466_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131466_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131466_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131466_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131466_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131466_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131466_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131466_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131466_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131466_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131466_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131466_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131466_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131466_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131466_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131466_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131466_total_iter /
                (ctx->futhark_mc_segmap_parloop_131466_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131466_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131466_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131466_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131459            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131459_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131459_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131459_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131459_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131459_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131459_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131459_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131459_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131459_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131459_iter[i] /
                    (ctx->futhark_mc_segmap_task_131459_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131459_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131464     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131464_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131464_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131464_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131464_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131464_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131464_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131464_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131464_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131464_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131464_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131464_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131464_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131490         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131490_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131490_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131490_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131490_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131490_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131490_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131490_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131490_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131490_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131490_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131490_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131490_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131490_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131490_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131490_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131490_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131490_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131490_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131490_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131490_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131490_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131490_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131490_total_iter /
                (ctx->futhark_mc_segmap_parloop_131490_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131490_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131490_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131490_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131503         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131503_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131503_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131503_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131503_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131503_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131503_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131503_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131503_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131503_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131503_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131503_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131503_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131503_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131503_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131503_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131503_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131503_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131503_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131503_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131503_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131503_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131503_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131503_total_iter /
                (ctx->futhark_mc_segmap_parloop_131503_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131503_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131503_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131503_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131517 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_131517_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131517_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131517_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131517_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131517_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131517_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131517_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131517_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131517_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131517_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131517_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131517_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131517_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_131517_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131517_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131517_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131517_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131517_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131517_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131517_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131517_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131517_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131517_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131517_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131517_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131517_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131517_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131512            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131512_runs[i],
                    (long) ctx->futhark_mc_segred_task_131512_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131512_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131512_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131512_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131512_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131512_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131512_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131512_iter[i],
                    (long) ctx->futhark_mc_segred_task_131512_iter[i] /
                    (ctx->futhark_mc_segred_task_131512_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131512_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131523 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_131523_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131523_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131523_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131523_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131523_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131523_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131523_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131523_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131523_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131523_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131523_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131523_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131523_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_131523_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131523_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131523_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131523_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131523_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131523_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131523_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131523_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131523_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131523_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131523_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131523_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131523_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131523_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131519            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131519_runs[i],
                    (long) ctx->futhark_mc_segred_task_131519_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131519_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131519_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131519_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131519_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131519_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131519_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131519_iter[i],
                    (long) ctx->futhark_mc_segred_task_131519_iter[i] /
                    (ctx->futhark_mc_segred_task_131519_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131519_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131508         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131508_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131508_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131508_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131508_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131508_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131508_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131508_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131508_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131508_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131508_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131508_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131508_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131508_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131508_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131508_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131508_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131508_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131508_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131508_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131508_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131508_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131508_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131508_total_iter /
                (ctx->futhark_mc_segmap_parloop_131508_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131508_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131508_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131508_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131501            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131501_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131501_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131501_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131501_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131501_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131501_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131501_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131501_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131501_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131501_iter[i] /
                    (ctx->futhark_mc_segmap_task_131501_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131501_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131506     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131506_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131506_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131506_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131506_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131506_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131506_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131506_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131506_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131506_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131506_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131506_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131506_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131497         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131497_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131497_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131497_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131497_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131497_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131497_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131497_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131497_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131497_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131497_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131497_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131497_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131497_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131497_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131497_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131497_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131497_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131497_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131497_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131497_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131497_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131497_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131497_total_iter /
                (ctx->futhark_mc_segmap_parloop_131497_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131497_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131497_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131497_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131488            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131488_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131488_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131488_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131488_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131488_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131488_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131488_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131488_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131488_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131488_iter[i] /
                    (ctx->futhark_mc_segmap_task_131488_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131488_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131495     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131495_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131495_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131495_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131495_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131495_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131495_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131495_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131495_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131495_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131495_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131495_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131495_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131527         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131527_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131527_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131527_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131527_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131527_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131527_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131527_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131527_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131527_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131527_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131527_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131527_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131527_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131527_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131527_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131527_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131527_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131527_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131527_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131527_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131527_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131527_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131527_total_iter /
                (ctx->futhark_mc_segmap_parloop_131527_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131527_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131527_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131527_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131542         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131542_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131542_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131542_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131542_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131542_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131542_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131542_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131542_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131542_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131542_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131542_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131542_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131542_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131542_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131542_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131542_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131542_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131542_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131542_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131542_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131542_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131542_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131542_total_iter /
                (ctx->futhark_mc_segmap_parloop_131542_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131542_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131542_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131542_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131557         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131557_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131557_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131557_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131557_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131557_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131557_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131557_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131557_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131557_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131557_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131557_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131557_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131557_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131557_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131557_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131557_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131557_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131557_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131557_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131557_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131557_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131557_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131557_total_iter /
                (ctx->futhark_mc_segmap_parloop_131557_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131557_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131557_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131557_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131555            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131555_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131555_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131555_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131555_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131555_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131555_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131555_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131555_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131555_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131555_iter[i] /
                    (ctx->futhark_mc_segmap_task_131555_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131555_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131566 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_131566_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131566_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131566_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131566_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131566_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131566_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131566_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131566_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131566_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131566_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131566_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131566_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131566_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_131566_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131566_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131566_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131566_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131566_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131566_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131566_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131566_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131566_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131566_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131566_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131566_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131566_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131566_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131559            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131559_runs[i],
                    (long) ctx->futhark_mc_segred_task_131559_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131559_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131559_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131559_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131559_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131559_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131559_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131559_iter[i],
                    (long) ctx->futhark_mc_segred_task_131559_iter[i] /
                    (ctx->futhark_mc_segred_task_131559_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131559_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131572 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_131572_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131572_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131572_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131572_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131572_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131572_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131572_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131572_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131572_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131572_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131572_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131572_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131572_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_131572_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131572_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131572_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131572_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131572_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131572_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131572_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131572_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131572_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131572_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131572_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131572_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131572_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131572_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131568            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131568_runs[i],
                    (long) ctx->futhark_mc_segred_task_131568_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131568_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131568_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131568_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131568_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131568_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131568_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131568_iter[i],
                    (long) ctx->futhark_mc_segred_task_131568_iter[i] /
                    (ctx->futhark_mc_segred_task_131568_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131568_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131549         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131549_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131549_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131549_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131549_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131549_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131549_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131549_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131549_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131549_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131549_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131549_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131549_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131549_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131549_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131549_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131549_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131549_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131549_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131549_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131549_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131549_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131549_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131549_total_iter /
                (ctx->futhark_mc_segmap_parloop_131549_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131549_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131549_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131549_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131540            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131540_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131540_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131540_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131540_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131540_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131540_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131540_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131540_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131540_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131540_iter[i] /
                    (ctx->futhark_mc_segmap_task_131540_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131540_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131547     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131547_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131547_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131547_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131547_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131547_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131547_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131547_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131547_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131547_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131547_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131547_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131547_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131536         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131536_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131536_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131536_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131536_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131536_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131536_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131536_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131536_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131536_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131536_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131536_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131536_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131536_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131536_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131536_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131536_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131536_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131536_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131536_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131536_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131536_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131536_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131536_total_iter /
                (ctx->futhark_mc_segmap_parloop_131536_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131536_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131536_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131536_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131525            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131525_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131525_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131525_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131525_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131525_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131525_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131525_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131525_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131525_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131525_iter[i] /
                    (ctx->futhark_mc_segmap_task_131525_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131525_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131534     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131534_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131534_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131534_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131534_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131534_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131534_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131534_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131534_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131534_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131534_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131534_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131534_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131576         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131576_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131576_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131576_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131576_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131576_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131576_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131576_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131576_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131576_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131576_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131576_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131576_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131576_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131576_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131576_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131576_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131576_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131576_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131576_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131576_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131576_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131576_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131576_total_iter /
                (ctx->futhark_mc_segmap_parloop_131576_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131576_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131576_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131576_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131585         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131585_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131585_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131585_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131585_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131585_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131585_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131585_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131585_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131585_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131585_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131585_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131585_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131585_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131585_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131585_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131585_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131585_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131585_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131585_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131585_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131585_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131585_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131585_total_iter /
                (ctx->futhark_mc_segmap_parloop_131585_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131585_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131585_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131585_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131583            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131583_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131583_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131583_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131583_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131583_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131583_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131583_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131583_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131583_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131583_iter[i] /
                    (ctx->futhark_mc_segmap_task_131583_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131583_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131580         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131580_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131580_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131580_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131580_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131580_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131580_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131580_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131580_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131580_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131580_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131580_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131580_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131580_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131580_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131580_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131580_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131580_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131580_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131580_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131580_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131580_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131580_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131580_total_iter /
                (ctx->futhark_mc_segmap_parloop_131580_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131580_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131580_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131580_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131574            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131574_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131574_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131574_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131574_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131574_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131574_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131574_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131574_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131574_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131574_iter[i] /
                    (ctx->futhark_mc_segmap_task_131574_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131574_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131578     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131578_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131578_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131578_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131578_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131578_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131578_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131578_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131578_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131578_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131578_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131578_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131578_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131589         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131589_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131589_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131589_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131589_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131589_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131589_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131589_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131589_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131589_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131589_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131589_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131589_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131589_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131589_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131589_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131589_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131589_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131589_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131589_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131589_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131589_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131589_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131589_total_iter /
                (ctx->futhark_mc_segmap_parloop_131589_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131589_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131589_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131589_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131598         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131598_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131598_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131598_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131598_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131598_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131598_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131598_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131598_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131598_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131598_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131598_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131598_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131598_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131598_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131598_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131598_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131598_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131598_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131598_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131598_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131598_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131598_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131598_total_iter /
                (ctx->futhark_mc_segmap_parloop_131598_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131598_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131598_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131598_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131596            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131596_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131596_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131596_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131596_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131596_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131596_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131596_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131596_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131596_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131596_iter[i] /
                    (ctx->futhark_mc_segmap_task_131596_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131596_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131593         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131593_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131593_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131593_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131593_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131593_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131593_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131593_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131593_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131593_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131593_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131593_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131593_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131593_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131593_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131593_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131593_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131593_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131593_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131593_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131593_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131593_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131593_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131593_total_iter /
                (ctx->futhark_mc_segmap_parloop_131593_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131593_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131593_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131593_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131587            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131587_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131587_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131587_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131587_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131587_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131587_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131587_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131587_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131587_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131587_iter[i] /
                    (ctx->futhark_mc_segmap_task_131587_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131587_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131591     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131591_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131591_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131591_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131591_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131591_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131591_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131591_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131591_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131591_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131591_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131591_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131591_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131602         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131602_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131602_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131602_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131602_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131602_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131602_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131602_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131602_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131602_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131602_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131602_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131602_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131602_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131602_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131602_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131602_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131602_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131602_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131602_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131602_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131602_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131602_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131602_total_iter /
                (ctx->futhark_mc_segmap_parloop_131602_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131602_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131602_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131602_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131613         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131613_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131613_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131613_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131613_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131613_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131613_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131613_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131613_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131613_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131613_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131613_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131613_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131613_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131613_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131613_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131613_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131613_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131613_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131613_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131613_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131613_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131613_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131613_total_iter /
                (ctx->futhark_mc_segmap_parloop_131613_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131613_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131613_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131613_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131611            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131611_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131611_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131611_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131611_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131611_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131611_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131611_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131611_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131611_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131611_iter[i] /
                    (ctx->futhark_mc_segmap_task_131611_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131611_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131617         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131617_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131617_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131617_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131617_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131617_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131617_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131617_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131617_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131617_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131617_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131617_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131617_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131617_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131617_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131617_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131617_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131617_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131617_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131617_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131617_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131617_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131617_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131617_total_iter /
                (ctx->futhark_mc_segmap_parloop_131617_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131617_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131617_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131617_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131615            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131615_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131615_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131615_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131615_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131615_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131615_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131615_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131615_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131615_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131615_iter[i] /
                    (ctx->futhark_mc_segmap_task_131615_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131615_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131607         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131607_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131607_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131607_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131607_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131607_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131607_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131607_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131607_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131607_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131607_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131607_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131607_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131607_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131607_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131607_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131607_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131607_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131607_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131607_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131607_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131607_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131607_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131607_total_iter /
                (ctx->futhark_mc_segmap_parloop_131607_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131607_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131607_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131607_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131600            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131600_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131600_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131600_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131600_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131600_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131600_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131600_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131600_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131600_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131600_iter[i] /
                    (ctx->futhark_mc_segmap_task_131600_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131600_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131605     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131605_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131605_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131605_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131605_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131605_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131605_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131605_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131605_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131605_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131605_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131605_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131605_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131621         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131621_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131621_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131621_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131621_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131621_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131621_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131621_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131621_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131621_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131621_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131621_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131621_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131621_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131621_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131621_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131621_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131621_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131621_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131621_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131621_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131621_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131621_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131621_total_iter /
                (ctx->futhark_mc_segmap_parloop_131621_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131621_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131621_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131621_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131630         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131630_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131630_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131630_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131630_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131630_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131630_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131630_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131630_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131630_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131630_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131630_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131630_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131630_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131630_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131630_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131630_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131630_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131630_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131630_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131630_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131630_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131630_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131630_total_iter /
                (ctx->futhark_mc_segmap_parloop_131630_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131630_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131630_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131630_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131638 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_131638_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131638_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131638_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131638_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131638_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131638_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131638_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131638_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131638_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131638_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131638_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131638_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131638_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_131638_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131638_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131638_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131638_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131638_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131638_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131638_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131638_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131638_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131638_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131638_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131638_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131638_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131638_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131635            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131635_runs[i],
                    (long) ctx->futhark_mc_segred_task_131635_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131635_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131635_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131635_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131635_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131635_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131635_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131635_iter[i],
                    (long) ctx->futhark_mc_segred_task_131635_iter[i] /
                    (ctx->futhark_mc_segred_task_131635_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131635_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131643 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_131643_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131643_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131643_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131643_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131643_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131643_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131643_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131643_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131643_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131643_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131643_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131643_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131643_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_131643_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131643_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131643_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131643_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131643_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131643_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131643_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131643_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131643_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131643_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131643_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131643_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131643_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131643_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131640            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131640_runs[i],
                    (long) ctx->futhark_mc_segred_task_131640_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131640_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131640_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131640_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131640_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131640_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131640_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131640_iter[i],
                    (long) ctx->futhark_mc_segred_task_131640_iter[i] /
                    (ctx->futhark_mc_segred_task_131640_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131640_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131633         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131633_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131633_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131633_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131633_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131633_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131633_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131633_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131633_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131633_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131633_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131633_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131633_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131633_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131633_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131633_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131633_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131633_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131633_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131633_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131633_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131633_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131633_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131633_total_iter /
                (ctx->futhark_mc_segmap_parloop_131633_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131633_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131633_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131633_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131628            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131628_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131628_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131628_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131628_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131628_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131628_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131628_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131628_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131628_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131628_iter[i] /
                    (ctx->futhark_mc_segmap_task_131628_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131628_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131631     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131631_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131631_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131631_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131631_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131631_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131631_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131631_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131631_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131631_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131631_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131631_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131631_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131625         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131625_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131625_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131625_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131625_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131625_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131625_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131625_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131625_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131625_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131625_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131625_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131625_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131625_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131625_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131625_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131625_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131625_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131625_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131625_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131625_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131625_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131625_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131625_total_iter /
                (ctx->futhark_mc_segmap_parloop_131625_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131625_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131625_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131625_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131619            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131619_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131619_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131619_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131619_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131619_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131619_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131619_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131619_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131619_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131619_iter[i] /
                    (ctx->futhark_mc_segmap_task_131619_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131619_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131623     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131623_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131623_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131623_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131623_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131623_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131623_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131623_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131623_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131623_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131623_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131623_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131623_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131647         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131647_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131647_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131647_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131647_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131647_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131647_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131647_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131647_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131647_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131647_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131647_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131647_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131647_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131647_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131647_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131647_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131647_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131647_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131647_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131647_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131647_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131647_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131647_total_iter /
                (ctx->futhark_mc_segmap_parloop_131647_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131647_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131647_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131647_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131658         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131658_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131658_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131658_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131658_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131658_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131658_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131658_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131658_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131658_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131658_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131658_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131658_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131658_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131658_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131658_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131658_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131658_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131658_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131658_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131658_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131658_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131658_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131658_total_iter /
                (ctx->futhark_mc_segmap_parloop_131658_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131658_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131658_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131658_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131668 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_131668_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131668_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131668_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131668_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131668_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131668_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131668_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131668_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131668_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131668_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131668_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131668_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131668_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_131668_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131668_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131668_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131668_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131668_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131668_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131668_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131668_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131668_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131668_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131668_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131668_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131668_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131668_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131663            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131663_runs[i],
                    (long) ctx->futhark_mc_segred_task_131663_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131663_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131663_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131663_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131663_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131663_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131663_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131663_iter[i],
                    (long) ctx->futhark_mc_segred_task_131663_iter[i] /
                    (ctx->futhark_mc_segred_task_131663_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131663_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131674 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_131674_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131674_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131674_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131674_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131674_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131674_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131674_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131674_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131674_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131674_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131674_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131674_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131674_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_131674_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131674_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131674_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131674_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131674_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131674_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131674_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131674_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131674_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131674_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131674_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131674_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131674_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131674_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131670            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131670_runs[i],
                    (long) ctx->futhark_mc_segred_task_131670_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131670_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131670_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131670_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131670_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131670_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131670_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131670_iter[i],
                    (long) ctx->futhark_mc_segred_task_131670_iter[i] /
                    (ctx->futhark_mc_segred_task_131670_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131670_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131661         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131661_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131661_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131661_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131661_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131661_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131661_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131661_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131661_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131661_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131661_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131661_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131661_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131661_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131661_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131661_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131661_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131661_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131661_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131661_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131661_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131661_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131661_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131661_total_iter /
                (ctx->futhark_mc_segmap_parloop_131661_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131661_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131661_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131661_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131656            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131656_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131656_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131656_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131656_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131656_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131656_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131656_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131656_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131656_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131656_iter[i] /
                    (ctx->futhark_mc_segmap_task_131656_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131656_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131659     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131659_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131659_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131659_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131659_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131659_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131659_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131659_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131659_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131659_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131659_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131659_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131659_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131652         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131652_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131652_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131652_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131652_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131652_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131652_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131652_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131652_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131652_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131652_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131652_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131652_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131652_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131652_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131652_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131652_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131652_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131652_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131652_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131652_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131652_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131652_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131652_total_iter /
                (ctx->futhark_mc_segmap_parloop_131652_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131652_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131652_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131652_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131645            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131645_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131645_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131645_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131645_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131645_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131645_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131645_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131645_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131645_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131645_iter[i] /
                    (ctx->futhark_mc_segmap_task_131645_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131645_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131650     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131650_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131650_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131650_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131650_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131650_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131650_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131650_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131650_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131650_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131650_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131650_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131650_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131678         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131678_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131678_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131678_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131678_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131678_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131678_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131678_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131678_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131678_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131678_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131678_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131678_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131678_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131678_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131678_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131678_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131678_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131678_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131678_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131678_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131678_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131678_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131678_total_iter /
                (ctx->futhark_mc_segmap_parloop_131678_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131678_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131678_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131678_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131689         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131689_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131689_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131689_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131689_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131689_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131689_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131689_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131689_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131689_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131689_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131689_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131689_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131689_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131689_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131689_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131689_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131689_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131689_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131689_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131689_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131689_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131689_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131689_total_iter /
                (ctx->futhark_mc_segmap_parloop_131689_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131689_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131689_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131689_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131701 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_131701_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131701_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131701_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131701_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131701_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131701_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131701_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131701_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131701_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131701_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131701_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131701_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131701_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_131701_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131701_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131701_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131701_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131701_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131701_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131701_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131701_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131701_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131701_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131701_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131701_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131701_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131701_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131694            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131694_runs[i],
                    (long) ctx->futhark_mc_segred_task_131694_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131694_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131694_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131694_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131694_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131694_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131694_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131694_iter[i],
                    (long) ctx->futhark_mc_segred_task_131694_iter[i] /
                    (ctx->futhark_mc_segred_task_131694_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131694_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131707 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_131707_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131707_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131707_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131707_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131707_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131707_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131707_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131707_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131707_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131707_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131707_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131707_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131707_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_131707_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131707_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131707_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131707_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131707_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131707_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131707_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131707_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131707_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131707_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131707_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131707_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131707_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131707_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131703            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131703_runs[i],
                    (long) ctx->futhark_mc_segred_task_131703_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131703_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131703_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131703_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131703_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131703_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131703_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131703_iter[i],
                    (long) ctx->futhark_mc_segred_task_131703_iter[i] /
                    (ctx->futhark_mc_segred_task_131703_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131703_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131692         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131692_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131692_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131692_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131692_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131692_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131692_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131692_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131692_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131692_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131692_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131692_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131692_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131692_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131692_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131692_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131692_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131692_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131692_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131692_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131692_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131692_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131692_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131692_total_iter /
                (ctx->futhark_mc_segmap_parloop_131692_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131692_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131692_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131692_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131687            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131687_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131687_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131687_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131687_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131687_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131687_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131687_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131687_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131687_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131687_iter[i] /
                    (ctx->futhark_mc_segmap_task_131687_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131687_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131690     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131690_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131690_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131690_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131690_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131690_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131690_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131690_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131690_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131690_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131690_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131690_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131690_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131683         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131683_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131683_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131683_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131683_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131683_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131683_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131683_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131683_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131683_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131683_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131683_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131683_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131683_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131683_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131683_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131683_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131683_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131683_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131683_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131683_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131683_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131683_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131683_total_iter /
                (ctx->futhark_mc_segmap_parloop_131683_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131683_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131683_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131683_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131676            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131676_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131676_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131676_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131676_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131676_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131676_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131676_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131676_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131676_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131676_iter[i] /
                    (ctx->futhark_mc_segmap_task_131676_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131676_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131681     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131681_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131681_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131681_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131681_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131681_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131681_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131681_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131681_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131681_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131681_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131681_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131681_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131711         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131711_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131711_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131711_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131711_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131711_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131711_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131711_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131711_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131711_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131711_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131711_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131711_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131711_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131711_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131711_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131711_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131711_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131711_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131711_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131711_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131711_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131711_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131711_total_iter /
                (ctx->futhark_mc_segmap_parloop_131711_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131711_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131711_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131711_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131721         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131721_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131721_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131721_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131721_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131721_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131721_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131721_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131721_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131721_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131721_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131721_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131721_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131721_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131721_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131721_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131721_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131721_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131721_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131721_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131721_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131721_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131721_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131721_total_iter /
                (ctx->futhark_mc_segmap_parloop_131721_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131721_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131721_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131721_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131731 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_131731_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131731_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131731_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131731_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131731_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131731_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131731_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131731_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131731_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131731_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131731_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131731_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131731_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_131731_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131731_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131731_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131731_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131731_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131731_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131731_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131731_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131731_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131731_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131731_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131731_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131731_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131731_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131728            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131728_runs[i],
                    (long) ctx->futhark_mc_segred_task_131728_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131728_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131728_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131728_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131728_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131728_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131728_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131728_iter[i],
                    (long) ctx->futhark_mc_segred_task_131728_iter[i] /
                    (ctx->futhark_mc_segred_task_131728_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131728_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131736 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_131736_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131736_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131736_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131736_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131736_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131736_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131736_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131736_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131736_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131736_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131736_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131736_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131736_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_131736_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131736_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131736_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131736_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131736_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131736_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131736_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131736_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131736_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131736_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131736_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131736_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131736_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131736_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131733            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131733_runs[i],
                    (long) ctx->futhark_mc_segred_task_131733_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131733_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131733_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131733_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131733_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131733_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131733_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131733_iter[i],
                    (long) ctx->futhark_mc_segred_task_131733_iter[i] /
                    (ctx->futhark_mc_segred_task_131733_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131733_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131725         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131725_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131725_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131725_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131725_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131725_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131725_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131725_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131725_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131725_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131725_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131725_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131725_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131725_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131725_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131725_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131725_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131725_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131725_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131725_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131725_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131725_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131725_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131725_total_iter /
                (ctx->futhark_mc_segmap_parloop_131725_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131725_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131725_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131725_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131719            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131719_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131719_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131719_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131719_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131719_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131719_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131719_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131719_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131719_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131719_iter[i] /
                    (ctx->futhark_mc_segmap_task_131719_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131719_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131723     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131723_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131723_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131723_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131723_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131723_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131723_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131723_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131723_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131723_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131723_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131723_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131723_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131716         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131716_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131716_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131716_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131716_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131716_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131716_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131716_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131716_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131716_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131716_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131716_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131716_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131716_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131716_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131716_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131716_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131716_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131716_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131716_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131716_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131716_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131716_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131716_total_iter /
                (ctx->futhark_mc_segmap_parloop_131716_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131716_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131716_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131716_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131709            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131709_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131709_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131709_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131709_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131709_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131709_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131709_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131709_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131709_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131709_iter[i] /
                    (ctx->futhark_mc_segmap_task_131709_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131709_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131714     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131714_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131714_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131714_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131714_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131714_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131714_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131714_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131714_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131714_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131714_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131714_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131714_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131740         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131740_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131740_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131740_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131740_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131740_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131740_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131740_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131740_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131740_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131740_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131740_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131740_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131740_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131740_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131740_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131740_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131740_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131740_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131740_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131740_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131740_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131740_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131740_total_iter /
                (ctx->futhark_mc_segmap_parloop_131740_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131740_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131740_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131740_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131753         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131753_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131753_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131753_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131753_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131753_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131753_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131753_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131753_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131753_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131753_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131753_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131753_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131753_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131753_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131753_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131753_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131753_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131753_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131753_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131753_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131753_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131753_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131753_total_iter /
                (ctx->futhark_mc_segmap_parloop_131753_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131753_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131753_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131753_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131767 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_131767_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131767_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131767_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131767_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131767_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131767_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131767_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131767_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131767_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131767_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131767_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131767_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131767_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_131767_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131767_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131767_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131767_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131767_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131767_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131767_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131767_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131767_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131767_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131767_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131767_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131767_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131767_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131762            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131762_runs[i],
                    (long) ctx->futhark_mc_segred_task_131762_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131762_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131762_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131762_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131762_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131762_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131762_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131762_iter[i],
                    (long) ctx->futhark_mc_segred_task_131762_iter[i] /
                    (ctx->futhark_mc_segred_task_131762_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131762_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131773 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_131773_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131773_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131773_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131773_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131773_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131773_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131773_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131773_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131773_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131773_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131773_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131773_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131773_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_131773_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131773_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131773_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131773_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131773_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131773_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131773_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131773_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131773_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131773_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131773_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131773_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131773_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131773_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131769            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131769_runs[i],
                    (long) ctx->futhark_mc_segred_task_131769_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131769_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131769_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131769_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131769_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131769_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131769_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131769_iter[i],
                    (long) ctx->futhark_mc_segred_task_131769_iter[i] /
                    (ctx->futhark_mc_segred_task_131769_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131769_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131758         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131758_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131758_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131758_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131758_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131758_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131758_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131758_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131758_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131758_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131758_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131758_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131758_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131758_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131758_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131758_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131758_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131758_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131758_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131758_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131758_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131758_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131758_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131758_total_iter /
                (ctx->futhark_mc_segmap_parloop_131758_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131758_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131758_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131758_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131751            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131751_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131751_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131751_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131751_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131751_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131751_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131751_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131751_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131751_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131751_iter[i] /
                    (ctx->futhark_mc_segmap_task_131751_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131751_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131756     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131756_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131756_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131756_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131756_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131756_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131756_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131756_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131756_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131756_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131756_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131756_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131756_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131747         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131747_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131747_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131747_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131747_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131747_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131747_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131747_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131747_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131747_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131747_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131747_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131747_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131747_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131747_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131747_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131747_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131747_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131747_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131747_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131747_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131747_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131747_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131747_total_iter /
                (ctx->futhark_mc_segmap_parloop_131747_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131747_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131747_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131747_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131738            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131738_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131738_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131738_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131738_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131738_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131738_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131738_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131738_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131738_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131738_iter[i] /
                    (ctx->futhark_mc_segmap_task_131738_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131738_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131745     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131745_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131745_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131745_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131745_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131745_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131745_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131745_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131745_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131745_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131745_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131745_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131745_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131777         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131777_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131777_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131777_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131777_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131777_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131777_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131777_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131777_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131777_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131777_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131777_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131777_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131777_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131777_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131777_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131777_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131777_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131777_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131777_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131777_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131777_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131777_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131777_total_iter /
                (ctx->futhark_mc_segmap_parloop_131777_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131777_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131777_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131777_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131792         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131792_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131792_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131792_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131792_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131792_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131792_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131792_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131792_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131792_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131792_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131792_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131792_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131792_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131792_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131792_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131792_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131792_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131792_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131792_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131792_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131792_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131792_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131792_total_iter /
                (ctx->futhark_mc_segmap_parloop_131792_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131792_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131792_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131792_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131807         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131807_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131807_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131807_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131807_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131807_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131807_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131807_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131807_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131807_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131807_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131807_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131807_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131807_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131807_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131807_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131807_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131807_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131807_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131807_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131807_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131807_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131807_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131807_total_iter /
                (ctx->futhark_mc_segmap_parloop_131807_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131807_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131807_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131807_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131805            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131805_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131805_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131805_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131805_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131805_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131805_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131805_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131805_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131805_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131805_iter[i] /
                    (ctx->futhark_mc_segmap_task_131805_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131805_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131816 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_131816_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131816_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131816_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131816_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131816_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131816_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131816_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131816_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131816_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131816_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131816_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131816_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131816_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_131816_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131816_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131816_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131816_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131816_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131816_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131816_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131816_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131816_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131816_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131816_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131816_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131816_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131816_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131809            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131809_runs[i],
                    (long) ctx->futhark_mc_segred_task_131809_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131809_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131809_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131809_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131809_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131809_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131809_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131809_iter[i],
                    (long) ctx->futhark_mc_segred_task_131809_iter[i] /
                    (ctx->futhark_mc_segred_task_131809_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131809_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131822 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_131822_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131822_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131822_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131822_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131822_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131822_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131822_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131822_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131822_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131822_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131822_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131822_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131822_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_131822_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131822_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131822_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131822_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131822_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131822_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131822_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131822_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131822_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131822_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131822_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131822_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131822_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131822_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131818            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131818_runs[i],
                    (long) ctx->futhark_mc_segred_task_131818_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131818_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131818_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131818_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131818_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131818_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131818_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131818_iter[i],
                    (long) ctx->futhark_mc_segred_task_131818_iter[i] /
                    (ctx->futhark_mc_segred_task_131818_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131818_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131799         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131799_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131799_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131799_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131799_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131799_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131799_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131799_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131799_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131799_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131799_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131799_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131799_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131799_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131799_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131799_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131799_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131799_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131799_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131799_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131799_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131799_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131799_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131799_total_iter /
                (ctx->futhark_mc_segmap_parloop_131799_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131799_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131799_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131799_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131790            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131790_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131790_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131790_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131790_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131790_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131790_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131790_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131790_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131790_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131790_iter[i] /
                    (ctx->futhark_mc_segmap_task_131790_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131790_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131797     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131797_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131797_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131797_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131797_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131797_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131797_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131797_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131797_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131797_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131797_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131797_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131797_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131786         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131786_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131786_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131786_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131786_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131786_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131786_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131786_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131786_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131786_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131786_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131786_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131786_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131786_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131786_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131786_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131786_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131786_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131786_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131786_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131786_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131786_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131786_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131786_total_iter /
                (ctx->futhark_mc_segmap_parloop_131786_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131786_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131786_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131786_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131775            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131775_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131775_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131775_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131775_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131775_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131775_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131775_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131775_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131775_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131775_iter[i] /
                    (ctx->futhark_mc_segmap_task_131775_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131775_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131784     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131784_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131784_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131784_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131784_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131784_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131784_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131784_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131784_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131784_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131784_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131784_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131784_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131826         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131826_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131826_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131826_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131826_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131826_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131826_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131826_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131826_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131826_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131826_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131826_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131826_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131826_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131826_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131826_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131826_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131826_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131826_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131826_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131826_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131826_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131826_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131826_total_iter /
                (ctx->futhark_mc_segmap_parloop_131826_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131826_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131826_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131826_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131835         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131835_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131835_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131835_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131835_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131835_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131835_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131835_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131835_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131835_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131835_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131835_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131835_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131835_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131835_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131835_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131835_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131835_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131835_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131835_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131835_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131835_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131835_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131835_total_iter /
                (ctx->futhark_mc_segmap_parloop_131835_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131835_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131835_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131835_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131833            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131833_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131833_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131833_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131833_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131833_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131833_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131833_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131833_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131833_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131833_iter[i] /
                    (ctx->futhark_mc_segmap_task_131833_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131833_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131830         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131830_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131830_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131830_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131830_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131830_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131830_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131830_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131830_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131830_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131830_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131830_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131830_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131830_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131830_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131830_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131830_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131830_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131830_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131830_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131830_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131830_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131830_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131830_total_iter /
                (ctx->futhark_mc_segmap_parloop_131830_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131830_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131830_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131830_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131824            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131824_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131824_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131824_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131824_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131824_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131824_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131824_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131824_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131824_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131824_iter[i] /
                    (ctx->futhark_mc_segmap_task_131824_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131824_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131828     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131828_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131828_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131828_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131828_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131828_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131828_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131828_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131828_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131828_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131828_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131828_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131828_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131839         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131839_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131839_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131839_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131839_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131839_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131839_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131839_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131839_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131839_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131839_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131839_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131839_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131839_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131839_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131839_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131839_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131839_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131839_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131839_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131839_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131839_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131839_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131839_total_iter /
                (ctx->futhark_mc_segmap_parloop_131839_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131839_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131839_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131839_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131848         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131848_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131848_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131848_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131848_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131848_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131848_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131848_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131848_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131848_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131848_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131848_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131848_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131848_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131848_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131848_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131848_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131848_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131848_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131848_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131848_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131848_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131848_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131848_total_iter /
                (ctx->futhark_mc_segmap_parloop_131848_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131848_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131848_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131848_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131846            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131846_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131846_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131846_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131846_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131846_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131846_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131846_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131846_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131846_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131846_iter[i] /
                    (ctx->futhark_mc_segmap_task_131846_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131846_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131843         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131843_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131843_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131843_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131843_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131843_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131843_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131843_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131843_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131843_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131843_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131843_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131843_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131843_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131843_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131843_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131843_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131843_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131843_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131843_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131843_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131843_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131843_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131843_total_iter /
                (ctx->futhark_mc_segmap_parloop_131843_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131843_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131843_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131843_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131837            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131837_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131837_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131837_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131837_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131837_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131837_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131837_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131837_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131837_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131837_iter[i] /
                    (ctx->futhark_mc_segmap_task_131837_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131837_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131841     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131841_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131841_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131841_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131841_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131841_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131841_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131841_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131841_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131841_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131841_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131841_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131841_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131852         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131852_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131852_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131852_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131852_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131852_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131852_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131852_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131852_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131852_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131852_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131852_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131852_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131852_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131852_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131852_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131852_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131852_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131852_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131852_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131852_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131852_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131852_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131852_total_iter /
                (ctx->futhark_mc_segmap_parloop_131852_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131852_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131852_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131852_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131861         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131861_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131861_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131861_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131861_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131861_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131861_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131861_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131861_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131861_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131861_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131861_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131861_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131861_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131861_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131861_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131861_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131861_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131861_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131861_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131861_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131861_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131861_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131861_total_iter /
                (ctx->futhark_mc_segmap_parloop_131861_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131861_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131861_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131861_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131859            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131859_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131859_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131859_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131859_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131859_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131859_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131859_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131859_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131859_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131859_iter[i] /
                    (ctx->futhark_mc_segmap_task_131859_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131859_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131856         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131856_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131856_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131856_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131856_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131856_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131856_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131856_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131856_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131856_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131856_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131856_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131856_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131856_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131856_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131856_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131856_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131856_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131856_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131856_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131856_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131856_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131856_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131856_total_iter /
                (ctx->futhark_mc_segmap_parloop_131856_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131856_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131856_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131856_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131850            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131850_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131850_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131850_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131850_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131850_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131850_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131850_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131850_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131850_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131850_iter[i] /
                    (ctx->futhark_mc_segmap_task_131850_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131850_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131854     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131854_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131854_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131854_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131854_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131854_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131854_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131854_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131854_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131854_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131854_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131854_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131854_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131865         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131865_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131865_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131865_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131865_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131865_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131865_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131865_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131865_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131865_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131865_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131865_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131865_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131865_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131865_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131865_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131865_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131865_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131865_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131865_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131865_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131865_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131865_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131865_total_iter /
                (ctx->futhark_mc_segmap_parloop_131865_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131865_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131865_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131865_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_1_parloop_131890   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_131890_runs[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131890_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131890_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_131890_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131890_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_1_parloop_131890_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131890_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_131890_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131890_iter[i],
                    (long) ctx->futhark_mc_scan_stage_1_parloop_131890_iter[i] /
                    (ctx->futhark_mc_scan_stage_1_parloop_131890_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_1_parloop_131890_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_1_parloop_131890_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_131890_total_runs,
                (long) ctx->futhark_mc_scan_stage_1_parloop_131890_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_131890_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_131890_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_1_parloop_131890_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_1_parloop_131890_total_total_runtime /
                (ctx->futhark_mc_scan_stage_1_parloop_131890_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_1_parloop_131890_total_iter),
                (long) ctx->futhark_mc_scan_stage_1_parloop_131890_total_iter,
                (long) ctx->futhark_mc_scan_stage_1_parloop_131890_total_iter /
                (ctx->futhark_mc_scan_stage_1_parloop_131890_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_1_parloop_131890_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_1_parloop_131890_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_1_parloop_131890_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_scan_stage_3_parloop_131892   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_131892_runs[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131892_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131892_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_131892_runs[i] : 1),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131892_total_runtime[i],
                    (double) ctx->futhark_mc_scan_stage_3_parloop_131892_total_runtime[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131892_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_131892_iter[i]),
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131892_iter[i],
                    (long) ctx->futhark_mc_scan_stage_3_parloop_131892_iter[i] /
                    (ctx->futhark_mc_scan_stage_3_parloop_131892_runs[i] !=
                     0 ? ctx->futhark_mc_scan_stage_3_parloop_131892_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_scan_stage_3_parloop_131892_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_131892_total_runs,
                (long) ctx->futhark_mc_scan_stage_3_parloop_131892_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_131892_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_131892_total_runs : 1),
                (long) ctx->futhark_mc_scan_stage_3_parloop_131892_total_total_runtime,
                (double) ctx->futhark_mc_scan_stage_3_parloop_131892_total_total_runtime /
                (ctx->futhark_mc_scan_stage_3_parloop_131892_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_scan_stage_3_parloop_131892_total_iter),
                (long) ctx->futhark_mc_scan_stage_3_parloop_131892_total_iter,
                (long) ctx->futhark_mc_scan_stage_3_parloop_131892_total_iter /
                (ctx->futhark_mc_scan_stage_3_parloop_131892_total_runs !=
                 0 ? ctx->futhark_mc_scan_stage_3_parloop_131892_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_scan_stage_3_parloop_131892_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_scan_stage_3_parloop_131892_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segscan_task_131884           ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segscan_task_131884_runs[i],
                    (long) ctx->futhark_mc_segscan_task_131884_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_131884_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_131884_runs[i] : 1),
                    (long) ctx->futhark_mc_segscan_task_131884_total_runtime[i],
                    (double) ctx->futhark_mc_segscan_task_131884_total_runtime[i] /
                    (ctx->futhark_mc_segscan_task_131884_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segscan_task_131884_iter[i]),
                    (long) ctx->futhark_mc_segscan_task_131884_iter[i],
                    (long) ctx->futhark_mc_segscan_task_131884_iter[i] /
                    (ctx->futhark_mc_segscan_task_131884_runs[i] !=
                     0 ? ctx->futhark_mc_segscan_task_131884_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131896         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131896_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131896_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131896_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131896_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131896_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131896_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131896_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131896_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131896_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131896_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131896_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131896_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131896_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131896_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131896_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131896_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131896_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131896_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131896_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131896_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131896_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131896_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131896_total_iter /
                (ctx->futhark_mc_segmap_parloop_131896_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131896_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131896_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131896_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131894            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131894_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131894_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131894_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131894_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131894_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131894_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131894_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131894_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131894_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131894_iter[i] /
                    (ctx->futhark_mc_segmap_task_131894_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131894_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131875         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131875_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131875_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131875_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131875_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131875_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131875_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131875_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131875_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131875_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131875_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131875_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131875_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131875_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131875_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131875_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131875_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131875_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131875_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131875_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131875_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131875_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131875_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131875_total_iter /
                (ctx->futhark_mc_segmap_parloop_131875_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131875_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131875_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131875_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131863            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131863_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131863_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131863_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131863_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131863_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131863_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131863_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131863_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131863_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131863_iter[i] /
                    (ctx->futhark_mc_segmap_task_131863_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131863_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131873     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131873_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131873_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131873_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131873_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131873_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131873_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131873_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131873_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131873_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131873_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131873_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131873_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131900         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131900_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131900_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131900_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131900_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131900_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131900_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131900_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131900_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131900_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131900_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131900_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131900_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131900_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131900_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131900_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131900_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131900_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131900_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131900_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131900_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131900_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131900_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131900_total_iter /
                (ctx->futhark_mc_segmap_parloop_131900_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131900_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131900_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131900_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_stage_1_parloop_131908 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_131908_runs[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131908_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131908_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131908_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131908_total_runtime[i],
                    (double) ctx->futhark_mc_segred_stage_1_parloop_131908_total_runtime[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131908_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131908_iter[i]),
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131908_iter[i],
                    (long) ctx->futhark_mc_segred_stage_1_parloop_131908_iter[i] /
                    (ctx->futhark_mc_segred_stage_1_parloop_131908_runs[i] !=
                     0 ? ctx->futhark_mc_segred_stage_1_parloop_131908_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segred_stage_1_parloop_131908_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_131908_total_runs,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131908_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131908_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131908_total_runs : 1),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131908_total_total_runtime,
                (double) ctx->futhark_mc_segred_stage_1_parloop_131908_total_total_runtime /
                (ctx->futhark_mc_segred_stage_1_parloop_131908_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segred_stage_1_parloop_131908_total_iter),
                (long) ctx->futhark_mc_segred_stage_1_parloop_131908_total_iter,
                (long) ctx->futhark_mc_segred_stage_1_parloop_131908_total_iter /
                (ctx->futhark_mc_segred_stage_1_parloop_131908_total_runs !=
                 0 ? ctx->futhark_mc_segred_stage_1_parloop_131908_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segred_stage_1_parloop_131908_total_total_runtime;
        ctx->total_runs +=
            ctx->futhark_mc_segred_stage_1_parloop_131908_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segred_task_131905            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segred_task_131905_runs[i],
                    (long) ctx->futhark_mc_segred_task_131905_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131905_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131905_runs[i] : 1),
                    (long) ctx->futhark_mc_segred_task_131905_total_runtime[i],
                    (double) ctx->futhark_mc_segred_task_131905_total_runtime[i] /
                    (ctx->futhark_mc_segred_task_131905_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segred_task_131905_iter[i]),
                    (long) ctx->futhark_mc_segred_task_131905_iter[i],
                    (long) ctx->futhark_mc_segred_task_131905_iter[i] /
                    (ctx->futhark_mc_segred_task_131905_runs[i] !=
                     0 ? ctx->futhark_mc_segred_task_131905_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131903         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131903_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131903_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131903_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131903_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131903_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131903_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131903_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131903_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131903_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131903_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131903_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131903_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131903_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131903_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131903_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131903_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131903_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131903_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131903_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131903_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131903_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131903_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131903_total_iter /
                (ctx->futhark_mc_segmap_parloop_131903_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131903_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131903_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131903_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131898            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131898_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131898_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131898_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131898_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131898_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131898_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131898_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131898_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131898_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131898_iter[i] /
                    (ctx->futhark_mc_segmap_task_131898_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131898_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131901     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131901_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131901_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131901_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131901_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131901_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131901_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131901_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131901_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131901_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131901_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131901_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131901_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131912         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131912_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131912_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131912_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131912_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131912_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131912_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131912_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131912_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131912_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131912_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131912_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131912_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131912_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131912_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131912_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131912_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131912_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131912_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131912_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131912_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131912_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131912_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131912_total_iter /
                (ctx->futhark_mc_segmap_parloop_131912_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131912_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131912_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131912_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131921         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131921_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131921_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131921_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131921_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131921_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131921_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131921_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131921_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131921_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131921_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131921_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131921_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131921_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131921_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131921_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131921_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131921_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131921_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131921_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131921_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131921_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131921_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131921_total_iter /
                (ctx->futhark_mc_segmap_parloop_131921_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131921_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131921_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131921_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131919            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131919_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131919_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131919_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131919_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131919_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131919_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131919_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131919_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131919_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131919_iter[i] /
                    (ctx->futhark_mc_segmap_task_131919_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131919_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131916         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131916_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131916_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131916_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131916_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131916_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131916_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131916_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131916_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131916_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131916_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131916_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131916_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131916_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131916_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131916_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131916_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131916_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131916_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131916_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131916_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131916_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131916_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131916_total_iter /
                (ctx->futhark_mc_segmap_parloop_131916_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131916_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131916_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131916_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131910            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131910_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131910_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131910_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131910_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131910_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131910_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131910_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131910_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131910_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131910_iter[i] /
                    (ctx->futhark_mc_segmap_task_131910_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131910_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131914     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131914_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131914_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131914_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131914_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131914_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131914_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131914_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131914_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131914_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131914_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131914_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131914_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131925         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131925_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131925_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131925_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131925_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131925_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131925_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131925_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131925_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131925_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131925_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131925_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131925_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131925_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131925_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131925_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131925_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131925_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131925_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131925_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131925_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131925_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131925_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131925_total_iter /
                (ctx->futhark_mc_segmap_parloop_131925_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131925_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131925_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131925_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131934         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131934_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131934_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131934_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131934_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131934_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131934_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131934_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131934_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131934_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131934_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131934_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131934_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131934_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131934_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131934_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131934_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131934_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131934_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131934_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131934_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131934_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131934_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131934_total_iter /
                (ctx->futhark_mc_segmap_parloop_131934_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131934_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131934_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131934_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131932            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131932_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131932_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131932_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131932_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131932_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131932_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131932_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131932_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131932_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131932_iter[i] /
                    (ctx->futhark_mc_segmap_task_131932_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131932_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_parloop_131929         ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_parloop_131929_runs[i],
                    (long) ctx->futhark_mc_segmap_parloop_131929_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131929_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131929_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_parloop_131929_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_parloop_131929_total_runtime[i] /
                    (ctx->futhark_mc_segmap_parloop_131929_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131929_iter[i]),
                    (long) ctx->futhark_mc_segmap_parloop_131929_iter[i],
                    (long) ctx->futhark_mc_segmap_parloop_131929_iter[i] /
                    (ctx->futhark_mc_segmap_parloop_131929_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_parloop_131929_runs[i] : 1));
        fprintf(ctx->log,
                "         futhark_mc_segmap_parloop_131929_total   ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                ctx->futhark_mc_segmap_parloop_131929_total_runs,
                (long) ctx->futhark_mc_segmap_parloop_131929_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131929_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131929_total_runs : 1),
                (long) ctx->futhark_mc_segmap_parloop_131929_total_total_runtime,
                (double) ctx->futhark_mc_segmap_parloop_131929_total_total_runtime /
                (ctx->futhark_mc_segmap_parloop_131929_total_iter ==
                 0 ? 1 : (double) ctx->futhark_mc_segmap_parloop_131929_total_iter),
                (long) ctx->futhark_mc_segmap_parloop_131929_total_iter,
                (long) ctx->futhark_mc_segmap_parloop_131929_total_iter /
                (ctx->futhark_mc_segmap_parloop_131929_total_runs !=
                 0 ? ctx->futhark_mc_segmap_parloop_131929_total_runs : 1));
        ctx->total_runtime +=
            ctx->futhark_mc_segmap_parloop_131929_total_total_runtime;
        ctx->total_runs += ctx->futhark_mc_segmap_parloop_131929_total_runs;
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_task_131923            ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_task_131923_runs[i],
                    (long) ctx->futhark_mc_segmap_task_131923_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131923_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131923_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_task_131923_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_task_131923_total_runtime[i] /
                    (ctx->futhark_mc_segmap_task_131923_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_task_131923_iter[i]),
                    (long) ctx->futhark_mc_segmap_task_131923_iter[i],
                    (long) ctx->futhark_mc_segmap_task_131923_iter[i] /
                    (ctx->futhark_mc_segmap_task_131923_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_task_131923_runs[i] : 1));
        for (int i = 0; i < ctx->scheduler.num_threads; i++)
            fprintf(ctx->log,
                    "tid %2d - futhark_mc_segmap_nested_task_131927     ran %10d times; avg: %10ldus; total: %10ldus; time pr. iter %9.6f; iters %9ld; avg %ld\n",
                    i, ctx->futhark_mc_segmap_nested_task_131927_runs[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131927_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131927_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131927_runs[i] : 1),
                    (long) ctx->futhark_mc_segmap_nested_task_131927_total_runtime[i],
                    (double) ctx->futhark_mc_segmap_nested_task_131927_total_runtime[i] /
                    (ctx->futhark_mc_segmap_nested_task_131927_iter[i] ==
                     0 ? 1 : (double) ctx->futhark_mc_segmap_nested_task_131927_iter[i]),
                    (long) ctx->futhark_mc_segmap_nested_task_131927_iter[i],
                    (long) ctx->futhark_mc_segmap_nested_task_131927_iter[i] /
                    (ctx->futhark_mc_segmap_nested_task_131927_runs[i] !=
                     0 ? ctx->futhark_mc_segmap_nested_task_131927_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 *out_mem_p_131101,
                             struct memblock *out_mem_p_131102,
                             struct memblock *out_mem_p_131103,
                             struct memblock Y_mem_121939, int64_t m_114533,
                             int64_t n_114534, int64_t n_p_114536,
                             int64_t t_window_114537, int64_t l_window_114538,
                             int64_t t_degree_114539, int64_t l_degree_114540,
                             int64_t t_jump_114541, int64_t l_jump_114542,
                             int64_t inner_114543, int64_t outer_114544,
                             int64_t jump_threshold_114545,
                             int64_t max_group_sizze_114546);
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_131126 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_i_114610;
    char *free_Y_mem_121939;
    int64_t free_bytes_121940;
    char *free_mem_121979;
    char *free_mem_121982;
};
struct futhark_mc_segmap_parloop_struct_131128 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_i_114610;
    char *free_Y_mem_121939;
    int64_t free_bytes_121940;
    char *free_mem_121979;
    char *free_mem_121982;
};
static int futhark_mc_segmap_parloop_131129(void *args, int64_t start,
                                            int64_t end, int flat_tid_116755,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131128
    *futhark_mc_segmap_parloop_struct_131128 =
    (struct futhark_mc_segmap_parloop_struct_131128 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131128->ctx;
    uint64_t futhark_mc_segmap_parloop_131129_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131129_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131128->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131128->free_n_114534;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131128->free_i_114610;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131128->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121940 =
            futhark_mc_segmap_parloop_struct_131128->free_bytes_121940;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131128->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131128->free_mem_121982,
                                  .size =0, .references =NULL};
    size_t mem_121948_cached_sizze_131130 = 0;
    char *mem_121948 = NULL;
    size_t mem_121963_cached_sizze_131131 = 0;
    char *mem_121963 = NULL;
    int64_t iterations = end - start;
    int64_t iter_123854 = start;
    
    if (mem_121948_cached_sizze_131130 < (size_t) bytes_121940) {
        mem_121948 = realloc(mem_121948, bytes_121940);
        mem_121948_cached_sizze_131130 = bytes_121940;
    }
    if (mem_121963_cached_sizze_131131 < (size_t) bytes_121940) {
        mem_121963 = realloc(mem_121963, bytes_121940);
        mem_121963_cached_sizze_131131 = bytes_121940;
    }
    for (; iter_123854 < end; iter_123854++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_123873 = m_114533;
        int64_t gtid_116756 = iter_123854;
        int64_t remnant_123874 = iter_123854 - gtid_116756;
        int64_t discard_121292;
        int64_t scanacc_123856 = (int64_t) 0;
        
        for (int64_t i_123855 = 0; i_123855 < n_114534; i_123855++) {
            float x_123858 = ((float *) Y_mem_121939.mem)[gtid_116756 *
                                                          n_114534 + i_123855];
            bool isnan_res_123859;
            
            isnan_res_123859 = futrts_isnan32(x_123858);
            
            bool defunc_0_p_res_123860 = !isnan_res_123859;
            int64_t defunc_0_f_res_123861 =
                    btoi_bool_i64(defunc_0_p_res_123860);
            int64_t defunc_1_op_res_123862 = add64(defunc_0_f_res_123861,
                                                   scanacc_123856);
            
            ((int64_t *) mem_121948)[i_123855] = defunc_1_op_res_123862;
            
            int64_t scanacc_tmp_123875 = defunc_1_op_res_123862;
            
            scanacc_123856 = scanacc_tmp_123875;
        }
        discard_121292 = scanacc_123856;
        
        int64_t last_res_114627 = ((int64_t *) mem_121948)[i_114610];
        
        for (int64_t i_123877 = 0; i_123877 < n_114534; i_123877++) {
            ((int64_t *) mem_121963)[i_123877] = (int64_t) -1;
        }
        for (int64_t write_iter_123864 = 0; write_iter_123864 < n_114534;
             write_iter_123864++) {
            float write_iv_123866 = ((float *) Y_mem_121939.mem)[gtid_116756 *
                                                                 n_114534 +
                                                                 write_iter_123864];
            bool isnan_res_123867;
            
            isnan_res_123867 = futrts_isnan32(write_iv_123866);
            
            bool defunc_0_p_res_123868 = !isnan_res_123867;
            int64_t defunc_1_f_res_123869;
            
            if (defunc_0_p_res_123868) {
                int64_t write_iv_123870 =
                        ((int64_t *) mem_121948)[write_iter_123864];
                int64_t defunc_1_f_res_t_res_123871 = sub64(write_iv_123870,
                                                            (int64_t) 1);
                
                defunc_1_f_res_123869 = defunc_1_f_res_t_res_123871;
            } else {
                defunc_1_f_res_123869 = (int64_t) -1;
            }
            if (sle64((int64_t) 0, defunc_1_f_res_123869) &&
                slt64(defunc_1_f_res_123869, n_114534)) {
                ((int64_t *) mem_121963)[defunc_1_f_res_123869] =
                    write_iter_123864;
            }
        }
        memmove(mem_121979.mem + gtid_116756 * n_114534 * (int64_t) 8,
                mem_121963 + (int64_t) 0, n_114534 * (int64_t) 8);
        ((int64_t *) mem_121982.mem)[gtid_116756] = last_res_114627;
    }
    
  cleanup:
    { }
    free(mem_121948);
    free(mem_121963);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131129_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131129_end -
                 futhark_mc_segmap_parloop_131129_start;
        
        ctx->futhark_mc_segmap_parloop_131129_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131129_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131129_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131127(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116755 = tid;
    int num_tasks_123853 = info.nsubtasks;
    struct futhark_mc_task_131126 *futhark_mc_task_131126 =
                                  (struct futhark_mc_task_131126 *) args;
    struct futhark_context *ctx = futhark_mc_task_131126->ctx;
    uint64_t futhark_mc_segmap_task_131127_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131127_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131126->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131126->free_n_114534;
    int64_t i_114610 = futhark_mc_task_131126->free_i_114610;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131126->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121940 = futhark_mc_task_131126->free_bytes_121940;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131126->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131126->free_mem_121982,
                                  .size =0, .references =NULL};
    int64_t iter_123854;
    struct futhark_mc_segmap_parloop_struct_131128
    futhark_mc_segmap_parloop_struct_131128;
    
    futhark_mc_segmap_parloop_struct_131128.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131128.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131128.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131128.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131128.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131128.free_bytes_121940 = bytes_121940;
    futhark_mc_segmap_parloop_struct_131128.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131128.free_mem_121982 = mem_121982.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131129_task;
    
    futhark_mc_segmap_parloop_131129_task.name =
        "futhark_mc_segmap_parloop_131129";
    futhark_mc_segmap_parloop_131129_task.fn = futhark_mc_segmap_parloop_131129;
    futhark_mc_segmap_parloop_131129_task.args =
        &futhark_mc_segmap_parloop_struct_131128;
    futhark_mc_segmap_parloop_131129_task.iterations = iterations;
    futhark_mc_segmap_parloop_131129_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131129_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131129_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131129_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131129_task);
    
    if (futhark_mc_segmap_parloop_131129_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131129_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131129_total_end -
                 futhark_mc_segmap_parloop_131129_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131129_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131129_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131129_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131127_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131127_end -
                 futhark_mc_segmap_task_131127_start;
        
        ctx->futhark_mc_segmap_task_131127_runs[tid]++;
        ctx->futhark_mc_segmap_task_131127_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131127_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131133 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_i_114610;
    char *free_Y_mem_121939;
    int64_t free_bytes_121940;
    char *free_mem_121979;
    char *free_mem_121982;
};
struct futhark_mc_task_131137 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_116758;
    char *free_Y_mem_121939;
    char *free_mem_121942;
};
struct futhark_mc_scan_stage_1_parloop_struct_131140 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_116758;
    char *free_Y_mem_121939;
    char *free_mem_121942;
};
static int futhark_mc_scan_stage_1_parloop_131141(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_116759, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_131140
    *futhark_mc_scan_stage_1_parloop_struct_131140 =
    (struct futhark_mc_scan_stage_1_parloop_struct_131140 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_131140->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_131141_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_131141_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_scan_stage_1_parloop_struct_131140->free_n_114534;
    int64_t gtid_116758 =
            futhark_mc_scan_stage_1_parloop_struct_131140->free_gtid_116758;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_scan_stage_1_parloop_struct_131140->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_121942 = {.desc ="mem_121942", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_131140->free_mem_121942,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_123896 = start;
    int64_t x_123880;
    int64_t x_123881;
    
    x_123880 = (int64_t) 0;
    for (; iter_123896 < end; iter_123896++) {
        int64_t gtid_116760 = iter_123896;
        
        // stage 1 scan body
        {
            float x_123883 = ((float *) Y_mem_121939.mem)[gtid_116758 *
                                                          n_114534 +
                                                          gtid_116760];
            bool isnan_res_123884;
            
            isnan_res_123884 = futrts_isnan32(x_123883);
            
            bool defunc_0_p_res_123885 = !isnan_res_123884;
            int64_t defunc_0_f_res_123886 =
                    btoi_bool_i64(defunc_0_p_res_123885);
            
            // write mapped values results to memory
            { }
            x_123880 = x_123880;
            // Read next values
            {
                x_123881 = defunc_0_f_res_123886;
            }
            
            int64_t defunc_1_op_res_123882 = add64(x_123880, x_123881);
            
            ((int64_t *) mem_121942.mem)[gtid_116760] = defunc_1_op_res_123882;
            x_123880 = defunc_1_op_res_123882;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_131141_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_131141_end -
                 futhark_mc_scan_stage_1_parloop_131141_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_131141_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_131141_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_131141_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_131142 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_116758;
    char *free_Y_mem_121939;
    char *free_mem_121942;
};
static int futhark_mc_scan_stage_3_parloop_131143(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_116759, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_131142
    *futhark_mc_scan_stage_3_parloop_struct_131142 =
    (struct futhark_mc_scan_stage_3_parloop_struct_131142 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_131142->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_131143_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_131143_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_scan_stage_3_parloop_struct_131142->free_n_114534;
    int64_t gtid_116758 =
            futhark_mc_scan_stage_3_parloop_struct_131142->free_gtid_116758;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_scan_stage_3_parloop_struct_131142->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_121942 = {.desc ="mem_121942", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_131142->free_mem_121942,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_123908 = start;
    int64_t x_123905;
    int64_t x_123906;
    
    if (iter_123908 == (int64_t) 0) {
        x_123905 = (int64_t) 0;
    } else {
        x_123905 = ((int64_t *) mem_121942.mem)[iter_123908 - (int64_t) 1];
    }
    for (; iter_123908 < end; iter_123908++) {
        int64_t gtid_116760 = iter_123908;
        
        // stage 3 scan body
        {
            float x_123883 = ((float *) Y_mem_121939.mem)[gtid_116758 *
                                                          n_114534 +
                                                          gtid_116760];
            bool isnan_res_123884;
            
            isnan_res_123884 = futrts_isnan32(x_123883);
            
            bool defunc_0_p_res_123885 = !isnan_res_123884;
            int64_t defunc_0_f_res_123886 =
                    btoi_bool_i64(defunc_0_p_res_123885);
            
            x_123905 = x_123905;
            x_123906 = defunc_0_f_res_123886;
            
            int64_t defunc_1_op_res_123907 = add64(x_123905, x_123906);
            
            ((int64_t *) mem_121942.mem)[gtid_116760] = defunc_1_op_res_123907;
            x_123905 = defunc_1_op_res_123907;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_131143_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_131143_end -
                 futhark_mc_scan_stage_3_parloop_131143_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_131143_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_131143_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_131143_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_131138(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116759 = tid;
    int num_tasks_123895 = info.nsubtasks;
    struct futhark_mc_task_131137 *futhark_mc_task_131137 =
                                  (struct futhark_mc_task_131137 *) args;
    struct futhark_context *ctx = futhark_mc_task_131137->ctx;
    uint64_t futhark_mc_segscan_task_131138_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_131138_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131137->free_n_114534;
    int64_t gtid_116758 = futhark_mc_task_131137->free_gtid_116758;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131137->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_121942 = {.desc ="mem_121942", .mem =
                                  futhark_mc_task_131137->free_mem_121942,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_123902_cached_sizze_131139 = 0;
    char *scan_stage_2_accum_mem_123902 = NULL;
    int64_t iter_123896;
    struct futhark_mc_scan_stage_1_parloop_struct_131140
    futhark_mc_scan_stage_1_parloop_struct_131140;
    
    futhark_mc_scan_stage_1_parloop_struct_131140.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_131140.free_n_114534 = n_114534;
    futhark_mc_scan_stage_1_parloop_struct_131140.free_gtid_116758 =
        gtid_116758;
    futhark_mc_scan_stage_1_parloop_struct_131140.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_scan_stage_1_parloop_struct_131140.free_mem_121942 =
        mem_121942.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_131141_task;
    
    futhark_mc_scan_stage_1_parloop_131141_task.name =
        "futhark_mc_scan_stage_1_parloop_131141";
    futhark_mc_scan_stage_1_parloop_131141_task.fn =
        futhark_mc_scan_stage_1_parloop_131141;
    futhark_mc_scan_stage_1_parloop_131141_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_131140;
    futhark_mc_scan_stage_1_parloop_131141_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_131141_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_131141_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_131141_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_131141_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_131141_task);
    
    if (futhark_mc_scan_stage_1_parloop_131141_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_131141_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_131141_total_end -
                 futhark_mc_scan_stage_1_parloop_131141_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131141_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131141_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131141_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_123895)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_123897;
        int64_t x_123898;
        int64_t offset_123900 = (int64_t) 0;
        int64_t offset_index_123901 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_123902_cached_sizze_131139 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_123902 =
                realloc(scan_stage_2_accum_mem_123902, (int64_t) 8);
            scan_stage_2_accum_mem_123902_cached_sizze_131139 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_123902)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_123904 = 0; i_123904 < num_tasks_123895 - 1;
             i_123904++) {
            offset_123900 = squot64(n_114534, sext_i32_i64(num_tasks_123895));
            if (slt64(sext_i32_i64(i_123904), srem64(n_114534,
                                                     sext_i32_i64(num_tasks_123895)))) {
                offset_123900 += (int64_t) 1;
            }
            offset_index_123901 += offset_123900;
            
            int64_t gtid_116760 = offset_index_123901;
            float x_123883 = ((float *) Y_mem_121939.mem)[gtid_116758 *
                                                          n_114534 +
                                                          gtid_116760];
            bool isnan_res_123884;
            
            isnan_res_123884 = futrts_isnan32(x_123883);
            
            bool defunc_0_p_res_123885 = !isnan_res_123884;
            int64_t defunc_0_f_res_123886 =
                    btoi_bool_i64(defunc_0_p_res_123885);
            
            // Read carry in
            {
                x_123897 =
                    ((int64_t *) scan_stage_2_accum_mem_123902)[(int64_t) 0];
            }
            // Read next values
            {
                x_123898 = ((int64_t *) mem_121942.mem)[offset_index_123901 -
                                                        (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_123899 = add64(x_123897, x_123898);
            
            ((int64_t *) mem_121942.mem)[offset_index_123901 - (int64_t) 1] =
                defunc_1_op_res_123899;
            ((int64_t *) scan_stage_2_accum_mem_123902)[(int64_t) 0] =
                defunc_1_op_res_123899;
        }
        
        int64_t iter_123908 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_131142
        futhark_mc_scan_stage_3_parloop_struct_131142;
        
        futhark_mc_scan_stage_3_parloop_struct_131142.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_131142.free_n_114534 = n_114534;
        futhark_mc_scan_stage_3_parloop_struct_131142.free_gtid_116758 =
            gtid_116758;
        futhark_mc_scan_stage_3_parloop_struct_131142.free_Y_mem_121939 =
            Y_mem_121939.mem;
        futhark_mc_scan_stage_3_parloop_struct_131142.free_mem_121942 =
            mem_121942.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_131143_task;
        
        futhark_mc_scan_stage_3_parloop_131143_task.name =
            "futhark_mc_scan_stage_3_parloop_131143";
        futhark_mc_scan_stage_3_parloop_131143_task.fn =
            futhark_mc_scan_stage_3_parloop_131143;
        futhark_mc_scan_stage_3_parloop_131143_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_131142;
        futhark_mc_scan_stage_3_parloop_131143_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_131143_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_131143_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_131143_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_131143_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_131143_task);
        
        if (futhark_mc_scan_stage_3_parloop_131143_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_131143_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_131143_total_end -
                     futhark_mc_scan_stage_3_parloop_131143_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131143_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131143_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131143_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    free(scan_stage_2_accum_mem_123902);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_131138_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_131138_end -
                 futhark_mc_segscan_task_131138_start;
        
        ctx->futhark_mc_segscan_task_131138_runs[tid]++;
        ctx->futhark_mc_segscan_task_131138_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_131138_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131144 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_116758;
    char *free_Y_mem_121939;
    char *free_mem_121942;
    char *free_mem_121945;
};
struct futhark_mc_segmap_parloop_struct_131146 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_116758;
    char *free_Y_mem_121939;
    char *free_mem_121942;
    char *free_mem_121945;
};
static int futhark_mc_segmap_parloop_131147(void *args, int64_t start,
                                            int64_t end, int flat_tid_116761,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131146
    *futhark_mc_segmap_parloop_struct_131146 =
    (struct futhark_mc_segmap_parloop_struct_131146 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131146->ctx;
    uint64_t futhark_mc_segmap_parloop_131147_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131147_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131146->free_n_114534;
    int64_t gtid_116758 =
            futhark_mc_segmap_parloop_struct_131146->free_gtid_116758;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131146->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_121942 = {.desc ="mem_121942", .mem =
                                  futhark_mc_segmap_parloop_struct_131146->free_mem_121942,
                                  .size =0, .references =NULL};
    struct memblock mem_121945 = {.desc ="mem_121945", .mem =
                                  futhark_mc_segmap_parloop_struct_131146->free_mem_121945,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_123911 = start;
    
    for (; iter_123911 < end; iter_123911++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_123914 = n_114534;
        int64_t gtid_116762 = iter_123911;
        int64_t remnant_123915 = iter_123911 - gtid_116762;
        float x_123887 = ((float *) Y_mem_121939.mem)[gtid_116758 * n_114534 +
                                                      gtid_116762];
        bool isnan_res_123888;
        
        isnan_res_123888 = futrts_isnan32(x_123887);
        
        bool defunc_0_p_res_123889 = !isnan_res_123888;
        int64_t defunc_1_f_res_123890;
        
        if (defunc_0_p_res_123889) {
            int64_t x_123912 = ((int64_t *) mem_121942.mem)[gtid_116762];
            int64_t defunc_1_f_res_t_res_123913 = sub64(x_123912, (int64_t) 1);
            
            defunc_1_f_res_123890 = defunc_1_f_res_t_res_123913;
        } else {
            defunc_1_f_res_123890 = (int64_t) -1;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_123890) &&
            slt64(defunc_1_f_res_123890, n_114534)) {
            ((int64_t *) mem_121945.mem)[defunc_1_f_res_123890] = gtid_116762;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131147_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131147_end -
                 futhark_mc_segmap_parloop_131147_start;
        
        ctx->futhark_mc_segmap_parloop_131147_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131147_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131147_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131145(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116761 = tid;
    int num_tasks_123910 = info.nsubtasks;
    struct futhark_mc_task_131144 *futhark_mc_task_131144 =
                                  (struct futhark_mc_task_131144 *) args;
    struct futhark_context *ctx = futhark_mc_task_131144->ctx;
    uint64_t futhark_mc_segmap_task_131145_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131145_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131144->free_n_114534;
    int64_t gtid_116758 = futhark_mc_task_131144->free_gtid_116758;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131144->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_121942 = {.desc ="mem_121942", .mem =
                                  futhark_mc_task_131144->free_mem_121942,
                                  .size =0, .references =NULL};
    struct memblock mem_121945 = {.desc ="mem_121945", .mem =
                                  futhark_mc_task_131144->free_mem_121945,
                                  .size =0, .references =NULL};
    int64_t iter_123911;
    struct futhark_mc_segmap_parloop_struct_131146
    futhark_mc_segmap_parloop_struct_131146;
    
    futhark_mc_segmap_parloop_struct_131146.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131146.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131146.free_gtid_116758 = gtid_116758;
    futhark_mc_segmap_parloop_struct_131146.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131146.free_mem_121942 = mem_121942.mem;
    futhark_mc_segmap_parloop_struct_131146.free_mem_121945 = mem_121945.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131147_task;
    
    futhark_mc_segmap_parloop_131147_task.name =
        "futhark_mc_segmap_parloop_131147";
    futhark_mc_segmap_parloop_131147_task.fn = futhark_mc_segmap_parloop_131147;
    futhark_mc_segmap_parloop_131147_task.args =
        &futhark_mc_segmap_parloop_struct_131146;
    futhark_mc_segmap_parloop_131147_task.iterations = iterations;
    futhark_mc_segmap_parloop_131147_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131147_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131147_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131147_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131147_task);
    
    if (futhark_mc_segmap_parloop_131147_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131147_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131147_total_end -
                 futhark_mc_segmap_parloop_131147_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131147_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131147_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131147_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131145_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131145_end -
                 futhark_mc_segmap_task_131145_start;
        
        ctx->futhark_mc_segmap_task_131145_runs[tid]++;
        ctx->futhark_mc_segmap_task_131145_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131145_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131134(void *args, int64_t start,
                                            int64_t end, int flat_tid_116757,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131133
    *futhark_mc_segmap_parloop_struct_131133 =
    (struct futhark_mc_segmap_parloop_struct_131133 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131133->ctx;
    uint64_t futhark_mc_segmap_parloop_131134_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131134_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131133->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131133->free_n_114534;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131133->free_i_114610;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131133->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121940 =
            futhark_mc_segmap_parloop_struct_131133->free_bytes_121940;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131133->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131133->free_mem_121982,
                                  .size =0, .references =NULL};
    size_t mem_121942_cached_sizze_131135 = 0;
    char *mem_121942 = NULL;
    size_t mem_121945_cached_sizze_131136 = 0;
    char *mem_121945 = NULL;
    int64_t iterations = end - start;
    int64_t iter_123879 = start;
    
    if (mem_121942_cached_sizze_131135 < (size_t) bytes_121940) {
        mem_121942 = realloc(mem_121942, bytes_121940);
        mem_121942_cached_sizze_131135 = bytes_121940;
    }
    if (mem_121945_cached_sizze_131136 < (size_t) bytes_121940) {
        mem_121945 = realloc(mem_121945, bytes_121940);
        mem_121945_cached_sizze_131136 = bytes_121940;
    }
    for (; iter_123879 < end; iter_123879++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_123893 = m_114533;
        int64_t gtid_116758 = iter_123879;
        int64_t remnant_123894 = iter_123879 - gtid_116758;
        int64_t flat_tid_116759 = (int64_t) 0;
        int32_t num_tasks_123895;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_131137 futhark_mc_task_131137;
        
        futhark_mc_task_131137.ctx = ctx;
        futhark_mc_task_131137.free_n_114534 = n_114534;
        futhark_mc_task_131137.free_gtid_116758 = gtid_116758;
        futhark_mc_task_131137.free_Y_mem_121939 = Y_mem_121939.mem;
        futhark_mc_task_131137.free_mem_121942 = mem_121942;
        
        struct scheduler_segop futhark_mc_task_131137_task;
        
        futhark_mc_task_131137_task.args = &futhark_mc_task_131137;
        futhark_mc_task_131137_task.top_level_fn =
            futhark_mc_segscan_task_131138;
        futhark_mc_task_131137_task.name = "futhark_mc_segscan_task_131138";
        futhark_mc_task_131137_task.iterations = n_114534;
        futhark_mc_task_131137_task.task_time =
            &ctx->futhark_mc_segscan_task_131138_total_time;
        futhark_mc_task_131137_task.task_iter =
            &ctx->futhark_mc_segscan_task_131138_total_iter;
        futhark_mc_task_131137_task.sched = STATIC;
        futhark_mc_task_131137_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_131138_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131137_task);
        
        if (futhark_mc_segscan_task_131138_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        int64_t last_res_116772 = ((int64_t *) mem_121942)[i_114610];
        
        for (int64_t i_123909 = 0; i_123909 < n_114534; i_123909++) {
            ((int64_t *) mem_121945)[i_123909] = (int64_t) -1;
        }
        
        int64_t flat_tid_116761 = (int64_t) 0;
        int32_t num_tasks_123910;
        struct futhark_mc_task_131144 futhark_mc_task_131144;
        
        futhark_mc_task_131144.ctx = ctx;
        futhark_mc_task_131144.free_n_114534 = n_114534;
        futhark_mc_task_131144.free_gtid_116758 = gtid_116758;
        futhark_mc_task_131144.free_Y_mem_121939 = Y_mem_121939.mem;
        futhark_mc_task_131144.free_mem_121942 = mem_121942;
        futhark_mc_task_131144.free_mem_121945 = mem_121945;
        
        struct scheduler_segop futhark_mc_task_131144_task;
        
        futhark_mc_task_131144_task.args = &futhark_mc_task_131144;
        futhark_mc_task_131144_task.top_level_fn =
            futhark_mc_segmap_task_131145;
        futhark_mc_task_131144_task.name = "futhark_mc_segmap_task_131145";
        futhark_mc_task_131144_task.iterations = n_114534;
        futhark_mc_task_131144_task.task_time =
            &ctx->futhark_mc_segmap_task_131145_total_time;
        futhark_mc_task_131144_task.task_iter =
            &ctx->futhark_mc_segmap_task_131145_total_iter;
        futhark_mc_task_131144_task.sched = STATIC;
        futhark_mc_task_131144_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131145_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131144_task);
        
        if (futhark_mc_segmap_task_131145_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_121979.mem + gtid_116758 * n_114534 * (int64_t) 8,
                mem_121945 + (int64_t) 0, n_114534 * (int64_t) 8);
        ((int64_t *) mem_121982.mem)[gtid_116758] = last_res_116772;
    }
    
  cleanup:
    { }
    free(mem_121942);
    free(mem_121945);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131134_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131134_end -
                 futhark_mc_segmap_parloop_131134_start;
        
        ctx->futhark_mc_segmap_parloop_131134_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131134_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131134_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131132(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116757 = tid;
    int num_tasks_123853 = info.nsubtasks;
    struct futhark_mc_task_131126 *futhark_mc_task_131126 =
                                  (struct futhark_mc_task_131126 *) args;
    struct futhark_context *ctx = futhark_mc_task_131126->ctx;
    uint64_t futhark_mc_segmap_nested_task_131132_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131132_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131126->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131126->free_n_114534;
    int64_t i_114610 = futhark_mc_task_131126->free_i_114610;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131126->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121940 = futhark_mc_task_131126->free_bytes_121940;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131126->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131126->free_mem_121982,
                                  .size =0, .references =NULL};
    int64_t iter_123879;
    struct futhark_mc_segmap_parloop_struct_131133
    futhark_mc_segmap_parloop_struct_131133;
    
    futhark_mc_segmap_parloop_struct_131133.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131133.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131133.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131133.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131133.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131133.free_bytes_121940 = bytes_121940;
    futhark_mc_segmap_parloop_struct_131133.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131133.free_mem_121982 = mem_121982.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131134_task;
    
    futhark_mc_segmap_parloop_131134_task.name =
        "futhark_mc_segmap_parloop_131134";
    futhark_mc_segmap_parloop_131134_task.fn = futhark_mc_segmap_parloop_131134;
    futhark_mc_segmap_parloop_131134_task.args =
        &futhark_mc_segmap_parloop_struct_131133;
    futhark_mc_segmap_parloop_131134_task.iterations = iterations;
    futhark_mc_segmap_parloop_131134_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131134_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131134_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131134_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131134_task);
    
    if (futhark_mc_segmap_parloop_131134_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131134_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131134_total_end -
                 futhark_mc_segmap_parloop_131134_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131134_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131134_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131134_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131132_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131132_end -
                 futhark_mc_segmap_nested_task_131132_start;
        
        ctx->futhark_mc_segmap_nested_task_131132_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131132_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131132_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131148 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_mem_121979;
    int64_t free_bytes_121983;
    char *free_mem_122004;
};
struct futhark_mc_segmap_parloop_struct_131150 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_mem_121979;
    int64_t free_bytes_121983;
    char *free_mem_122004;
};
static int futhark_mc_segmap_parloop_131151(void *args, int64_t start,
                                            int64_t end, int flat_tid_116782,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131150
    *futhark_mc_segmap_parloop_struct_131150 =
    (struct futhark_mc_segmap_parloop_struct_131150 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131150->ctx;
    uint64_t futhark_mc_segmap_parloop_131151_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131151_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131150->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131150->free_n_114534;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131150->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131150->free_bytes_121983;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131150->free_mem_122004,
                                  .size =0, .references =NULL};
    size_t mem_121988_cached_sizze_131152 = 0;
    char *mem_121988 = NULL;
    int64_t iterations = end - start;
    int64_t iter_123917 = start;
    
    if (mem_121988_cached_sizze_131152 < (size_t) bytes_121983) {
        mem_121988 = realloc(mem_121988, bytes_121983);
        mem_121988_cached_sizze_131152 = bytes_121983;
    }
    for (; iter_123917 < end; iter_123917++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_123923 = m_114533;
        int64_t gtid_116783 = iter_123917;
        int64_t remnant_123924 = iter_123917 - gtid_116783;
        
        for (int64_t i_123918 = 0; i_123918 < n_114534; i_123918++) {
            int64_t x_123920 = ((int64_t *) mem_121979.mem)[gtid_116783 *
                                                            n_114534 +
                                                            i_123918];
            float i64_res_123921 = sitofp_i64_f32(x_123920);
            
            ((float *) mem_121988)[i_123918] = i64_res_123921;
        }
        memmove(mem_122004.mem + gtid_116783 * n_114534 * (int64_t) 4,
                mem_121988 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_121988);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131151_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131151_end -
                 futhark_mc_segmap_parloop_131151_start;
        
        ctx->futhark_mc_segmap_parloop_131151_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131151_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131151_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131149(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116782 = tid;
    int num_tasks_123916 = info.nsubtasks;
    struct futhark_mc_task_131148 *futhark_mc_task_131148 =
                                  (struct futhark_mc_task_131148 *) args;
    struct futhark_context *ctx = futhark_mc_task_131148->ctx;
    uint64_t futhark_mc_segmap_task_131149_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131149_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131148->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131148->free_n_114534;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131148->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131148->free_bytes_121983;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131148->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t iter_123917;
    struct futhark_mc_segmap_parloop_struct_131150
    futhark_mc_segmap_parloop_struct_131150;
    
    futhark_mc_segmap_parloop_struct_131150.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131150.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131150.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131150.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131150.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131150.free_mem_122004 = mem_122004.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131151_task;
    
    futhark_mc_segmap_parloop_131151_task.name =
        "futhark_mc_segmap_parloop_131151";
    futhark_mc_segmap_parloop_131151_task.fn = futhark_mc_segmap_parloop_131151;
    futhark_mc_segmap_parloop_131151_task.args =
        &futhark_mc_segmap_parloop_struct_131150;
    futhark_mc_segmap_parloop_131151_task.iterations = iterations;
    futhark_mc_segmap_parloop_131151_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131151_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131151_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131151_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131151_task);
    
    if (futhark_mc_segmap_parloop_131151_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131151_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131151_total_end -
                 futhark_mc_segmap_parloop_131151_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131151_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131151_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131151_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131149_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131149_end -
                 futhark_mc_segmap_task_131149_start;
        
        ctx->futhark_mc_segmap_task_131149_runs[tid]++;
        ctx->futhark_mc_segmap_task_131149_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131149_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131154 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_mem_121979;
    int64_t free_bytes_121983;
    char *free_mem_122004;
};
struct futhark_mc_task_131157 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_116785;
    char *free_mem_121979;
    char *free_mem_121985;
};
struct futhark_mc_segmap_parloop_struct_131159 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_116785;
    char *free_mem_121979;
    char *free_mem_121985;
};
static int futhark_mc_segmap_parloop_131160(void *args, int64_t start,
                                            int64_t end, int flat_tid_116786,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131159
    *futhark_mc_segmap_parloop_struct_131159 =
    (struct futhark_mc_segmap_parloop_struct_131159 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131159->ctx;
    uint64_t futhark_mc_segmap_parloop_131160_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131160_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131159->free_n_114534;
    int64_t gtid_116785 =
            futhark_mc_segmap_parloop_struct_131159->free_gtid_116785;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131159->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121985 = {.desc ="mem_121985", .mem =
                                  futhark_mc_segmap_parloop_struct_131159->free_mem_121985,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_123932 = start;
    
    for (; iter_123932 < end; iter_123932++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_123933 = n_114534;
        int64_t gtid_116787 = iter_123932;
        int64_t remnant_123934 = iter_123932 - gtid_116787;
        int64_t x_123927 = ((int64_t *) mem_121979.mem)[gtid_116785 * n_114534 +
                                                        gtid_116787];
        float i64_res_123928 = sitofp_i64_f32(x_123927);
        
        ((float *) mem_121985.mem)[gtid_116787] = i64_res_123928;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131160_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131160_end -
                 futhark_mc_segmap_parloop_131160_start;
        
        ctx->futhark_mc_segmap_parloop_131160_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131160_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131160_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131158(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116786 = tid;
    int num_tasks_123931 = info.nsubtasks;
    struct futhark_mc_task_131157 *futhark_mc_task_131157 =
                                  (struct futhark_mc_task_131157 *) args;
    struct futhark_context *ctx = futhark_mc_task_131157->ctx;
    uint64_t futhark_mc_segmap_task_131158_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131158_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131157->free_n_114534;
    int64_t gtid_116785 = futhark_mc_task_131157->free_gtid_116785;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131157->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121985 = {.desc ="mem_121985", .mem =
                                  futhark_mc_task_131157->free_mem_121985,
                                  .size =0, .references =NULL};
    int64_t iter_123932;
    struct futhark_mc_segmap_parloop_struct_131159
    futhark_mc_segmap_parloop_struct_131159;
    
    futhark_mc_segmap_parloop_struct_131159.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131159.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131159.free_gtid_116785 = gtid_116785;
    futhark_mc_segmap_parloop_struct_131159.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131159.free_mem_121985 = mem_121985.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131160_task;
    
    futhark_mc_segmap_parloop_131160_task.name =
        "futhark_mc_segmap_parloop_131160";
    futhark_mc_segmap_parloop_131160_task.fn = futhark_mc_segmap_parloop_131160;
    futhark_mc_segmap_parloop_131160_task.args =
        &futhark_mc_segmap_parloop_struct_131159;
    futhark_mc_segmap_parloop_131160_task.iterations = iterations;
    futhark_mc_segmap_parloop_131160_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131160_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131160_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131160_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131160_task);
    
    if (futhark_mc_segmap_parloop_131160_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131160_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131160_total_end -
                 futhark_mc_segmap_parloop_131160_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131160_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131160_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131160_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131158_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131158_end -
                 futhark_mc_segmap_task_131158_start;
        
        ctx->futhark_mc_segmap_task_131158_runs[tid]++;
        ctx->futhark_mc_segmap_task_131158_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131158_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131155(void *args, int64_t start,
                                            int64_t end, int flat_tid_116784,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131154
    *futhark_mc_segmap_parloop_struct_131154 =
    (struct futhark_mc_segmap_parloop_struct_131154 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131154->ctx;
    uint64_t futhark_mc_segmap_parloop_131155_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131155_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131154->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131154->free_n_114534;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131154->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131154->free_bytes_121983;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131154->free_mem_122004,
                                  .size =0, .references =NULL};
    size_t mem_121985_cached_sizze_131156 = 0;
    char *mem_121985 = NULL;
    int64_t iterations = end - start;
    int64_t iter_123926 = start;
    
    if (mem_121985_cached_sizze_131156 < (size_t) bytes_121983) {
        mem_121985 = realloc(mem_121985, bytes_121983);
        mem_121985_cached_sizze_131156 = bytes_121983;
    }
    for (; iter_123926 < end; iter_123926++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_123929 = m_114533;
        int64_t gtid_116785 = iter_123926;
        int64_t remnant_123930 = iter_123926 - gtid_116785;
        int64_t flat_tid_116786 = (int64_t) 0;
        int32_t num_tasks_123931;
        struct futhark_mc_task_131157 futhark_mc_task_131157;
        
        futhark_mc_task_131157.ctx = ctx;
        futhark_mc_task_131157.free_n_114534 = n_114534;
        futhark_mc_task_131157.free_gtid_116785 = gtid_116785;
        futhark_mc_task_131157.free_mem_121979 = mem_121979.mem;
        futhark_mc_task_131157.free_mem_121985 = mem_121985;
        
        struct scheduler_segop futhark_mc_task_131157_task;
        
        futhark_mc_task_131157_task.args = &futhark_mc_task_131157;
        futhark_mc_task_131157_task.top_level_fn =
            futhark_mc_segmap_task_131158;
        futhark_mc_task_131157_task.name = "futhark_mc_segmap_task_131158";
        futhark_mc_task_131157_task.iterations = n_114534;
        futhark_mc_task_131157_task.task_time =
            &ctx->futhark_mc_segmap_task_131158_total_time;
        futhark_mc_task_131157_task.task_iter =
            &ctx->futhark_mc_segmap_task_131158_total_iter;
        futhark_mc_task_131157_task.sched = STATIC;
        futhark_mc_task_131157_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131158_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131157_task);
        
        if (futhark_mc_segmap_task_131158_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122004.mem + gtid_116785 * n_114534 * (int64_t) 4,
                mem_121985 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_121985);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131155_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131155_end -
                 futhark_mc_segmap_parloop_131155_start;
        
        ctx->futhark_mc_segmap_parloop_131155_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131155_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131155_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131153(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116784 = tid;
    int num_tasks_123916 = info.nsubtasks;
    struct futhark_mc_task_131148 *futhark_mc_task_131148 =
                                  (struct futhark_mc_task_131148 *) args;
    struct futhark_context *ctx = futhark_mc_task_131148->ctx;
    uint64_t futhark_mc_segmap_nested_task_131153_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131153_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131148->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131148->free_n_114534;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131148->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131148->free_bytes_121983;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131148->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t iter_123926;
    struct futhark_mc_segmap_parloop_struct_131154
    futhark_mc_segmap_parloop_struct_131154;
    
    futhark_mc_segmap_parloop_struct_131154.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131154.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131154.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131154.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131154.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131154.free_mem_122004 = mem_122004.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131155_task;
    
    futhark_mc_segmap_parloop_131155_task.name =
        "futhark_mc_segmap_parloop_131155";
    futhark_mc_segmap_parloop_131155_task.fn = futhark_mc_segmap_parloop_131155;
    futhark_mc_segmap_parloop_131155_task.args =
        &futhark_mc_segmap_parloop_struct_131154;
    futhark_mc_segmap_parloop_131155_task.iterations = iterations;
    futhark_mc_segmap_parloop_131155_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131155_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131155_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131155_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131155_task);
    
    if (futhark_mc_segmap_parloop_131155_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131155_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131155_total_end -
                 futhark_mc_segmap_parloop_131155_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131155_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131155_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131155_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131153_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131153_end -
                 futhark_mc_segmap_nested_task_131153_start;
        
        ctx->futhark_mc_segmap_nested_task_131153_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131153_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131153_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131161 {
    struct futhark_context *ctx;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    int64_t free_i_114610;
    int64_t free_bytes_122005;
    char *free_mem_122026;
};
struct futhark_mc_segmap_parloop_struct_131163 {
    struct futhark_context *ctx;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    int64_t free_i_114610;
    int64_t free_bytes_122005;
    char *free_mem_122026;
};
static int futhark_mc_segmap_parloop_131164(void *args, int64_t start,
                                            int64_t end, int flat_tid_116792,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131163
    *futhark_mc_segmap_parloop_struct_131163 =
    (struct futhark_mc_segmap_parloop_struct_131163 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131163->ctx;
    uint64_t futhark_mc_segmap_parloop_131164_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131164_start = get_wall_time();
    
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131163->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_segmap_parloop_struct_131163->free_css_chunk_len_114580;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131163->free_i_114610;
    int64_t bytes_122005 =
            futhark_mc_segmap_parloop_struct_131163->free_bytes_122005;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_segmap_parloop_struct_131163->free_mem_122026,
                                  .size =0, .references =NULL};
    size_t mem_122010_cached_sizze_131165 = 0;
    char *mem_122010 = NULL;
    int64_t iterations = end - start;
    int64_t iter_123936 = start;
    
    if (mem_122010_cached_sizze_131165 < (size_t) bytes_122005) {
        mem_122010 = realloc(mem_122010, bytes_122005);
        mem_122010_cached_sizze_131165 = bytes_122005;
    }
    for (; iter_123936 < end; iter_123936++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_123944 = n_p_114536;
        int64_t gtid_116793 = iter_123936;
        int64_t remnant_123945 = iter_123936 - gtid_116793;
        
        for (int64_t i_123937 = 0; i_123937 < css_chunk_len_114580;
             i_123937++) {
            int64_t y_123939 = mul64(n_p_114536, i_123937);
            int64_t res_idx_123940 = add64(y_123939, gtid_116793);
            bool cond_123941 = slt64(i_114610, res_idx_123940);
            int64_t defunc_0_f_res_123942;
            
            if (cond_123941) {
                defunc_0_f_res_123942 = (int64_t) -1;
            } else {
                defunc_0_f_res_123942 = res_idx_123940;
            }
            ((int64_t *) mem_122010)[i_123937] = defunc_0_f_res_123942;
        }
        memmove(mem_122026.mem + gtid_116793 * css_chunk_len_114580 *
                (int64_t) 8, mem_122010 + (int64_t) 0, css_chunk_len_114580 *
                (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_122010);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131164_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131164_end -
                 futhark_mc_segmap_parloop_131164_start;
        
        ctx->futhark_mc_segmap_parloop_131164_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131164_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131164_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131162(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116792 = tid;
    int num_tasks_123935 = info.nsubtasks;
    struct futhark_mc_task_131161 *futhark_mc_task_131161 =
                                  (struct futhark_mc_task_131161 *) args;
    struct futhark_context *ctx = futhark_mc_task_131161->ctx;
    uint64_t futhark_mc_segmap_task_131162_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131162_start = get_wall_time();
    
    int64_t n_p_114536 = futhark_mc_task_131161->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_task_131161->free_css_chunk_len_114580;
    int64_t i_114610 = futhark_mc_task_131161->free_i_114610;
    int64_t bytes_122005 = futhark_mc_task_131161->free_bytes_122005;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_task_131161->free_mem_122026,
                                  .size =0, .references =NULL};
    int64_t iter_123936;
    struct futhark_mc_segmap_parloop_struct_131163
    futhark_mc_segmap_parloop_struct_131163;
    
    futhark_mc_segmap_parloop_struct_131163.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131163.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131163.free_css_chunk_len_114580 =
        css_chunk_len_114580;
    futhark_mc_segmap_parloop_struct_131163.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131163.free_bytes_122005 = bytes_122005;
    futhark_mc_segmap_parloop_struct_131163.free_mem_122026 = mem_122026.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131164_task;
    
    futhark_mc_segmap_parloop_131164_task.name =
        "futhark_mc_segmap_parloop_131164";
    futhark_mc_segmap_parloop_131164_task.fn = futhark_mc_segmap_parloop_131164;
    futhark_mc_segmap_parloop_131164_task.args =
        &futhark_mc_segmap_parloop_struct_131163;
    futhark_mc_segmap_parloop_131164_task.iterations = iterations;
    futhark_mc_segmap_parloop_131164_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131164_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131164_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131164_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131164_task);
    
    if (futhark_mc_segmap_parloop_131164_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131164_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131164_total_end -
                 futhark_mc_segmap_parloop_131164_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131164_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131164_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131164_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131162_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131162_end -
                 futhark_mc_segmap_task_131162_start;
        
        ctx->futhark_mc_segmap_task_131162_runs[tid]++;
        ctx->futhark_mc_segmap_task_131162_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131162_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131167 {
    struct futhark_context *ctx;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    int64_t free_i_114610;
    int64_t free_bytes_122005;
    char *free_mem_122026;
};
struct futhark_mc_task_131170 {
    struct futhark_context *ctx;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    int64_t free_i_114610;
    int64_t free_gtid_116795;
    char *free_mem_122007;
};
struct futhark_mc_segmap_parloop_struct_131172 {
    struct futhark_context *ctx;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    int64_t free_i_114610;
    int64_t free_gtid_116795;
    char *free_mem_122007;
};
static int futhark_mc_segmap_parloop_131173(void *args, int64_t start,
                                            int64_t end, int flat_tid_116796,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131172
    *futhark_mc_segmap_parloop_struct_131172 =
    (struct futhark_mc_segmap_parloop_struct_131172 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131172->ctx;
    uint64_t futhark_mc_segmap_parloop_131173_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131173_start = get_wall_time();
    
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131172->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_segmap_parloop_struct_131172->free_css_chunk_len_114580;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131172->free_i_114610;
    int64_t gtid_116795 =
            futhark_mc_segmap_parloop_struct_131172->free_gtid_116795;
    struct memblock mem_122007 = {.desc ="mem_122007", .mem =
                                  futhark_mc_segmap_parloop_struct_131172->free_mem_122007,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_123955 = start;
    
    for (; iter_123955 < end; iter_123955++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_123956 = css_chunk_len_114580;
        int64_t gtid_116797 = iter_123955;
        int64_t remnant_123957 = iter_123955 - gtid_116797;
        int64_t y_123948 = mul64(n_p_114536, gtid_116797);
        int64_t res_idx_123949 = add64(gtid_116795, y_123948);
        bool cond_123950 = slt64(i_114610, res_idx_123949);
        int64_t defunc_0_f_res_123951;
        
        if (cond_123950) {
            defunc_0_f_res_123951 = (int64_t) -1;
        } else {
            defunc_0_f_res_123951 = res_idx_123949;
        }
        ((int64_t *) mem_122007.mem)[gtid_116797] = defunc_0_f_res_123951;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131173_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131173_end -
                 futhark_mc_segmap_parloop_131173_start;
        
        ctx->futhark_mc_segmap_parloop_131173_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131173_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131173_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131171(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116796 = tid;
    int num_tasks_123954 = info.nsubtasks;
    struct futhark_mc_task_131170 *futhark_mc_task_131170 =
                                  (struct futhark_mc_task_131170 *) args;
    struct futhark_context *ctx = futhark_mc_task_131170->ctx;
    uint64_t futhark_mc_segmap_task_131171_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131171_start = get_wall_time();
    
    int64_t n_p_114536 = futhark_mc_task_131170->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_task_131170->free_css_chunk_len_114580;
    int64_t i_114610 = futhark_mc_task_131170->free_i_114610;
    int64_t gtid_116795 = futhark_mc_task_131170->free_gtid_116795;
    struct memblock mem_122007 = {.desc ="mem_122007", .mem =
                                  futhark_mc_task_131170->free_mem_122007,
                                  .size =0, .references =NULL};
    int64_t iter_123955;
    struct futhark_mc_segmap_parloop_struct_131172
    futhark_mc_segmap_parloop_struct_131172;
    
    futhark_mc_segmap_parloop_struct_131172.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131172.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131172.free_css_chunk_len_114580 =
        css_chunk_len_114580;
    futhark_mc_segmap_parloop_struct_131172.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131172.free_gtid_116795 = gtid_116795;
    futhark_mc_segmap_parloop_struct_131172.free_mem_122007 = mem_122007.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131173_task;
    
    futhark_mc_segmap_parloop_131173_task.name =
        "futhark_mc_segmap_parloop_131173";
    futhark_mc_segmap_parloop_131173_task.fn = futhark_mc_segmap_parloop_131173;
    futhark_mc_segmap_parloop_131173_task.args =
        &futhark_mc_segmap_parloop_struct_131172;
    futhark_mc_segmap_parloop_131173_task.iterations = iterations;
    futhark_mc_segmap_parloop_131173_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131173_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131173_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131173_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131173_task);
    
    if (futhark_mc_segmap_parloop_131173_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131173_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131173_total_end -
                 futhark_mc_segmap_parloop_131173_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131173_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131173_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131173_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131171_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131171_end -
                 futhark_mc_segmap_task_131171_start;
        
        ctx->futhark_mc_segmap_task_131171_runs[tid]++;
        ctx->futhark_mc_segmap_task_131171_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131171_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131168(void *args, int64_t start,
                                            int64_t end, int flat_tid_116794,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131167
    *futhark_mc_segmap_parloop_struct_131167 =
    (struct futhark_mc_segmap_parloop_struct_131167 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131167->ctx;
    uint64_t futhark_mc_segmap_parloop_131168_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131168_start = get_wall_time();
    
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131167->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_segmap_parloop_struct_131167->free_css_chunk_len_114580;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131167->free_i_114610;
    int64_t bytes_122005 =
            futhark_mc_segmap_parloop_struct_131167->free_bytes_122005;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_segmap_parloop_struct_131167->free_mem_122026,
                                  .size =0, .references =NULL};
    size_t mem_122007_cached_sizze_131169 = 0;
    char *mem_122007 = NULL;
    int64_t iterations = end - start;
    int64_t iter_123947 = start;
    
    if (mem_122007_cached_sizze_131169 < (size_t) bytes_122005) {
        mem_122007 = realloc(mem_122007, bytes_122005);
        mem_122007_cached_sizze_131169 = bytes_122005;
    }
    for (; iter_123947 < end; iter_123947++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_123952 = n_p_114536;
        int64_t gtid_116795 = iter_123947;
        int64_t remnant_123953 = iter_123947 - gtid_116795;
        int64_t flat_tid_116796 = (int64_t) 0;
        int32_t num_tasks_123954;
        struct futhark_mc_task_131170 futhark_mc_task_131170;
        
        futhark_mc_task_131170.ctx = ctx;
        futhark_mc_task_131170.free_n_p_114536 = n_p_114536;
        futhark_mc_task_131170.free_css_chunk_len_114580 = css_chunk_len_114580;
        futhark_mc_task_131170.free_i_114610 = i_114610;
        futhark_mc_task_131170.free_gtid_116795 = gtid_116795;
        futhark_mc_task_131170.free_mem_122007 = mem_122007;
        
        struct scheduler_segop futhark_mc_task_131170_task;
        
        futhark_mc_task_131170_task.args = &futhark_mc_task_131170;
        futhark_mc_task_131170_task.top_level_fn =
            futhark_mc_segmap_task_131171;
        futhark_mc_task_131170_task.name = "futhark_mc_segmap_task_131171";
        futhark_mc_task_131170_task.iterations = css_chunk_len_114580;
        futhark_mc_task_131170_task.task_time =
            &ctx->futhark_mc_segmap_task_131171_total_time;
        futhark_mc_task_131170_task.task_iter =
            &ctx->futhark_mc_segmap_task_131171_total_iter;
        futhark_mc_task_131170_task.sched = STATIC;
        futhark_mc_task_131170_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131171_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131170_task);
        
        if (futhark_mc_segmap_task_131171_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122026.mem + gtid_116795 * css_chunk_len_114580 *
                (int64_t) 8, mem_122007 + (int64_t) 0, css_chunk_len_114580 *
                (int64_t) 8);
    }
    
  cleanup:
    { }
    free(mem_122007);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131168_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131168_end -
                 futhark_mc_segmap_parloop_131168_start;
        
        ctx->futhark_mc_segmap_parloop_131168_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131168_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131168_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131166(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116794 = tid;
    int num_tasks_123935 = info.nsubtasks;
    struct futhark_mc_task_131161 *futhark_mc_task_131161 =
                                  (struct futhark_mc_task_131161 *) args;
    struct futhark_context *ctx = futhark_mc_task_131161->ctx;
    uint64_t futhark_mc_segmap_nested_task_131166_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131166_start = get_wall_time();
    
    int64_t n_p_114536 = futhark_mc_task_131161->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_task_131161->free_css_chunk_len_114580;
    int64_t i_114610 = futhark_mc_task_131161->free_i_114610;
    int64_t bytes_122005 = futhark_mc_task_131161->free_bytes_122005;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_task_131161->free_mem_122026,
                                  .size =0, .references =NULL};
    int64_t iter_123947;
    struct futhark_mc_segmap_parloop_struct_131167
    futhark_mc_segmap_parloop_struct_131167;
    
    futhark_mc_segmap_parloop_struct_131167.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131167.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131167.free_css_chunk_len_114580 =
        css_chunk_len_114580;
    futhark_mc_segmap_parloop_struct_131167.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131167.free_bytes_122005 = bytes_122005;
    futhark_mc_segmap_parloop_struct_131167.free_mem_122026 = mem_122026.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131168_task;
    
    futhark_mc_segmap_parloop_131168_task.name =
        "futhark_mc_segmap_parloop_131168";
    futhark_mc_segmap_parloop_131168_task.fn = futhark_mc_segmap_parloop_131168;
    futhark_mc_segmap_parloop_131168_task.args =
        &futhark_mc_segmap_parloop_struct_131167;
    futhark_mc_segmap_parloop_131168_task.iterations = iterations;
    futhark_mc_segmap_parloop_131168_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131168_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131168_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131168_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131168_task);
    
    if (futhark_mc_segmap_parloop_131168_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131168_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131168_total_end -
                 futhark_mc_segmap_parloop_131168_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131168_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131168_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131168_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131166_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131166_end -
                 futhark_mc_segmap_nested_task_131166_start;
        
        ctx->futhark_mc_segmap_nested_task_131166_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131166_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131166_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131174 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    char *free_Y_mem_121939;
    char *free_mem_122026;
    int64_t free_bytes_122027;
    char *free_mem_122048;
};
struct futhark_mc_segmap_parloop_struct_131176 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    char *free_Y_mem_121939;
    char *free_mem_122026;
    int64_t free_bytes_122027;
    char *free_mem_122048;
};
static int futhark_mc_segmap_parloop_131177(void *args, int64_t start,
                                            int64_t end, int flat_tid_116805,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131176
    *futhark_mc_segmap_parloop_struct_131176 =
    (struct futhark_mc_segmap_parloop_struct_131176 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131176->ctx;
    uint64_t futhark_mc_segmap_parloop_131177_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131177_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131176->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131176->free_n_114534;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131176->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_segmap_parloop_struct_131176->free_css_chunk_len_114580;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131176->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_segmap_parloop_struct_131176->free_mem_122026,
                                  .size =0, .references =NULL};
    int64_t bytes_122027 =
            futhark_mc_segmap_parloop_struct_131176->free_bytes_122027;
    struct memblock mem_122048 = {.desc ="mem_122048", .mem =
                                  futhark_mc_segmap_parloop_struct_131176->free_mem_122048,
                                  .size =0, .references =NULL};
    size_t mem_122032_cached_sizze_131178 = 0;
    char *mem_122032 = NULL;
    int64_t iterations = end - start;
    int64_t iter_123959 = start;
    
    if (mem_122032_cached_sizze_131178 < (size_t) bytes_122027) {
        mem_122032 = realloc(mem_122032, bytes_122027);
        mem_122032_cached_sizze_131178 = bytes_122027;
    }
    for (; iter_123959 < end; iter_123959++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_123978 = m_114533;
        int64_t gtid_116806 = iter_123959;
        int64_t remnant_123979 = iter_123959 - gtid_116806;
        
        for (int64_t i_123960 = 0; i_123960 < n_p_114536; i_123960++) {
            float defunc_2_reduce_res_123962;
            float redout_123964 = 0.0F;
            
            for (int64_t i_123963 = 0; i_123963 < css_chunk_len_114580;
                 i_123963++) {
                int64_t x_123965 = ((int64_t *) mem_122026.mem)[i_123960 *
                                                                css_chunk_len_114580 +
                                                                i_123963];
                bool cond_123966 = sle64((int64_t) 0, x_123965);
                float defunc_0_f_res_123967;
                
                if (cond_123966) {
                    bool y_123968 = slt64(x_123965, n_114534);
                    bool bounds_check_123969 = cond_123966 && y_123968;
                    bool index_certs_123970;
                    
                    if (!bounds_check_123969) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", x_123965,
                                      "] out of bounds for array of shape [",
                                      n_114534, "].",
                                      "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:152:30-55\n   #3  stl.fut:150:13-159:26\n   #4  stl.fut:148:5-160:11\n   #5  stl.fut:394:3-405:33\n   #6  stl.fut:381:1-405:33\n");
                        return 1;
                    }
                    
                    float defunc_0_f_res_t_res_123971 =
                          ((float *) Y_mem_121939.mem)[gtid_116806 * n_114534 +
                                                       x_123965];
                    
                    defunc_0_f_res_123967 = defunc_0_f_res_t_res_123971;
                } else {
                    defunc_0_f_res_123967 = NAN;
                }
                
                bool isnan_res_123972;
                
                isnan_res_123972 = futrts_isnan32(defunc_0_f_res_123967);
                
                float defunc_0_f_res_123973;
                
                if (isnan_res_123972) {
                    defunc_0_f_res_123973 = 0.0F;
                } else {
                    defunc_0_f_res_123973 = 1.0F;
                }
                
                float defunc_1_op_res_123974 = defunc_0_f_res_123973 +
                      redout_123964;
                float redout_tmp_123981 = defunc_1_op_res_123974;
                
                redout_123964 = redout_tmp_123981;
            }
            defunc_2_reduce_res_123962 = redout_123964;
            
            bool sub_series_is_not_all_nan_123975 = 0.0F <
                 defunc_2_reduce_res_123962;
            bool assert_c_123976;
            
            if (!sub_series_is_not_all_nan_123975) {
                ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                       "Assertion is false: sub_series_is_not_all_nan",
                                       "-> #0  stl.fut:157:34-75\n   #1  stl.fut:150:13-159:26\n   #2  stl.fut:148:5-160:11\n   #3  stl.fut:394:3-405:33\n   #4  stl.fut:381:1-405:33\n");
                return 1;
            }
            ((float *) mem_122032)[i_123960] = defunc_2_reduce_res_123962;
        }
        memmove(mem_122048.mem + gtid_116806 * n_p_114536 * (int64_t) 4,
                mem_122032 + (int64_t) 0, n_p_114536 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122032);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131177_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131177_end -
                 futhark_mc_segmap_parloop_131177_start;
        
        ctx->futhark_mc_segmap_parloop_131177_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131177_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131177_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131175(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116805 = tid;
    int num_tasks_123958 = info.nsubtasks;
    struct futhark_mc_task_131174 *futhark_mc_task_131174 =
                                  (struct futhark_mc_task_131174 *) args;
    struct futhark_context *ctx = futhark_mc_task_131174->ctx;
    uint64_t futhark_mc_segmap_task_131175_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131175_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131174->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131174->free_n_114534;
    int64_t n_p_114536 = futhark_mc_task_131174->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_task_131174->free_css_chunk_len_114580;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131174->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_task_131174->free_mem_122026,
                                  .size =0, .references =NULL};
    int64_t bytes_122027 = futhark_mc_task_131174->free_bytes_122027;
    struct memblock mem_122048 = {.desc ="mem_122048", .mem =
                                  futhark_mc_task_131174->free_mem_122048,
                                  .size =0, .references =NULL};
    int64_t iter_123959;
    struct futhark_mc_segmap_parloop_struct_131176
    futhark_mc_segmap_parloop_struct_131176;
    
    futhark_mc_segmap_parloop_struct_131176.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131176.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131176.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131176.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131176.free_css_chunk_len_114580 =
        css_chunk_len_114580;
    futhark_mc_segmap_parloop_struct_131176.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131176.free_mem_122026 = mem_122026.mem;
    futhark_mc_segmap_parloop_struct_131176.free_bytes_122027 = bytes_122027;
    futhark_mc_segmap_parloop_struct_131176.free_mem_122048 = mem_122048.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131177_task;
    
    futhark_mc_segmap_parloop_131177_task.name =
        "futhark_mc_segmap_parloop_131177";
    futhark_mc_segmap_parloop_131177_task.fn = futhark_mc_segmap_parloop_131177;
    futhark_mc_segmap_parloop_131177_task.args =
        &futhark_mc_segmap_parloop_struct_131176;
    futhark_mc_segmap_parloop_131177_task.iterations = iterations;
    futhark_mc_segmap_parloop_131177_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131177_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131177_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131177_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131177_task);
    
    if (futhark_mc_segmap_parloop_131177_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131177_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131177_total_end -
                 futhark_mc_segmap_parloop_131177_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131177_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131177_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131177_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131175_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131175_end -
                 futhark_mc_segmap_task_131175_start;
        
        ctx->futhark_mc_segmap_task_131175_runs[tid]++;
        ctx->futhark_mc_segmap_task_131175_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131175_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131180 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    char *free_Y_mem_121939;
    char *free_mem_122026;
    int64_t free_bytes_122027;
    char *free_mem_122048;
};
struct futhark_mc_task_131183 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    int64_t free_gtid_116808;
    char *free_Y_mem_121939;
    char *free_mem_122026;
    char *free_mem_122029;
};
struct futhark_mc_segmap_parloop_struct_131185 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    int64_t free_gtid_116808;
    char *free_Y_mem_121939;
    char *free_mem_122026;
    char *free_mem_122029;
};
static int futhark_mc_segmap_parloop_131186(void *args, int64_t start,
                                            int64_t end, int flat_tid_116809,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131185
    *futhark_mc_segmap_parloop_struct_131185 =
    (struct futhark_mc_segmap_parloop_struct_131185 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131185->ctx;
    uint64_t futhark_mc_segmap_parloop_131186_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131186_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131185->free_n_114534;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131185->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_segmap_parloop_struct_131185->free_css_chunk_len_114580;
    int64_t gtid_116808 =
            futhark_mc_segmap_parloop_struct_131185->free_gtid_116808;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131185->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_segmap_parloop_struct_131185->free_mem_122026,
                                  .size =0, .references =NULL};
    struct memblock mem_122029 = {.desc ="mem_122029", .mem =
                                  futhark_mc_segmap_parloop_struct_131185->free_mem_122029,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_124018 = start;
    
    for (; iter_124018 < end; iter_124018++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_124031 = n_p_114536;
        int64_t gtid_116810 = iter_124018;
        int64_t remnant_124032 = iter_124018 - gtid_116810;
        float defunc_2_reduce_res_123999;
        float redout_124020 = 0.0F;
        
        for (int64_t i_124019 = 0; i_124019 < css_chunk_len_114580;
             i_124019++) {
            int64_t x_124021 = ((int64_t *) mem_122026.mem)[gtid_116810 *
                                                            css_chunk_len_114580 +
                                                            i_124019];
            bool cond_124022 = sle64((int64_t) 0, x_124021);
            float defunc_0_f_res_124023;
            
            if (cond_124022) {
                bool y_124024 = slt64(x_124021, n_114534);
                bool bounds_check_124025 = cond_124022 && y_124024;
                bool index_certs_124026;
                
                if (!bounds_check_124025) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", x_124021,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:152:30-55\n   #3  stl.fut:150:13-159:26\n   #4  stl.fut:148:5-160:11\n   #5  stl.fut:394:3-405:33\n   #6  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float defunc_0_f_res_t_res_124027 =
                      ((float *) Y_mem_121939.mem)[gtid_116808 * n_114534 +
                                                   x_124021];
                
                defunc_0_f_res_124023 = defunc_0_f_res_t_res_124027;
            } else {
                defunc_0_f_res_124023 = NAN;
            }
            
            bool isnan_res_124028;
            
            isnan_res_124028 = futrts_isnan32(defunc_0_f_res_124023);
            
            float defunc_0_f_res_124029;
            
            if (isnan_res_124028) {
                defunc_0_f_res_124029 = 0.0F;
            } else {
                defunc_0_f_res_124029 = 1.0F;
            }
            
            float defunc_1_op_res_124030 = defunc_0_f_res_124029 +
                  redout_124020;
            float redout_tmp_124033 = defunc_1_op_res_124030;
            
            redout_124020 = redout_tmp_124033;
        }
        defunc_2_reduce_res_123999 = redout_124020;
        
        bool sub_series_is_not_all_nan_124012 = 0.0F <
             defunc_2_reduce_res_123999;
        bool assert_c_124013;
        
        if (!sub_series_is_not_all_nan_124012) {
            ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                   "Assertion is false: sub_series_is_not_all_nan",
                                   "-> #0  stl.fut:157:34-75\n   #1  stl.fut:150:13-159:26\n   #2  stl.fut:148:5-160:11\n   #3  stl.fut:394:3-405:33\n   #4  stl.fut:381:1-405:33\n");
            return 1;
        }
        
        float lam_res_124014 = defunc_2_reduce_res_123999;
        
        ((float *) mem_122029.mem)[gtid_116810] = lam_res_124014;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131186_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131186_end -
                 futhark_mc_segmap_parloop_131186_start;
        
        ctx->futhark_mc_segmap_parloop_131186_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131186_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131186_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131184(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116809 = tid;
    int num_tasks_124017 = info.nsubtasks;
    struct futhark_mc_task_131183 *futhark_mc_task_131183 =
                                  (struct futhark_mc_task_131183 *) args;
    struct futhark_context *ctx = futhark_mc_task_131183->ctx;
    uint64_t futhark_mc_segmap_task_131184_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131184_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131183->free_n_114534;
    int64_t n_p_114536 = futhark_mc_task_131183->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_task_131183->free_css_chunk_len_114580;
    int64_t gtid_116808 = futhark_mc_task_131183->free_gtid_116808;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131183->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_task_131183->free_mem_122026,
                                  .size =0, .references =NULL};
    struct memblock mem_122029 = {.desc ="mem_122029", .mem =
                                  futhark_mc_task_131183->free_mem_122029,
                                  .size =0, .references =NULL};
    int64_t iter_124018;
    struct futhark_mc_segmap_parloop_struct_131185
    futhark_mc_segmap_parloop_struct_131185;
    
    futhark_mc_segmap_parloop_struct_131185.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131185.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131185.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131185.free_css_chunk_len_114580 =
        css_chunk_len_114580;
    futhark_mc_segmap_parloop_struct_131185.free_gtid_116808 = gtid_116808;
    futhark_mc_segmap_parloop_struct_131185.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131185.free_mem_122026 = mem_122026.mem;
    futhark_mc_segmap_parloop_struct_131185.free_mem_122029 = mem_122029.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131186_task;
    
    futhark_mc_segmap_parloop_131186_task.name =
        "futhark_mc_segmap_parloop_131186";
    futhark_mc_segmap_parloop_131186_task.fn = futhark_mc_segmap_parloop_131186;
    futhark_mc_segmap_parloop_131186_task.args =
        &futhark_mc_segmap_parloop_struct_131185;
    futhark_mc_segmap_parloop_131186_task.iterations = iterations;
    futhark_mc_segmap_parloop_131186_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131186_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131186_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131186_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131186_task);
    
    if (futhark_mc_segmap_parloop_131186_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131186_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131186_total_end -
                 futhark_mc_segmap_parloop_131186_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131186_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131186_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131186_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131184_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131184_end -
                 futhark_mc_segmap_task_131184_start;
        
        ctx->futhark_mc_segmap_task_131184_runs[tid]++;
        ctx->futhark_mc_segmap_task_131184_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131184_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131188 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    int64_t free_gtid_116808;
    char *free_Y_mem_121939;
    char *free_mem_122026;
    char *free_mem_122029;
};
struct futhark_mc_task_131190 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_css_chunk_len_114580;
    int64_t free_gtid_116808;
    int64_t free_gtid_116812;
    char *free_Y_mem_121939;
    char *free_mem_122026;
    float *retval_defunc_2_reduce_res_123983;
};
struct futhark_mc_segred_stage_1_parloop_struct_131193 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_css_chunk_len_114580;
    int64_t free_gtid_116808;
    int64_t free_gtid_116812;
    char *free_Y_mem_121939;
    char *free_mem_122026;
    char *free_reduce_stage_1_tid_res_arr_mem_124050;
};
static int futhark_mc_segred_stage_1_parloop_131194(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_116813,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131193
    *futhark_mc_segred_stage_1_parloop_struct_131193 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131193 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131193->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131194_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131194_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131193->free_n_114534;
    int64_t css_chunk_len_114580 =
            futhark_mc_segred_stage_1_parloop_struct_131193->free_css_chunk_len_114580;
    int64_t gtid_116808 =
            futhark_mc_segred_stage_1_parloop_struct_131193->free_gtid_116808;
    int64_t gtid_116812 =
            futhark_mc_segred_stage_1_parloop_struct_131193->free_gtid_116812;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segred_stage_1_parloop_struct_131193->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131193->free_mem_122026,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_124050 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_124050",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131193->free_reduce_stage_1_tid_res_arr_mem_124050,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_124052 = start;
    float x_124035;
    float x_124036;
    float local_acc_124053 = 0.0F;
    
    for (; iter_124052 < end; iter_124052++) {
        int64_t gtid_116814 = iter_124052;
        int64_t x_124038 = ((int64_t *) mem_122026.mem)[gtid_116812 *
                                                        css_chunk_len_114580 +
                                                        gtid_116814];
        bool cond_124039 = sle64((int64_t) 0, x_124038);
        float defunc_0_f_res_124040;
        
        if (cond_124039) {
            bool y_124041 = slt64(x_124038, n_114534);
            bool bounds_check_124042 = cond_124039 && y_124041;
            bool index_certs_124043;
            
            if (!bounds_check_124042) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", x_124038,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:152:30-55\n   #3  stl.fut:150:13-159:26\n   #4  stl.fut:148:5-160:11\n   #5  stl.fut:394:3-405:33\n   #6  stl.fut:381:1-405:33\n");
                return 1;
            }
            
            float defunc_0_f_res_t_res_124044 =
                  ((float *) Y_mem_121939.mem)[gtid_116808 * n_114534 +
                                               x_124038];
            
            defunc_0_f_res_124040 = defunc_0_f_res_t_res_124044;
        } else {
            defunc_0_f_res_124040 = NAN;
        }
        
        bool isnan_res_124045;
        
        isnan_res_124045 = futrts_isnan32(defunc_0_f_res_124040);
        
        float defunc_0_f_res_124046;
        
        if (isnan_res_124045) {
            defunc_0_f_res_124046 = 0.0F;
        } else {
            defunc_0_f_res_124046 = 1.0F;
        }
        // save map-out results
        { }
        // Load accum params
        {
            x_124035 = local_acc_124053;
        }
        // Load next params
        {
            x_124036 = defunc_0_f_res_124046;
        }
        // Red body
        {
            float defunc_1_op_res_124037 = x_124035 + x_124036;
            
            local_acc_124053 = defunc_1_op_res_124037;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_124050.mem)[flat_tid_116813] =
        local_acc_124053;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131194_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131194_end -
                 futhark_mc_segred_stage_1_parloop_131194_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131194_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131194_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131194_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131191(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116813 = tid;
    int num_tasks_124049 = info.nsubtasks;
    struct futhark_mc_task_131190 *futhark_mc_task_131190 =
                                  (struct futhark_mc_task_131190 *) args;
    struct futhark_context *ctx = futhark_mc_task_131190->ctx;
    uint64_t futhark_mc_segred_task_131191_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131191_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131190->free_n_114534;
    int64_t css_chunk_len_114580 =
            futhark_mc_task_131190->free_css_chunk_len_114580;
    int64_t gtid_116808 = futhark_mc_task_131190->free_gtid_116808;
    int64_t gtid_116812 = futhark_mc_task_131190->free_gtid_116812;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131190->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_task_131190->free_mem_122026,
                                  .size =0, .references =NULL};
    float defunc_2_reduce_res_123983 =
          *futhark_mc_task_131190->retval_defunc_2_reduce_res_123983;
    size_t reduce_stage_1_tid_res_arr_mem_124050_cached_sizze_131192 = 0;
    char *reduce_stage_1_tid_res_arr_mem_124050 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_124050_cached_sizze_131192 <
        (size_t) ((int64_t) 4 * num_tasks_124049)) {
        reduce_stage_1_tid_res_arr_mem_124050 =
            realloc(reduce_stage_1_tid_res_arr_mem_124050, (int64_t) 4 *
                    num_tasks_124049);
        reduce_stage_1_tid_res_arr_mem_124050_cached_sizze_131192 =
            (int64_t) 4 * num_tasks_124049;
    }
    
    int64_t iter_124052;
    struct futhark_mc_segred_stage_1_parloop_struct_131193
    futhark_mc_segred_stage_1_parloop_struct_131193;
    
    futhark_mc_segred_stage_1_parloop_struct_131193.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131193.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131193.free_css_chunk_len_114580 =
        css_chunk_len_114580;
    futhark_mc_segred_stage_1_parloop_struct_131193.free_gtid_116808 =
        gtid_116808;
    futhark_mc_segred_stage_1_parloop_struct_131193.free_gtid_116812 =
        gtid_116812;
    futhark_mc_segred_stage_1_parloop_struct_131193.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segred_stage_1_parloop_struct_131193.free_mem_122026 =
        mem_122026.mem;
    futhark_mc_segred_stage_1_parloop_struct_131193.free_reduce_stage_1_tid_res_arr_mem_124050 =
        reduce_stage_1_tid_res_arr_mem_124050;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131194_task;
    
    futhark_mc_segred_stage_1_parloop_131194_task.name =
        "futhark_mc_segred_stage_1_parloop_131194";
    futhark_mc_segred_stage_1_parloop_131194_task.fn =
        futhark_mc_segred_stage_1_parloop_131194;
    futhark_mc_segred_stage_1_parloop_131194_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131193;
    futhark_mc_segred_stage_1_parloop_131194_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131194_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131194_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131194_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131194_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131194_task);
    
    if (futhark_mc_segred_stage_1_parloop_131194_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131194_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131194_total_end -
                 futhark_mc_segred_stage_1_parloop_131194_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131194_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131194_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131194_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_123983 = 0.0F;
    }
    
    float x_124054;
    float x_124055;
    
    for (int32_t i_124057 = 0; i_124057 < num_tasks_124049; i_124057++) {
        flat_tid_116813 = i_124057;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_124054 = defunc_2_reduce_res_123983;
            }
            // load next params
            {
                x_124055 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_124050)[flat_tid_116813];
            }
            // red body
            {
                float defunc_1_op_res_124056 = x_124054 + x_124055;
                
                defunc_2_reduce_res_123983 = defunc_1_op_res_124056;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_124050);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131191_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131191_end -
                 futhark_mc_segred_task_131191_start;
        
        ctx->futhark_mc_segred_task_131191_runs[tid]++;
        ctx->futhark_mc_segred_task_131191_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131191_iter[tid] += iterations;
    }
    *futhark_mc_task_131190->retval_defunc_2_reduce_res_123983 =
        defunc_2_reduce_res_123983;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131189(void *args, int64_t start,
                                            int64_t end, int flat_tid_116811,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131188
    *futhark_mc_segmap_parloop_struct_131188 =
    (struct futhark_mc_segmap_parloop_struct_131188 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131188->ctx;
    uint64_t futhark_mc_segmap_parloop_131189_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131189_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131188->free_n_114534;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131188->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_segmap_parloop_struct_131188->free_css_chunk_len_114580;
    int64_t gtid_116808 =
            futhark_mc_segmap_parloop_struct_131188->free_gtid_116808;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131188->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_segmap_parloop_struct_131188->free_mem_122026,
                                  .size =0, .references =NULL};
    struct memblock mem_122029 = {.desc ="mem_122029", .mem =
                                  futhark_mc_segmap_parloop_struct_131188->free_mem_122029,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_124034 = start;
    
    for (; iter_124034 < end; iter_124034++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_124047 = n_p_114536;
        int64_t gtid_116812 = iter_124034;
        int64_t remnant_124048 = iter_124034 - gtid_116812;
        float defunc_2_reduce_res_123983;
        int64_t flat_tid_116813 = (int64_t) 0;
        int32_t num_tasks_124049;
        struct futhark_mc_task_131190 futhark_mc_task_131190;
        
        futhark_mc_task_131190.ctx = ctx;
        futhark_mc_task_131190.free_n_114534 = n_114534;
        futhark_mc_task_131190.free_css_chunk_len_114580 = css_chunk_len_114580;
        futhark_mc_task_131190.free_gtid_116808 = gtid_116808;
        futhark_mc_task_131190.free_gtid_116812 = gtid_116812;
        futhark_mc_task_131190.free_Y_mem_121939 = Y_mem_121939.mem;
        futhark_mc_task_131190.free_mem_122026 = mem_122026.mem;
        futhark_mc_task_131190.retval_defunc_2_reduce_res_123983 =
            &defunc_2_reduce_res_123983;
        
        struct scheduler_segop futhark_mc_task_131190_task;
        
        futhark_mc_task_131190_task.args = &futhark_mc_task_131190;
        futhark_mc_task_131190_task.top_level_fn =
            futhark_mc_segred_task_131191;
        futhark_mc_task_131190_task.name = "futhark_mc_segred_task_131191";
        futhark_mc_task_131190_task.iterations = css_chunk_len_114580;
        futhark_mc_task_131190_task.task_time =
            &ctx->futhark_mc_segred_task_131191_total_time;
        futhark_mc_task_131190_task.task_iter =
            &ctx->futhark_mc_segred_task_131191_total_iter;
        futhark_mc_task_131190_task.sched = STATIC;
        futhark_mc_task_131190_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131191_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131190_task);
        
        if (futhark_mc_segred_task_131191_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        bool sub_series_is_not_all_nan_123996 = 0.0F <
             defunc_2_reduce_res_123983;
        bool assert_c_123997;
        
        if (!sub_series_is_not_all_nan_123996) {
            ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                   "Assertion is false: sub_series_is_not_all_nan",
                                   "-> #0  stl.fut:157:34-75\n   #1  stl.fut:150:13-159:26\n   #2  stl.fut:148:5-160:11\n   #3  stl.fut:394:3-405:33\n   #4  stl.fut:381:1-405:33\n");
            return 1;
        }
        
        float lam_res_123998 = defunc_2_reduce_res_123983;
        
        ((float *) mem_122029.mem)[gtid_116812] = lam_res_123998;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131189_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131189_end -
                 futhark_mc_segmap_parloop_131189_start;
        
        ctx->futhark_mc_segmap_parloop_131189_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131189_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131189_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131187(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116811 = tid;
    int num_tasks_124017 = info.nsubtasks;
    struct futhark_mc_task_131183 *futhark_mc_task_131183 =
                                  (struct futhark_mc_task_131183 *) args;
    struct futhark_context *ctx = futhark_mc_task_131183->ctx;
    uint64_t futhark_mc_segmap_nested_task_131187_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131187_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131183->free_n_114534;
    int64_t n_p_114536 = futhark_mc_task_131183->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_task_131183->free_css_chunk_len_114580;
    int64_t gtid_116808 = futhark_mc_task_131183->free_gtid_116808;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131183->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_task_131183->free_mem_122026,
                                  .size =0, .references =NULL};
    struct memblock mem_122029 = {.desc ="mem_122029", .mem =
                                  futhark_mc_task_131183->free_mem_122029,
                                  .size =0, .references =NULL};
    int64_t iter_124034;
    struct futhark_mc_segmap_parloop_struct_131188
    futhark_mc_segmap_parloop_struct_131188;
    
    futhark_mc_segmap_parloop_struct_131188.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131188.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131188.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131188.free_css_chunk_len_114580 =
        css_chunk_len_114580;
    futhark_mc_segmap_parloop_struct_131188.free_gtid_116808 = gtid_116808;
    futhark_mc_segmap_parloop_struct_131188.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131188.free_mem_122026 = mem_122026.mem;
    futhark_mc_segmap_parloop_struct_131188.free_mem_122029 = mem_122029.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131189_task;
    
    futhark_mc_segmap_parloop_131189_task.name =
        "futhark_mc_segmap_parloop_131189";
    futhark_mc_segmap_parloop_131189_task.fn = futhark_mc_segmap_parloop_131189;
    futhark_mc_segmap_parloop_131189_task.args =
        &futhark_mc_segmap_parloop_struct_131188;
    futhark_mc_segmap_parloop_131189_task.iterations = iterations;
    futhark_mc_segmap_parloop_131189_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131189_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131189_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131189_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131189_task);
    
    if (futhark_mc_segmap_parloop_131189_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131189_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131189_total_end -
                 futhark_mc_segmap_parloop_131189_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131189_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131189_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131189_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131187_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131187_end -
                 futhark_mc_segmap_nested_task_131187_start;
        
        ctx->futhark_mc_segmap_nested_task_131187_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131187_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131187_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131181(void *args, int64_t start,
                                            int64_t end, int flat_tid_116807,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131180
    *futhark_mc_segmap_parloop_struct_131180 =
    (struct futhark_mc_segmap_parloop_struct_131180 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131180->ctx;
    uint64_t futhark_mc_segmap_parloop_131181_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131181_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131180->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131180->free_n_114534;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131180->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_segmap_parloop_struct_131180->free_css_chunk_len_114580;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131180->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_segmap_parloop_struct_131180->free_mem_122026,
                                  .size =0, .references =NULL};
    int64_t bytes_122027 =
            futhark_mc_segmap_parloop_struct_131180->free_bytes_122027;
    struct memblock mem_122048 = {.desc ="mem_122048", .mem =
                                  futhark_mc_segmap_parloop_struct_131180->free_mem_122048,
                                  .size =0, .references =NULL};
    size_t mem_122029_cached_sizze_131182 = 0;
    char *mem_122029 = NULL;
    int64_t iterations = end - start;
    int64_t iter_123982 = start;
    
    if (mem_122029_cached_sizze_131182 < (size_t) bytes_122027) {
        mem_122029 = realloc(mem_122029, bytes_122027);
        mem_122029_cached_sizze_131182 = bytes_122027;
    }
    for (; iter_123982 < end; iter_123982++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_124015 = m_114533;
        int64_t gtid_116808 = iter_123982;
        int64_t remnant_124016 = iter_123982 - gtid_116808;
        int64_t flat_tid_116809 = (int64_t) 0;
        int32_t num_tasks_124017;
        int64_t flat_tid_116811 = (int64_t) 0;
        struct futhark_mc_task_131183 futhark_mc_task_131183;
        
        futhark_mc_task_131183.ctx = ctx;
        futhark_mc_task_131183.free_n_114534 = n_114534;
        futhark_mc_task_131183.free_n_p_114536 = n_p_114536;
        futhark_mc_task_131183.free_css_chunk_len_114580 = css_chunk_len_114580;
        futhark_mc_task_131183.free_gtid_116808 = gtid_116808;
        futhark_mc_task_131183.free_Y_mem_121939 = Y_mem_121939.mem;
        futhark_mc_task_131183.free_mem_122026 = mem_122026.mem;
        futhark_mc_task_131183.free_mem_122029 = mem_122029;
        
        struct scheduler_segop futhark_mc_task_131183_task;
        
        futhark_mc_task_131183_task.args = &futhark_mc_task_131183;
        futhark_mc_task_131183_task.top_level_fn =
            futhark_mc_segmap_task_131184;
        futhark_mc_task_131183_task.name = "futhark_mc_segmap_task_131184";
        futhark_mc_task_131183_task.iterations = n_p_114536;
        futhark_mc_task_131183_task.task_time =
            &ctx->futhark_mc_segmap_task_131184_total_time;
        futhark_mc_task_131183_task.task_iter =
            &ctx->futhark_mc_segmap_task_131184_total_iter;
        futhark_mc_task_131183_task.sched = STATIC;
        futhark_mc_task_131183_task.nested_fn =
            futhark_mc_segmap_nested_task_131187;
        
        int futhark_mc_segmap_task_131184_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131183_task);
        
        if (futhark_mc_segmap_task_131184_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122048.mem + gtid_116808 * n_p_114536 * (int64_t) 4,
                mem_122029 + (int64_t) 0, n_p_114536 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122029);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131181_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131181_end -
                 futhark_mc_segmap_parloop_131181_start;
        
        ctx->futhark_mc_segmap_parloop_131181_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131181_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131181_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131179(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116807 = tid;
    int num_tasks_123958 = info.nsubtasks;
    struct futhark_mc_task_131174 *futhark_mc_task_131174 =
                                  (struct futhark_mc_task_131174 *) args;
    struct futhark_context *ctx = futhark_mc_task_131174->ctx;
    uint64_t futhark_mc_segmap_nested_task_131179_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131179_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131174->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131174->free_n_114534;
    int64_t n_p_114536 = futhark_mc_task_131174->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_task_131174->free_css_chunk_len_114580;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131174->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_task_131174->free_mem_122026,
                                  .size =0, .references =NULL};
    int64_t bytes_122027 = futhark_mc_task_131174->free_bytes_122027;
    struct memblock mem_122048 = {.desc ="mem_122048", .mem =
                                  futhark_mc_task_131174->free_mem_122048,
                                  .size =0, .references =NULL};
    int64_t iter_123982;
    struct futhark_mc_segmap_parloop_struct_131180
    futhark_mc_segmap_parloop_struct_131180;
    
    futhark_mc_segmap_parloop_struct_131180.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131180.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131180.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131180.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131180.free_css_chunk_len_114580 =
        css_chunk_len_114580;
    futhark_mc_segmap_parloop_struct_131180.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131180.free_mem_122026 = mem_122026.mem;
    futhark_mc_segmap_parloop_struct_131180.free_bytes_122027 = bytes_122027;
    futhark_mc_segmap_parloop_struct_131180.free_mem_122048 = mem_122048.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131181_task;
    
    futhark_mc_segmap_parloop_131181_task.name =
        "futhark_mc_segmap_parloop_131181";
    futhark_mc_segmap_parloop_131181_task.fn = futhark_mc_segmap_parloop_131181;
    futhark_mc_segmap_parloop_131181_task.args =
        &futhark_mc_segmap_parloop_struct_131180;
    futhark_mc_segmap_parloop_131181_task.iterations = iterations;
    futhark_mc_segmap_parloop_131181_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131181_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131181_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131181_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131181_task);
    
    if (futhark_mc_segmap_parloop_131181_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131181_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131181_total_end -
                 futhark_mc_segmap_parloop_131181_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131181_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131181_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131181_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131179_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131179_end -
                 futhark_mc_segmap_nested_task_131179_start;
        
        ctx->futhark_mc_segmap_nested_task_131179_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131179_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131179_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131195 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_jump_114542;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    bool free_x_114611;
    int64_t free_min_res_114683;
    bool free_empty_slice_114688;
    int64_t free_m_114689;
    float free_i64_res_114690;
    int64_t free_bytes_121940;
    char *free_mem_121979;
    char *free_mem_121982;
    int64_t free_bytes_122055;
    int64_t free_bytes_122058;
    char *free_mem_122124;
    char *free_mem_122128;
};
struct futhark_mc_segmap_parloop_struct_131197 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_jump_114542;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    bool free_x_114611;
    int64_t free_min_res_114683;
    bool free_empty_slice_114688;
    int64_t free_m_114689;
    float free_i64_res_114690;
    int64_t free_bytes_121940;
    char *free_mem_121979;
    char *free_mem_121982;
    int64_t free_bytes_122055;
    int64_t free_bytes_122058;
    char *free_mem_122124;
    char *free_mem_122128;
};
static int futhark_mc_segmap_parloop_131198(void *args, int64_t start,
                                            int64_t end, int flat_tid_116868,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131197
    *futhark_mc_segmap_parloop_struct_131197 =
    (struct futhark_mc_segmap_parloop_struct_131197 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131197->ctx;
    uint64_t futhark_mc_segmap_parloop_131198_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131198_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131197->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131197->free_n_114534;
    int64_t l_jump_114542 =
            futhark_mc_segmap_parloop_struct_131197->free_l_jump_114542;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131197->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131197->free_i_114610;
    bool x_114611 = futhark_mc_segmap_parloop_struct_131197->free_x_114611;
    int64_t min_res_114683 =
            futhark_mc_segmap_parloop_struct_131197->free_min_res_114683;
    bool empty_slice_114688 =
         futhark_mc_segmap_parloop_struct_131197->free_empty_slice_114688;
    int64_t m_114689 = futhark_mc_segmap_parloop_struct_131197->free_m_114689;
    float i64_res_114690 =
          futhark_mc_segmap_parloop_struct_131197->free_i64_res_114690;
    int64_t bytes_121940 =
            futhark_mc_segmap_parloop_struct_131197->free_bytes_121940;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131197->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131197->free_mem_121982,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131197->free_bytes_122055;
    int64_t bytes_122058 =
            futhark_mc_segmap_parloop_struct_131197->free_bytes_122058;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131197->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131197->free_mem_122128,
                                  .size =0, .references =NULL};
    size_t mem_122063_cached_sizze_131199 = 0;
    char *mem_122063 = NULL;
    size_t mem_122066_cached_sizze_131200 = 0;
    char *mem_122066 = NULL;
    size_t mem_122093_cached_sizze_131201 = 0;
    char *mem_122093 = NULL;
    size_t mem_122096_cached_sizze_131202 = 0;
    char *mem_122096 = NULL;
    int64_t iterations = end - start;
    int64_t iter_124059 = start;
    
    if (mem_122063_cached_sizze_131199 < (size_t) bytes_121940) {
        mem_122063 = realloc(mem_122063, bytes_121940);
        mem_122063_cached_sizze_131199 = bytes_121940;
    }
    if (mem_122066_cached_sizze_131200 < (size_t) bytes_121940) {
        mem_122066 = realloc(mem_122066, bytes_121940);
        mem_122066_cached_sizze_131200 = bytes_121940;
    }
    if (mem_122093_cached_sizze_131201 < (size_t) bytes_122055) {
        mem_122093 = realloc(mem_122093, bytes_122055);
        mem_122093_cached_sizze_131201 = bytes_122055;
    }
    if (mem_122096_cached_sizze_131202 < (size_t) bytes_122058) {
        mem_122096 = realloc(mem_122096, bytes_122058);
        mem_122096_cached_sizze_131202 = bytes_122058;
    }
    for (; iter_124059 < end; iter_124059++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_124172 = m_114533;
        int64_t gtid_116869 = iter_124059;
        int64_t remnant_124173 = iter_124059 - gtid_116869;
        int64_t x_114694 = ((int64_t *) mem_121982.mem)[gtid_116869];
        
        for (int64_t i_124060 = 0; i_124060 < n_114534; i_124060++) {
            int64_t x_124063 = ((int64_t *) mem_121979.mem)[gtid_116869 *
                                                            n_114534 +
                                                            i_124060];
            int64_t defunc_0_f_res_124064 = add64((int64_t) 1, x_124063);
            bool cond_124065 = slt64(defunc_0_f_res_124064, (int64_t) 0);
            int64_t defunc_0_f_res_124066;
            
            if (cond_124065) {
                defunc_0_f_res_124066 = (int64_t) 9223372036854775807;
            } else {
                defunc_0_f_res_124066 = defunc_0_f_res_124064;
            }
            ((int64_t *) mem_122063)[i_124060] = defunc_0_f_res_124066;
            ((int64_t *) mem_122066)[i_124060] = defunc_0_f_res_124064;
        }
        
        int64_t min_arg_114701 = sub64(x_114694, min_res_114683);
        float i64_res_114702 = sitofp_i64_f32(x_114694);
        float x_114703 = i64_res_114690 - i64_res_114702;
        float max_arg_114704 = x_114703 / 2.0F;
        float max_res_114705 = fmax32(0.0F, max_arg_114704);
        
        for (int64_t i_124069 = 0; i_124069 < l_n_m_114584; i_124069++) {
            int64_t min_arg_124072 = mul64(l_jump_114542, i_124069);
            int64_t min_res_124073 = smin64(i_114610, min_arg_124072);
            int64_t defunc_0_g_res_124074 = add64((int64_t) 1, min_res_124073);
            bool nearest_idx_124075;
            int64_t nearest_idx_124076;
            int64_t nearest_idx_124077;
            bool loop_while_124078;
            int64_t low_124079;
            int64_t high_124080;
            
            loop_while_124078 = x_114611;
            low_124079 = (int64_t) 0;
            high_124080 = i_114610;
            while (loop_while_124078) {
                int64_t x_124081 = add64(low_124079, high_124080);
                int64_t mid_124082 = sdiv64(x_124081, (int64_t) 2);
                bool x_124083 = sle64((int64_t) 0, mid_124082);
                bool y_124084 = slt64(mid_124082, n_114534);
                bool bounds_check_124085 = x_124083 && y_124084;
                bool index_certs_124086;
                
                if (!bounds_check_124085) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", mid_124082,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  loess.fut:343:19-30\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                int64_t x_124087 = ((int64_t *) mem_122063)[mid_124082];
                bool cond_124088 = sle64(defunc_0_g_res_124074, x_124087);
                int64_t loopres_124089;
                int64_t loopres_124090;
                
                if (cond_124088) {
                    int64_t loopres_t_res_124091 = sub64(mid_124082,
                                                         (int64_t) 1);
                    
                    loopres_124089 = low_124079;
                    loopres_124090 = loopres_t_res_124091;
                } else {
                    int64_t loopres_f_res_124092 = add64((int64_t) 1,
                                                         mid_124082);
                    
                    loopres_124089 = loopres_f_res_124092;
                    loopres_124090 = high_124080;
                }
                
                bool loop_cond_124093 = sle64(loopres_124089, loopres_124090);
                bool loop_while_tmp_124178 = loop_cond_124093;
                int64_t low_tmp_124179 = loopres_124089;
                int64_t high_tmp_124180 = loopres_124090;
                
                loop_while_124078 = loop_while_tmp_124178;
                low_124079 = low_tmp_124179;
                high_124080 = high_tmp_124180;
            }
            nearest_idx_124075 = loop_while_124078;
            nearest_idx_124076 = low_124079;
            nearest_idx_124077 = high_124080;
            
            int64_t max_arg_124094 = sub64(nearest_idx_124076, min_res_114683);
            int64_t max_res_124095 = smax64((int64_t) 0, max_arg_124094);
            int64_t j_124096 = add64(min_res_114683, max_res_124095);
            int64_t i_p_m_t_s_124097 = add64(m_114689, max_res_124095);
            bool zzero_leq_i_p_m_t_s_124098 = sle64((int64_t) 0,
                                                    i_p_m_t_s_124097);
            bool i_p_m_t_s_leq_w_124099 = slt64(i_p_m_t_s_124097, n_114534);
            bool zzero_lte_i_124100 = sle64((int64_t) 0, max_res_124095);
            bool i_lte_j_124101 = sle64(max_res_124095, j_124096);
            bool y_124102 = i_p_m_t_s_leq_w_124099 && zzero_lte_i_124100;
            bool y_124103 = zzero_leq_i_p_m_t_s_124098 && y_124102;
            bool y_124104 = i_lte_j_124101 && y_124103;
            bool forwards_ok_124105 = zzero_lte_i_124100 && y_124104;
            bool ok_or_empty_124106 = empty_slice_114688 || forwards_ok_124105;
            bool index_certs_124107;
            
            if (!ok_or_empty_124106) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", max_res_124095, ":", j_124096,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  loess.fut:350:25-55\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                return 1;
            }
            
            int64_t defunc_2_reduce_res_124108;
            int64_t redout_124110 = (int64_t) 0;
            
            for (int64_t i_124109 = 0; i_124109 < min_res_114683; i_124109++) {
                int64_t slice_124111 = max_res_124095 + i_124109;
                int64_t x_124112 = ((int64_t *) mem_122066)[slice_124111];
                int64_t abs_arg_124113 = sub64(x_124112, defunc_0_g_res_124074);
                int64_t abs_res_124114 = abs(abs_arg_124113);
                int64_t defunc_1_op_res_124115 = add64(abs_res_124114,
                                                       redout_124110);
                int64_t redout_tmp_124181 = defunc_1_op_res_124115;
                
                redout_124110 = redout_tmp_124181;
            }
            defunc_2_reduce_res_124108 = redout_124110;
            
            int64_t idx_124116;
            int64_t idx_124117;
            int64_t idx_124118;
            int64_t idx_124119;
            int64_t best_idx_124121;
            int64_t last_idx_124122;
            int64_t best_sum_124123;
            int64_t curr_sum_124124;
            
            best_idx_124121 = max_res_124095;
            last_idx_124122 = max_res_124095;
            best_sum_124123 = defunc_2_reduce_res_124108;
            curr_sum_124124 = defunc_2_reduce_res_124108;
            for (int64_t j_124120 = 0; j_124120 < min_res_114683; j_124120++) {
                int64_t new_idx_124125 = add64(max_res_124095, j_124120);
                int64_t x_124126 = add64(min_res_114683, new_idx_124125);
                bool cond_124127 = slt64(x_114694, x_124126);
                int64_t new_sum_124128;
                
                if (cond_124127) {
                    new_sum_124128 = (int64_t) 9223372036854775807;
                } else {
                    bool x_124129 = sle64((int64_t) 0, last_idx_124122);
                    bool y_124130 = slt64(last_idx_124122, n_114534);
                    bool bounds_check_124131 = x_124129 && y_124130;
                    bool index_certs_124132;
                    
                    if (!bounds_check_124131) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", last_idx_124122,
                                      "] out of bounds for array of shape [",
                                      n_114534, "].",
                                      "-> #0  loess.fut:362:51-66\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                        return 1;
                    }
                    
                    int64_t y_124133 =
                            ((int64_t *) mem_122066)[last_idx_124122];
                    int64_t binop_p_124134 = sub64(defunc_0_g_res_124074,
                                                   y_124133);
                    int64_t defunc_0_f_res_124135 = abs(binop_p_124134);
                    int64_t x_124136 = sub64(curr_sum_124124,
                                             defunc_0_f_res_124135);
                    int64_t min_arg_124137 = add64(min_res_114683,
                                                   last_idx_124122);
                    int64_t min_res_124138 = smin64(i_114610, min_arg_124137);
                    bool x_124139 = sle64((int64_t) 0, min_res_124138);
                    bool y_124140 = slt64(min_res_124138, n_114534);
                    bool bounds_check_124141 = x_124139 && y_124140;
                    bool index_certs_124142;
                    
                    if (!bounds_check_124141) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", min_res_124138,
                                      "] out of bounds for array of shape [",
                                      n_114534, "].",
                                      "-> #0  loess.fut:363:51-88\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                        return 1;
                    }
                    
                    int64_t y_124143 = ((int64_t *) mem_122066)[min_res_124138];
                    int64_t binop_p_124144 = sub64(defunc_0_g_res_124074,
                                                   y_124143);
                    int64_t defunc_0_f_res_124145 = abs(binop_p_124144);
                    int64_t new_sum_f_res_124146 = add64(x_124136,
                                                         defunc_0_f_res_124145);
                    
                    new_sum_124128 = new_sum_f_res_124146;
                }
                
                bool cond_124147 = sle64(new_sum_124128, best_sum_124123);
                int64_t loopres_124148;
                
                if (cond_124147) {
                    loopres_124148 = new_idx_124125;
                } else {
                    loopres_124148 = best_idx_124121;
                }
                
                int64_t loopres_124149;
                
                if (cond_124147) {
                    loopres_124149 = new_sum_124128;
                } else {
                    loopres_124149 = best_sum_124123;
                }
                
                int64_t best_idx_tmp_124182 = loopres_124148;
                int64_t last_idx_tmp_124183 = new_idx_124125;
                int64_t best_sum_tmp_124184 = loopres_124149;
                int64_t curr_sum_tmp_124185 = new_sum_124128;
                
                best_idx_124121 = best_idx_tmp_124182;
                last_idx_124122 = last_idx_tmp_124183;
                best_sum_124123 = best_sum_tmp_124184;
                curr_sum_124124 = curr_sum_tmp_124185;
            }
            idx_124116 = best_idx_124121;
            idx_124117 = last_idx_124122;
            idx_124118 = best_sum_124123;
            idx_124119 = curr_sum_124124;
            
            int64_t min_res_124150 = smin64(min_arg_114701, idx_124116);
            int64_t x_124151 = add64(min_res_114683, min_res_124150);
            int64_t r_124152 = sub64(x_124151, (int64_t) 1);
            bool x_124153 = sle64((int64_t) 0, r_124152);
            bool y_124154 = slt64(r_124152, n_114534);
            bool bounds_check_124155 = x_124153 && y_124154;
            bool index_certs_124156;
            
            if (!bounds_check_124155) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", r_124152,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  loess.fut:386:66-73\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:383:3-389:25\n   #4  loess.fut:401:18-55\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                return 1;
            }
            
            int64_t x_124157 = ((int64_t *) mem_121979.mem)[gtid_116869 *
                                                            n_114534 +
                                                            r_124152];
            int64_t abs_arg_124158 = sub64(x_124157, min_res_124073);
            int64_t abs_res_124159 = abs(abs_arg_124158);
            bool x_124160 = sle64((int64_t) 0, min_res_124150);
            bool y_124161 = slt64(min_res_124150, n_114534);
            bool bounds_check_124162 = x_124160 && y_124161;
            bool index_certs_124163;
            
            if (!bounds_check_124162) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", min_res_124150,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  loess.fut:386:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:383:3-389:25\n   #4  loess.fut:401:18-55\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                return 1;
            }
            
            int64_t x_124164 = ((int64_t *) mem_121979.mem)[gtid_116869 *
                                                            n_114534 +
                                                            min_res_124150];
            int64_t abs_arg_124165 = sub64(x_124164, min_res_124073);
            int64_t abs_res_124166 = abs(abs_arg_124165);
            int64_t max_res_124167 = smax64(abs_res_124159, abs_res_124166);
            float defunc_0_f_res_124168 = sitofp_i64_f32(max_res_124167);
            float defunc_1_f_res_124169 = max_res_114705 +
                  defunc_0_f_res_124168;
            
            ((float *) mem_122093)[i_124069] = defunc_1_f_res_124169;
            ((int64_t *) mem_122096)[i_124069] = min_res_124150;
        }
        memmove(mem_122124.mem + gtid_116869 * l_n_m_114584 * (int64_t) 8,
                mem_122096 + (int64_t) 0, l_n_m_114584 * (int64_t) 8);
        memmove(mem_122128.mem + gtid_116869 * l_n_m_114584 * (int64_t) 4,
                mem_122093 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122063);
    free(mem_122066);
    free(mem_122093);
    free(mem_122096);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131198_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131198_end -
                 futhark_mc_segmap_parloop_131198_start;
        
        ctx->futhark_mc_segmap_parloop_131198_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131198_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131198_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131196(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116868 = tid;
    int num_tasks_124058 = info.nsubtasks;
    struct futhark_mc_task_131195 *futhark_mc_task_131195 =
                                  (struct futhark_mc_task_131195 *) args;
    struct futhark_context *ctx = futhark_mc_task_131195->ctx;
    uint64_t futhark_mc_segmap_task_131196_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131196_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131195->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131195->free_n_114534;
    int64_t l_jump_114542 = futhark_mc_task_131195->free_l_jump_114542;
    int64_t l_n_m_114584 = futhark_mc_task_131195->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131195->free_i_114610;
    bool x_114611 = futhark_mc_task_131195->free_x_114611;
    int64_t min_res_114683 = futhark_mc_task_131195->free_min_res_114683;
    bool empty_slice_114688 = futhark_mc_task_131195->free_empty_slice_114688;
    int64_t m_114689 = futhark_mc_task_131195->free_m_114689;
    float i64_res_114690 = futhark_mc_task_131195->free_i64_res_114690;
    int64_t bytes_121940 = futhark_mc_task_131195->free_bytes_121940;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131195->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131195->free_mem_121982,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131195->free_bytes_122055;
    int64_t bytes_122058 = futhark_mc_task_131195->free_bytes_122058;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131195->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131195->free_mem_122128,
                                  .size =0, .references =NULL};
    int64_t iter_124059;
    struct futhark_mc_segmap_parloop_struct_131197
    futhark_mc_segmap_parloop_struct_131197;
    
    futhark_mc_segmap_parloop_struct_131197.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131197.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131197.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131197.free_l_jump_114542 = l_jump_114542;
    futhark_mc_segmap_parloop_struct_131197.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131197.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131197.free_x_114611 = x_114611;
    futhark_mc_segmap_parloop_struct_131197.free_min_res_114683 =
        min_res_114683;
    futhark_mc_segmap_parloop_struct_131197.free_empty_slice_114688 =
        empty_slice_114688;
    futhark_mc_segmap_parloop_struct_131197.free_m_114689 = m_114689;
    futhark_mc_segmap_parloop_struct_131197.free_i64_res_114690 =
        i64_res_114690;
    futhark_mc_segmap_parloop_struct_131197.free_bytes_121940 = bytes_121940;
    futhark_mc_segmap_parloop_struct_131197.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131197.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131197.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131197.free_bytes_122058 = bytes_122058;
    futhark_mc_segmap_parloop_struct_131197.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131197.free_mem_122128 = mem_122128.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131198_task;
    
    futhark_mc_segmap_parloop_131198_task.name =
        "futhark_mc_segmap_parloop_131198";
    futhark_mc_segmap_parloop_131198_task.fn = futhark_mc_segmap_parloop_131198;
    futhark_mc_segmap_parloop_131198_task.args =
        &futhark_mc_segmap_parloop_struct_131197;
    futhark_mc_segmap_parloop_131198_task.iterations = iterations;
    futhark_mc_segmap_parloop_131198_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131198_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131198_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131198_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131198_task);
    
    if (futhark_mc_segmap_parloop_131198_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131198_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131198_total_end -
                 futhark_mc_segmap_parloop_131198_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131198_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131198_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131198_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131196_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131196_end -
                 futhark_mc_segmap_task_131196_start;
        
        ctx->futhark_mc_segmap_task_131196_runs[tid]++;
        ctx->futhark_mc_segmap_task_131196_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131196_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131204 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_jump_114542;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    bool free_x_114611;
    int64_t free_min_res_114683;
    bool free_empty_slice_114688;
    int64_t free_m_114689;
    float free_i64_res_114690;
    int64_t free_bytes_121940;
    char *free_mem_121979;
    char *free_mem_121982;
    int64_t free_bytes_122055;
    int64_t free_bytes_122058;
    char *free_mem_122124;
    char *free_mem_122128;
};
struct futhark_mc_task_131210 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_116871;
    char *free_mem_121979;
    char *free_mem_122051;
    char *free_mem_122054;
};
struct futhark_mc_segmap_parloop_struct_131212 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_116871;
    char *free_mem_121979;
    char *free_mem_122051;
    char *free_mem_122054;
};
static int futhark_mc_segmap_parloop_131213(void *args, int64_t start,
                                            int64_t end, int flat_tid_116872,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131212
    *futhark_mc_segmap_parloop_struct_131212 =
    (struct futhark_mc_segmap_parloop_struct_131212 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131212->ctx;
    uint64_t futhark_mc_segmap_parloop_131213_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131213_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131212->free_n_114534;
    int64_t gtid_116871 =
            futhark_mc_segmap_parloop_struct_131212->free_gtid_116871;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131212->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122051 = {.desc ="mem_122051", .mem =
                                  futhark_mc_segmap_parloop_struct_131212->free_mem_122051,
                                  .size =0, .references =NULL};
    struct memblock mem_122054 = {.desc ="mem_122054", .mem =
                                  futhark_mc_segmap_parloop_struct_131212->free_mem_122054,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_124390 = start;
    
    for (; iter_124390 < end; iter_124390++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_124391 = n_114534;
        int64_t gtid_116873 = iter_124390;
        int64_t remnant_124392 = iter_124390 - gtid_116873;
        int64_t x_124187 = ((int64_t *) mem_121979.mem)[gtid_116871 * n_114534 +
                                                        gtid_116873];
        int64_t defunc_0_f_res_124188 = add64((int64_t) 1, x_124187);
        bool cond_124189 = slt64(defunc_0_f_res_124188, (int64_t) 0);
        int64_t defunc_0_f_res_124190;
        
        if (cond_124189) {
            defunc_0_f_res_124190 = (int64_t) 9223372036854775807;
        } else {
            defunc_0_f_res_124190 = defunc_0_f_res_124188;
        }
        ((int64_t *) mem_122051.mem)[gtid_116873] = defunc_0_f_res_124190;
        ((int64_t *) mem_122054.mem)[gtid_116873] = defunc_0_f_res_124188;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131213_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131213_end -
                 futhark_mc_segmap_parloop_131213_start;
        
        ctx->futhark_mc_segmap_parloop_131213_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131213_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131213_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131211(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116872 = tid;
    int num_tasks_124389 = info.nsubtasks;
    struct futhark_mc_task_131210 *futhark_mc_task_131210 =
                                  (struct futhark_mc_task_131210 *) args;
    struct futhark_context *ctx = futhark_mc_task_131210->ctx;
    uint64_t futhark_mc_segmap_task_131211_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131211_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131210->free_n_114534;
    int64_t gtid_116871 = futhark_mc_task_131210->free_gtid_116871;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131210->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122051 = {.desc ="mem_122051", .mem =
                                  futhark_mc_task_131210->free_mem_122051,
                                  .size =0, .references =NULL};
    struct memblock mem_122054 = {.desc ="mem_122054", .mem =
                                  futhark_mc_task_131210->free_mem_122054,
                                  .size =0, .references =NULL};
    int64_t iter_124390;
    struct futhark_mc_segmap_parloop_struct_131212
    futhark_mc_segmap_parloop_struct_131212;
    
    futhark_mc_segmap_parloop_struct_131212.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131212.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131212.free_gtid_116871 = gtid_116871;
    futhark_mc_segmap_parloop_struct_131212.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131212.free_mem_122051 = mem_122051.mem;
    futhark_mc_segmap_parloop_struct_131212.free_mem_122054 = mem_122054.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131213_task;
    
    futhark_mc_segmap_parloop_131213_task.name =
        "futhark_mc_segmap_parloop_131213";
    futhark_mc_segmap_parloop_131213_task.fn = futhark_mc_segmap_parloop_131213;
    futhark_mc_segmap_parloop_131213_task.args =
        &futhark_mc_segmap_parloop_struct_131212;
    futhark_mc_segmap_parloop_131213_task.iterations = iterations;
    futhark_mc_segmap_parloop_131213_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131213_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131213_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131213_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131213_task);
    
    if (futhark_mc_segmap_parloop_131213_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131213_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131213_total_end -
                 futhark_mc_segmap_parloop_131213_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131213_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131213_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131213_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131211_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131211_end -
                 futhark_mc_segmap_task_131211_start;
        
        ctx->futhark_mc_segmap_task_131211_runs[tid]++;
        ctx->futhark_mc_segmap_task_131211_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131211_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131214 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_jump_114542;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    bool free_x_114611;
    int64_t free_min_res_114683;
    bool free_empty_slice_114688;
    int64_t free_m_114689;
    int64_t free_gtid_116871;
    int64_t free_x_116980;
    int64_t free_min_arg_116987;
    float free_max_res_116991;
    char *free_mem_121979;
    char *free_mem_122051;
    char *free_mem_122054;
    char *free_mem_122057;
    char *free_mem_122060;
};
struct futhark_mc_segmap_parloop_struct_131216 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_jump_114542;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    bool free_x_114611;
    int64_t free_min_res_114683;
    bool free_empty_slice_114688;
    int64_t free_m_114689;
    int64_t free_gtid_116871;
    int64_t free_x_116980;
    int64_t free_min_arg_116987;
    float free_max_res_116991;
    char *free_mem_121979;
    char *free_mem_122051;
    char *free_mem_122054;
    char *free_mem_122057;
    char *free_mem_122060;
};
static int futhark_mc_segmap_parloop_131217(void *args, int64_t start,
                                            int64_t end, int flat_tid_116874,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131216
    *futhark_mc_segmap_parloop_struct_131216 =
    (struct futhark_mc_segmap_parloop_struct_131216 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131216->ctx;
    uint64_t futhark_mc_segmap_parloop_131217_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131217_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131216->free_n_114534;
    int64_t l_jump_114542 =
            futhark_mc_segmap_parloop_struct_131216->free_l_jump_114542;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131216->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131216->free_i_114610;
    bool x_114611 = futhark_mc_segmap_parloop_struct_131216->free_x_114611;
    int64_t min_res_114683 =
            futhark_mc_segmap_parloop_struct_131216->free_min_res_114683;
    bool empty_slice_114688 =
         futhark_mc_segmap_parloop_struct_131216->free_empty_slice_114688;
    int64_t m_114689 = futhark_mc_segmap_parloop_struct_131216->free_m_114689;
    int64_t gtid_116871 =
            futhark_mc_segmap_parloop_struct_131216->free_gtid_116871;
    int64_t x_116980 = futhark_mc_segmap_parloop_struct_131216->free_x_116980;
    int64_t min_arg_116987 =
            futhark_mc_segmap_parloop_struct_131216->free_min_arg_116987;
    float max_res_116991 =
          futhark_mc_segmap_parloop_struct_131216->free_max_res_116991;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131216->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122051 = {.desc ="mem_122051", .mem =
                                  futhark_mc_segmap_parloop_struct_131216->free_mem_122051,
                                  .size =0, .references =NULL};
    struct memblock mem_122054 = {.desc ="mem_122054", .mem =
                                  futhark_mc_segmap_parloop_struct_131216->free_mem_122054,
                                  .size =0, .references =NULL};
    struct memblock mem_122057 = {.desc ="mem_122057", .mem =
                                  futhark_mc_segmap_parloop_struct_131216->free_mem_122057,
                                  .size =0, .references =NULL};
    struct memblock mem_122060 = {.desc ="mem_122060", .mem =
                                  futhark_mc_segmap_parloop_struct_131216->free_mem_122060,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_124394 = start;
    
    for (; iter_124394 < end; iter_124394++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_124448 = l_n_m_114584;
        int64_t gtid_116875 = iter_124394;
        int64_t remnant_124449 = iter_124394 - gtid_116875;
        int64_t min_arg_124289 = mul64(l_jump_114542, gtid_116875);
        int64_t min_res_124290 = smin64(i_114610, min_arg_124289);
        int64_t defunc_0_g_res_124291 = add64((int64_t) 1, min_res_124290);
        bool nearest_idx_124292;
        int64_t nearest_idx_124293;
        int64_t nearest_idx_124294;
        bool loop_while_124395;
        int64_t low_124396;
        int64_t high_124397;
        
        loop_while_124395 = x_114611;
        low_124396 = (int64_t) 0;
        high_124397 = i_114610;
        while (loop_while_124395) {
            int64_t x_124398 = add64(low_124396, high_124397);
            int64_t mid_124399 = sdiv64(x_124398, (int64_t) 2);
            bool x_124400 = sle64((int64_t) 0, mid_124399);
            bool y_124401 = slt64(mid_124399, n_114534);
            bool bounds_check_124402 = x_124400 && y_124401;
            bool index_certs_124403;
            
            if (!bounds_check_124402) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", mid_124399,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  loess.fut:343:19-30\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                return 1;
            }
            
            int64_t x_124404 = ((int64_t *) mem_122051.mem)[mid_124399];
            bool cond_124405 = sle64(defunc_0_g_res_124291, x_124404);
            int64_t loopres_124406;
            int64_t loopres_124407;
            
            if (cond_124405) {
                int64_t loopres_t_res_124408 = sub64(mid_124399, (int64_t) 1);
                
                loopres_124406 = low_124396;
                loopres_124407 = loopres_t_res_124408;
            } else {
                int64_t loopres_f_res_124409 = add64((int64_t) 1, mid_124399);
                
                loopres_124406 = loopres_f_res_124409;
                loopres_124407 = high_124397;
            }
            
            bool loop_cond_124410 = sle64(loopres_124406, loopres_124407);
            bool loop_while_tmp_124450 = loop_cond_124410;
            int64_t low_tmp_124451 = loopres_124406;
            int64_t high_tmp_124452 = loopres_124407;
            
            loop_while_124395 = loop_while_tmp_124450;
            low_124396 = low_tmp_124451;
            high_124397 = high_tmp_124452;
        }
        nearest_idx_124292 = loop_while_124395;
        nearest_idx_124293 = low_124396;
        nearest_idx_124294 = high_124397;
        
        int64_t max_arg_124311 = sub64(nearest_idx_124293, min_res_114683);
        int64_t max_res_124312 = smax64((int64_t) 0, max_arg_124311);
        int64_t j_124313 = add64(min_res_114683, max_res_124312);
        int64_t i_p_m_t_s_124314 = add64(m_114689, max_res_124312);
        bool zzero_leq_i_p_m_t_s_124315 = sle64((int64_t) 0, i_p_m_t_s_124314);
        bool i_p_m_t_s_leq_w_124316 = slt64(i_p_m_t_s_124314, n_114534);
        bool zzero_lte_i_124317 = sle64((int64_t) 0, max_res_124312);
        bool i_lte_j_124318 = sle64(max_res_124312, j_124313);
        bool y_124319 = i_p_m_t_s_leq_w_124316 && zzero_lte_i_124317;
        bool y_124320 = zzero_leq_i_p_m_t_s_124315 && y_124319;
        bool y_124321 = i_lte_j_124318 && y_124320;
        bool forwards_ok_124322 = zzero_lte_i_124317 && y_124321;
        bool ok_or_empty_124323 = empty_slice_114688 || forwards_ok_124322;
        bool index_certs_124324;
        
        if (!ok_or_empty_124323) {
            ctx->error =
                msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                          "Index [", max_res_124312, ":", j_124313,
                          "] out of bounds for array of shape [", n_114534,
                          "].",
                          "-> #0  loess.fut:350:25-55\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
            return 1;
        }
        
        int64_t defunc_2_reduce_res_124325;
        int64_t redout_124412 = (int64_t) 0;
        
        for (int64_t i_124411 = 0; i_124411 < min_res_114683; i_124411++) {
            int64_t slice_124413 = max_res_124312 + i_124411;
            int64_t x_124414 = ((int64_t *) mem_122054.mem)[slice_124413];
            int64_t abs_arg_124415 = sub64(x_124414, defunc_0_g_res_124291);
            int64_t abs_res_124416 = abs(abs_arg_124415);
            int64_t defunc_1_op_res_124417 = add64(abs_res_124416,
                                                   redout_124412);
            int64_t redout_tmp_124453 = defunc_1_op_res_124417;
            
            redout_124412 = redout_tmp_124453;
        }
        defunc_2_reduce_res_124325 = redout_124412;
        
        int64_t idx_124333;
        int64_t idx_124334;
        int64_t idx_124335;
        int64_t idx_124336;
        int64_t best_idx_124419;
        int64_t last_idx_124420;
        int64_t best_sum_124421;
        int64_t curr_sum_124422;
        
        best_idx_124419 = max_res_124312;
        last_idx_124420 = max_res_124312;
        best_sum_124421 = defunc_2_reduce_res_124325;
        curr_sum_124422 = defunc_2_reduce_res_124325;
        for (int64_t j_124418 = 0; j_124418 < min_res_114683; j_124418++) {
            int64_t new_idx_124423 = add64(max_res_124312, j_124418);
            int64_t x_124424 = add64(min_res_114683, new_idx_124423);
            bool cond_124425 = slt64(x_116980, x_124424);
            int64_t new_sum_124426;
            
            if (cond_124425) {
                new_sum_124426 = (int64_t) 9223372036854775807;
            } else {
                bool x_124427 = sle64((int64_t) 0, last_idx_124420);
                bool y_124428 = slt64(last_idx_124420, n_114534);
                bool bounds_check_124429 = x_124427 && y_124428;
                bool index_certs_124430;
                
                if (!bounds_check_124429) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", last_idx_124420,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  loess.fut:362:51-66\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                int64_t y_124431 =
                        ((int64_t *) mem_122054.mem)[last_idx_124420];
                int64_t binop_p_124432 = sub64(defunc_0_g_res_124291, y_124431);
                int64_t defunc_0_f_res_124433 = abs(binop_p_124432);
                int64_t x_124434 = sub64(curr_sum_124422,
                                         defunc_0_f_res_124433);
                int64_t min_arg_124435 = add64(min_res_114683, last_idx_124420);
                int64_t min_res_124436 = smin64(i_114610, min_arg_124435);
                bool x_124437 = sle64((int64_t) 0, min_res_124436);
                bool y_124438 = slt64(min_res_124436, n_114534);
                bool bounds_check_124439 = x_124437 && y_124438;
                bool index_certs_124440;
                
                if (!bounds_check_124439) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", min_res_124436,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  loess.fut:363:51-88\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                int64_t y_124441 = ((int64_t *) mem_122054.mem)[min_res_124436];
                int64_t binop_p_124442 = sub64(defunc_0_g_res_124291, y_124441);
                int64_t defunc_0_f_res_124443 = abs(binop_p_124442);
                int64_t new_sum_f_res_124444 = add64(x_124434,
                                                     defunc_0_f_res_124443);
                
                new_sum_124426 = new_sum_f_res_124444;
            }
            
            bool cond_124445 = sle64(new_sum_124426, best_sum_124421);
            int64_t loopres_124446;
            
            if (cond_124445) {
                loopres_124446 = new_idx_124423;
            } else {
                loopres_124446 = best_idx_124419;
            }
            
            int64_t loopres_124447;
            
            if (cond_124445) {
                loopres_124447 = new_sum_124426;
            } else {
                loopres_124447 = best_sum_124421;
            }
            
            int64_t best_idx_tmp_124454 = loopres_124446;
            int64_t last_idx_tmp_124455 = new_idx_124423;
            int64_t best_sum_tmp_124456 = loopres_124447;
            int64_t curr_sum_tmp_124457 = new_sum_124426;
            
            best_idx_124419 = best_idx_tmp_124454;
            last_idx_124420 = last_idx_tmp_124455;
            best_sum_124421 = best_sum_tmp_124456;
            curr_sum_124422 = curr_sum_tmp_124457;
        }
        idx_124333 = best_idx_124419;
        idx_124334 = last_idx_124420;
        idx_124335 = best_sum_124421;
        idx_124336 = curr_sum_124422;
        
        int64_t min_res_124367 = smin64(min_arg_116987, idx_124333);
        int64_t x_124368 = add64(min_res_114683, min_res_124367);
        int64_t r_124369 = sub64(x_124368, (int64_t) 1);
        bool x_124370 = sle64((int64_t) 0, r_124369);
        bool y_124371 = slt64(r_124369, n_114534);
        bool bounds_check_124372 = x_124370 && y_124371;
        bool index_certs_124373;
        
        if (!bounds_check_124372) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", r_124369,
                                   "] out of bounds for array of shape [",
                                   n_114534, "].",
                                   "-> #0  loess.fut:386:66-73\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:383:3-389:25\n   #4  loess.fut:401:18-55\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
            return 1;
        }
        
        int64_t x_124374 = ((int64_t *) mem_121979.mem)[gtid_116871 * n_114534 +
                                                        r_124369];
        int64_t abs_arg_124375 = sub64(x_124374, min_res_124290);
        int64_t abs_res_124376 = abs(abs_arg_124375);
        bool x_124377 = sle64((int64_t) 0, min_res_124367);
        bool y_124378 = slt64(min_res_124367, n_114534);
        bool bounds_check_124379 = x_124377 && y_124378;
        bool index_certs_124380;
        
        if (!bounds_check_124379) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", min_res_124367,
                                   "] out of bounds for array of shape [",
                                   n_114534, "].",
                                   "-> #0  loess.fut:386:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:383:3-389:25\n   #4  loess.fut:401:18-55\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
            return 1;
        }
        
        int64_t x_124381 = ((int64_t *) mem_121979.mem)[gtid_116871 * n_114534 +
                                                        min_res_124367];
        int64_t abs_arg_124382 = sub64(x_124381, min_res_124290);
        int64_t abs_res_124383 = abs(abs_arg_124382);
        int64_t max_res_124384 = smax64(abs_res_124376, abs_res_124383);
        float defunc_0_f_res_124385 = sitofp_i64_f32(max_res_124384);
        float defunc_1_f_res_124386 = max_res_116991 + defunc_0_f_res_124385;
        
        ((float *) mem_122057.mem)[gtid_116875] = defunc_1_f_res_124386;
        ((int64_t *) mem_122060.mem)[gtid_116875] = min_res_124367;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131217_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131217_end -
                 futhark_mc_segmap_parloop_131217_start;
        
        ctx->futhark_mc_segmap_parloop_131217_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131217_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131217_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131215(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116874 = tid;
    int num_tasks_124393 = info.nsubtasks;
    struct futhark_mc_task_131214 *futhark_mc_task_131214 =
                                  (struct futhark_mc_task_131214 *) args;
    struct futhark_context *ctx = futhark_mc_task_131214->ctx;
    uint64_t futhark_mc_segmap_task_131215_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131215_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131214->free_n_114534;
    int64_t l_jump_114542 = futhark_mc_task_131214->free_l_jump_114542;
    int64_t l_n_m_114584 = futhark_mc_task_131214->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131214->free_i_114610;
    bool x_114611 = futhark_mc_task_131214->free_x_114611;
    int64_t min_res_114683 = futhark_mc_task_131214->free_min_res_114683;
    bool empty_slice_114688 = futhark_mc_task_131214->free_empty_slice_114688;
    int64_t m_114689 = futhark_mc_task_131214->free_m_114689;
    int64_t gtid_116871 = futhark_mc_task_131214->free_gtid_116871;
    int64_t x_116980 = futhark_mc_task_131214->free_x_116980;
    int64_t min_arg_116987 = futhark_mc_task_131214->free_min_arg_116987;
    float max_res_116991 = futhark_mc_task_131214->free_max_res_116991;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131214->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122051 = {.desc ="mem_122051", .mem =
                                  futhark_mc_task_131214->free_mem_122051,
                                  .size =0, .references =NULL};
    struct memblock mem_122054 = {.desc ="mem_122054", .mem =
                                  futhark_mc_task_131214->free_mem_122054,
                                  .size =0, .references =NULL};
    struct memblock mem_122057 = {.desc ="mem_122057", .mem =
                                  futhark_mc_task_131214->free_mem_122057,
                                  .size =0, .references =NULL};
    struct memblock mem_122060 = {.desc ="mem_122060", .mem =
                                  futhark_mc_task_131214->free_mem_122060,
                                  .size =0, .references =NULL};
    int64_t iter_124394;
    struct futhark_mc_segmap_parloop_struct_131216
    futhark_mc_segmap_parloop_struct_131216;
    
    futhark_mc_segmap_parloop_struct_131216.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131216.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131216.free_l_jump_114542 = l_jump_114542;
    futhark_mc_segmap_parloop_struct_131216.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131216.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131216.free_x_114611 = x_114611;
    futhark_mc_segmap_parloop_struct_131216.free_min_res_114683 =
        min_res_114683;
    futhark_mc_segmap_parloop_struct_131216.free_empty_slice_114688 =
        empty_slice_114688;
    futhark_mc_segmap_parloop_struct_131216.free_m_114689 = m_114689;
    futhark_mc_segmap_parloop_struct_131216.free_gtid_116871 = gtid_116871;
    futhark_mc_segmap_parloop_struct_131216.free_x_116980 = x_116980;
    futhark_mc_segmap_parloop_struct_131216.free_min_arg_116987 =
        min_arg_116987;
    futhark_mc_segmap_parloop_struct_131216.free_max_res_116991 =
        max_res_116991;
    futhark_mc_segmap_parloop_struct_131216.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131216.free_mem_122051 = mem_122051.mem;
    futhark_mc_segmap_parloop_struct_131216.free_mem_122054 = mem_122054.mem;
    futhark_mc_segmap_parloop_struct_131216.free_mem_122057 = mem_122057.mem;
    futhark_mc_segmap_parloop_struct_131216.free_mem_122060 = mem_122060.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131217_task;
    
    futhark_mc_segmap_parloop_131217_task.name =
        "futhark_mc_segmap_parloop_131217";
    futhark_mc_segmap_parloop_131217_task.fn = futhark_mc_segmap_parloop_131217;
    futhark_mc_segmap_parloop_131217_task.args =
        &futhark_mc_segmap_parloop_struct_131216;
    futhark_mc_segmap_parloop_131217_task.iterations = iterations;
    futhark_mc_segmap_parloop_131217_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131217_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131217_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131217_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131217_task);
    
    if (futhark_mc_segmap_parloop_131217_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131217_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131217_total_end -
                 futhark_mc_segmap_parloop_131217_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131217_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131217_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131217_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131215_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131215_end -
                 futhark_mc_segmap_task_131215_start;
        
        ctx->futhark_mc_segmap_task_131215_runs[tid]++;
        ctx->futhark_mc_segmap_task_131215_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131215_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131219 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_jump_114542;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    bool free_x_114611;
    int64_t free_min_res_114683;
    bool free_empty_slice_114688;
    int64_t free_m_114689;
    int64_t free_gtid_116871;
    int64_t free_x_116980;
    int64_t free_min_arg_116987;
    float free_max_res_116991;
    char *free_mem_121979;
    char *free_mem_122051;
    char *free_mem_122054;
    char *free_mem_122057;
    char *free_mem_122060;
};
struct futhark_mc_task_131221 {
    struct futhark_context *ctx;
    char *free_mem_122054;
    int64_t free_defunc_0_g_res_124193;
    int64_t free_max_res_124214;
    int64_t *retval_defunc_2_reduce_res_124227;
};
struct futhark_mc_segred_stage_1_parloop_struct_131224 {
    struct futhark_context *ctx;
    char *free_mem_122054;
    int64_t free_defunc_0_g_res_124193;
    int64_t free_max_res_124214;
    char *free_reduce_stage_1_tid_res_arr_mem_124518;
};
static int futhark_mc_segred_stage_1_parloop_131225(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_116878,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131224
    *futhark_mc_segred_stage_1_parloop_struct_131224 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131224 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131224->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131225_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131225_start = get_wall_time();
    
    struct memblock mem_122054 = {.desc ="mem_122054", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131224->free_mem_122054,
                                  .size =0, .references =NULL};
    int64_t defunc_0_g_res_124193 =
            futhark_mc_segred_stage_1_parloop_struct_131224->free_defunc_0_g_res_124193;
    int64_t max_res_124214 =
            futhark_mc_segred_stage_1_parloop_struct_131224->free_max_res_124214;
    struct memblock reduce_stage_1_tid_res_arr_mem_124518 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_124518",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131224->free_reduce_stage_1_tid_res_arr_mem_124518,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_124520 = start;
    int64_t x_124475;
    int64_t x_124476;
    int64_t local_acc_124521 = (int64_t) 0;
    
    for (; iter_124520 < end; iter_124520++) {
        int64_t gtid_116879 = iter_124520;
        int64_t slice_124478 = gtid_116879 + max_res_124214;
        int64_t x_124479 = ((int64_t *) mem_122054.mem)[slice_124478];
        int64_t abs_arg_124480 = sub64(x_124479, defunc_0_g_res_124193);
        int64_t abs_res_124481 = abs(abs_arg_124480);
        
        // save map-out results
        { }
        // Load accum params
        {
            x_124475 = local_acc_124521;
        }
        // Load next params
        {
            x_124476 = abs_res_124481;
        }
        // Red body
        {
            int64_t defunc_1_op_res_124477 = add64(x_124475, x_124476);
            
            local_acc_124521 = defunc_1_op_res_124477;
        }
    }
    ((int64_t *) reduce_stage_1_tid_res_arr_mem_124518.mem)[flat_tid_116878] =
        local_acc_124521;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131225_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131225_end -
                 futhark_mc_segred_stage_1_parloop_131225_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131225_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131225_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131225_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131222(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116878 = tid;
    int num_tasks_124517 = info.nsubtasks;
    struct futhark_mc_task_131221 *futhark_mc_task_131221 =
                                  (struct futhark_mc_task_131221 *) args;
    struct futhark_context *ctx = futhark_mc_task_131221->ctx;
    uint64_t futhark_mc_segred_task_131222_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131222_start = get_wall_time();
    
    struct memblock mem_122054 = {.desc ="mem_122054", .mem =
                                  futhark_mc_task_131221->free_mem_122054,
                                  .size =0, .references =NULL};
    int64_t defunc_0_g_res_124193 =
            futhark_mc_task_131221->free_defunc_0_g_res_124193;
    int64_t max_res_124214 = futhark_mc_task_131221->free_max_res_124214;
    int64_t defunc_2_reduce_res_124227 =
            *futhark_mc_task_131221->retval_defunc_2_reduce_res_124227;
    size_t reduce_stage_1_tid_res_arr_mem_124518_cached_sizze_131223 = 0;
    char *reduce_stage_1_tid_res_arr_mem_124518 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_124518_cached_sizze_131223 <
        (size_t) ((int64_t) 8 * num_tasks_124517)) {
        reduce_stage_1_tid_res_arr_mem_124518 =
            realloc(reduce_stage_1_tid_res_arr_mem_124518, (int64_t) 8 *
                    num_tasks_124517);
        reduce_stage_1_tid_res_arr_mem_124518_cached_sizze_131223 =
            (int64_t) 8 * num_tasks_124517;
    }
    
    int64_t iter_124520;
    struct futhark_mc_segred_stage_1_parloop_struct_131224
    futhark_mc_segred_stage_1_parloop_struct_131224;
    
    futhark_mc_segred_stage_1_parloop_struct_131224.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131224.free_mem_122054 =
        mem_122054.mem;
    futhark_mc_segred_stage_1_parloop_struct_131224.free_defunc_0_g_res_124193 =
        defunc_0_g_res_124193;
    futhark_mc_segred_stage_1_parloop_struct_131224.free_max_res_124214 =
        max_res_124214;
    futhark_mc_segred_stage_1_parloop_struct_131224.free_reduce_stage_1_tid_res_arr_mem_124518 =
        reduce_stage_1_tid_res_arr_mem_124518;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131225_task;
    
    futhark_mc_segred_stage_1_parloop_131225_task.name =
        "futhark_mc_segred_stage_1_parloop_131225";
    futhark_mc_segred_stage_1_parloop_131225_task.fn =
        futhark_mc_segred_stage_1_parloop_131225;
    futhark_mc_segred_stage_1_parloop_131225_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131224;
    futhark_mc_segred_stage_1_parloop_131225_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131225_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131225_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131225_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131225_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131225_task);
    
    if (futhark_mc_segred_stage_1_parloop_131225_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131225_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131225_total_end -
                 futhark_mc_segred_stage_1_parloop_131225_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131225_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131225_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131225_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_124227 = (int64_t) 0;
    }
    
    int64_t x_124522;
    int64_t x_124523;
    
    for (int32_t i_124525 = 0; i_124525 < num_tasks_124517; i_124525++) {
        flat_tid_116878 = i_124525;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_124522 = defunc_2_reduce_res_124227;
            }
            // load next params
            {
                x_124523 =
                    ((int64_t *) reduce_stage_1_tid_res_arr_mem_124518)[flat_tid_116878];
            }
            // red body
            {
                int64_t defunc_1_op_res_124524 = add64(x_124522, x_124523);
                
                defunc_2_reduce_res_124227 = defunc_1_op_res_124524;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_124518);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131222_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131222_end -
                 futhark_mc_segred_task_131222_start;
        
        ctx->futhark_mc_segred_task_131222_runs[tid]++;
        ctx->futhark_mc_segred_task_131222_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131222_iter[tid] += iterations;
    }
    *futhark_mc_task_131221->retval_defunc_2_reduce_res_124227 =
        defunc_2_reduce_res_124227;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131220(void *args, int64_t start,
                                            int64_t end, int flat_tid_116876,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131219
    *futhark_mc_segmap_parloop_struct_131219 =
    (struct futhark_mc_segmap_parloop_struct_131219 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131219->ctx;
    uint64_t futhark_mc_segmap_parloop_131220_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131220_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131219->free_n_114534;
    int64_t l_jump_114542 =
            futhark_mc_segmap_parloop_struct_131219->free_l_jump_114542;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131219->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131219->free_i_114610;
    bool x_114611 = futhark_mc_segmap_parloop_struct_131219->free_x_114611;
    int64_t min_res_114683 =
            futhark_mc_segmap_parloop_struct_131219->free_min_res_114683;
    bool empty_slice_114688 =
         futhark_mc_segmap_parloop_struct_131219->free_empty_slice_114688;
    int64_t m_114689 = futhark_mc_segmap_parloop_struct_131219->free_m_114689;
    int64_t gtid_116871 =
            futhark_mc_segmap_parloop_struct_131219->free_gtid_116871;
    int64_t x_116980 = futhark_mc_segmap_parloop_struct_131219->free_x_116980;
    int64_t min_arg_116987 =
            futhark_mc_segmap_parloop_struct_131219->free_min_arg_116987;
    float max_res_116991 =
          futhark_mc_segmap_parloop_struct_131219->free_max_res_116991;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131219->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122051 = {.desc ="mem_122051", .mem =
                                  futhark_mc_segmap_parloop_struct_131219->free_mem_122051,
                                  .size =0, .references =NULL};
    struct memblock mem_122054 = {.desc ="mem_122054", .mem =
                                  futhark_mc_segmap_parloop_struct_131219->free_mem_122054,
                                  .size =0, .references =NULL};
    struct memblock mem_122057 = {.desc ="mem_122057", .mem =
                                  futhark_mc_segmap_parloop_struct_131219->free_mem_122057,
                                  .size =0, .references =NULL};
    struct memblock mem_122060 = {.desc ="mem_122060", .mem =
                                  futhark_mc_segmap_parloop_struct_131219->free_mem_122060,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_124458 = start;
    
    for (; iter_124458 < end; iter_124458++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_124512 = l_n_m_114584;
        int64_t gtid_116877 = iter_124458;
        int64_t remnant_124513 = iter_124458 - gtid_116877;
        int64_t min_arg_124191 = mul64(l_jump_114542, gtid_116877);
        int64_t min_res_124192 = smin64(i_114610, min_arg_124191);
        int64_t defunc_0_g_res_124193 = add64((int64_t) 1, min_res_124192);
        bool nearest_idx_124194;
        int64_t nearest_idx_124195;
        int64_t nearest_idx_124196;
        bool loop_while_124459;
        int64_t low_124460;
        int64_t high_124461;
        
        loop_while_124459 = x_114611;
        low_124460 = (int64_t) 0;
        high_124461 = i_114610;
        while (loop_while_124459) {
            int64_t x_124462 = add64(low_124460, high_124461);
            int64_t mid_124463 = sdiv64(x_124462, (int64_t) 2);
            bool x_124464 = sle64((int64_t) 0, mid_124463);
            bool y_124465 = slt64(mid_124463, n_114534);
            bool bounds_check_124466 = x_124464 && y_124465;
            bool index_certs_124467;
            
            if (!bounds_check_124466) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", mid_124463,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  loess.fut:343:19-30\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                return 1;
            }
            
            int64_t x_124468 = ((int64_t *) mem_122051.mem)[mid_124463];
            bool cond_124469 = sle64(defunc_0_g_res_124193, x_124468);
            int64_t loopres_124470;
            int64_t loopres_124471;
            
            if (cond_124469) {
                int64_t loopres_t_res_124472 = sub64(mid_124463, (int64_t) 1);
                
                loopres_124470 = low_124460;
                loopres_124471 = loopres_t_res_124472;
            } else {
                int64_t loopres_f_res_124473 = add64((int64_t) 1, mid_124463);
                
                loopres_124470 = loopres_f_res_124473;
                loopres_124471 = high_124461;
            }
            
            bool loop_cond_124474 = sle64(loopres_124470, loopres_124471);
            bool loop_while_tmp_124514 = loop_cond_124474;
            int64_t low_tmp_124515 = loopres_124470;
            int64_t high_tmp_124516 = loopres_124471;
            
            loop_while_124459 = loop_while_tmp_124514;
            low_124460 = low_tmp_124515;
            high_124461 = high_tmp_124516;
        }
        nearest_idx_124194 = loop_while_124459;
        nearest_idx_124195 = low_124460;
        nearest_idx_124196 = high_124461;
        
        int64_t max_arg_124213 = sub64(nearest_idx_124195, min_res_114683);
        int64_t max_res_124214 = smax64((int64_t) 0, max_arg_124213);
        int64_t j_124215 = add64(min_res_114683, max_res_124214);
        int64_t i_p_m_t_s_124216 = add64(m_114689, max_res_124214);
        bool zzero_leq_i_p_m_t_s_124217 = sle64((int64_t) 0, i_p_m_t_s_124216);
        bool i_p_m_t_s_leq_w_124218 = slt64(i_p_m_t_s_124216, n_114534);
        bool zzero_lte_i_124219 = sle64((int64_t) 0, max_res_124214);
        bool i_lte_j_124220 = sle64(max_res_124214, j_124215);
        bool y_124221 = i_p_m_t_s_leq_w_124218 && zzero_lte_i_124219;
        bool y_124222 = zzero_leq_i_p_m_t_s_124217 && y_124221;
        bool y_124223 = i_lte_j_124220 && y_124222;
        bool forwards_ok_124224 = zzero_lte_i_124219 && y_124223;
        bool ok_or_empty_124225 = empty_slice_114688 || forwards_ok_124224;
        bool index_certs_124226;
        
        if (!ok_or_empty_124225) {
            ctx->error =
                msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                          "Index [", max_res_124214, ":", j_124215,
                          "] out of bounds for array of shape [", n_114534,
                          "].",
                          "-> #0  loess.fut:350:25-55\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
            return 1;
        }
        
        int64_t defunc_2_reduce_res_124227;
        int64_t flat_tid_116878 = (int64_t) 0;
        int32_t num_tasks_124517;
        struct futhark_mc_task_131221 futhark_mc_task_131221;
        
        futhark_mc_task_131221.ctx = ctx;
        futhark_mc_task_131221.free_mem_122054 = mem_122054.mem;
        futhark_mc_task_131221.free_defunc_0_g_res_124193 =
            defunc_0_g_res_124193;
        futhark_mc_task_131221.free_max_res_124214 = max_res_124214;
        futhark_mc_task_131221.retval_defunc_2_reduce_res_124227 =
            &defunc_2_reduce_res_124227;
        
        struct scheduler_segop futhark_mc_task_131221_task;
        
        futhark_mc_task_131221_task.args = &futhark_mc_task_131221;
        futhark_mc_task_131221_task.top_level_fn =
            futhark_mc_segred_task_131222;
        futhark_mc_task_131221_task.name = "futhark_mc_segred_task_131222";
        futhark_mc_task_131221_task.iterations = min_res_114683;
        futhark_mc_task_131221_task.task_time =
            &ctx->futhark_mc_segred_task_131222_total_time;
        futhark_mc_task_131221_task.task_iter =
            &ctx->futhark_mc_segred_task_131222_total_iter;
        futhark_mc_task_131221_task.sched = STATIC;
        futhark_mc_task_131221_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131222_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131221_task);
        
        if (futhark_mc_segred_task_131222_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        int64_t idx_124235;
        int64_t idx_124236;
        int64_t idx_124237;
        int64_t idx_124238;
        int64_t best_idx_124483;
        int64_t last_idx_124484;
        int64_t best_sum_124485;
        int64_t curr_sum_124486;
        
        best_idx_124483 = max_res_124214;
        last_idx_124484 = max_res_124214;
        best_sum_124485 = defunc_2_reduce_res_124227;
        curr_sum_124486 = defunc_2_reduce_res_124227;
        for (int64_t j_124482 = 0; j_124482 < min_res_114683; j_124482++) {
            int64_t new_idx_124487 = add64(max_res_124214, j_124482);
            int64_t x_124488 = add64(min_res_114683, new_idx_124487);
            bool cond_124489 = slt64(x_116980, x_124488);
            int64_t new_sum_124490;
            
            if (cond_124489) {
                new_sum_124490 = (int64_t) 9223372036854775807;
            } else {
                bool x_124491 = sle64((int64_t) 0, last_idx_124484);
                bool y_124492 = slt64(last_idx_124484, n_114534);
                bool bounds_check_124493 = x_124491 && y_124492;
                bool index_certs_124494;
                
                if (!bounds_check_124493) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", last_idx_124484,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  loess.fut:362:51-66\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                int64_t y_124495 =
                        ((int64_t *) mem_122054.mem)[last_idx_124484];
                int64_t binop_p_124496 = sub64(defunc_0_g_res_124193, y_124495);
                int64_t defunc_0_f_res_124497 = abs(binop_p_124496);
                int64_t x_124498 = sub64(curr_sum_124486,
                                         defunc_0_f_res_124497);
                int64_t min_arg_124499 = add64(min_res_114683, last_idx_124484);
                int64_t min_res_124500 = smin64(i_114610, min_arg_124499);
                bool x_124501 = sle64((int64_t) 0, min_res_124500);
                bool y_124502 = slt64(min_res_124500, n_114534);
                bool bounds_check_124503 = x_124501 && y_124502;
                bool index_certs_124504;
                
                if (!bounds_check_124503) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", min_res_124500,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  loess.fut:363:51-88\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                int64_t y_124505 = ((int64_t *) mem_122054.mem)[min_res_124500];
                int64_t binop_p_124506 = sub64(defunc_0_g_res_124193, y_124505);
                int64_t defunc_0_f_res_124507 = abs(binop_p_124506);
                int64_t new_sum_f_res_124508 = add64(x_124498,
                                                     defunc_0_f_res_124507);
                
                new_sum_124490 = new_sum_f_res_124508;
            }
            
            bool cond_124509 = sle64(new_sum_124490, best_sum_124485);
            int64_t loopres_124510;
            
            if (cond_124509) {
                loopres_124510 = new_idx_124487;
            } else {
                loopres_124510 = best_idx_124483;
            }
            
            int64_t loopres_124511;
            
            if (cond_124509) {
                loopres_124511 = new_sum_124490;
            } else {
                loopres_124511 = best_sum_124485;
            }
            
            int64_t best_idx_tmp_124526 = loopres_124510;
            int64_t last_idx_tmp_124527 = new_idx_124487;
            int64_t best_sum_tmp_124528 = loopres_124511;
            int64_t curr_sum_tmp_124529 = new_sum_124490;
            
            best_idx_124483 = best_idx_tmp_124526;
            last_idx_124484 = last_idx_tmp_124527;
            best_sum_124485 = best_sum_tmp_124528;
            curr_sum_124486 = curr_sum_tmp_124529;
        }
        idx_124235 = best_idx_124483;
        idx_124236 = last_idx_124484;
        idx_124237 = best_sum_124485;
        idx_124238 = curr_sum_124486;
        
        int64_t min_res_124269 = smin64(min_arg_116987, idx_124235);
        int64_t x_124270 = add64(min_res_114683, min_res_124269);
        int64_t r_124271 = sub64(x_124270, (int64_t) 1);
        bool x_124272 = sle64((int64_t) 0, r_124271);
        bool y_124273 = slt64(r_124271, n_114534);
        bool bounds_check_124274 = x_124272 && y_124273;
        bool index_certs_124275;
        
        if (!bounds_check_124274) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", r_124271,
                                   "] out of bounds for array of shape [",
                                   n_114534, "].",
                                   "-> #0  loess.fut:386:66-73\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:383:3-389:25\n   #4  loess.fut:401:18-55\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
            return 1;
        }
        
        int64_t x_124276 = ((int64_t *) mem_121979.mem)[gtid_116871 * n_114534 +
                                                        r_124271];
        int64_t abs_arg_124277 = sub64(x_124276, min_res_124192);
        int64_t abs_res_124278 = abs(abs_arg_124277);
        bool x_124279 = sle64((int64_t) 0, min_res_124269);
        bool y_124280 = slt64(min_res_124269, n_114534);
        bool bounds_check_124281 = x_124279 && y_124280;
        bool index_certs_124282;
        
        if (!bounds_check_124281) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", min_res_124269,
                                   "] out of bounds for array of shape [",
                                   n_114534, "].",
                                   "-> #0  loess.fut:386:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:383:3-389:25\n   #4  loess.fut:401:18-55\n   #5  stl.fut:166:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:164:5-167:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
            return 1;
        }
        
        int64_t x_124283 = ((int64_t *) mem_121979.mem)[gtid_116871 * n_114534 +
                                                        min_res_124269];
        int64_t abs_arg_124284 = sub64(x_124283, min_res_124192);
        int64_t abs_res_124285 = abs(abs_arg_124284);
        int64_t max_res_124286 = smax64(abs_res_124278, abs_res_124285);
        float defunc_0_f_res_124287 = sitofp_i64_f32(max_res_124286);
        float defunc_1_f_res_124288 = max_res_116991 + defunc_0_f_res_124287;
        
        ((float *) mem_122057.mem)[gtid_116877] = defunc_1_f_res_124288;
        ((int64_t *) mem_122060.mem)[gtid_116877] = min_res_124269;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131220_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131220_end -
                 futhark_mc_segmap_parloop_131220_start;
        
        ctx->futhark_mc_segmap_parloop_131220_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131220_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131220_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131218(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116876 = tid;
    int num_tasks_124393 = info.nsubtasks;
    struct futhark_mc_task_131214 *futhark_mc_task_131214 =
                                  (struct futhark_mc_task_131214 *) args;
    struct futhark_context *ctx = futhark_mc_task_131214->ctx;
    uint64_t futhark_mc_segmap_nested_task_131218_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131218_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131214->free_n_114534;
    int64_t l_jump_114542 = futhark_mc_task_131214->free_l_jump_114542;
    int64_t l_n_m_114584 = futhark_mc_task_131214->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131214->free_i_114610;
    bool x_114611 = futhark_mc_task_131214->free_x_114611;
    int64_t min_res_114683 = futhark_mc_task_131214->free_min_res_114683;
    bool empty_slice_114688 = futhark_mc_task_131214->free_empty_slice_114688;
    int64_t m_114689 = futhark_mc_task_131214->free_m_114689;
    int64_t gtid_116871 = futhark_mc_task_131214->free_gtid_116871;
    int64_t x_116980 = futhark_mc_task_131214->free_x_116980;
    int64_t min_arg_116987 = futhark_mc_task_131214->free_min_arg_116987;
    float max_res_116991 = futhark_mc_task_131214->free_max_res_116991;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131214->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122051 = {.desc ="mem_122051", .mem =
                                  futhark_mc_task_131214->free_mem_122051,
                                  .size =0, .references =NULL};
    struct memblock mem_122054 = {.desc ="mem_122054", .mem =
                                  futhark_mc_task_131214->free_mem_122054,
                                  .size =0, .references =NULL};
    struct memblock mem_122057 = {.desc ="mem_122057", .mem =
                                  futhark_mc_task_131214->free_mem_122057,
                                  .size =0, .references =NULL};
    struct memblock mem_122060 = {.desc ="mem_122060", .mem =
                                  futhark_mc_task_131214->free_mem_122060,
                                  .size =0, .references =NULL};
    int64_t iter_124458;
    struct futhark_mc_segmap_parloop_struct_131219
    futhark_mc_segmap_parloop_struct_131219;
    
    futhark_mc_segmap_parloop_struct_131219.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131219.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131219.free_l_jump_114542 = l_jump_114542;
    futhark_mc_segmap_parloop_struct_131219.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131219.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131219.free_x_114611 = x_114611;
    futhark_mc_segmap_parloop_struct_131219.free_min_res_114683 =
        min_res_114683;
    futhark_mc_segmap_parloop_struct_131219.free_empty_slice_114688 =
        empty_slice_114688;
    futhark_mc_segmap_parloop_struct_131219.free_m_114689 = m_114689;
    futhark_mc_segmap_parloop_struct_131219.free_gtid_116871 = gtid_116871;
    futhark_mc_segmap_parloop_struct_131219.free_x_116980 = x_116980;
    futhark_mc_segmap_parloop_struct_131219.free_min_arg_116987 =
        min_arg_116987;
    futhark_mc_segmap_parloop_struct_131219.free_max_res_116991 =
        max_res_116991;
    futhark_mc_segmap_parloop_struct_131219.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131219.free_mem_122051 = mem_122051.mem;
    futhark_mc_segmap_parloop_struct_131219.free_mem_122054 = mem_122054.mem;
    futhark_mc_segmap_parloop_struct_131219.free_mem_122057 = mem_122057.mem;
    futhark_mc_segmap_parloop_struct_131219.free_mem_122060 = mem_122060.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131220_task;
    
    futhark_mc_segmap_parloop_131220_task.name =
        "futhark_mc_segmap_parloop_131220";
    futhark_mc_segmap_parloop_131220_task.fn = futhark_mc_segmap_parloop_131220;
    futhark_mc_segmap_parloop_131220_task.args =
        &futhark_mc_segmap_parloop_struct_131219;
    futhark_mc_segmap_parloop_131220_task.iterations = iterations;
    futhark_mc_segmap_parloop_131220_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131220_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131220_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131220_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131220_task);
    
    if (futhark_mc_segmap_parloop_131220_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131220_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131220_total_end -
                 futhark_mc_segmap_parloop_131220_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131220_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131220_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131220_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131218_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131218_end -
                 futhark_mc_segmap_nested_task_131218_start;
        
        ctx->futhark_mc_segmap_nested_task_131218_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131218_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131218_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131205(void *args, int64_t start,
                                            int64_t end, int flat_tid_116870,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131204
    *futhark_mc_segmap_parloop_struct_131204 =
    (struct futhark_mc_segmap_parloop_struct_131204 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131204->ctx;
    uint64_t futhark_mc_segmap_parloop_131205_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131205_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131204->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131204->free_n_114534;
    int64_t l_jump_114542 =
            futhark_mc_segmap_parloop_struct_131204->free_l_jump_114542;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131204->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131204->free_i_114610;
    bool x_114611 = futhark_mc_segmap_parloop_struct_131204->free_x_114611;
    int64_t min_res_114683 =
            futhark_mc_segmap_parloop_struct_131204->free_min_res_114683;
    bool empty_slice_114688 =
         futhark_mc_segmap_parloop_struct_131204->free_empty_slice_114688;
    int64_t m_114689 = futhark_mc_segmap_parloop_struct_131204->free_m_114689;
    float i64_res_114690 =
          futhark_mc_segmap_parloop_struct_131204->free_i64_res_114690;
    int64_t bytes_121940 =
            futhark_mc_segmap_parloop_struct_131204->free_bytes_121940;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131204->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131204->free_mem_121982,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131204->free_bytes_122055;
    int64_t bytes_122058 =
            futhark_mc_segmap_parloop_struct_131204->free_bytes_122058;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131204->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131204->free_mem_122128,
                                  .size =0, .references =NULL};
    size_t mem_122051_cached_sizze_131206 = 0;
    char *mem_122051 = NULL;
    size_t mem_122054_cached_sizze_131207 = 0;
    char *mem_122054 = NULL;
    size_t mem_122057_cached_sizze_131208 = 0;
    char *mem_122057 = NULL;
    size_t mem_122060_cached_sizze_131209 = 0;
    char *mem_122060 = NULL;
    int64_t iterations = end - start;
    int64_t iter_124186 = start;
    
    if (mem_122051_cached_sizze_131206 < (size_t) bytes_121940) {
        mem_122051 = realloc(mem_122051, bytes_121940);
        mem_122051_cached_sizze_131206 = bytes_121940;
    }
    if (mem_122054_cached_sizze_131207 < (size_t) bytes_121940) {
        mem_122054 = realloc(mem_122054, bytes_121940);
        mem_122054_cached_sizze_131207 = bytes_121940;
    }
    if (mem_122057_cached_sizze_131208 < (size_t) bytes_122055) {
        mem_122057 = realloc(mem_122057, bytes_122055);
        mem_122057_cached_sizze_131208 = bytes_122055;
    }
    if (mem_122060_cached_sizze_131209 < (size_t) bytes_122058) {
        mem_122060 = realloc(mem_122060, bytes_122058);
        mem_122060_cached_sizze_131209 = bytes_122058;
    }
    for (; iter_124186 < end; iter_124186++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_124387 = m_114533;
        int64_t gtid_116871 = iter_124186;
        int64_t remnant_124388 = iter_124186 - gtid_116871;
        int64_t x_116980 = ((int64_t *) mem_121982.mem)[gtid_116871];
        int64_t flat_tid_116872 = (int64_t) 0;
        int32_t num_tasks_124389;
        struct futhark_mc_task_131210 futhark_mc_task_131210;
        
        futhark_mc_task_131210.ctx = ctx;
        futhark_mc_task_131210.free_n_114534 = n_114534;
        futhark_mc_task_131210.free_gtid_116871 = gtid_116871;
        futhark_mc_task_131210.free_mem_121979 = mem_121979.mem;
        futhark_mc_task_131210.free_mem_122051 = mem_122051;
        futhark_mc_task_131210.free_mem_122054 = mem_122054;
        
        struct scheduler_segop futhark_mc_task_131210_task;
        
        futhark_mc_task_131210_task.args = &futhark_mc_task_131210;
        futhark_mc_task_131210_task.top_level_fn =
            futhark_mc_segmap_task_131211;
        futhark_mc_task_131210_task.name = "futhark_mc_segmap_task_131211";
        futhark_mc_task_131210_task.iterations = n_114534;
        futhark_mc_task_131210_task.task_time =
            &ctx->futhark_mc_segmap_task_131211_total_time;
        futhark_mc_task_131210_task.task_iter =
            &ctx->futhark_mc_segmap_task_131211_total_iter;
        futhark_mc_task_131210_task.sched = STATIC;
        futhark_mc_task_131210_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131211_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131210_task);
        
        if (futhark_mc_segmap_task_131211_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_116987 = sub64(x_116980, min_res_114683);
        float i64_res_116988 = sitofp_i64_f32(x_116980);
        float x_116989 = i64_res_114690 - i64_res_116988;
        float max_arg_116990 = x_116989 / 2.0F;
        float max_res_116991 = fmax32(0.0F, max_arg_116990);
        int64_t flat_tid_116874 = (int64_t) 0;
        int32_t num_tasks_124393;
        int64_t flat_tid_116876 = (int64_t) 0;
        struct futhark_mc_task_131214 futhark_mc_task_131214;
        
        futhark_mc_task_131214.ctx = ctx;
        futhark_mc_task_131214.free_n_114534 = n_114534;
        futhark_mc_task_131214.free_l_jump_114542 = l_jump_114542;
        futhark_mc_task_131214.free_l_n_m_114584 = l_n_m_114584;
        futhark_mc_task_131214.free_i_114610 = i_114610;
        futhark_mc_task_131214.free_x_114611 = x_114611;
        futhark_mc_task_131214.free_min_res_114683 = min_res_114683;
        futhark_mc_task_131214.free_empty_slice_114688 = empty_slice_114688;
        futhark_mc_task_131214.free_m_114689 = m_114689;
        futhark_mc_task_131214.free_gtid_116871 = gtid_116871;
        futhark_mc_task_131214.free_x_116980 = x_116980;
        futhark_mc_task_131214.free_min_arg_116987 = min_arg_116987;
        futhark_mc_task_131214.free_max_res_116991 = max_res_116991;
        futhark_mc_task_131214.free_mem_121979 = mem_121979.mem;
        futhark_mc_task_131214.free_mem_122051 = mem_122051;
        futhark_mc_task_131214.free_mem_122054 = mem_122054;
        futhark_mc_task_131214.free_mem_122057 = mem_122057;
        futhark_mc_task_131214.free_mem_122060 = mem_122060;
        
        struct scheduler_segop futhark_mc_task_131214_task;
        
        futhark_mc_task_131214_task.args = &futhark_mc_task_131214;
        futhark_mc_task_131214_task.top_level_fn =
            futhark_mc_segmap_task_131215;
        futhark_mc_task_131214_task.name = "futhark_mc_segmap_task_131215";
        futhark_mc_task_131214_task.iterations = l_n_m_114584;
        futhark_mc_task_131214_task.task_time =
            &ctx->futhark_mc_segmap_task_131215_total_time;
        futhark_mc_task_131214_task.task_iter =
            &ctx->futhark_mc_segmap_task_131215_total_iter;
        futhark_mc_task_131214_task.sched = DYNAMIC;
        futhark_mc_task_131214_task.nested_fn =
            futhark_mc_segmap_nested_task_131218;
        
        int futhark_mc_segmap_task_131215_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131214_task);
        
        if (futhark_mc_segmap_task_131215_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122124.mem + gtid_116871 * l_n_m_114584 * (int64_t) 8,
                mem_122060 + (int64_t) 0, l_n_m_114584 * (int64_t) 8);
        memmove(mem_122128.mem + gtid_116871 * l_n_m_114584 * (int64_t) 4,
                mem_122057 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122051);
    free(mem_122054);
    free(mem_122057);
    free(mem_122060);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131205_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131205_end -
                 futhark_mc_segmap_parloop_131205_start;
        
        ctx->futhark_mc_segmap_parloop_131205_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131205_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131205_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131203(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_116870 = tid;
    int num_tasks_124058 = info.nsubtasks;
    struct futhark_mc_task_131195 *futhark_mc_task_131195 =
                                  (struct futhark_mc_task_131195 *) args;
    struct futhark_context *ctx = futhark_mc_task_131195->ctx;
    uint64_t futhark_mc_segmap_nested_task_131203_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131203_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131195->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131195->free_n_114534;
    int64_t l_jump_114542 = futhark_mc_task_131195->free_l_jump_114542;
    int64_t l_n_m_114584 = futhark_mc_task_131195->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131195->free_i_114610;
    bool x_114611 = futhark_mc_task_131195->free_x_114611;
    int64_t min_res_114683 = futhark_mc_task_131195->free_min_res_114683;
    bool empty_slice_114688 = futhark_mc_task_131195->free_empty_slice_114688;
    int64_t m_114689 = futhark_mc_task_131195->free_m_114689;
    float i64_res_114690 = futhark_mc_task_131195->free_i64_res_114690;
    int64_t bytes_121940 = futhark_mc_task_131195->free_bytes_121940;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131195->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131195->free_mem_121982,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131195->free_bytes_122055;
    int64_t bytes_122058 = futhark_mc_task_131195->free_bytes_122058;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131195->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131195->free_mem_122128,
                                  .size =0, .references =NULL};
    int64_t iter_124186;
    struct futhark_mc_segmap_parloop_struct_131204
    futhark_mc_segmap_parloop_struct_131204;
    
    futhark_mc_segmap_parloop_struct_131204.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131204.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131204.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131204.free_l_jump_114542 = l_jump_114542;
    futhark_mc_segmap_parloop_struct_131204.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131204.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131204.free_x_114611 = x_114611;
    futhark_mc_segmap_parloop_struct_131204.free_min_res_114683 =
        min_res_114683;
    futhark_mc_segmap_parloop_struct_131204.free_empty_slice_114688 =
        empty_slice_114688;
    futhark_mc_segmap_parloop_struct_131204.free_m_114689 = m_114689;
    futhark_mc_segmap_parloop_struct_131204.free_i64_res_114690 =
        i64_res_114690;
    futhark_mc_segmap_parloop_struct_131204.free_bytes_121940 = bytes_121940;
    futhark_mc_segmap_parloop_struct_131204.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131204.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131204.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131204.free_bytes_122058 = bytes_122058;
    futhark_mc_segmap_parloop_struct_131204.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131204.free_mem_122128 = mem_122128.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131205_task;
    
    futhark_mc_segmap_parloop_131205_task.name =
        "futhark_mc_segmap_parloop_131205";
    futhark_mc_segmap_parloop_131205_task.fn = futhark_mc_segmap_parloop_131205;
    futhark_mc_segmap_parloop_131205_task.args =
        &futhark_mc_segmap_parloop_struct_131204;
    futhark_mc_segmap_parloop_131205_task.iterations = iterations;
    futhark_mc_segmap_parloop_131205_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131205_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131205_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131205_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131205_task);
    
    if (futhark_mc_segmap_parloop_131205_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131205_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131205_total_end -
                 futhark_mc_segmap_parloop_131205_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131205_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131205_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131205_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131203_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131203_end -
                 futhark_mc_segmap_nested_task_131203_start;
        
        ctx->futhark_mc_segmap_nested_task_131203_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131203_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131203_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131226 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    bool free_x_114611;
    int64_t free_min_res_114809;
    bool free_empty_slice_114814;
    int64_t free_m_114815;
    float free_i64_res_114816;
    int64_t free_bytes_121940;
    char *free_mem_121979;
    char *free_mem_121982;
    int64_t free_bytes_122135;
    int64_t free_bytes_122138;
    char *free_mem_122204;
    char *free_mem_122208;
};
struct futhark_mc_segmap_parloop_struct_131228 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    bool free_x_114611;
    int64_t free_min_res_114809;
    bool free_empty_slice_114814;
    int64_t free_m_114815;
    float free_i64_res_114816;
    int64_t free_bytes_121940;
    char *free_mem_121979;
    char *free_mem_121982;
    int64_t free_bytes_122135;
    int64_t free_bytes_122138;
    char *free_mem_122204;
    char *free_mem_122208;
};
static int futhark_mc_segmap_parloop_131229(void *args, int64_t start,
                                            int64_t end, int flat_tid_117192,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131228
    *futhark_mc_segmap_parloop_struct_131228 =
    (struct futhark_mc_segmap_parloop_struct_131228 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131228->ctx;
    uint64_t futhark_mc_segmap_parloop_131229_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131229_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131228->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131228->free_n_114534;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131228->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131228->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131228->free_i_114610;
    bool x_114611 = futhark_mc_segmap_parloop_struct_131228->free_x_114611;
    int64_t min_res_114809 =
            futhark_mc_segmap_parloop_struct_131228->free_min_res_114809;
    bool empty_slice_114814 =
         futhark_mc_segmap_parloop_struct_131228->free_empty_slice_114814;
    int64_t m_114815 = futhark_mc_segmap_parloop_struct_131228->free_m_114815;
    float i64_res_114816 =
          futhark_mc_segmap_parloop_struct_131228->free_i64_res_114816;
    int64_t bytes_121940 =
            futhark_mc_segmap_parloop_struct_131228->free_bytes_121940;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131228->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131228->free_mem_121982,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131228->free_bytes_122135;
    int64_t bytes_122138 =
            futhark_mc_segmap_parloop_struct_131228->free_bytes_122138;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131228->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131228->free_mem_122208,
                                  .size =0, .references =NULL};
    size_t mem_122143_cached_sizze_131230 = 0;
    char *mem_122143 = NULL;
    size_t mem_122146_cached_sizze_131231 = 0;
    char *mem_122146 = NULL;
    size_t mem_122173_cached_sizze_131232 = 0;
    char *mem_122173 = NULL;
    size_t mem_122176_cached_sizze_131233 = 0;
    char *mem_122176 = NULL;
    int64_t iterations = end - start;
    int64_t iter_124531 = start;
    
    if (mem_122143_cached_sizze_131230 < (size_t) bytes_121940) {
        mem_122143 = realloc(mem_122143, bytes_121940);
        mem_122143_cached_sizze_131230 = bytes_121940;
    }
    if (mem_122146_cached_sizze_131231 < (size_t) bytes_121940) {
        mem_122146 = realloc(mem_122146, bytes_121940);
        mem_122146_cached_sizze_131231 = bytes_121940;
    }
    if (mem_122173_cached_sizze_131232 < (size_t) bytes_122135) {
        mem_122173 = realloc(mem_122173, bytes_122135);
        mem_122173_cached_sizze_131232 = bytes_122135;
    }
    if (mem_122176_cached_sizze_131233 < (size_t) bytes_122138) {
        mem_122176 = realloc(mem_122176, bytes_122138);
        mem_122176_cached_sizze_131233 = bytes_122138;
    }
    for (; iter_124531 < end; iter_124531++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_124644 = m_114533;
        int64_t gtid_117193 = iter_124531;
        int64_t remnant_124645 = iter_124531 - gtid_117193;
        int64_t x_114820 = ((int64_t *) mem_121982.mem)[gtid_117193];
        
        for (int64_t i_124532 = 0; i_124532 < n_114534; i_124532++) {
            int64_t x_124535 = ((int64_t *) mem_121979.mem)[gtid_117193 *
                                                            n_114534 +
                                                            i_124532];
            int64_t defunc_0_f_res_124536 = add64((int64_t) 1, x_124535);
            bool cond_124537 = slt64(defunc_0_f_res_124536, (int64_t) 0);
            int64_t defunc_0_f_res_124538;
            
            if (cond_124537) {
                defunc_0_f_res_124538 = (int64_t) 9223372036854775807;
            } else {
                defunc_0_f_res_124538 = defunc_0_f_res_124536;
            }
            ((int64_t *) mem_122143)[i_124532] = defunc_0_f_res_124538;
            ((int64_t *) mem_122146)[i_124532] = defunc_0_f_res_124536;
        }
        
        int64_t min_arg_114827 = sub64(x_114820, min_res_114809);
        float i64_res_114828 = sitofp_i64_f32(x_114820);
        float x_114829 = i64_res_114816 - i64_res_114828;
        float max_arg_114830 = x_114829 / 2.0F;
        float max_res_114831 = fmax32(0.0F, max_arg_114830);
        
        for (int64_t i_124541 = 0; i_124541 < t_n_m_114591; i_124541++) {
            int64_t min_arg_124544 = mul64(t_jump_114541, i_124541);
            int64_t min_res_124545 = smin64(i_114610, min_arg_124544);
            int64_t defunc_0_g_res_124546 = add64((int64_t) 1, min_res_124545);
            bool nearest_idx_124547;
            int64_t nearest_idx_124548;
            int64_t nearest_idx_124549;
            bool loop_while_124550;
            int64_t low_124551;
            int64_t high_124552;
            
            loop_while_124550 = x_114611;
            low_124551 = (int64_t) 0;
            high_124552 = i_114610;
            while (loop_while_124550) {
                int64_t x_124553 = add64(low_124551, high_124552);
                int64_t mid_124554 = sdiv64(x_124553, (int64_t) 2);
                bool x_124555 = sle64((int64_t) 0, mid_124554);
                bool y_124556 = slt64(mid_124554, n_114534);
                bool bounds_check_124557 = x_124555 && y_124556;
                bool index_certs_124558;
                
                if (!bounds_check_124557) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", mid_124554,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  loess.fut:343:19-30\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                int64_t x_124559 = ((int64_t *) mem_122143)[mid_124554];
                bool cond_124560 = sle64(defunc_0_g_res_124546, x_124559);
                int64_t loopres_124561;
                int64_t loopres_124562;
                
                if (cond_124560) {
                    int64_t loopres_t_res_124563 = sub64(mid_124554,
                                                         (int64_t) 1);
                    
                    loopres_124561 = low_124551;
                    loopres_124562 = loopres_t_res_124563;
                } else {
                    int64_t loopres_f_res_124564 = add64((int64_t) 1,
                                                         mid_124554);
                    
                    loopres_124561 = loopres_f_res_124564;
                    loopres_124562 = high_124552;
                }
                
                bool loop_cond_124565 = sle64(loopres_124561, loopres_124562);
                bool loop_while_tmp_124650 = loop_cond_124565;
                int64_t low_tmp_124651 = loopres_124561;
                int64_t high_tmp_124652 = loopres_124562;
                
                loop_while_124550 = loop_while_tmp_124650;
                low_124551 = low_tmp_124651;
                high_124552 = high_tmp_124652;
            }
            nearest_idx_124547 = loop_while_124550;
            nearest_idx_124548 = low_124551;
            nearest_idx_124549 = high_124552;
            
            int64_t max_arg_124566 = sub64(nearest_idx_124548, min_res_114809);
            int64_t max_res_124567 = smax64((int64_t) 0, max_arg_124566);
            int64_t j_124568 = add64(min_res_114809, max_res_124567);
            int64_t i_p_m_t_s_124569 = add64(m_114815, max_res_124567);
            bool zzero_leq_i_p_m_t_s_124570 = sle64((int64_t) 0,
                                                    i_p_m_t_s_124569);
            bool i_p_m_t_s_leq_w_124571 = slt64(i_p_m_t_s_124569, n_114534);
            bool zzero_lte_i_124572 = sle64((int64_t) 0, max_res_124567);
            bool i_lte_j_124573 = sle64(max_res_124567, j_124568);
            bool y_124574 = i_p_m_t_s_leq_w_124571 && zzero_lte_i_124572;
            bool y_124575 = zzero_leq_i_p_m_t_s_124570 && y_124574;
            bool y_124576 = i_lte_j_124573 && y_124575;
            bool forwards_ok_124577 = zzero_lte_i_124572 && y_124576;
            bool ok_or_empty_124578 = empty_slice_114814 || forwards_ok_124577;
            bool index_certs_124579;
            
            if (!ok_or_empty_124578) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", max_res_124567, ":", j_124568,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  loess.fut:350:25-55\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                return 1;
            }
            
            int64_t defunc_2_reduce_res_124580;
            int64_t redout_124582 = (int64_t) 0;
            
            for (int64_t i_124581 = 0; i_124581 < min_res_114809; i_124581++) {
                int64_t slice_124583 = max_res_124567 + i_124581;
                int64_t x_124584 = ((int64_t *) mem_122146)[slice_124583];
                int64_t abs_arg_124585 = sub64(x_124584, defunc_0_g_res_124546);
                int64_t abs_res_124586 = abs(abs_arg_124585);
                int64_t defunc_1_op_res_124587 = add64(abs_res_124586,
                                                       redout_124582);
                int64_t redout_tmp_124653 = defunc_1_op_res_124587;
                
                redout_124582 = redout_tmp_124653;
            }
            defunc_2_reduce_res_124580 = redout_124582;
            
            int64_t idx_124588;
            int64_t idx_124589;
            int64_t idx_124590;
            int64_t idx_124591;
            int64_t best_idx_124593;
            int64_t last_idx_124594;
            int64_t best_sum_124595;
            int64_t curr_sum_124596;
            
            best_idx_124593 = max_res_124567;
            last_idx_124594 = max_res_124567;
            best_sum_124595 = defunc_2_reduce_res_124580;
            curr_sum_124596 = defunc_2_reduce_res_124580;
            for (int64_t j_124592 = 0; j_124592 < min_res_114809; j_124592++) {
                int64_t new_idx_124597 = add64(max_res_124567, j_124592);
                int64_t x_124598 = add64(min_res_114809, new_idx_124597);
                bool cond_124599 = slt64(x_114820, x_124598);
                int64_t new_sum_124600;
                
                if (cond_124599) {
                    new_sum_124600 = (int64_t) 9223372036854775807;
                } else {
                    bool x_124601 = sle64((int64_t) 0, last_idx_124594);
                    bool y_124602 = slt64(last_idx_124594, n_114534);
                    bool bounds_check_124603 = x_124601 && y_124602;
                    bool index_certs_124604;
                    
                    if (!bounds_check_124603) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", last_idx_124594,
                                      "] out of bounds for array of shape [",
                                      n_114534, "].",
                                      "-> #0  loess.fut:362:51-66\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                        return 1;
                    }
                    
                    int64_t y_124605 =
                            ((int64_t *) mem_122146)[last_idx_124594];
                    int64_t binop_p_124606 = sub64(defunc_0_g_res_124546,
                                                   y_124605);
                    int64_t defunc_0_f_res_124607 = abs(binop_p_124606);
                    int64_t x_124608 = sub64(curr_sum_124596,
                                             defunc_0_f_res_124607);
                    int64_t min_arg_124609 = add64(min_res_114809,
                                                   last_idx_124594);
                    int64_t min_res_124610 = smin64(i_114610, min_arg_124609);
                    bool x_124611 = sle64((int64_t) 0, min_res_124610);
                    bool y_124612 = slt64(min_res_124610, n_114534);
                    bool bounds_check_124613 = x_124611 && y_124612;
                    bool index_certs_124614;
                    
                    if (!bounds_check_124613) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", min_res_124610,
                                      "] out of bounds for array of shape [",
                                      n_114534, "].",
                                      "-> #0  loess.fut:363:51-88\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                        return 1;
                    }
                    
                    int64_t y_124615 = ((int64_t *) mem_122146)[min_res_124610];
                    int64_t binop_p_124616 = sub64(defunc_0_g_res_124546,
                                                   y_124615);
                    int64_t defunc_0_f_res_124617 = abs(binop_p_124616);
                    int64_t new_sum_f_res_124618 = add64(x_124608,
                                                         defunc_0_f_res_124617);
                    
                    new_sum_124600 = new_sum_f_res_124618;
                }
                
                bool cond_124619 = sle64(new_sum_124600, best_sum_124595);
                int64_t loopres_124620;
                
                if (cond_124619) {
                    loopres_124620 = new_idx_124597;
                } else {
                    loopres_124620 = best_idx_124593;
                }
                
                int64_t loopres_124621;
                
                if (cond_124619) {
                    loopres_124621 = new_sum_124600;
                } else {
                    loopres_124621 = best_sum_124595;
                }
                
                int64_t best_idx_tmp_124654 = loopres_124620;
                int64_t last_idx_tmp_124655 = new_idx_124597;
                int64_t best_sum_tmp_124656 = loopres_124621;
                int64_t curr_sum_tmp_124657 = new_sum_124600;
                
                best_idx_124593 = best_idx_tmp_124654;
                last_idx_124594 = last_idx_tmp_124655;
                best_sum_124595 = best_sum_tmp_124656;
                curr_sum_124596 = curr_sum_tmp_124657;
            }
            idx_124588 = best_idx_124593;
            idx_124589 = last_idx_124594;
            idx_124590 = best_sum_124595;
            idx_124591 = curr_sum_124596;
            
            int64_t min_res_124622 = smin64(min_arg_114827, idx_124588);
            int64_t x_124623 = add64(min_res_114809, min_res_124622);
            int64_t r_124624 = sub64(x_124623, (int64_t) 1);
            bool x_124625 = sle64((int64_t) 0, r_124624);
            bool y_124626 = slt64(r_124624, n_114534);
            bool bounds_check_124627 = x_124625 && y_124626;
            bool index_certs_124628;
            
            if (!bounds_check_124627) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", r_124624,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  loess.fut:386:66-73\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:383:3-389:25\n   #4  loess.fut:401:18-55\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                return 1;
            }
            
            int64_t x_124629 = ((int64_t *) mem_121979.mem)[gtid_117193 *
                                                            n_114534 +
                                                            r_124624];
            int64_t abs_arg_124630 = sub64(x_124629, min_res_124545);
            int64_t abs_res_124631 = abs(abs_arg_124630);
            bool x_124632 = sle64((int64_t) 0, min_res_124622);
            bool y_124633 = slt64(min_res_124622, n_114534);
            bool bounds_check_124634 = x_124632 && y_124633;
            bool index_certs_124635;
            
            if (!bounds_check_124634) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", min_res_124622,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  loess.fut:386:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:383:3-389:25\n   #4  loess.fut:401:18-55\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                return 1;
            }
            
            int64_t x_124636 = ((int64_t *) mem_121979.mem)[gtid_117193 *
                                                            n_114534 +
                                                            min_res_124622];
            int64_t abs_arg_124637 = sub64(x_124636, min_res_124545);
            int64_t abs_res_124638 = abs(abs_arg_124637);
            int64_t max_res_124639 = smax64(abs_res_124631, abs_res_124638);
            float defunc_0_f_res_124640 = sitofp_i64_f32(max_res_124639);
            float defunc_1_f_res_124641 = max_res_114831 +
                  defunc_0_f_res_124640;
            
            ((float *) mem_122173)[i_124541] = defunc_1_f_res_124641;
            ((int64_t *) mem_122176)[i_124541] = min_res_124622;
        }
        memmove(mem_122204.mem + gtid_117193 * t_n_m_114591 * (int64_t) 8,
                mem_122176 + (int64_t) 0, t_n_m_114591 * (int64_t) 8);
        memmove(mem_122208.mem + gtid_117193 * t_n_m_114591 * (int64_t) 4,
                mem_122173 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122143);
    free(mem_122146);
    free(mem_122173);
    free(mem_122176);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131229_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131229_end -
                 futhark_mc_segmap_parloop_131229_start;
        
        ctx->futhark_mc_segmap_parloop_131229_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131229_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131229_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131227(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117192 = tid;
    int num_tasks_124530 = info.nsubtasks;
    struct futhark_mc_task_131226 *futhark_mc_task_131226 =
                                  (struct futhark_mc_task_131226 *) args;
    struct futhark_context *ctx = futhark_mc_task_131226->ctx;
    uint64_t futhark_mc_segmap_task_131227_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131227_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131226->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131226->free_n_114534;
    int64_t t_jump_114541 = futhark_mc_task_131226->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131226->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131226->free_i_114610;
    bool x_114611 = futhark_mc_task_131226->free_x_114611;
    int64_t min_res_114809 = futhark_mc_task_131226->free_min_res_114809;
    bool empty_slice_114814 = futhark_mc_task_131226->free_empty_slice_114814;
    int64_t m_114815 = futhark_mc_task_131226->free_m_114815;
    float i64_res_114816 = futhark_mc_task_131226->free_i64_res_114816;
    int64_t bytes_121940 = futhark_mc_task_131226->free_bytes_121940;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131226->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131226->free_mem_121982,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131226->free_bytes_122135;
    int64_t bytes_122138 = futhark_mc_task_131226->free_bytes_122138;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131226->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131226->free_mem_122208,
                                  .size =0, .references =NULL};
    int64_t iter_124531;
    struct futhark_mc_segmap_parloop_struct_131228
    futhark_mc_segmap_parloop_struct_131228;
    
    futhark_mc_segmap_parloop_struct_131228.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131228.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131228.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131228.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131228.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131228.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131228.free_x_114611 = x_114611;
    futhark_mc_segmap_parloop_struct_131228.free_min_res_114809 =
        min_res_114809;
    futhark_mc_segmap_parloop_struct_131228.free_empty_slice_114814 =
        empty_slice_114814;
    futhark_mc_segmap_parloop_struct_131228.free_m_114815 = m_114815;
    futhark_mc_segmap_parloop_struct_131228.free_i64_res_114816 =
        i64_res_114816;
    futhark_mc_segmap_parloop_struct_131228.free_bytes_121940 = bytes_121940;
    futhark_mc_segmap_parloop_struct_131228.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131228.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131228.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131228.free_bytes_122138 = bytes_122138;
    futhark_mc_segmap_parloop_struct_131228.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131228.free_mem_122208 = mem_122208.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131229_task;
    
    futhark_mc_segmap_parloop_131229_task.name =
        "futhark_mc_segmap_parloop_131229";
    futhark_mc_segmap_parloop_131229_task.fn = futhark_mc_segmap_parloop_131229;
    futhark_mc_segmap_parloop_131229_task.args =
        &futhark_mc_segmap_parloop_struct_131228;
    futhark_mc_segmap_parloop_131229_task.iterations = iterations;
    futhark_mc_segmap_parloop_131229_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131229_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131229_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131229_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131229_task);
    
    if (futhark_mc_segmap_parloop_131229_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131229_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131229_total_end -
                 futhark_mc_segmap_parloop_131229_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131229_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131229_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131229_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131227_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131227_end -
                 futhark_mc_segmap_task_131227_start;
        
        ctx->futhark_mc_segmap_task_131227_runs[tid]++;
        ctx->futhark_mc_segmap_task_131227_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131227_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131235 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    bool free_x_114611;
    int64_t free_min_res_114809;
    bool free_empty_slice_114814;
    int64_t free_m_114815;
    float free_i64_res_114816;
    int64_t free_bytes_121940;
    char *free_mem_121979;
    char *free_mem_121982;
    int64_t free_bytes_122135;
    int64_t free_bytes_122138;
    char *free_mem_122204;
    char *free_mem_122208;
};
struct futhark_mc_task_131241 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_117195;
    char *free_mem_121979;
    char *free_mem_122131;
    char *free_mem_122134;
};
struct futhark_mc_segmap_parloop_struct_131243 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_117195;
    char *free_mem_121979;
    char *free_mem_122131;
    char *free_mem_122134;
};
static int futhark_mc_segmap_parloop_131244(void *args, int64_t start,
                                            int64_t end, int flat_tid_117196,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131243
    *futhark_mc_segmap_parloop_struct_131243 =
    (struct futhark_mc_segmap_parloop_struct_131243 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131243->ctx;
    uint64_t futhark_mc_segmap_parloop_131244_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131244_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131243->free_n_114534;
    int64_t gtid_117195 =
            futhark_mc_segmap_parloop_struct_131243->free_gtid_117195;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131243->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122131 = {.desc ="mem_122131", .mem =
                                  futhark_mc_segmap_parloop_struct_131243->free_mem_122131,
                                  .size =0, .references =NULL};
    struct memblock mem_122134 = {.desc ="mem_122134", .mem =
                                  futhark_mc_segmap_parloop_struct_131243->free_mem_122134,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_124862 = start;
    
    for (; iter_124862 < end; iter_124862++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_124863 = n_114534;
        int64_t gtid_117197 = iter_124862;
        int64_t remnant_124864 = iter_124862 - gtid_117197;
        int64_t x_124659 = ((int64_t *) mem_121979.mem)[gtid_117195 * n_114534 +
                                                        gtid_117197];
        int64_t defunc_0_f_res_124660 = add64((int64_t) 1, x_124659);
        bool cond_124661 = slt64(defunc_0_f_res_124660, (int64_t) 0);
        int64_t defunc_0_f_res_124662;
        
        if (cond_124661) {
            defunc_0_f_res_124662 = (int64_t) 9223372036854775807;
        } else {
            defunc_0_f_res_124662 = defunc_0_f_res_124660;
        }
        ((int64_t *) mem_122131.mem)[gtid_117197] = defunc_0_f_res_124662;
        ((int64_t *) mem_122134.mem)[gtid_117197] = defunc_0_f_res_124660;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131244_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131244_end -
                 futhark_mc_segmap_parloop_131244_start;
        
        ctx->futhark_mc_segmap_parloop_131244_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131244_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131244_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131242(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117196 = tid;
    int num_tasks_124861 = info.nsubtasks;
    struct futhark_mc_task_131241 *futhark_mc_task_131241 =
                                  (struct futhark_mc_task_131241 *) args;
    struct futhark_context *ctx = futhark_mc_task_131241->ctx;
    uint64_t futhark_mc_segmap_task_131242_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131242_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131241->free_n_114534;
    int64_t gtid_117195 = futhark_mc_task_131241->free_gtid_117195;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131241->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122131 = {.desc ="mem_122131", .mem =
                                  futhark_mc_task_131241->free_mem_122131,
                                  .size =0, .references =NULL};
    struct memblock mem_122134 = {.desc ="mem_122134", .mem =
                                  futhark_mc_task_131241->free_mem_122134,
                                  .size =0, .references =NULL};
    int64_t iter_124862;
    struct futhark_mc_segmap_parloop_struct_131243
    futhark_mc_segmap_parloop_struct_131243;
    
    futhark_mc_segmap_parloop_struct_131243.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131243.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131243.free_gtid_117195 = gtid_117195;
    futhark_mc_segmap_parloop_struct_131243.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131243.free_mem_122131 = mem_122131.mem;
    futhark_mc_segmap_parloop_struct_131243.free_mem_122134 = mem_122134.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131244_task;
    
    futhark_mc_segmap_parloop_131244_task.name =
        "futhark_mc_segmap_parloop_131244";
    futhark_mc_segmap_parloop_131244_task.fn = futhark_mc_segmap_parloop_131244;
    futhark_mc_segmap_parloop_131244_task.args =
        &futhark_mc_segmap_parloop_struct_131243;
    futhark_mc_segmap_parloop_131244_task.iterations = iterations;
    futhark_mc_segmap_parloop_131244_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131244_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131244_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131244_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131244_task);
    
    if (futhark_mc_segmap_parloop_131244_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131244_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131244_total_end -
                 futhark_mc_segmap_parloop_131244_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131244_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131244_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131244_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131242_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131242_end -
                 futhark_mc_segmap_task_131242_start;
        
        ctx->futhark_mc_segmap_task_131242_runs[tid]++;
        ctx->futhark_mc_segmap_task_131242_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131242_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131245 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    bool free_x_114611;
    int64_t free_min_res_114809;
    bool free_empty_slice_114814;
    int64_t free_m_114815;
    int64_t free_gtid_117195;
    int64_t free_x_117304;
    int64_t free_min_arg_117311;
    float free_max_res_117315;
    char *free_mem_121979;
    char *free_mem_122131;
    char *free_mem_122134;
    char *free_mem_122137;
    char *free_mem_122140;
};
struct futhark_mc_segmap_parloop_struct_131247 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    bool free_x_114611;
    int64_t free_min_res_114809;
    bool free_empty_slice_114814;
    int64_t free_m_114815;
    int64_t free_gtid_117195;
    int64_t free_x_117304;
    int64_t free_min_arg_117311;
    float free_max_res_117315;
    char *free_mem_121979;
    char *free_mem_122131;
    char *free_mem_122134;
    char *free_mem_122137;
    char *free_mem_122140;
};
static int futhark_mc_segmap_parloop_131248(void *args, int64_t start,
                                            int64_t end, int flat_tid_117198,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131247
    *futhark_mc_segmap_parloop_struct_131247 =
    (struct futhark_mc_segmap_parloop_struct_131247 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131247->ctx;
    uint64_t futhark_mc_segmap_parloop_131248_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131248_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131247->free_n_114534;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131247->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131247->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131247->free_i_114610;
    bool x_114611 = futhark_mc_segmap_parloop_struct_131247->free_x_114611;
    int64_t min_res_114809 =
            futhark_mc_segmap_parloop_struct_131247->free_min_res_114809;
    bool empty_slice_114814 =
         futhark_mc_segmap_parloop_struct_131247->free_empty_slice_114814;
    int64_t m_114815 = futhark_mc_segmap_parloop_struct_131247->free_m_114815;
    int64_t gtid_117195 =
            futhark_mc_segmap_parloop_struct_131247->free_gtid_117195;
    int64_t x_117304 = futhark_mc_segmap_parloop_struct_131247->free_x_117304;
    int64_t min_arg_117311 =
            futhark_mc_segmap_parloop_struct_131247->free_min_arg_117311;
    float max_res_117315 =
          futhark_mc_segmap_parloop_struct_131247->free_max_res_117315;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131247->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122131 = {.desc ="mem_122131", .mem =
                                  futhark_mc_segmap_parloop_struct_131247->free_mem_122131,
                                  .size =0, .references =NULL};
    struct memblock mem_122134 = {.desc ="mem_122134", .mem =
                                  futhark_mc_segmap_parloop_struct_131247->free_mem_122134,
                                  .size =0, .references =NULL};
    struct memblock mem_122137 = {.desc ="mem_122137", .mem =
                                  futhark_mc_segmap_parloop_struct_131247->free_mem_122137,
                                  .size =0, .references =NULL};
    struct memblock mem_122140 = {.desc ="mem_122140", .mem =
                                  futhark_mc_segmap_parloop_struct_131247->free_mem_122140,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_124866 = start;
    
    for (; iter_124866 < end; iter_124866++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_124920 = t_n_m_114591;
        int64_t gtid_117199 = iter_124866;
        int64_t remnant_124921 = iter_124866 - gtid_117199;
        int64_t min_arg_124761 = mul64(t_jump_114541, gtid_117199);
        int64_t min_res_124762 = smin64(i_114610, min_arg_124761);
        int64_t defunc_0_g_res_124763 = add64((int64_t) 1, min_res_124762);
        bool nearest_idx_124764;
        int64_t nearest_idx_124765;
        int64_t nearest_idx_124766;
        bool loop_while_124867;
        int64_t low_124868;
        int64_t high_124869;
        
        loop_while_124867 = x_114611;
        low_124868 = (int64_t) 0;
        high_124869 = i_114610;
        while (loop_while_124867) {
            int64_t x_124870 = add64(low_124868, high_124869);
            int64_t mid_124871 = sdiv64(x_124870, (int64_t) 2);
            bool x_124872 = sle64((int64_t) 0, mid_124871);
            bool y_124873 = slt64(mid_124871, n_114534);
            bool bounds_check_124874 = x_124872 && y_124873;
            bool index_certs_124875;
            
            if (!bounds_check_124874) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", mid_124871,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  loess.fut:343:19-30\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                return 1;
            }
            
            int64_t x_124876 = ((int64_t *) mem_122131.mem)[mid_124871];
            bool cond_124877 = sle64(defunc_0_g_res_124763, x_124876);
            int64_t loopres_124878;
            int64_t loopres_124879;
            
            if (cond_124877) {
                int64_t loopres_t_res_124880 = sub64(mid_124871, (int64_t) 1);
                
                loopres_124878 = low_124868;
                loopres_124879 = loopres_t_res_124880;
            } else {
                int64_t loopres_f_res_124881 = add64((int64_t) 1, mid_124871);
                
                loopres_124878 = loopres_f_res_124881;
                loopres_124879 = high_124869;
            }
            
            bool loop_cond_124882 = sle64(loopres_124878, loopres_124879);
            bool loop_while_tmp_124922 = loop_cond_124882;
            int64_t low_tmp_124923 = loopres_124878;
            int64_t high_tmp_124924 = loopres_124879;
            
            loop_while_124867 = loop_while_tmp_124922;
            low_124868 = low_tmp_124923;
            high_124869 = high_tmp_124924;
        }
        nearest_idx_124764 = loop_while_124867;
        nearest_idx_124765 = low_124868;
        nearest_idx_124766 = high_124869;
        
        int64_t max_arg_124783 = sub64(nearest_idx_124765, min_res_114809);
        int64_t max_res_124784 = smax64((int64_t) 0, max_arg_124783);
        int64_t j_124785 = add64(min_res_114809, max_res_124784);
        int64_t i_p_m_t_s_124786 = add64(m_114815, max_res_124784);
        bool zzero_leq_i_p_m_t_s_124787 = sle64((int64_t) 0, i_p_m_t_s_124786);
        bool i_p_m_t_s_leq_w_124788 = slt64(i_p_m_t_s_124786, n_114534);
        bool zzero_lte_i_124789 = sle64((int64_t) 0, max_res_124784);
        bool i_lte_j_124790 = sle64(max_res_124784, j_124785);
        bool y_124791 = i_p_m_t_s_leq_w_124788 && zzero_lte_i_124789;
        bool y_124792 = zzero_leq_i_p_m_t_s_124787 && y_124791;
        bool y_124793 = i_lte_j_124790 && y_124792;
        bool forwards_ok_124794 = zzero_lte_i_124789 && y_124793;
        bool ok_or_empty_124795 = empty_slice_114814 || forwards_ok_124794;
        bool index_certs_124796;
        
        if (!ok_or_empty_124795) {
            ctx->error =
                msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                          "Index [", max_res_124784, ":", j_124785,
                          "] out of bounds for array of shape [", n_114534,
                          "].",
                          "-> #0  loess.fut:350:25-55\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
            return 1;
        }
        
        int64_t defunc_2_reduce_res_124797;
        int64_t redout_124884 = (int64_t) 0;
        
        for (int64_t i_124883 = 0; i_124883 < min_res_114809; i_124883++) {
            int64_t slice_124885 = max_res_124784 + i_124883;
            int64_t x_124886 = ((int64_t *) mem_122134.mem)[slice_124885];
            int64_t abs_arg_124887 = sub64(x_124886, defunc_0_g_res_124763);
            int64_t abs_res_124888 = abs(abs_arg_124887);
            int64_t defunc_1_op_res_124889 = add64(abs_res_124888,
                                                   redout_124884);
            int64_t redout_tmp_124925 = defunc_1_op_res_124889;
            
            redout_124884 = redout_tmp_124925;
        }
        defunc_2_reduce_res_124797 = redout_124884;
        
        int64_t idx_124805;
        int64_t idx_124806;
        int64_t idx_124807;
        int64_t idx_124808;
        int64_t best_idx_124891;
        int64_t last_idx_124892;
        int64_t best_sum_124893;
        int64_t curr_sum_124894;
        
        best_idx_124891 = max_res_124784;
        last_idx_124892 = max_res_124784;
        best_sum_124893 = defunc_2_reduce_res_124797;
        curr_sum_124894 = defunc_2_reduce_res_124797;
        for (int64_t j_124890 = 0; j_124890 < min_res_114809; j_124890++) {
            int64_t new_idx_124895 = add64(max_res_124784, j_124890);
            int64_t x_124896 = add64(min_res_114809, new_idx_124895);
            bool cond_124897 = slt64(x_117304, x_124896);
            int64_t new_sum_124898;
            
            if (cond_124897) {
                new_sum_124898 = (int64_t) 9223372036854775807;
            } else {
                bool x_124899 = sle64((int64_t) 0, last_idx_124892);
                bool y_124900 = slt64(last_idx_124892, n_114534);
                bool bounds_check_124901 = x_124899 && y_124900;
                bool index_certs_124902;
                
                if (!bounds_check_124901) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", last_idx_124892,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  loess.fut:362:51-66\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                int64_t y_124903 =
                        ((int64_t *) mem_122134.mem)[last_idx_124892];
                int64_t binop_p_124904 = sub64(defunc_0_g_res_124763, y_124903);
                int64_t defunc_0_f_res_124905 = abs(binop_p_124904);
                int64_t x_124906 = sub64(curr_sum_124894,
                                         defunc_0_f_res_124905);
                int64_t min_arg_124907 = add64(min_res_114809, last_idx_124892);
                int64_t min_res_124908 = smin64(i_114610, min_arg_124907);
                bool x_124909 = sle64((int64_t) 0, min_res_124908);
                bool y_124910 = slt64(min_res_124908, n_114534);
                bool bounds_check_124911 = x_124909 && y_124910;
                bool index_certs_124912;
                
                if (!bounds_check_124911) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", min_res_124908,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  loess.fut:363:51-88\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                int64_t y_124913 = ((int64_t *) mem_122134.mem)[min_res_124908];
                int64_t binop_p_124914 = sub64(defunc_0_g_res_124763, y_124913);
                int64_t defunc_0_f_res_124915 = abs(binop_p_124914);
                int64_t new_sum_f_res_124916 = add64(x_124906,
                                                     defunc_0_f_res_124915);
                
                new_sum_124898 = new_sum_f_res_124916;
            }
            
            bool cond_124917 = sle64(new_sum_124898, best_sum_124893);
            int64_t loopres_124918;
            
            if (cond_124917) {
                loopres_124918 = new_idx_124895;
            } else {
                loopres_124918 = best_idx_124891;
            }
            
            int64_t loopres_124919;
            
            if (cond_124917) {
                loopres_124919 = new_sum_124898;
            } else {
                loopres_124919 = best_sum_124893;
            }
            
            int64_t best_idx_tmp_124926 = loopres_124918;
            int64_t last_idx_tmp_124927 = new_idx_124895;
            int64_t best_sum_tmp_124928 = loopres_124919;
            int64_t curr_sum_tmp_124929 = new_sum_124898;
            
            best_idx_124891 = best_idx_tmp_124926;
            last_idx_124892 = last_idx_tmp_124927;
            best_sum_124893 = best_sum_tmp_124928;
            curr_sum_124894 = curr_sum_tmp_124929;
        }
        idx_124805 = best_idx_124891;
        idx_124806 = last_idx_124892;
        idx_124807 = best_sum_124893;
        idx_124808 = curr_sum_124894;
        
        int64_t min_res_124839 = smin64(min_arg_117311, idx_124805);
        int64_t x_124840 = add64(min_res_114809, min_res_124839);
        int64_t r_124841 = sub64(x_124840, (int64_t) 1);
        bool x_124842 = sle64((int64_t) 0, r_124841);
        bool y_124843 = slt64(r_124841, n_114534);
        bool bounds_check_124844 = x_124842 && y_124843;
        bool index_certs_124845;
        
        if (!bounds_check_124844) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", r_124841,
                                   "] out of bounds for array of shape [",
                                   n_114534, "].",
                                   "-> #0  loess.fut:386:66-73\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:383:3-389:25\n   #4  loess.fut:401:18-55\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
            return 1;
        }
        
        int64_t x_124846 = ((int64_t *) mem_121979.mem)[gtid_117195 * n_114534 +
                                                        r_124841];
        int64_t abs_arg_124847 = sub64(x_124846, min_res_124762);
        int64_t abs_res_124848 = abs(abs_arg_124847);
        bool x_124849 = sle64((int64_t) 0, min_res_124839);
        bool y_124850 = slt64(min_res_124839, n_114534);
        bool bounds_check_124851 = x_124849 && y_124850;
        bool index_certs_124852;
        
        if (!bounds_check_124851) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", min_res_124839,
                                   "] out of bounds for array of shape [",
                                   n_114534, "].",
                                   "-> #0  loess.fut:386:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:383:3-389:25\n   #4  loess.fut:401:18-55\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
            return 1;
        }
        
        int64_t x_124853 = ((int64_t *) mem_121979.mem)[gtid_117195 * n_114534 +
                                                        min_res_124839];
        int64_t abs_arg_124854 = sub64(x_124853, min_res_124762);
        int64_t abs_res_124855 = abs(abs_arg_124854);
        int64_t max_res_124856 = smax64(abs_res_124848, abs_res_124855);
        float defunc_0_f_res_124857 = sitofp_i64_f32(max_res_124856);
        float defunc_1_f_res_124858 = max_res_117315 + defunc_0_f_res_124857;
        
        ((float *) mem_122137.mem)[gtid_117199] = defunc_1_f_res_124858;
        ((int64_t *) mem_122140.mem)[gtid_117199] = min_res_124839;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131248_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131248_end -
                 futhark_mc_segmap_parloop_131248_start;
        
        ctx->futhark_mc_segmap_parloop_131248_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131248_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131248_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131246(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117198 = tid;
    int num_tasks_124865 = info.nsubtasks;
    struct futhark_mc_task_131245 *futhark_mc_task_131245 =
                                  (struct futhark_mc_task_131245 *) args;
    struct futhark_context *ctx = futhark_mc_task_131245->ctx;
    uint64_t futhark_mc_segmap_task_131246_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131246_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131245->free_n_114534;
    int64_t t_jump_114541 = futhark_mc_task_131245->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131245->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131245->free_i_114610;
    bool x_114611 = futhark_mc_task_131245->free_x_114611;
    int64_t min_res_114809 = futhark_mc_task_131245->free_min_res_114809;
    bool empty_slice_114814 = futhark_mc_task_131245->free_empty_slice_114814;
    int64_t m_114815 = futhark_mc_task_131245->free_m_114815;
    int64_t gtid_117195 = futhark_mc_task_131245->free_gtid_117195;
    int64_t x_117304 = futhark_mc_task_131245->free_x_117304;
    int64_t min_arg_117311 = futhark_mc_task_131245->free_min_arg_117311;
    float max_res_117315 = futhark_mc_task_131245->free_max_res_117315;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131245->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122131 = {.desc ="mem_122131", .mem =
                                  futhark_mc_task_131245->free_mem_122131,
                                  .size =0, .references =NULL};
    struct memblock mem_122134 = {.desc ="mem_122134", .mem =
                                  futhark_mc_task_131245->free_mem_122134,
                                  .size =0, .references =NULL};
    struct memblock mem_122137 = {.desc ="mem_122137", .mem =
                                  futhark_mc_task_131245->free_mem_122137,
                                  .size =0, .references =NULL};
    struct memblock mem_122140 = {.desc ="mem_122140", .mem =
                                  futhark_mc_task_131245->free_mem_122140,
                                  .size =0, .references =NULL};
    int64_t iter_124866;
    struct futhark_mc_segmap_parloop_struct_131247
    futhark_mc_segmap_parloop_struct_131247;
    
    futhark_mc_segmap_parloop_struct_131247.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131247.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131247.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131247.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131247.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131247.free_x_114611 = x_114611;
    futhark_mc_segmap_parloop_struct_131247.free_min_res_114809 =
        min_res_114809;
    futhark_mc_segmap_parloop_struct_131247.free_empty_slice_114814 =
        empty_slice_114814;
    futhark_mc_segmap_parloop_struct_131247.free_m_114815 = m_114815;
    futhark_mc_segmap_parloop_struct_131247.free_gtid_117195 = gtid_117195;
    futhark_mc_segmap_parloop_struct_131247.free_x_117304 = x_117304;
    futhark_mc_segmap_parloop_struct_131247.free_min_arg_117311 =
        min_arg_117311;
    futhark_mc_segmap_parloop_struct_131247.free_max_res_117315 =
        max_res_117315;
    futhark_mc_segmap_parloop_struct_131247.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131247.free_mem_122131 = mem_122131.mem;
    futhark_mc_segmap_parloop_struct_131247.free_mem_122134 = mem_122134.mem;
    futhark_mc_segmap_parloop_struct_131247.free_mem_122137 = mem_122137.mem;
    futhark_mc_segmap_parloop_struct_131247.free_mem_122140 = mem_122140.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131248_task;
    
    futhark_mc_segmap_parloop_131248_task.name =
        "futhark_mc_segmap_parloop_131248";
    futhark_mc_segmap_parloop_131248_task.fn = futhark_mc_segmap_parloop_131248;
    futhark_mc_segmap_parloop_131248_task.args =
        &futhark_mc_segmap_parloop_struct_131247;
    futhark_mc_segmap_parloop_131248_task.iterations = iterations;
    futhark_mc_segmap_parloop_131248_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131248_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131248_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131248_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131248_task);
    
    if (futhark_mc_segmap_parloop_131248_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131248_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131248_total_end -
                 futhark_mc_segmap_parloop_131248_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131248_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131248_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131248_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131246_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131246_end -
                 futhark_mc_segmap_task_131246_start;
        
        ctx->futhark_mc_segmap_task_131246_runs[tid]++;
        ctx->futhark_mc_segmap_task_131246_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131246_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131250 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    bool free_x_114611;
    int64_t free_min_res_114809;
    bool free_empty_slice_114814;
    int64_t free_m_114815;
    int64_t free_gtid_117195;
    int64_t free_x_117304;
    int64_t free_min_arg_117311;
    float free_max_res_117315;
    char *free_mem_121979;
    char *free_mem_122131;
    char *free_mem_122134;
    char *free_mem_122137;
    char *free_mem_122140;
};
struct futhark_mc_task_131252 {
    struct futhark_context *ctx;
    char *free_mem_122134;
    int64_t free_defunc_0_g_res_124665;
    int64_t free_max_res_124686;
    int64_t *retval_defunc_2_reduce_res_124699;
};
struct futhark_mc_segred_stage_1_parloop_struct_131255 {
    struct futhark_context *ctx;
    char *free_mem_122134;
    int64_t free_defunc_0_g_res_124665;
    int64_t free_max_res_124686;
    char *free_reduce_stage_1_tid_res_arr_mem_124990;
};
static int futhark_mc_segred_stage_1_parloop_131256(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_117202,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131255
    *futhark_mc_segred_stage_1_parloop_struct_131255 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131255 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131255->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131256_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131256_start = get_wall_time();
    
    struct memblock mem_122134 = {.desc ="mem_122134", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131255->free_mem_122134,
                                  .size =0, .references =NULL};
    int64_t defunc_0_g_res_124665 =
            futhark_mc_segred_stage_1_parloop_struct_131255->free_defunc_0_g_res_124665;
    int64_t max_res_124686 =
            futhark_mc_segred_stage_1_parloop_struct_131255->free_max_res_124686;
    struct memblock reduce_stage_1_tid_res_arr_mem_124990 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_124990",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131255->free_reduce_stage_1_tid_res_arr_mem_124990,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_124992 = start;
    int64_t x_124947;
    int64_t x_124948;
    int64_t local_acc_124993 = (int64_t) 0;
    
    for (; iter_124992 < end; iter_124992++) {
        int64_t gtid_117203 = iter_124992;
        int64_t slice_124950 = gtid_117203 + max_res_124686;
        int64_t x_124951 = ((int64_t *) mem_122134.mem)[slice_124950];
        int64_t abs_arg_124952 = sub64(x_124951, defunc_0_g_res_124665);
        int64_t abs_res_124953 = abs(abs_arg_124952);
        
        // save map-out results
        { }
        // Load accum params
        {
            x_124947 = local_acc_124993;
        }
        // Load next params
        {
            x_124948 = abs_res_124953;
        }
        // Red body
        {
            int64_t defunc_1_op_res_124949 = add64(x_124947, x_124948);
            
            local_acc_124993 = defunc_1_op_res_124949;
        }
    }
    ((int64_t *) reduce_stage_1_tid_res_arr_mem_124990.mem)[flat_tid_117202] =
        local_acc_124993;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131256_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131256_end -
                 futhark_mc_segred_stage_1_parloop_131256_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131256_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131256_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131256_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131253(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117202 = tid;
    int num_tasks_124989 = info.nsubtasks;
    struct futhark_mc_task_131252 *futhark_mc_task_131252 =
                                  (struct futhark_mc_task_131252 *) args;
    struct futhark_context *ctx = futhark_mc_task_131252->ctx;
    uint64_t futhark_mc_segred_task_131253_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131253_start = get_wall_time();
    
    struct memblock mem_122134 = {.desc ="mem_122134", .mem =
                                  futhark_mc_task_131252->free_mem_122134,
                                  .size =0, .references =NULL};
    int64_t defunc_0_g_res_124665 =
            futhark_mc_task_131252->free_defunc_0_g_res_124665;
    int64_t max_res_124686 = futhark_mc_task_131252->free_max_res_124686;
    int64_t defunc_2_reduce_res_124699 =
            *futhark_mc_task_131252->retval_defunc_2_reduce_res_124699;
    size_t reduce_stage_1_tid_res_arr_mem_124990_cached_sizze_131254 = 0;
    char *reduce_stage_1_tid_res_arr_mem_124990 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_124990_cached_sizze_131254 <
        (size_t) ((int64_t) 8 * num_tasks_124989)) {
        reduce_stage_1_tid_res_arr_mem_124990 =
            realloc(reduce_stage_1_tid_res_arr_mem_124990, (int64_t) 8 *
                    num_tasks_124989);
        reduce_stage_1_tid_res_arr_mem_124990_cached_sizze_131254 =
            (int64_t) 8 * num_tasks_124989;
    }
    
    int64_t iter_124992;
    struct futhark_mc_segred_stage_1_parloop_struct_131255
    futhark_mc_segred_stage_1_parloop_struct_131255;
    
    futhark_mc_segred_stage_1_parloop_struct_131255.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131255.free_mem_122134 =
        mem_122134.mem;
    futhark_mc_segred_stage_1_parloop_struct_131255.free_defunc_0_g_res_124665 =
        defunc_0_g_res_124665;
    futhark_mc_segred_stage_1_parloop_struct_131255.free_max_res_124686 =
        max_res_124686;
    futhark_mc_segred_stage_1_parloop_struct_131255.free_reduce_stage_1_tid_res_arr_mem_124990 =
        reduce_stage_1_tid_res_arr_mem_124990;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131256_task;
    
    futhark_mc_segred_stage_1_parloop_131256_task.name =
        "futhark_mc_segred_stage_1_parloop_131256";
    futhark_mc_segred_stage_1_parloop_131256_task.fn =
        futhark_mc_segred_stage_1_parloop_131256;
    futhark_mc_segred_stage_1_parloop_131256_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131255;
    futhark_mc_segred_stage_1_parloop_131256_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131256_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131256_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131256_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131256_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131256_task);
    
    if (futhark_mc_segred_stage_1_parloop_131256_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131256_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131256_total_end -
                 futhark_mc_segred_stage_1_parloop_131256_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131256_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131256_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131256_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_124699 = (int64_t) 0;
    }
    
    int64_t x_124994;
    int64_t x_124995;
    
    for (int32_t i_124997 = 0; i_124997 < num_tasks_124989; i_124997++) {
        flat_tid_117202 = i_124997;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_124994 = defunc_2_reduce_res_124699;
            }
            // load next params
            {
                x_124995 =
                    ((int64_t *) reduce_stage_1_tid_res_arr_mem_124990)[flat_tid_117202];
            }
            // red body
            {
                int64_t defunc_1_op_res_124996 = add64(x_124994, x_124995);
                
                defunc_2_reduce_res_124699 = defunc_1_op_res_124996;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_124990);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131253_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131253_end -
                 futhark_mc_segred_task_131253_start;
        
        ctx->futhark_mc_segred_task_131253_runs[tid]++;
        ctx->futhark_mc_segred_task_131253_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131253_iter[tid] += iterations;
    }
    *futhark_mc_task_131252->retval_defunc_2_reduce_res_124699 =
        defunc_2_reduce_res_124699;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131251(void *args, int64_t start,
                                            int64_t end, int flat_tid_117200,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131250
    *futhark_mc_segmap_parloop_struct_131250 =
    (struct futhark_mc_segmap_parloop_struct_131250 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131250->ctx;
    uint64_t futhark_mc_segmap_parloop_131251_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131251_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131250->free_n_114534;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131250->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131250->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131250->free_i_114610;
    bool x_114611 = futhark_mc_segmap_parloop_struct_131250->free_x_114611;
    int64_t min_res_114809 =
            futhark_mc_segmap_parloop_struct_131250->free_min_res_114809;
    bool empty_slice_114814 =
         futhark_mc_segmap_parloop_struct_131250->free_empty_slice_114814;
    int64_t m_114815 = futhark_mc_segmap_parloop_struct_131250->free_m_114815;
    int64_t gtid_117195 =
            futhark_mc_segmap_parloop_struct_131250->free_gtid_117195;
    int64_t x_117304 = futhark_mc_segmap_parloop_struct_131250->free_x_117304;
    int64_t min_arg_117311 =
            futhark_mc_segmap_parloop_struct_131250->free_min_arg_117311;
    float max_res_117315 =
          futhark_mc_segmap_parloop_struct_131250->free_max_res_117315;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131250->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122131 = {.desc ="mem_122131", .mem =
                                  futhark_mc_segmap_parloop_struct_131250->free_mem_122131,
                                  .size =0, .references =NULL};
    struct memblock mem_122134 = {.desc ="mem_122134", .mem =
                                  futhark_mc_segmap_parloop_struct_131250->free_mem_122134,
                                  .size =0, .references =NULL};
    struct memblock mem_122137 = {.desc ="mem_122137", .mem =
                                  futhark_mc_segmap_parloop_struct_131250->free_mem_122137,
                                  .size =0, .references =NULL};
    struct memblock mem_122140 = {.desc ="mem_122140", .mem =
                                  futhark_mc_segmap_parloop_struct_131250->free_mem_122140,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_124930 = start;
    
    for (; iter_124930 < end; iter_124930++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_124984 = t_n_m_114591;
        int64_t gtid_117201 = iter_124930;
        int64_t remnant_124985 = iter_124930 - gtid_117201;
        int64_t min_arg_124663 = mul64(t_jump_114541, gtid_117201);
        int64_t min_res_124664 = smin64(i_114610, min_arg_124663);
        int64_t defunc_0_g_res_124665 = add64((int64_t) 1, min_res_124664);
        bool nearest_idx_124666;
        int64_t nearest_idx_124667;
        int64_t nearest_idx_124668;
        bool loop_while_124931;
        int64_t low_124932;
        int64_t high_124933;
        
        loop_while_124931 = x_114611;
        low_124932 = (int64_t) 0;
        high_124933 = i_114610;
        while (loop_while_124931) {
            int64_t x_124934 = add64(low_124932, high_124933);
            int64_t mid_124935 = sdiv64(x_124934, (int64_t) 2);
            bool x_124936 = sle64((int64_t) 0, mid_124935);
            bool y_124937 = slt64(mid_124935, n_114534);
            bool bounds_check_124938 = x_124936 && y_124937;
            bool index_certs_124939;
            
            if (!bounds_check_124938) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", mid_124935,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  loess.fut:343:19-30\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                return 1;
            }
            
            int64_t x_124940 = ((int64_t *) mem_122131.mem)[mid_124935];
            bool cond_124941 = sle64(defunc_0_g_res_124665, x_124940);
            int64_t loopres_124942;
            int64_t loopres_124943;
            
            if (cond_124941) {
                int64_t loopres_t_res_124944 = sub64(mid_124935, (int64_t) 1);
                
                loopres_124942 = low_124932;
                loopres_124943 = loopres_t_res_124944;
            } else {
                int64_t loopres_f_res_124945 = add64((int64_t) 1, mid_124935);
                
                loopres_124942 = loopres_f_res_124945;
                loopres_124943 = high_124933;
            }
            
            bool loop_cond_124946 = sle64(loopres_124942, loopres_124943);
            bool loop_while_tmp_124986 = loop_cond_124946;
            int64_t low_tmp_124987 = loopres_124942;
            int64_t high_tmp_124988 = loopres_124943;
            
            loop_while_124931 = loop_while_tmp_124986;
            low_124932 = low_tmp_124987;
            high_124933 = high_tmp_124988;
        }
        nearest_idx_124666 = loop_while_124931;
        nearest_idx_124667 = low_124932;
        nearest_idx_124668 = high_124933;
        
        int64_t max_arg_124685 = sub64(nearest_idx_124667, min_res_114809);
        int64_t max_res_124686 = smax64((int64_t) 0, max_arg_124685);
        int64_t j_124687 = add64(min_res_114809, max_res_124686);
        int64_t i_p_m_t_s_124688 = add64(m_114815, max_res_124686);
        bool zzero_leq_i_p_m_t_s_124689 = sle64((int64_t) 0, i_p_m_t_s_124688);
        bool i_p_m_t_s_leq_w_124690 = slt64(i_p_m_t_s_124688, n_114534);
        bool zzero_lte_i_124691 = sle64((int64_t) 0, max_res_124686);
        bool i_lte_j_124692 = sle64(max_res_124686, j_124687);
        bool y_124693 = i_p_m_t_s_leq_w_124690 && zzero_lte_i_124691;
        bool y_124694 = zzero_leq_i_p_m_t_s_124689 && y_124693;
        bool y_124695 = i_lte_j_124692 && y_124694;
        bool forwards_ok_124696 = zzero_lte_i_124691 && y_124695;
        bool ok_or_empty_124697 = empty_slice_114814 || forwards_ok_124696;
        bool index_certs_124698;
        
        if (!ok_or_empty_124697) {
            ctx->error =
                msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                          "Index [", max_res_124686, ":", j_124687,
                          "] out of bounds for array of shape [", n_114534,
                          "].",
                          "-> #0  loess.fut:350:25-55\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
            return 1;
        }
        
        int64_t defunc_2_reduce_res_124699;
        int64_t flat_tid_117202 = (int64_t) 0;
        int32_t num_tasks_124989;
        struct futhark_mc_task_131252 futhark_mc_task_131252;
        
        futhark_mc_task_131252.ctx = ctx;
        futhark_mc_task_131252.free_mem_122134 = mem_122134.mem;
        futhark_mc_task_131252.free_defunc_0_g_res_124665 =
            defunc_0_g_res_124665;
        futhark_mc_task_131252.free_max_res_124686 = max_res_124686;
        futhark_mc_task_131252.retval_defunc_2_reduce_res_124699 =
            &defunc_2_reduce_res_124699;
        
        struct scheduler_segop futhark_mc_task_131252_task;
        
        futhark_mc_task_131252_task.args = &futhark_mc_task_131252;
        futhark_mc_task_131252_task.top_level_fn =
            futhark_mc_segred_task_131253;
        futhark_mc_task_131252_task.name = "futhark_mc_segred_task_131253";
        futhark_mc_task_131252_task.iterations = min_res_114809;
        futhark_mc_task_131252_task.task_time =
            &ctx->futhark_mc_segred_task_131253_total_time;
        futhark_mc_task_131252_task.task_iter =
            &ctx->futhark_mc_segred_task_131253_total_iter;
        futhark_mc_task_131252_task.sched = STATIC;
        futhark_mc_task_131252_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131253_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131252_task);
        
        if (futhark_mc_segred_task_131253_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        int64_t idx_124707;
        int64_t idx_124708;
        int64_t idx_124709;
        int64_t idx_124710;
        int64_t best_idx_124955;
        int64_t last_idx_124956;
        int64_t best_sum_124957;
        int64_t curr_sum_124958;
        
        best_idx_124955 = max_res_124686;
        last_idx_124956 = max_res_124686;
        best_sum_124957 = defunc_2_reduce_res_124699;
        curr_sum_124958 = defunc_2_reduce_res_124699;
        for (int64_t j_124954 = 0; j_124954 < min_res_114809; j_124954++) {
            int64_t new_idx_124959 = add64(max_res_124686, j_124954);
            int64_t x_124960 = add64(min_res_114809, new_idx_124959);
            bool cond_124961 = slt64(x_117304, x_124960);
            int64_t new_sum_124962;
            
            if (cond_124961) {
                new_sum_124962 = (int64_t) 9223372036854775807;
            } else {
                bool x_124963 = sle64((int64_t) 0, last_idx_124956);
                bool y_124964 = slt64(last_idx_124956, n_114534);
                bool bounds_check_124965 = x_124963 && y_124964;
                bool index_certs_124966;
                
                if (!bounds_check_124965) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", last_idx_124956,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  loess.fut:362:51-66\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                int64_t y_124967 =
                        ((int64_t *) mem_122134.mem)[last_idx_124956];
                int64_t binop_p_124968 = sub64(defunc_0_g_res_124665, y_124967);
                int64_t defunc_0_f_res_124969 = abs(binop_p_124968);
                int64_t x_124970 = sub64(curr_sum_124958,
                                         defunc_0_f_res_124969);
                int64_t min_arg_124971 = add64(min_res_114809, last_idx_124956);
                int64_t min_res_124972 = smin64(i_114610, min_arg_124971);
                bool x_124973 = sle64((int64_t) 0, min_res_124972);
                bool y_124974 = slt64(min_res_124972, n_114534);
                bool bounds_check_124975 = x_124973 && y_124974;
                bool index_certs_124976;
                
                if (!bounds_check_124975) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", min_res_124972,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  loess.fut:363:51-88\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  loess.fut:335:3-373:7\n   #4  loess.fut:400:15-58\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                int64_t y_124977 = ((int64_t *) mem_122134.mem)[min_res_124972];
                int64_t binop_p_124978 = sub64(defunc_0_g_res_124665, y_124977);
                int64_t defunc_0_f_res_124979 = abs(binop_p_124978);
                int64_t new_sum_f_res_124980 = add64(x_124970,
                                                     defunc_0_f_res_124979);
                
                new_sum_124962 = new_sum_f_res_124980;
            }
            
            bool cond_124981 = sle64(new_sum_124962, best_sum_124957);
            int64_t loopres_124982;
            
            if (cond_124981) {
                loopres_124982 = new_idx_124959;
            } else {
                loopres_124982 = best_idx_124955;
            }
            
            int64_t loopres_124983;
            
            if (cond_124981) {
                loopres_124983 = new_sum_124962;
            } else {
                loopres_124983 = best_sum_124957;
            }
            
            int64_t best_idx_tmp_124998 = loopres_124982;
            int64_t last_idx_tmp_124999 = new_idx_124959;
            int64_t best_sum_tmp_125000 = loopres_124983;
            int64_t curr_sum_tmp_125001 = new_sum_124962;
            
            best_idx_124955 = best_idx_tmp_124998;
            last_idx_124956 = last_idx_tmp_124999;
            best_sum_124957 = best_sum_tmp_125000;
            curr_sum_124958 = curr_sum_tmp_125001;
        }
        idx_124707 = best_idx_124955;
        idx_124708 = last_idx_124956;
        idx_124709 = best_sum_124957;
        idx_124710 = curr_sum_124958;
        
        int64_t min_res_124741 = smin64(min_arg_117311, idx_124707);
        int64_t x_124742 = add64(min_res_114809, min_res_124741);
        int64_t r_124743 = sub64(x_124742, (int64_t) 1);
        bool x_124744 = sle64((int64_t) 0, r_124743);
        bool y_124745 = slt64(r_124743, n_114534);
        bool bounds_check_124746 = x_124744 && y_124745;
        bool index_certs_124747;
        
        if (!bounds_check_124746) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", r_124743,
                                   "] out of bounds for array of shape [",
                                   n_114534, "].",
                                   "-> #0  loess.fut:386:66-73\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:383:3-389:25\n   #4  loess.fut:401:18-55\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
            return 1;
        }
        
        int64_t x_124748 = ((int64_t *) mem_121979.mem)[gtid_117195 * n_114534 +
                                                        r_124743];
        int64_t abs_arg_124749 = sub64(x_124748, min_res_124664);
        int64_t abs_res_124750 = abs(abs_arg_124749);
        bool x_124751 = sle64((int64_t) 0, min_res_124741);
        bool y_124752 = slt64(min_res_124741, n_114534);
        bool bounds_check_124753 = x_124751 && y_124752;
        bool index_certs_124754;
        
        if (!bounds_check_124753) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", min_res_124741,
                                   "] out of bounds for array of shape [",
                                   n_114534, "].",
                                   "-> #0  loess.fut:386:40-47\n   #1  /prelude/soacs.fut:67:19-23\n   #2  /prelude/soacs.fut:67:3-37\n   #3  loess.fut:383:3-389:25\n   #4  loess.fut:401:18-55\n   #5  stl.fut:173:13-65\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:171:5-174:26\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
            return 1;
        }
        
        int64_t x_124755 = ((int64_t *) mem_121979.mem)[gtid_117195 * n_114534 +
                                                        min_res_124741];
        int64_t abs_arg_124756 = sub64(x_124755, min_res_124664);
        int64_t abs_res_124757 = abs(abs_arg_124756);
        int64_t max_res_124758 = smax64(abs_res_124750, abs_res_124757);
        float defunc_0_f_res_124759 = sitofp_i64_f32(max_res_124758);
        float defunc_1_f_res_124760 = max_res_117315 + defunc_0_f_res_124759;
        
        ((float *) mem_122137.mem)[gtid_117201] = defunc_1_f_res_124760;
        ((int64_t *) mem_122140.mem)[gtid_117201] = min_res_124741;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131251_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131251_end -
                 futhark_mc_segmap_parloop_131251_start;
        
        ctx->futhark_mc_segmap_parloop_131251_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131251_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131251_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131249(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117200 = tid;
    int num_tasks_124865 = info.nsubtasks;
    struct futhark_mc_task_131245 *futhark_mc_task_131245 =
                                  (struct futhark_mc_task_131245 *) args;
    struct futhark_context *ctx = futhark_mc_task_131245->ctx;
    uint64_t futhark_mc_segmap_nested_task_131249_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131249_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131245->free_n_114534;
    int64_t t_jump_114541 = futhark_mc_task_131245->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131245->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131245->free_i_114610;
    bool x_114611 = futhark_mc_task_131245->free_x_114611;
    int64_t min_res_114809 = futhark_mc_task_131245->free_min_res_114809;
    bool empty_slice_114814 = futhark_mc_task_131245->free_empty_slice_114814;
    int64_t m_114815 = futhark_mc_task_131245->free_m_114815;
    int64_t gtid_117195 = futhark_mc_task_131245->free_gtid_117195;
    int64_t x_117304 = futhark_mc_task_131245->free_x_117304;
    int64_t min_arg_117311 = futhark_mc_task_131245->free_min_arg_117311;
    float max_res_117315 = futhark_mc_task_131245->free_max_res_117315;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131245->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122131 = {.desc ="mem_122131", .mem =
                                  futhark_mc_task_131245->free_mem_122131,
                                  .size =0, .references =NULL};
    struct memblock mem_122134 = {.desc ="mem_122134", .mem =
                                  futhark_mc_task_131245->free_mem_122134,
                                  .size =0, .references =NULL};
    struct memblock mem_122137 = {.desc ="mem_122137", .mem =
                                  futhark_mc_task_131245->free_mem_122137,
                                  .size =0, .references =NULL};
    struct memblock mem_122140 = {.desc ="mem_122140", .mem =
                                  futhark_mc_task_131245->free_mem_122140,
                                  .size =0, .references =NULL};
    int64_t iter_124930;
    struct futhark_mc_segmap_parloop_struct_131250
    futhark_mc_segmap_parloop_struct_131250;
    
    futhark_mc_segmap_parloop_struct_131250.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131250.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131250.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131250.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131250.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131250.free_x_114611 = x_114611;
    futhark_mc_segmap_parloop_struct_131250.free_min_res_114809 =
        min_res_114809;
    futhark_mc_segmap_parloop_struct_131250.free_empty_slice_114814 =
        empty_slice_114814;
    futhark_mc_segmap_parloop_struct_131250.free_m_114815 = m_114815;
    futhark_mc_segmap_parloop_struct_131250.free_gtid_117195 = gtid_117195;
    futhark_mc_segmap_parloop_struct_131250.free_x_117304 = x_117304;
    futhark_mc_segmap_parloop_struct_131250.free_min_arg_117311 =
        min_arg_117311;
    futhark_mc_segmap_parloop_struct_131250.free_max_res_117315 =
        max_res_117315;
    futhark_mc_segmap_parloop_struct_131250.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131250.free_mem_122131 = mem_122131.mem;
    futhark_mc_segmap_parloop_struct_131250.free_mem_122134 = mem_122134.mem;
    futhark_mc_segmap_parloop_struct_131250.free_mem_122137 = mem_122137.mem;
    futhark_mc_segmap_parloop_struct_131250.free_mem_122140 = mem_122140.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131251_task;
    
    futhark_mc_segmap_parloop_131251_task.name =
        "futhark_mc_segmap_parloop_131251";
    futhark_mc_segmap_parloop_131251_task.fn = futhark_mc_segmap_parloop_131251;
    futhark_mc_segmap_parloop_131251_task.args =
        &futhark_mc_segmap_parloop_struct_131250;
    futhark_mc_segmap_parloop_131251_task.iterations = iterations;
    futhark_mc_segmap_parloop_131251_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131251_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131251_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131251_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131251_task);
    
    if (futhark_mc_segmap_parloop_131251_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131251_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131251_total_end -
                 futhark_mc_segmap_parloop_131251_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131251_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131251_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131251_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131249_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131249_end -
                 futhark_mc_segmap_nested_task_131249_start;
        
        ctx->futhark_mc_segmap_nested_task_131249_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131249_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131249_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131236(void *args, int64_t start,
                                            int64_t end, int flat_tid_117194,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131235
    *futhark_mc_segmap_parloop_struct_131235 =
    (struct futhark_mc_segmap_parloop_struct_131235 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131235->ctx;
    uint64_t futhark_mc_segmap_parloop_131236_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131236_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131235->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131235->free_n_114534;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131235->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131235->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131235->free_i_114610;
    bool x_114611 = futhark_mc_segmap_parloop_struct_131235->free_x_114611;
    int64_t min_res_114809 =
            futhark_mc_segmap_parloop_struct_131235->free_min_res_114809;
    bool empty_slice_114814 =
         futhark_mc_segmap_parloop_struct_131235->free_empty_slice_114814;
    int64_t m_114815 = futhark_mc_segmap_parloop_struct_131235->free_m_114815;
    float i64_res_114816 =
          futhark_mc_segmap_parloop_struct_131235->free_i64_res_114816;
    int64_t bytes_121940 =
            futhark_mc_segmap_parloop_struct_131235->free_bytes_121940;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131235->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131235->free_mem_121982,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131235->free_bytes_122135;
    int64_t bytes_122138 =
            futhark_mc_segmap_parloop_struct_131235->free_bytes_122138;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131235->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131235->free_mem_122208,
                                  .size =0, .references =NULL};
    size_t mem_122131_cached_sizze_131237 = 0;
    char *mem_122131 = NULL;
    size_t mem_122134_cached_sizze_131238 = 0;
    char *mem_122134 = NULL;
    size_t mem_122137_cached_sizze_131239 = 0;
    char *mem_122137 = NULL;
    size_t mem_122140_cached_sizze_131240 = 0;
    char *mem_122140 = NULL;
    int64_t iterations = end - start;
    int64_t iter_124658 = start;
    
    if (mem_122131_cached_sizze_131237 < (size_t) bytes_121940) {
        mem_122131 = realloc(mem_122131, bytes_121940);
        mem_122131_cached_sizze_131237 = bytes_121940;
    }
    if (mem_122134_cached_sizze_131238 < (size_t) bytes_121940) {
        mem_122134 = realloc(mem_122134, bytes_121940);
        mem_122134_cached_sizze_131238 = bytes_121940;
    }
    if (mem_122137_cached_sizze_131239 < (size_t) bytes_122135) {
        mem_122137 = realloc(mem_122137, bytes_122135);
        mem_122137_cached_sizze_131239 = bytes_122135;
    }
    if (mem_122140_cached_sizze_131240 < (size_t) bytes_122138) {
        mem_122140 = realloc(mem_122140, bytes_122138);
        mem_122140_cached_sizze_131240 = bytes_122138;
    }
    for (; iter_124658 < end; iter_124658++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_124859 = m_114533;
        int64_t gtid_117195 = iter_124658;
        int64_t remnant_124860 = iter_124658 - gtid_117195;
        int64_t x_117304 = ((int64_t *) mem_121982.mem)[gtid_117195];
        int64_t flat_tid_117196 = (int64_t) 0;
        int32_t num_tasks_124861;
        struct futhark_mc_task_131241 futhark_mc_task_131241;
        
        futhark_mc_task_131241.ctx = ctx;
        futhark_mc_task_131241.free_n_114534 = n_114534;
        futhark_mc_task_131241.free_gtid_117195 = gtid_117195;
        futhark_mc_task_131241.free_mem_121979 = mem_121979.mem;
        futhark_mc_task_131241.free_mem_122131 = mem_122131;
        futhark_mc_task_131241.free_mem_122134 = mem_122134;
        
        struct scheduler_segop futhark_mc_task_131241_task;
        
        futhark_mc_task_131241_task.args = &futhark_mc_task_131241;
        futhark_mc_task_131241_task.top_level_fn =
            futhark_mc_segmap_task_131242;
        futhark_mc_task_131241_task.name = "futhark_mc_segmap_task_131242";
        futhark_mc_task_131241_task.iterations = n_114534;
        futhark_mc_task_131241_task.task_time =
            &ctx->futhark_mc_segmap_task_131242_total_time;
        futhark_mc_task_131241_task.task_iter =
            &ctx->futhark_mc_segmap_task_131242_total_iter;
        futhark_mc_task_131241_task.sched = STATIC;
        futhark_mc_task_131241_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131242_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131241_task);
        
        if (futhark_mc_segmap_task_131242_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        int64_t min_arg_117311 = sub64(x_117304, min_res_114809);
        float i64_res_117312 = sitofp_i64_f32(x_117304);
        float x_117313 = i64_res_114816 - i64_res_117312;
        float max_arg_117314 = x_117313 / 2.0F;
        float max_res_117315 = fmax32(0.0F, max_arg_117314);
        int64_t flat_tid_117198 = (int64_t) 0;
        int32_t num_tasks_124865;
        int64_t flat_tid_117200 = (int64_t) 0;
        struct futhark_mc_task_131245 futhark_mc_task_131245;
        
        futhark_mc_task_131245.ctx = ctx;
        futhark_mc_task_131245.free_n_114534 = n_114534;
        futhark_mc_task_131245.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131245.free_t_n_m_114591 = t_n_m_114591;
        futhark_mc_task_131245.free_i_114610 = i_114610;
        futhark_mc_task_131245.free_x_114611 = x_114611;
        futhark_mc_task_131245.free_min_res_114809 = min_res_114809;
        futhark_mc_task_131245.free_empty_slice_114814 = empty_slice_114814;
        futhark_mc_task_131245.free_m_114815 = m_114815;
        futhark_mc_task_131245.free_gtid_117195 = gtid_117195;
        futhark_mc_task_131245.free_x_117304 = x_117304;
        futhark_mc_task_131245.free_min_arg_117311 = min_arg_117311;
        futhark_mc_task_131245.free_max_res_117315 = max_res_117315;
        futhark_mc_task_131245.free_mem_121979 = mem_121979.mem;
        futhark_mc_task_131245.free_mem_122131 = mem_122131;
        futhark_mc_task_131245.free_mem_122134 = mem_122134;
        futhark_mc_task_131245.free_mem_122137 = mem_122137;
        futhark_mc_task_131245.free_mem_122140 = mem_122140;
        
        struct scheduler_segop futhark_mc_task_131245_task;
        
        futhark_mc_task_131245_task.args = &futhark_mc_task_131245;
        futhark_mc_task_131245_task.top_level_fn =
            futhark_mc_segmap_task_131246;
        futhark_mc_task_131245_task.name = "futhark_mc_segmap_task_131246";
        futhark_mc_task_131245_task.iterations = t_n_m_114591;
        futhark_mc_task_131245_task.task_time =
            &ctx->futhark_mc_segmap_task_131246_total_time;
        futhark_mc_task_131245_task.task_iter =
            &ctx->futhark_mc_segmap_task_131246_total_iter;
        futhark_mc_task_131245_task.sched = DYNAMIC;
        futhark_mc_task_131245_task.nested_fn =
            futhark_mc_segmap_nested_task_131249;
        
        int futhark_mc_segmap_task_131246_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131245_task);
        
        if (futhark_mc_segmap_task_131246_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122204.mem + gtid_117195 * t_n_m_114591 * (int64_t) 8,
                mem_122140 + (int64_t) 0, t_n_m_114591 * (int64_t) 8);
        memmove(mem_122208.mem + gtid_117195 * t_n_m_114591 * (int64_t) 4,
                mem_122137 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122131);
    free(mem_122134);
    free(mem_122137);
    free(mem_122140);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131236_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131236_end -
                 futhark_mc_segmap_parloop_131236_start;
        
        ctx->futhark_mc_segmap_parloop_131236_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131236_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131236_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131234(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117194 = tid;
    int num_tasks_124530 = info.nsubtasks;
    struct futhark_mc_task_131226 *futhark_mc_task_131226 =
                                  (struct futhark_mc_task_131226 *) args;
    struct futhark_context *ctx = futhark_mc_task_131226->ctx;
    uint64_t futhark_mc_segmap_nested_task_131234_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131234_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131226->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131226->free_n_114534;
    int64_t t_jump_114541 = futhark_mc_task_131226->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131226->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131226->free_i_114610;
    bool x_114611 = futhark_mc_task_131226->free_x_114611;
    int64_t min_res_114809 = futhark_mc_task_131226->free_min_res_114809;
    bool empty_slice_114814 = futhark_mc_task_131226->free_empty_slice_114814;
    int64_t m_114815 = futhark_mc_task_131226->free_m_114815;
    float i64_res_114816 = futhark_mc_task_131226->free_i64_res_114816;
    int64_t bytes_121940 = futhark_mc_task_131226->free_bytes_121940;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131226->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131226->free_mem_121982,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131226->free_bytes_122135;
    int64_t bytes_122138 = futhark_mc_task_131226->free_bytes_122138;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131226->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131226->free_mem_122208,
                                  .size =0, .references =NULL};
    int64_t iter_124658;
    struct futhark_mc_segmap_parloop_struct_131235
    futhark_mc_segmap_parloop_struct_131235;
    
    futhark_mc_segmap_parloop_struct_131235.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131235.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131235.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131235.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131235.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131235.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131235.free_x_114611 = x_114611;
    futhark_mc_segmap_parloop_struct_131235.free_min_res_114809 =
        min_res_114809;
    futhark_mc_segmap_parloop_struct_131235.free_empty_slice_114814 =
        empty_slice_114814;
    futhark_mc_segmap_parloop_struct_131235.free_m_114815 = m_114815;
    futhark_mc_segmap_parloop_struct_131235.free_i64_res_114816 =
        i64_res_114816;
    futhark_mc_segmap_parloop_struct_131235.free_bytes_121940 = bytes_121940;
    futhark_mc_segmap_parloop_struct_131235.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131235.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131235.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131235.free_bytes_122138 = bytes_122138;
    futhark_mc_segmap_parloop_struct_131235.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131235.free_mem_122208 = mem_122208.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131236_task;
    
    futhark_mc_segmap_parloop_131236_task.name =
        "futhark_mc_segmap_parloop_131236";
    futhark_mc_segmap_parloop_131236_task.fn = futhark_mc_segmap_parloop_131236;
    futhark_mc_segmap_parloop_131236_task.args =
        &futhark_mc_segmap_parloop_struct_131235;
    futhark_mc_segmap_parloop_131236_task.iterations = iterations;
    futhark_mc_segmap_parloop_131236_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131236_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131236_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131236_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131236_task);
    
    if (futhark_mc_segmap_parloop_131236_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131236_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131236_total_end -
                 futhark_mc_segmap_parloop_131236_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131236_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131236_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131236_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131234_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131234_end -
                 futhark_mc_segmap_nested_task_131234_start;
        
        ctx->futhark_mc_segmap_nested_task_131234_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131234_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131234_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131257 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_Y_mem_121939;
    int64_t free_bytes_121983;
    int64_t free_ctx_param_ext_122258;
    char *free_mem_param_122262;
    char *free_mem_122284;
};
struct futhark_mc_segmap_parloop_struct_131259 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_Y_mem_121939;
    int64_t free_bytes_121983;
    int64_t free_ctx_param_ext_122258;
    char *free_mem_param_122262;
    char *free_mem_122284;
};
static int futhark_mc_segmap_parloop_131260(void *args, int64_t start,
                                            int64_t end, int flat_tid_117516,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131259
    *futhark_mc_segmap_parloop_struct_131259 =
    (struct futhark_mc_segmap_parloop_struct_131259 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131259->ctx;
    uint64_t futhark_mc_segmap_parloop_131260_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131260_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131259->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131259->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131259->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131259->free_bytes_121983;
    int64_t ctx_param_ext_122258 =
            futhark_mc_segmap_parloop_struct_131259->free_ctx_param_ext_122258;
    struct memblock mem_param_122262 = {.desc ="mem_param_122262", .mem =
                                        futhark_mc_segmap_parloop_struct_131259->free_mem_param_122262,
                                        .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_segmap_parloop_struct_131259->free_mem_122284,
                                  .size =0, .references =NULL};
    size_t mem_122268_cached_sizze_131261 = 0;
    char *mem_122268 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125028 = start;
    
    if (mem_122268_cached_sizze_131261 < (size_t) bytes_121983) {
        mem_122268 = realloc(mem_122268, bytes_121983);
        mem_122268_cached_sizze_131261 = bytes_121983;
    }
    for (; iter_125028 < end; iter_125028++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125035 = m_114533;
        int64_t gtid_117517 = iter_125028;
        int64_t remnant_125036 = iter_125028 - gtid_117517;
        
        for (int64_t i_125029 = 0; i_125029 < n_114534; i_125029++) {
            float x_125031 = ((float *) Y_mem_121939.mem)[gtid_117517 *
                                                          n_114534 + i_125029];
            float x_125032 = ((float *) mem_param_122262.mem)[gtid_117517 *
                                                              ctx_param_ext_122258 +
                                                              i_125029];
            float defunc_1_f_res_125033 = x_125031 - x_125032;
            
            ((float *) mem_122268)[i_125029] = defunc_1_f_res_125033;
        }
        memmove(mem_122284.mem + gtid_117517 * n_114534 * (int64_t) 4,
                mem_122268 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122268);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131260_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131260_end -
                 futhark_mc_segmap_parloop_131260_start;
        
        ctx->futhark_mc_segmap_parloop_131260_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131260_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131260_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131258(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117516 = tid;
    int num_tasks_125027 = info.nsubtasks;
    struct futhark_mc_task_131257 *futhark_mc_task_131257 =
                                  (struct futhark_mc_task_131257 *) args;
    struct futhark_context *ctx = futhark_mc_task_131257->ctx;
    uint64_t futhark_mc_segmap_task_131258_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131258_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131257->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131257->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131257->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131257->free_bytes_121983;
    int64_t ctx_param_ext_122258 =
            futhark_mc_task_131257->free_ctx_param_ext_122258;
    struct memblock mem_param_122262 = {.desc ="mem_param_122262", .mem =
                                        futhark_mc_task_131257->free_mem_param_122262,
                                        .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_task_131257->free_mem_122284,
                                  .size =0, .references =NULL};
    int64_t iter_125028;
    struct futhark_mc_segmap_parloop_struct_131259
    futhark_mc_segmap_parloop_struct_131259;
    
    futhark_mc_segmap_parloop_struct_131259.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131259.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131259.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131259.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131259.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131259.free_ctx_param_ext_122258 =
        ctx_param_ext_122258;
    futhark_mc_segmap_parloop_struct_131259.free_mem_param_122262 =
        mem_param_122262.mem;
    futhark_mc_segmap_parloop_struct_131259.free_mem_122284 = mem_122284.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131260_task;
    
    futhark_mc_segmap_parloop_131260_task.name =
        "futhark_mc_segmap_parloop_131260";
    futhark_mc_segmap_parloop_131260_task.fn = futhark_mc_segmap_parloop_131260;
    futhark_mc_segmap_parloop_131260_task.args =
        &futhark_mc_segmap_parloop_struct_131259;
    futhark_mc_segmap_parloop_131260_task.iterations = iterations;
    futhark_mc_segmap_parloop_131260_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131260_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131260_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131260_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131260_task);
    
    if (futhark_mc_segmap_parloop_131260_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131260_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131260_total_end -
                 futhark_mc_segmap_parloop_131260_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131260_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131260_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131260_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131258_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131258_end -
                 futhark_mc_segmap_task_131258_start;
        
        ctx->futhark_mc_segmap_task_131258_runs[tid]++;
        ctx->futhark_mc_segmap_task_131258_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131258_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131263 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_Y_mem_121939;
    int64_t free_bytes_121983;
    int64_t free_ctx_param_ext_122258;
    char *free_mem_param_122262;
    char *free_mem_122284;
};
struct futhark_mc_task_131266 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_117519;
    char *free_Y_mem_121939;
    int64_t free_ctx_param_ext_122258;
    char *free_mem_param_122262;
    char *free_mem_122265;
};
struct futhark_mc_segmap_parloop_struct_131268 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_117519;
    char *free_Y_mem_121939;
    int64_t free_ctx_param_ext_122258;
    char *free_mem_param_122262;
    char *free_mem_122265;
};
static int futhark_mc_segmap_parloop_131269(void *args, int64_t start,
                                            int64_t end, int flat_tid_117520,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131268
    *futhark_mc_segmap_parloop_struct_131268 =
    (struct futhark_mc_segmap_parloop_struct_131268 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131268->ctx;
    uint64_t futhark_mc_segmap_parloop_131269_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131269_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131268->free_n_114534;
    int64_t gtid_117519 =
            futhark_mc_segmap_parloop_struct_131268->free_gtid_117519;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131268->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t ctx_param_ext_122258 =
            futhark_mc_segmap_parloop_struct_131268->free_ctx_param_ext_122258;
    struct memblock mem_param_122262 = {.desc ="mem_param_122262", .mem =
                                        futhark_mc_segmap_parloop_struct_131268->free_mem_param_122262,
                                        .size =0, .references =NULL};
    struct memblock mem_122265 = {.desc ="mem_122265", .mem =
                                  futhark_mc_segmap_parloop_struct_131268->free_mem_122265,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125045 = start;
    
    for (; iter_125045 < end; iter_125045++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125046 = n_114534;
        int64_t gtid_117521 = iter_125045;
        int64_t remnant_125047 = iter_125045 - gtid_117521;
        float x_125039 = ((float *) Y_mem_121939.mem)[gtid_117519 * n_114534 +
                                                      gtid_117521];
        float x_125040 = ((float *) mem_param_122262.mem)[gtid_117519 *
                                                          ctx_param_ext_122258 +
                                                          gtid_117521];
        float defunc_1_f_res_125041 = x_125039 - x_125040;
        
        ((float *) mem_122265.mem)[gtid_117521] = defunc_1_f_res_125041;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131269_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131269_end -
                 futhark_mc_segmap_parloop_131269_start;
        
        ctx->futhark_mc_segmap_parloop_131269_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131269_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131269_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131267(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117520 = tid;
    int num_tasks_125044 = info.nsubtasks;
    struct futhark_mc_task_131266 *futhark_mc_task_131266 =
                                  (struct futhark_mc_task_131266 *) args;
    struct futhark_context *ctx = futhark_mc_task_131266->ctx;
    uint64_t futhark_mc_segmap_task_131267_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131267_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131266->free_n_114534;
    int64_t gtid_117519 = futhark_mc_task_131266->free_gtid_117519;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131266->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t ctx_param_ext_122258 =
            futhark_mc_task_131266->free_ctx_param_ext_122258;
    struct memblock mem_param_122262 = {.desc ="mem_param_122262", .mem =
                                        futhark_mc_task_131266->free_mem_param_122262,
                                        .size =0, .references =NULL};
    struct memblock mem_122265 = {.desc ="mem_122265", .mem =
                                  futhark_mc_task_131266->free_mem_122265,
                                  .size =0, .references =NULL};
    int64_t iter_125045;
    struct futhark_mc_segmap_parloop_struct_131268
    futhark_mc_segmap_parloop_struct_131268;
    
    futhark_mc_segmap_parloop_struct_131268.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131268.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131268.free_gtid_117519 = gtid_117519;
    futhark_mc_segmap_parloop_struct_131268.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131268.free_ctx_param_ext_122258 =
        ctx_param_ext_122258;
    futhark_mc_segmap_parloop_struct_131268.free_mem_param_122262 =
        mem_param_122262.mem;
    futhark_mc_segmap_parloop_struct_131268.free_mem_122265 = mem_122265.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131269_task;
    
    futhark_mc_segmap_parloop_131269_task.name =
        "futhark_mc_segmap_parloop_131269";
    futhark_mc_segmap_parloop_131269_task.fn = futhark_mc_segmap_parloop_131269;
    futhark_mc_segmap_parloop_131269_task.args =
        &futhark_mc_segmap_parloop_struct_131268;
    futhark_mc_segmap_parloop_131269_task.iterations = iterations;
    futhark_mc_segmap_parloop_131269_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131269_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131269_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131269_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131269_task);
    
    if (futhark_mc_segmap_parloop_131269_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131269_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131269_total_end -
                 futhark_mc_segmap_parloop_131269_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131269_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131269_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131269_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131267_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131267_end -
                 futhark_mc_segmap_task_131267_start;
        
        ctx->futhark_mc_segmap_task_131267_runs[tid]++;
        ctx->futhark_mc_segmap_task_131267_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131267_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131264(void *args, int64_t start,
                                            int64_t end, int flat_tid_117518,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131263
    *futhark_mc_segmap_parloop_struct_131263 =
    (struct futhark_mc_segmap_parloop_struct_131263 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131263->ctx;
    uint64_t futhark_mc_segmap_parloop_131264_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131264_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131263->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131263->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131263->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131263->free_bytes_121983;
    int64_t ctx_param_ext_122258 =
            futhark_mc_segmap_parloop_struct_131263->free_ctx_param_ext_122258;
    struct memblock mem_param_122262 = {.desc ="mem_param_122262", .mem =
                                        futhark_mc_segmap_parloop_struct_131263->free_mem_param_122262,
                                        .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_segmap_parloop_struct_131263->free_mem_122284,
                                  .size =0, .references =NULL};
    size_t mem_122265_cached_sizze_131265 = 0;
    char *mem_122265 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125038 = start;
    
    if (mem_122265_cached_sizze_131265 < (size_t) bytes_121983) {
        mem_122265 = realloc(mem_122265, bytes_121983);
        mem_122265_cached_sizze_131265 = bytes_121983;
    }
    for (; iter_125038 < end; iter_125038++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125042 = m_114533;
        int64_t gtid_117519 = iter_125038;
        int64_t remnant_125043 = iter_125038 - gtid_117519;
        int64_t flat_tid_117520 = (int64_t) 0;
        int32_t num_tasks_125044;
        struct futhark_mc_task_131266 futhark_mc_task_131266;
        
        futhark_mc_task_131266.ctx = ctx;
        futhark_mc_task_131266.free_n_114534 = n_114534;
        futhark_mc_task_131266.free_gtid_117519 = gtid_117519;
        futhark_mc_task_131266.free_Y_mem_121939 = Y_mem_121939.mem;
        futhark_mc_task_131266.free_ctx_param_ext_122258 = ctx_param_ext_122258;
        futhark_mc_task_131266.free_mem_param_122262 = mem_param_122262.mem;
        futhark_mc_task_131266.free_mem_122265 = mem_122265;
        
        struct scheduler_segop futhark_mc_task_131266_task;
        
        futhark_mc_task_131266_task.args = &futhark_mc_task_131266;
        futhark_mc_task_131266_task.top_level_fn =
            futhark_mc_segmap_task_131267;
        futhark_mc_task_131266_task.name = "futhark_mc_segmap_task_131267";
        futhark_mc_task_131266_task.iterations = n_114534;
        futhark_mc_task_131266_task.task_time =
            &ctx->futhark_mc_segmap_task_131267_total_time;
        futhark_mc_task_131266_task.task_iter =
            &ctx->futhark_mc_segmap_task_131267_total_iter;
        futhark_mc_task_131266_task.sched = STATIC;
        futhark_mc_task_131266_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131267_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131266_task);
        
        if (futhark_mc_segmap_task_131267_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122284.mem + gtid_117519 * n_114534 * (int64_t) 4,
                mem_122265 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122265);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131264_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131264_end -
                 futhark_mc_segmap_parloop_131264_start;
        
        ctx->futhark_mc_segmap_parloop_131264_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131264_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131264_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131262(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117518 = tid;
    int num_tasks_125027 = info.nsubtasks;
    struct futhark_mc_task_131257 *futhark_mc_task_131257 =
                                  (struct futhark_mc_task_131257 *) args;
    struct futhark_context *ctx = futhark_mc_task_131257->ctx;
    uint64_t futhark_mc_segmap_nested_task_131262_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131262_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131257->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131257->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131257->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131257->free_bytes_121983;
    int64_t ctx_param_ext_122258 =
            futhark_mc_task_131257->free_ctx_param_ext_122258;
    struct memblock mem_param_122262 = {.desc ="mem_param_122262", .mem =
                                        futhark_mc_task_131257->free_mem_param_122262,
                                        .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_task_131257->free_mem_122284,
                                  .size =0, .references =NULL};
    int64_t iter_125038;
    struct futhark_mc_segmap_parloop_struct_131263
    futhark_mc_segmap_parloop_struct_131263;
    
    futhark_mc_segmap_parloop_struct_131263.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131263.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131263.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131263.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131263.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131263.free_ctx_param_ext_122258 =
        ctx_param_ext_122258;
    futhark_mc_segmap_parloop_struct_131263.free_mem_param_122262 =
        mem_param_122262.mem;
    futhark_mc_segmap_parloop_struct_131263.free_mem_122284 = mem_122284.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131264_task;
    
    futhark_mc_segmap_parloop_131264_task.name =
        "futhark_mc_segmap_parloop_131264";
    futhark_mc_segmap_parloop_131264_task.fn = futhark_mc_segmap_parloop_131264;
    futhark_mc_segmap_parloop_131264_task.args =
        &futhark_mc_segmap_parloop_struct_131263;
    futhark_mc_segmap_parloop_131264_task.iterations = iterations;
    futhark_mc_segmap_parloop_131264_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131264_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131264_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131264_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131264_task);
    
    if (futhark_mc_segmap_parloop_131264_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131264_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131264_total_end -
                 futhark_mc_segmap_parloop_131264_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131264_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131264_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131264_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131262_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131262_end -
                 futhark_mc_segmap_nested_task_131262_start;
        
        ctx->futhark_mc_segmap_nested_task_131262_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131262_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131262_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131270 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    char *free_mem_122026;
    int64_t free_bytes_122027;
    char *free_mem_122048;
    char *free_mem_122284;
    char *free_mem_122306;
};
struct futhark_mc_segmap_parloop_struct_131272 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    char *free_mem_122026;
    int64_t free_bytes_122027;
    char *free_mem_122048;
    char *free_mem_122284;
    char *free_mem_122306;
};
static int futhark_mc_segmap_parloop_131273(void *args, int64_t start,
                                            int64_t end, int flat_tid_117528,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131272
    *futhark_mc_segmap_parloop_struct_131272 =
    (struct futhark_mc_segmap_parloop_struct_131272 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131272->ctx;
    uint64_t futhark_mc_segmap_parloop_131273_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131273_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131272->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131272->free_n_114534;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131272->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_segmap_parloop_struct_131272->free_css_chunk_len_114580;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_segmap_parloop_struct_131272->free_mem_122026,
                                  .size =0, .references =NULL};
    int64_t bytes_122027 =
            futhark_mc_segmap_parloop_struct_131272->free_bytes_122027;
    struct memblock mem_122048 = {.desc ="mem_122048", .mem =
                                  futhark_mc_segmap_parloop_struct_131272->free_mem_122048,
                                  .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_segmap_parloop_struct_131272->free_mem_122284,
                                  .size =0, .references =NULL};
    struct memblock mem_122306 = {.desc ="mem_122306", .mem =
                                  futhark_mc_segmap_parloop_struct_131272->free_mem_122306,
                                  .size =0, .references =NULL};
    size_t mem_122290_cached_sizze_131274 = 0;
    char *mem_122290 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125049 = start;
    
    if (mem_122290_cached_sizze_131274 < (size_t) bytes_122027) {
        mem_122290 = realloc(mem_122290, bytes_122027);
        mem_122290_cached_sizze_131274 = bytes_122027;
    }
    for (; iter_125049 < end; iter_125049++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125068 = m_114533;
        int64_t gtid_117529 = iter_125049;
        int64_t remnant_125069 = iter_125049 - gtid_117529;
        
        for (int64_t i_125050 = 0; i_125050 < n_p_114536; i_125050++) {
            float x_125052 = ((float *) mem_122048.mem)[gtid_117529 *
                                                        n_p_114536 + i_125050];
            float defunc_2_reduce_res_125053;
            float redout_125055 = 0.0F;
            
            for (int64_t i_125054 = 0; i_125054 < css_chunk_len_114580;
                 i_125054++) {
                int64_t x_125056 = ((int64_t *) mem_122026.mem)[i_125050 *
                                                                css_chunk_len_114580 +
                                                                i_125054];
                bool cond_125057 = sle64((int64_t) 0, x_125056);
                float defunc_0_f_res_125058;
                
                if (cond_125057) {
                    bool y_125059 = slt64(x_125056, n_114534);
                    bool bounds_check_125060 = cond_125057 && y_125059;
                    bool index_certs_125061;
                    
                    if (!bounds_check_125060) {
                        ctx->error =
                            msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                      "Index [", x_125056,
                                      "] out of bounds for array of shape [",
                                      n_114534, "].",
                                      "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:207:38-73\n   #3  /prelude/soacs.fut:67:19-23\n   #4  /prelude/soacs.fut:67:3-37\n   #5  stl.fut:205:21-210:44\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:203:13-211:43\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                        return 1;
                    }
                    
                    float defunc_0_f_res_t_res_125062 =
                          ((float *) mem_122284.mem)[gtid_117529 * n_114534 +
                                                     x_125056];
                    
                    defunc_0_f_res_125058 = defunc_0_f_res_t_res_125062;
                } else {
                    defunc_0_f_res_125058 = NAN;
                }
                
                bool isnan_res_125063;
                
                isnan_res_125063 = futrts_isnan32(defunc_0_f_res_125058);
                
                float defunc_0_f_res_125064;
                
                if (isnan_res_125063) {
                    defunc_0_f_res_125064 = 0.0F;
                } else {
                    defunc_0_f_res_125064 = defunc_0_f_res_125058;
                }
                
                float defunc_1_op_res_125065 = defunc_0_f_res_125064 +
                      redout_125055;
                float redout_tmp_125071 = defunc_1_op_res_125065;
                
                redout_125055 = redout_tmp_125071;
            }
            defunc_2_reduce_res_125053 = redout_125055;
            
            float defunc_1_f_res_125066 = defunc_2_reduce_res_125053 / x_125052;
            
            ((float *) mem_122290)[i_125050] = defunc_1_f_res_125066;
        }
        memmove(mem_122306.mem + gtid_117529 * n_p_114536 * (int64_t) 4,
                mem_122290 + (int64_t) 0, n_p_114536 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122290);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131273_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131273_end -
                 futhark_mc_segmap_parloop_131273_start;
        
        ctx->futhark_mc_segmap_parloop_131273_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131273_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131273_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131271(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117528 = tid;
    int num_tasks_125048 = info.nsubtasks;
    struct futhark_mc_task_131270 *futhark_mc_task_131270 =
                                  (struct futhark_mc_task_131270 *) args;
    struct futhark_context *ctx = futhark_mc_task_131270->ctx;
    uint64_t futhark_mc_segmap_task_131271_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131271_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131270->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131270->free_n_114534;
    int64_t n_p_114536 = futhark_mc_task_131270->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_task_131270->free_css_chunk_len_114580;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_task_131270->free_mem_122026,
                                  .size =0, .references =NULL};
    int64_t bytes_122027 = futhark_mc_task_131270->free_bytes_122027;
    struct memblock mem_122048 = {.desc ="mem_122048", .mem =
                                  futhark_mc_task_131270->free_mem_122048,
                                  .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_task_131270->free_mem_122284,
                                  .size =0, .references =NULL};
    struct memblock mem_122306 = {.desc ="mem_122306", .mem =
                                  futhark_mc_task_131270->free_mem_122306,
                                  .size =0, .references =NULL};
    int64_t iter_125049;
    struct futhark_mc_segmap_parloop_struct_131272
    futhark_mc_segmap_parloop_struct_131272;
    
    futhark_mc_segmap_parloop_struct_131272.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131272.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131272.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131272.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131272.free_css_chunk_len_114580 =
        css_chunk_len_114580;
    futhark_mc_segmap_parloop_struct_131272.free_mem_122026 = mem_122026.mem;
    futhark_mc_segmap_parloop_struct_131272.free_bytes_122027 = bytes_122027;
    futhark_mc_segmap_parloop_struct_131272.free_mem_122048 = mem_122048.mem;
    futhark_mc_segmap_parloop_struct_131272.free_mem_122284 = mem_122284.mem;
    futhark_mc_segmap_parloop_struct_131272.free_mem_122306 = mem_122306.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131273_task;
    
    futhark_mc_segmap_parloop_131273_task.name =
        "futhark_mc_segmap_parloop_131273";
    futhark_mc_segmap_parloop_131273_task.fn = futhark_mc_segmap_parloop_131273;
    futhark_mc_segmap_parloop_131273_task.args =
        &futhark_mc_segmap_parloop_struct_131272;
    futhark_mc_segmap_parloop_131273_task.iterations = iterations;
    futhark_mc_segmap_parloop_131273_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131273_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131273_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131273_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131273_task);
    
    if (futhark_mc_segmap_parloop_131273_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131273_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131273_total_end -
                 futhark_mc_segmap_parloop_131273_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131273_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131273_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131273_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131271_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131271_end -
                 futhark_mc_segmap_task_131271_start;
        
        ctx->futhark_mc_segmap_task_131271_runs[tid]++;
        ctx->futhark_mc_segmap_task_131271_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131271_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131276 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    char *free_mem_122026;
    int64_t free_bytes_122027;
    char *free_mem_122048;
    char *free_mem_122284;
    char *free_mem_122306;
};
struct futhark_mc_task_131279 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    int64_t free_gtid_117531;
    char *free_mem_122026;
    char *free_mem_122048;
    char *free_mem_122284;
    char *free_mem_122287;
};
struct futhark_mc_segmap_parloop_struct_131281 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    int64_t free_gtid_117531;
    char *free_mem_122026;
    char *free_mem_122048;
    char *free_mem_122284;
    char *free_mem_122287;
};
static int futhark_mc_segmap_parloop_131282(void *args, int64_t start,
                                            int64_t end, int flat_tid_117532,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131281
    *futhark_mc_segmap_parloop_struct_131281 =
    (struct futhark_mc_segmap_parloop_struct_131281 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131281->ctx;
    uint64_t futhark_mc_segmap_parloop_131282_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131282_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131281->free_n_114534;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131281->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_segmap_parloop_struct_131281->free_css_chunk_len_114580;
    int64_t gtid_117531 =
            futhark_mc_segmap_parloop_struct_131281->free_gtid_117531;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_segmap_parloop_struct_131281->free_mem_122026,
                                  .size =0, .references =NULL};
    struct memblock mem_122048 = {.desc ="mem_122048", .mem =
                                  futhark_mc_segmap_parloop_struct_131281->free_mem_122048,
                                  .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_segmap_parloop_struct_131281->free_mem_122284,
                                  .size =0, .references =NULL};
    struct memblock mem_122287 = {.desc ="mem_122287", .mem =
                                  futhark_mc_segmap_parloop_struct_131281->free_mem_122287,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125106 = start;
    
    for (; iter_125106 < end; iter_125106++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125119 = n_p_114536;
        int64_t gtid_117533 = iter_125106;
        int64_t remnant_125120 = iter_125106 - gtid_117533;
        float x_125088 = ((float *) mem_122048.mem)[gtid_117531 * n_p_114536 +
                                                    gtid_117533];
        float defunc_2_reduce_res_125089;
        float redout_125108 = 0.0F;
        
        for (int64_t i_125107 = 0; i_125107 < css_chunk_len_114580;
             i_125107++) {
            int64_t x_125109 = ((int64_t *) mem_122026.mem)[gtid_117533 *
                                                            css_chunk_len_114580 +
                                                            i_125107];
            bool cond_125110 = sle64((int64_t) 0, x_125109);
            float defunc_0_f_res_125111;
            
            if (cond_125110) {
                bool y_125112 = slt64(x_125109, n_114534);
                bool bounds_check_125113 = cond_125110 && y_125112;
                bool index_certs_125114;
                
                if (!bounds_check_125113) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", x_125109,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:207:38-73\n   #3  /prelude/soacs.fut:67:19-23\n   #4  /prelude/soacs.fut:67:3-37\n   #5  stl.fut:205:21-210:44\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:203:13-211:43\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float defunc_0_f_res_t_res_125115 =
                      ((float *) mem_122284.mem)[gtid_117531 * n_114534 +
                                                 x_125109];
                
                defunc_0_f_res_125111 = defunc_0_f_res_t_res_125115;
            } else {
                defunc_0_f_res_125111 = NAN;
            }
            
            bool isnan_res_125116;
            
            isnan_res_125116 = futrts_isnan32(defunc_0_f_res_125111);
            
            float defunc_0_f_res_125117;
            
            if (isnan_res_125116) {
                defunc_0_f_res_125117 = 0.0F;
            } else {
                defunc_0_f_res_125117 = defunc_0_f_res_125111;
            }
            
            float defunc_1_op_res_125118 = defunc_0_f_res_125117 +
                  redout_125108;
            float redout_tmp_125121 = defunc_1_op_res_125118;
            
            redout_125108 = redout_tmp_125121;
        }
        defunc_2_reduce_res_125089 = redout_125108;
        
        float defunc_1_f_res_125102 = defunc_2_reduce_res_125089 / x_125088;
        
        ((float *) mem_122287.mem)[gtid_117533] = defunc_1_f_res_125102;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131282_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131282_end -
                 futhark_mc_segmap_parloop_131282_start;
        
        ctx->futhark_mc_segmap_parloop_131282_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131282_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131282_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131280(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117532 = tid;
    int num_tasks_125105 = info.nsubtasks;
    struct futhark_mc_task_131279 *futhark_mc_task_131279 =
                                  (struct futhark_mc_task_131279 *) args;
    struct futhark_context *ctx = futhark_mc_task_131279->ctx;
    uint64_t futhark_mc_segmap_task_131280_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131280_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131279->free_n_114534;
    int64_t n_p_114536 = futhark_mc_task_131279->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_task_131279->free_css_chunk_len_114580;
    int64_t gtid_117531 = futhark_mc_task_131279->free_gtid_117531;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_task_131279->free_mem_122026,
                                  .size =0, .references =NULL};
    struct memblock mem_122048 = {.desc ="mem_122048", .mem =
                                  futhark_mc_task_131279->free_mem_122048,
                                  .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_task_131279->free_mem_122284,
                                  .size =0, .references =NULL};
    struct memblock mem_122287 = {.desc ="mem_122287", .mem =
                                  futhark_mc_task_131279->free_mem_122287,
                                  .size =0, .references =NULL};
    int64_t iter_125106;
    struct futhark_mc_segmap_parloop_struct_131281
    futhark_mc_segmap_parloop_struct_131281;
    
    futhark_mc_segmap_parloop_struct_131281.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131281.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131281.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131281.free_css_chunk_len_114580 =
        css_chunk_len_114580;
    futhark_mc_segmap_parloop_struct_131281.free_gtid_117531 = gtid_117531;
    futhark_mc_segmap_parloop_struct_131281.free_mem_122026 = mem_122026.mem;
    futhark_mc_segmap_parloop_struct_131281.free_mem_122048 = mem_122048.mem;
    futhark_mc_segmap_parloop_struct_131281.free_mem_122284 = mem_122284.mem;
    futhark_mc_segmap_parloop_struct_131281.free_mem_122287 = mem_122287.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131282_task;
    
    futhark_mc_segmap_parloop_131282_task.name =
        "futhark_mc_segmap_parloop_131282";
    futhark_mc_segmap_parloop_131282_task.fn = futhark_mc_segmap_parloop_131282;
    futhark_mc_segmap_parloop_131282_task.args =
        &futhark_mc_segmap_parloop_struct_131281;
    futhark_mc_segmap_parloop_131282_task.iterations = iterations;
    futhark_mc_segmap_parloop_131282_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131282_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131282_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131282_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131282_task);
    
    if (futhark_mc_segmap_parloop_131282_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131282_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131282_total_end -
                 futhark_mc_segmap_parloop_131282_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131282_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131282_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131282_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131280_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131280_end -
                 futhark_mc_segmap_task_131280_start;
        
        ctx->futhark_mc_segmap_task_131280_runs[tid]++;
        ctx->futhark_mc_segmap_task_131280_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131280_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131284 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_css_chunk_len_114580;
    int64_t free_gtid_117531;
    char *free_mem_122026;
    char *free_mem_122048;
    char *free_mem_122284;
    char *free_mem_122287;
};
struct futhark_mc_task_131286 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_css_chunk_len_114580;
    int64_t free_gtid_117531;
    int64_t free_gtid_117535;
    char *free_mem_122026;
    char *free_mem_122284;
    float *retval_defunc_2_reduce_res_125074;
};
struct futhark_mc_segred_stage_1_parloop_struct_131289 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_css_chunk_len_114580;
    int64_t free_gtid_117531;
    int64_t free_gtid_117535;
    char *free_mem_122026;
    char *free_mem_122284;
    char *free_reduce_stage_1_tid_res_arr_mem_125138;
};
static int futhark_mc_segred_stage_1_parloop_131290(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_117536,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131289
    *futhark_mc_segred_stage_1_parloop_struct_131289 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131289 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131289->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131290_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131290_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131289->free_n_114534;
    int64_t css_chunk_len_114580 =
            futhark_mc_segred_stage_1_parloop_struct_131289->free_css_chunk_len_114580;
    int64_t gtid_117531 =
            futhark_mc_segred_stage_1_parloop_struct_131289->free_gtid_117531;
    int64_t gtid_117535 =
            futhark_mc_segred_stage_1_parloop_struct_131289->free_gtid_117535;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131289->free_mem_122026,
                                  .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131289->free_mem_122284,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_125138 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_125138",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131289->free_reduce_stage_1_tid_res_arr_mem_125138,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125140 = start;
    float x_125123;
    float x_125124;
    float local_acc_125141 = 0.0F;
    
    for (; iter_125140 < end; iter_125140++) {
        int64_t gtid_117537 = iter_125140;
        int64_t x_125126 = ((int64_t *) mem_122026.mem)[gtid_117535 *
                                                        css_chunk_len_114580 +
                                                        gtid_117537];
        bool cond_125127 = sle64((int64_t) 0, x_125126);
        float defunc_0_f_res_125128;
        
        if (cond_125127) {
            bool y_125129 = slt64(x_125126, n_114534);
            bool bounds_check_125130 = cond_125127 && y_125129;
            bool index_certs_125131;
            
            if (!bounds_check_125130) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", x_125126,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:207:38-73\n   #3  /prelude/soacs.fut:67:19-23\n   #4  /prelude/soacs.fut:67:3-37\n   #5  stl.fut:205:21-210:44\n   #6  /prelude/soacs.fut:67:19-23\n   #7  /prelude/soacs.fut:67:3-37\n   #8  stl.fut:203:13-211:43\n   #9  stl.fut:394:3-405:33\n   #10 stl.fut:381:1-405:33\n");
                return 1;
            }
            
            float defunc_0_f_res_t_res_125132 =
                  ((float *) mem_122284.mem)[gtid_117531 * n_114534 + x_125126];
            
            defunc_0_f_res_125128 = defunc_0_f_res_t_res_125132;
        } else {
            defunc_0_f_res_125128 = NAN;
        }
        
        bool isnan_res_125133;
        
        isnan_res_125133 = futrts_isnan32(defunc_0_f_res_125128);
        
        float defunc_0_f_res_125134;
        
        if (isnan_res_125133) {
            defunc_0_f_res_125134 = 0.0F;
        } else {
            defunc_0_f_res_125134 = defunc_0_f_res_125128;
        }
        // save map-out results
        { }
        // Load accum params
        {
            x_125123 = local_acc_125141;
        }
        // Load next params
        {
            x_125124 = defunc_0_f_res_125134;
        }
        // Red body
        {
            float defunc_1_op_res_125125 = x_125123 + x_125124;
            
            local_acc_125141 = defunc_1_op_res_125125;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_125138.mem)[flat_tid_117536] =
        local_acc_125141;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131290_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131290_end -
                 futhark_mc_segred_stage_1_parloop_131290_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131290_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131290_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131290_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131287(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117536 = tid;
    int num_tasks_125137 = info.nsubtasks;
    struct futhark_mc_task_131286 *futhark_mc_task_131286 =
                                  (struct futhark_mc_task_131286 *) args;
    struct futhark_context *ctx = futhark_mc_task_131286->ctx;
    uint64_t futhark_mc_segred_task_131287_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131287_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131286->free_n_114534;
    int64_t css_chunk_len_114580 =
            futhark_mc_task_131286->free_css_chunk_len_114580;
    int64_t gtid_117531 = futhark_mc_task_131286->free_gtid_117531;
    int64_t gtid_117535 = futhark_mc_task_131286->free_gtid_117535;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_task_131286->free_mem_122026,
                                  .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_task_131286->free_mem_122284,
                                  .size =0, .references =NULL};
    float defunc_2_reduce_res_125074 =
          *futhark_mc_task_131286->retval_defunc_2_reduce_res_125074;
    size_t reduce_stage_1_tid_res_arr_mem_125138_cached_sizze_131288 = 0;
    char *reduce_stage_1_tid_res_arr_mem_125138 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_125138_cached_sizze_131288 <
        (size_t) ((int64_t) 4 * num_tasks_125137)) {
        reduce_stage_1_tid_res_arr_mem_125138 =
            realloc(reduce_stage_1_tid_res_arr_mem_125138, (int64_t) 4 *
                    num_tasks_125137);
        reduce_stage_1_tid_res_arr_mem_125138_cached_sizze_131288 =
            (int64_t) 4 * num_tasks_125137;
    }
    
    int64_t iter_125140;
    struct futhark_mc_segred_stage_1_parloop_struct_131289
    futhark_mc_segred_stage_1_parloop_struct_131289;
    
    futhark_mc_segred_stage_1_parloop_struct_131289.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131289.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131289.free_css_chunk_len_114580 =
        css_chunk_len_114580;
    futhark_mc_segred_stage_1_parloop_struct_131289.free_gtid_117531 =
        gtid_117531;
    futhark_mc_segred_stage_1_parloop_struct_131289.free_gtid_117535 =
        gtid_117535;
    futhark_mc_segred_stage_1_parloop_struct_131289.free_mem_122026 =
        mem_122026.mem;
    futhark_mc_segred_stage_1_parloop_struct_131289.free_mem_122284 =
        mem_122284.mem;
    futhark_mc_segred_stage_1_parloop_struct_131289.free_reduce_stage_1_tid_res_arr_mem_125138 =
        reduce_stage_1_tid_res_arr_mem_125138;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131290_task;
    
    futhark_mc_segred_stage_1_parloop_131290_task.name =
        "futhark_mc_segred_stage_1_parloop_131290";
    futhark_mc_segred_stage_1_parloop_131290_task.fn =
        futhark_mc_segred_stage_1_parloop_131290;
    futhark_mc_segred_stage_1_parloop_131290_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131289;
    futhark_mc_segred_stage_1_parloop_131290_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131290_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131290_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131290_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131290_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131290_task);
    
    if (futhark_mc_segred_stage_1_parloop_131290_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131290_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131290_total_end -
                 futhark_mc_segred_stage_1_parloop_131290_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131290_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131290_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131290_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_125074 = 0.0F;
    }
    
    float x_125142;
    float x_125143;
    
    for (int32_t i_125145 = 0; i_125145 < num_tasks_125137; i_125145++) {
        flat_tid_117536 = i_125145;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_125142 = defunc_2_reduce_res_125074;
            }
            // load next params
            {
                x_125143 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_125138)[flat_tid_117536];
            }
            // red body
            {
                float defunc_1_op_res_125144 = x_125142 + x_125143;
                
                defunc_2_reduce_res_125074 = defunc_1_op_res_125144;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_125138);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131287_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131287_end -
                 futhark_mc_segred_task_131287_start;
        
        ctx->futhark_mc_segred_task_131287_runs[tid]++;
        ctx->futhark_mc_segred_task_131287_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131287_iter[tid] += iterations;
    }
    *futhark_mc_task_131286->retval_defunc_2_reduce_res_125074 =
        defunc_2_reduce_res_125074;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131285(void *args, int64_t start,
                                            int64_t end, int flat_tid_117534,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131284
    *futhark_mc_segmap_parloop_struct_131284 =
    (struct futhark_mc_segmap_parloop_struct_131284 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131284->ctx;
    uint64_t futhark_mc_segmap_parloop_131285_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131285_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131284->free_n_114534;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131284->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_segmap_parloop_struct_131284->free_css_chunk_len_114580;
    int64_t gtid_117531 =
            futhark_mc_segmap_parloop_struct_131284->free_gtid_117531;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_segmap_parloop_struct_131284->free_mem_122026,
                                  .size =0, .references =NULL};
    struct memblock mem_122048 = {.desc ="mem_122048", .mem =
                                  futhark_mc_segmap_parloop_struct_131284->free_mem_122048,
                                  .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_segmap_parloop_struct_131284->free_mem_122284,
                                  .size =0, .references =NULL};
    struct memblock mem_122287 = {.desc ="mem_122287", .mem =
                                  futhark_mc_segmap_parloop_struct_131284->free_mem_122287,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125122 = start;
    
    for (; iter_125122 < end; iter_125122++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125135 = n_p_114536;
        int64_t gtid_117535 = iter_125122;
        int64_t remnant_125136 = iter_125122 - gtid_117535;
        float x_125073 = ((float *) mem_122048.mem)[gtid_117531 * n_p_114536 +
                                                    gtid_117535];
        float defunc_2_reduce_res_125074;
        int64_t flat_tid_117536 = (int64_t) 0;
        int32_t num_tasks_125137;
        struct futhark_mc_task_131286 futhark_mc_task_131286;
        
        futhark_mc_task_131286.ctx = ctx;
        futhark_mc_task_131286.free_n_114534 = n_114534;
        futhark_mc_task_131286.free_css_chunk_len_114580 = css_chunk_len_114580;
        futhark_mc_task_131286.free_gtid_117531 = gtid_117531;
        futhark_mc_task_131286.free_gtid_117535 = gtid_117535;
        futhark_mc_task_131286.free_mem_122026 = mem_122026.mem;
        futhark_mc_task_131286.free_mem_122284 = mem_122284.mem;
        futhark_mc_task_131286.retval_defunc_2_reduce_res_125074 =
            &defunc_2_reduce_res_125074;
        
        struct scheduler_segop futhark_mc_task_131286_task;
        
        futhark_mc_task_131286_task.args = &futhark_mc_task_131286;
        futhark_mc_task_131286_task.top_level_fn =
            futhark_mc_segred_task_131287;
        futhark_mc_task_131286_task.name = "futhark_mc_segred_task_131287";
        futhark_mc_task_131286_task.iterations = css_chunk_len_114580;
        futhark_mc_task_131286_task.task_time =
            &ctx->futhark_mc_segred_task_131287_total_time;
        futhark_mc_task_131286_task.task_iter =
            &ctx->futhark_mc_segred_task_131287_total_iter;
        futhark_mc_task_131286_task.sched = STATIC;
        futhark_mc_task_131286_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131287_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131286_task);
        
        if (futhark_mc_segred_task_131287_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float defunc_1_f_res_125087 = defunc_2_reduce_res_125074 / x_125073;
        
        ((float *) mem_122287.mem)[gtid_117535] = defunc_1_f_res_125087;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131285_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131285_end -
                 futhark_mc_segmap_parloop_131285_start;
        
        ctx->futhark_mc_segmap_parloop_131285_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131285_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131285_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131283(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117534 = tid;
    int num_tasks_125105 = info.nsubtasks;
    struct futhark_mc_task_131279 *futhark_mc_task_131279 =
                                  (struct futhark_mc_task_131279 *) args;
    struct futhark_context *ctx = futhark_mc_task_131279->ctx;
    uint64_t futhark_mc_segmap_nested_task_131283_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131283_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131279->free_n_114534;
    int64_t n_p_114536 = futhark_mc_task_131279->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_task_131279->free_css_chunk_len_114580;
    int64_t gtid_117531 = futhark_mc_task_131279->free_gtid_117531;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_task_131279->free_mem_122026,
                                  .size =0, .references =NULL};
    struct memblock mem_122048 = {.desc ="mem_122048", .mem =
                                  futhark_mc_task_131279->free_mem_122048,
                                  .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_task_131279->free_mem_122284,
                                  .size =0, .references =NULL};
    struct memblock mem_122287 = {.desc ="mem_122287", .mem =
                                  futhark_mc_task_131279->free_mem_122287,
                                  .size =0, .references =NULL};
    int64_t iter_125122;
    struct futhark_mc_segmap_parloop_struct_131284
    futhark_mc_segmap_parloop_struct_131284;
    
    futhark_mc_segmap_parloop_struct_131284.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131284.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131284.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131284.free_css_chunk_len_114580 =
        css_chunk_len_114580;
    futhark_mc_segmap_parloop_struct_131284.free_gtid_117531 = gtid_117531;
    futhark_mc_segmap_parloop_struct_131284.free_mem_122026 = mem_122026.mem;
    futhark_mc_segmap_parloop_struct_131284.free_mem_122048 = mem_122048.mem;
    futhark_mc_segmap_parloop_struct_131284.free_mem_122284 = mem_122284.mem;
    futhark_mc_segmap_parloop_struct_131284.free_mem_122287 = mem_122287.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131285_task;
    
    futhark_mc_segmap_parloop_131285_task.name =
        "futhark_mc_segmap_parloop_131285";
    futhark_mc_segmap_parloop_131285_task.fn = futhark_mc_segmap_parloop_131285;
    futhark_mc_segmap_parloop_131285_task.args =
        &futhark_mc_segmap_parloop_struct_131284;
    futhark_mc_segmap_parloop_131285_task.iterations = iterations;
    futhark_mc_segmap_parloop_131285_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131285_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131285_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131285_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131285_task);
    
    if (futhark_mc_segmap_parloop_131285_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131285_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131285_total_end -
                 futhark_mc_segmap_parloop_131285_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131285_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131285_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131285_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131283_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131283_end -
                 futhark_mc_segmap_nested_task_131283_start;
        
        ctx->futhark_mc_segmap_nested_task_131283_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131283_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131283_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131277(void *args, int64_t start,
                                            int64_t end, int flat_tid_117530,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131276
    *futhark_mc_segmap_parloop_struct_131276 =
    (struct futhark_mc_segmap_parloop_struct_131276 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131276->ctx;
    uint64_t futhark_mc_segmap_parloop_131277_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131277_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131276->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131276->free_n_114534;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131276->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_segmap_parloop_struct_131276->free_css_chunk_len_114580;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_segmap_parloop_struct_131276->free_mem_122026,
                                  .size =0, .references =NULL};
    int64_t bytes_122027 =
            futhark_mc_segmap_parloop_struct_131276->free_bytes_122027;
    struct memblock mem_122048 = {.desc ="mem_122048", .mem =
                                  futhark_mc_segmap_parloop_struct_131276->free_mem_122048,
                                  .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_segmap_parloop_struct_131276->free_mem_122284,
                                  .size =0, .references =NULL};
    struct memblock mem_122306 = {.desc ="mem_122306", .mem =
                                  futhark_mc_segmap_parloop_struct_131276->free_mem_122306,
                                  .size =0, .references =NULL};
    size_t mem_122287_cached_sizze_131278 = 0;
    char *mem_122287 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125072 = start;
    
    if (mem_122287_cached_sizze_131278 < (size_t) bytes_122027) {
        mem_122287 = realloc(mem_122287, bytes_122027);
        mem_122287_cached_sizze_131278 = bytes_122027;
    }
    for (; iter_125072 < end; iter_125072++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125103 = m_114533;
        int64_t gtid_117531 = iter_125072;
        int64_t remnant_125104 = iter_125072 - gtid_117531;
        int64_t flat_tid_117532 = (int64_t) 0;
        int32_t num_tasks_125105;
        int64_t flat_tid_117534 = (int64_t) 0;
        struct futhark_mc_task_131279 futhark_mc_task_131279;
        
        futhark_mc_task_131279.ctx = ctx;
        futhark_mc_task_131279.free_n_114534 = n_114534;
        futhark_mc_task_131279.free_n_p_114536 = n_p_114536;
        futhark_mc_task_131279.free_css_chunk_len_114580 = css_chunk_len_114580;
        futhark_mc_task_131279.free_gtid_117531 = gtid_117531;
        futhark_mc_task_131279.free_mem_122026 = mem_122026.mem;
        futhark_mc_task_131279.free_mem_122048 = mem_122048.mem;
        futhark_mc_task_131279.free_mem_122284 = mem_122284.mem;
        futhark_mc_task_131279.free_mem_122287 = mem_122287;
        
        struct scheduler_segop futhark_mc_task_131279_task;
        
        futhark_mc_task_131279_task.args = &futhark_mc_task_131279;
        futhark_mc_task_131279_task.top_level_fn =
            futhark_mc_segmap_task_131280;
        futhark_mc_task_131279_task.name = "futhark_mc_segmap_task_131280";
        futhark_mc_task_131279_task.iterations = n_p_114536;
        futhark_mc_task_131279_task.task_time =
            &ctx->futhark_mc_segmap_task_131280_total_time;
        futhark_mc_task_131279_task.task_iter =
            &ctx->futhark_mc_segmap_task_131280_total_iter;
        futhark_mc_task_131279_task.sched = STATIC;
        futhark_mc_task_131279_task.nested_fn =
            futhark_mc_segmap_nested_task_131283;
        
        int futhark_mc_segmap_task_131280_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131279_task);
        
        if (futhark_mc_segmap_task_131280_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122306.mem + gtid_117531 * n_p_114536 * (int64_t) 4,
                mem_122287 + (int64_t) 0, n_p_114536 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122287);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131277_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131277_end -
                 futhark_mc_segmap_parloop_131277_start;
        
        ctx->futhark_mc_segmap_parloop_131277_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131277_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131277_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131275(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117530 = tid;
    int num_tasks_125048 = info.nsubtasks;
    struct futhark_mc_task_131270 *futhark_mc_task_131270 =
                                  (struct futhark_mc_task_131270 *) args;
    struct futhark_context *ctx = futhark_mc_task_131270->ctx;
    uint64_t futhark_mc_segmap_nested_task_131275_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131275_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131270->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131270->free_n_114534;
    int64_t n_p_114536 = futhark_mc_task_131270->free_n_p_114536;
    int64_t css_chunk_len_114580 =
            futhark_mc_task_131270->free_css_chunk_len_114580;
    struct memblock mem_122026 = {.desc ="mem_122026", .mem =
                                  futhark_mc_task_131270->free_mem_122026,
                                  .size =0, .references =NULL};
    int64_t bytes_122027 = futhark_mc_task_131270->free_bytes_122027;
    struct memblock mem_122048 = {.desc ="mem_122048", .mem =
                                  futhark_mc_task_131270->free_mem_122048,
                                  .size =0, .references =NULL};
    struct memblock mem_122284 = {.desc ="mem_122284", .mem =
                                  futhark_mc_task_131270->free_mem_122284,
                                  .size =0, .references =NULL};
    struct memblock mem_122306 = {.desc ="mem_122306", .mem =
                                  futhark_mc_task_131270->free_mem_122306,
                                  .size =0, .references =NULL};
    int64_t iter_125072;
    struct futhark_mc_segmap_parloop_struct_131276
    futhark_mc_segmap_parloop_struct_131276;
    
    futhark_mc_segmap_parloop_struct_131276.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131276.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131276.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131276.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131276.free_css_chunk_len_114580 =
        css_chunk_len_114580;
    futhark_mc_segmap_parloop_struct_131276.free_mem_122026 = mem_122026.mem;
    futhark_mc_segmap_parloop_struct_131276.free_bytes_122027 = bytes_122027;
    futhark_mc_segmap_parloop_struct_131276.free_mem_122048 = mem_122048.mem;
    futhark_mc_segmap_parloop_struct_131276.free_mem_122284 = mem_122284.mem;
    futhark_mc_segmap_parloop_struct_131276.free_mem_122306 = mem_122306.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131277_task;
    
    futhark_mc_segmap_parloop_131277_task.name =
        "futhark_mc_segmap_parloop_131277";
    futhark_mc_segmap_parloop_131277_task.fn = futhark_mc_segmap_parloop_131277;
    futhark_mc_segmap_parloop_131277_task.args =
        &futhark_mc_segmap_parloop_struct_131276;
    futhark_mc_segmap_parloop_131277_task.iterations = iterations;
    futhark_mc_segmap_parloop_131277_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131277_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131277_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131277_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131277_task);
    
    if (futhark_mc_segmap_parloop_131277_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131277_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131277_total_end -
                 futhark_mc_segmap_parloop_131277_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131277_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131277_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131277_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131275_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131275_end -
                 futhark_mc_segmap_nested_task_131275_start;
        
        ctx->futhark_mc_segmap_nested_task_131275_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131275_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131275_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131291 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_p_114536;
    int64_t free_C_len_114582;
    char *free_mem_122306;
    int64_t free_bytes_122307;
    char *free_mem_122328;
};
struct futhark_mc_segmap_parloop_struct_131293 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_p_114536;
    int64_t free_C_len_114582;
    char *free_mem_122306;
    int64_t free_bytes_122307;
    char *free_mem_122328;
};
static int futhark_mc_segmap_parloop_131294(void *args, int64_t start,
                                            int64_t end, int flat_tid_117589,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131293
    *futhark_mc_segmap_parloop_struct_131293 =
    (struct futhark_mc_segmap_parloop_struct_131293 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131293->ctx;
    uint64_t futhark_mc_segmap_parloop_131294_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131294_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131293->free_m_114533;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131293->free_n_p_114536;
    int64_t C_len_114582 =
            futhark_mc_segmap_parloop_struct_131293->free_C_len_114582;
    struct memblock mem_122306 = {.desc ="mem_122306", .mem =
                                  futhark_mc_segmap_parloop_struct_131293->free_mem_122306,
                                  .size =0, .references =NULL};
    int64_t bytes_122307 =
            futhark_mc_segmap_parloop_struct_131293->free_bytes_122307;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_segmap_parloop_struct_131293->free_mem_122328,
                                  .size =0, .references =NULL};
    size_t mem_122312_cached_sizze_131295 = 0;
    char *mem_122312 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125147 = start;
    
    if (mem_122312_cached_sizze_131295 < (size_t) bytes_122307) {
        mem_122312 = realloc(mem_122312, bytes_122307);
        mem_122312_cached_sizze_131295 = bytes_122307;
    }
    for (; iter_125147 < end; iter_125147++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125157 = m_114533;
        int64_t gtid_117590 = iter_125147;
        int64_t remnant_125158 = iter_125147 - gtid_117590;
        
        for (int64_t i_125148 = 0; i_125148 < C_len_114582; i_125148++) {
            int64_t i_125150 = smod64(i_125148, n_p_114536);
            bool x_125151 = sle64((int64_t) 0, i_125150);
            bool y_125152 = slt64(i_125150, n_p_114536);
            bool bounds_check_125153 = x_125151 && y_125152;
            bool index_certs_125154;
            
            if (!bounds_check_125153) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", i_125150,
                              "] out of bounds for array of shape [",
                              n_p_114536, "].",
                              "-> #0  stl.fut:217:43-59\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:217:21-60\n   #4  stl.fut:215:13-218:24\n   #5  stl.fut:394:3-405:33\n   #6  stl.fut:381:1-405:33\n");
                return 1;
            }
            memmove(mem_122312 + i_125148 * (int64_t) 4, mem_122306.mem +
                    (gtid_117590 * n_p_114536 + i_125150) * (int64_t) 4,
                    (int64_t) 4);
        }
        memmove(mem_122328.mem + gtid_117590 * C_len_114582 * (int64_t) 4,
                mem_122312 + (int64_t) 0, C_len_114582 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122312);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131294_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131294_end -
                 futhark_mc_segmap_parloop_131294_start;
        
        ctx->futhark_mc_segmap_parloop_131294_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131294_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131294_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131292(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117589 = tid;
    int num_tasks_125146 = info.nsubtasks;
    struct futhark_mc_task_131291 *futhark_mc_task_131291 =
                                  (struct futhark_mc_task_131291 *) args;
    struct futhark_context *ctx = futhark_mc_task_131291->ctx;
    uint64_t futhark_mc_segmap_task_131292_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131292_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131291->free_m_114533;
    int64_t n_p_114536 = futhark_mc_task_131291->free_n_p_114536;
    int64_t C_len_114582 = futhark_mc_task_131291->free_C_len_114582;
    struct memblock mem_122306 = {.desc ="mem_122306", .mem =
                                  futhark_mc_task_131291->free_mem_122306,
                                  .size =0, .references =NULL};
    int64_t bytes_122307 = futhark_mc_task_131291->free_bytes_122307;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_task_131291->free_mem_122328,
                                  .size =0, .references =NULL};
    int64_t iter_125147;
    struct futhark_mc_segmap_parloop_struct_131293
    futhark_mc_segmap_parloop_struct_131293;
    
    futhark_mc_segmap_parloop_struct_131293.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131293.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131293.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131293.free_C_len_114582 = C_len_114582;
    futhark_mc_segmap_parloop_struct_131293.free_mem_122306 = mem_122306.mem;
    futhark_mc_segmap_parloop_struct_131293.free_bytes_122307 = bytes_122307;
    futhark_mc_segmap_parloop_struct_131293.free_mem_122328 = mem_122328.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131294_task;
    
    futhark_mc_segmap_parloop_131294_task.name =
        "futhark_mc_segmap_parloop_131294";
    futhark_mc_segmap_parloop_131294_task.fn = futhark_mc_segmap_parloop_131294;
    futhark_mc_segmap_parloop_131294_task.args =
        &futhark_mc_segmap_parloop_struct_131293;
    futhark_mc_segmap_parloop_131294_task.iterations = iterations;
    futhark_mc_segmap_parloop_131294_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131294_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131294_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131294_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131294_task);
    
    if (futhark_mc_segmap_parloop_131294_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131294_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131294_total_end -
                 futhark_mc_segmap_parloop_131294_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131294_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131294_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131294_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131292_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131292_end -
                 futhark_mc_segmap_task_131292_start;
        
        ctx->futhark_mc_segmap_task_131292_runs[tid]++;
        ctx->futhark_mc_segmap_task_131292_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131292_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131297 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_p_114536;
    int64_t free_C_len_114582;
    char *free_mem_122306;
    int64_t free_bytes_122307;
    char *free_mem_122328;
};
struct futhark_mc_task_131300 {
    struct futhark_context *ctx;
    int64_t free_n_p_114536;
    int64_t free_C_len_114582;
    int64_t free_gtid_117592;
    char *free_mem_122306;
    char *free_mem_122309;
};
struct futhark_mc_segmap_parloop_struct_131302 {
    struct futhark_context *ctx;
    int64_t free_n_p_114536;
    int64_t free_C_len_114582;
    int64_t free_gtid_117592;
    char *free_mem_122306;
    char *free_mem_122309;
};
static int futhark_mc_segmap_parloop_131303(void *args, int64_t start,
                                            int64_t end, int flat_tid_117593,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131302
    *futhark_mc_segmap_parloop_struct_131302 =
    (struct futhark_mc_segmap_parloop_struct_131302 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131302->ctx;
    uint64_t futhark_mc_segmap_parloop_131303_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131303_start = get_wall_time();
    
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131302->free_n_p_114536;
    int64_t C_len_114582 =
            futhark_mc_segmap_parloop_struct_131302->free_C_len_114582;
    int64_t gtid_117592 =
            futhark_mc_segmap_parloop_struct_131302->free_gtid_117592;
    struct memblock mem_122306 = {.desc ="mem_122306", .mem =
                                  futhark_mc_segmap_parloop_struct_131302->free_mem_122306,
                                  .size =0, .references =NULL};
    struct memblock mem_122309 = {.desc ="mem_122309", .mem =
                                  futhark_mc_segmap_parloop_struct_131302->free_mem_122309,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125170 = start;
    
    for (; iter_125170 < end; iter_125170++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125171 = C_len_114582;
        int64_t gtid_117594 = iter_125170;
        int64_t remnant_125172 = iter_125170 - gtid_117594;
        int64_t i_125161 = smod64(gtid_117594, n_p_114536);
        bool x_125162 = sle64((int64_t) 0, i_125161);
        bool y_125163 = slt64(i_125161, n_p_114536);
        bool bounds_check_125164 = x_125162 && y_125163;
        bool index_certs_125165;
        
        if (!bounds_check_125164) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", i_125161,
                                   "] out of bounds for array of shape [",
                                   n_p_114536, "].",
                                   "-> #0  stl.fut:217:43-59\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:217:21-60\n   #4  stl.fut:215:13-218:24\n   #5  stl.fut:394:3-405:33\n   #6  stl.fut:381:1-405:33\n");
            return 1;
        }
        
        float defunc_0_f_res_125166 = ((float *) mem_122306.mem)[gtid_117592 *
                                                                 n_p_114536 +
                                                                 i_125161];
        
        ((float *) mem_122309.mem)[gtid_117594] = defunc_0_f_res_125166;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131303_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131303_end -
                 futhark_mc_segmap_parloop_131303_start;
        
        ctx->futhark_mc_segmap_parloop_131303_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131303_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131303_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131301(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117593 = tid;
    int num_tasks_125169 = info.nsubtasks;
    struct futhark_mc_task_131300 *futhark_mc_task_131300 =
                                  (struct futhark_mc_task_131300 *) args;
    struct futhark_context *ctx = futhark_mc_task_131300->ctx;
    uint64_t futhark_mc_segmap_task_131301_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131301_start = get_wall_time();
    
    int64_t n_p_114536 = futhark_mc_task_131300->free_n_p_114536;
    int64_t C_len_114582 = futhark_mc_task_131300->free_C_len_114582;
    int64_t gtid_117592 = futhark_mc_task_131300->free_gtid_117592;
    struct memblock mem_122306 = {.desc ="mem_122306", .mem =
                                  futhark_mc_task_131300->free_mem_122306,
                                  .size =0, .references =NULL};
    struct memblock mem_122309 = {.desc ="mem_122309", .mem =
                                  futhark_mc_task_131300->free_mem_122309,
                                  .size =0, .references =NULL};
    int64_t iter_125170;
    struct futhark_mc_segmap_parloop_struct_131302
    futhark_mc_segmap_parloop_struct_131302;
    
    futhark_mc_segmap_parloop_struct_131302.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131302.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131302.free_C_len_114582 = C_len_114582;
    futhark_mc_segmap_parloop_struct_131302.free_gtid_117592 = gtid_117592;
    futhark_mc_segmap_parloop_struct_131302.free_mem_122306 = mem_122306.mem;
    futhark_mc_segmap_parloop_struct_131302.free_mem_122309 = mem_122309.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131303_task;
    
    futhark_mc_segmap_parloop_131303_task.name =
        "futhark_mc_segmap_parloop_131303";
    futhark_mc_segmap_parloop_131303_task.fn = futhark_mc_segmap_parloop_131303;
    futhark_mc_segmap_parloop_131303_task.args =
        &futhark_mc_segmap_parloop_struct_131302;
    futhark_mc_segmap_parloop_131303_task.iterations = iterations;
    futhark_mc_segmap_parloop_131303_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131303_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131303_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131303_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131303_task);
    
    if (futhark_mc_segmap_parloop_131303_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131303_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131303_total_end -
                 futhark_mc_segmap_parloop_131303_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131303_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131303_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131303_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131301_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131301_end -
                 futhark_mc_segmap_task_131301_start;
        
        ctx->futhark_mc_segmap_task_131301_runs[tid]++;
        ctx->futhark_mc_segmap_task_131301_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131301_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131298(void *args, int64_t start,
                                            int64_t end, int flat_tid_117591,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131297
    *futhark_mc_segmap_parloop_struct_131297 =
    (struct futhark_mc_segmap_parloop_struct_131297 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131297->ctx;
    uint64_t futhark_mc_segmap_parloop_131298_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131298_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131297->free_m_114533;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131297->free_n_p_114536;
    int64_t C_len_114582 =
            futhark_mc_segmap_parloop_struct_131297->free_C_len_114582;
    struct memblock mem_122306 = {.desc ="mem_122306", .mem =
                                  futhark_mc_segmap_parloop_struct_131297->free_mem_122306,
                                  .size =0, .references =NULL};
    int64_t bytes_122307 =
            futhark_mc_segmap_parloop_struct_131297->free_bytes_122307;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_segmap_parloop_struct_131297->free_mem_122328,
                                  .size =0, .references =NULL};
    size_t mem_122309_cached_sizze_131299 = 0;
    char *mem_122309 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125160 = start;
    
    if (mem_122309_cached_sizze_131299 < (size_t) bytes_122307) {
        mem_122309 = realloc(mem_122309, bytes_122307);
        mem_122309_cached_sizze_131299 = bytes_122307;
    }
    for (; iter_125160 < end; iter_125160++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125167 = m_114533;
        int64_t gtid_117592 = iter_125160;
        int64_t remnant_125168 = iter_125160 - gtid_117592;
        int64_t flat_tid_117593 = (int64_t) 0;
        int32_t num_tasks_125169;
        struct futhark_mc_task_131300 futhark_mc_task_131300;
        
        futhark_mc_task_131300.ctx = ctx;
        futhark_mc_task_131300.free_n_p_114536 = n_p_114536;
        futhark_mc_task_131300.free_C_len_114582 = C_len_114582;
        futhark_mc_task_131300.free_gtid_117592 = gtid_117592;
        futhark_mc_task_131300.free_mem_122306 = mem_122306.mem;
        futhark_mc_task_131300.free_mem_122309 = mem_122309;
        
        struct scheduler_segop futhark_mc_task_131300_task;
        
        futhark_mc_task_131300_task.args = &futhark_mc_task_131300;
        futhark_mc_task_131300_task.top_level_fn =
            futhark_mc_segmap_task_131301;
        futhark_mc_task_131300_task.name = "futhark_mc_segmap_task_131301";
        futhark_mc_task_131300_task.iterations = C_len_114582;
        futhark_mc_task_131300_task.task_time =
            &ctx->futhark_mc_segmap_task_131301_total_time;
        futhark_mc_task_131300_task.task_iter =
            &ctx->futhark_mc_segmap_task_131301_total_iter;
        futhark_mc_task_131300_task.sched = STATIC;
        futhark_mc_task_131300_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131301_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131300_task);
        
        if (futhark_mc_segmap_task_131301_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122328.mem + gtid_117592 * C_len_114582 * (int64_t) 4,
                mem_122309 + (int64_t) 0, C_len_114582 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122309);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131298_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131298_end -
                 futhark_mc_segmap_parloop_131298_start;
        
        ctx->futhark_mc_segmap_parloop_131298_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131298_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131298_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131296(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117591 = tid;
    int num_tasks_125146 = info.nsubtasks;
    struct futhark_mc_task_131291 *futhark_mc_task_131291 =
                                  (struct futhark_mc_task_131291 *) args;
    struct futhark_context *ctx = futhark_mc_task_131291->ctx;
    uint64_t futhark_mc_segmap_nested_task_131296_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131296_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131291->free_m_114533;
    int64_t n_p_114536 = futhark_mc_task_131291->free_n_p_114536;
    int64_t C_len_114582 = futhark_mc_task_131291->free_C_len_114582;
    struct memblock mem_122306 = {.desc ="mem_122306", .mem =
                                  futhark_mc_task_131291->free_mem_122306,
                                  .size =0, .references =NULL};
    int64_t bytes_122307 = futhark_mc_task_131291->free_bytes_122307;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_task_131291->free_mem_122328,
                                  .size =0, .references =NULL};
    int64_t iter_125160;
    struct futhark_mc_segmap_parloop_struct_131297
    futhark_mc_segmap_parloop_struct_131297;
    
    futhark_mc_segmap_parloop_struct_131297.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131297.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131297.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131297.free_C_len_114582 = C_len_114582;
    futhark_mc_segmap_parloop_struct_131297.free_mem_122306 = mem_122306.mem;
    futhark_mc_segmap_parloop_struct_131297.free_bytes_122307 = bytes_122307;
    futhark_mc_segmap_parloop_struct_131297.free_mem_122328 = mem_122328.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131298_task;
    
    futhark_mc_segmap_parloop_131298_task.name =
        "futhark_mc_segmap_parloop_131298";
    futhark_mc_segmap_parloop_131298_task.fn = futhark_mc_segmap_parloop_131298;
    futhark_mc_segmap_parloop_131298_task.args =
        &futhark_mc_segmap_parloop_struct_131297;
    futhark_mc_segmap_parloop_131298_task.iterations = iterations;
    futhark_mc_segmap_parloop_131298_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131298_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131298_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131298_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131298_task);
    
    if (futhark_mc_segmap_parloop_131298_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131298_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131298_total_end -
                 futhark_mc_segmap_parloop_131298_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131298_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131298_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131298_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131296_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131296_end -
                 futhark_mc_segmap_nested_task_131296_start;
        
        ctx->futhark_mc_segmap_nested_task_131296_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131296_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131296_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131304 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    float free_i64_res_114576;
    int64_t free_C_len_114582;
    int64_t free_lifted_single_ma_arg_114959;
    int64_t free_lifted_single_ma_arg_114976;
    int64_t free_bytes_121983;
    char *free_mem_122328;
    int64_t free_bytes_122329;
    int64_t free_bytes_122332;
    char *free_mem_122386;
};
struct futhark_mc_segmap_parloop_struct_131306 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    float free_i64_res_114576;
    int64_t free_C_len_114582;
    int64_t free_lifted_single_ma_arg_114959;
    int64_t free_lifted_single_ma_arg_114976;
    int64_t free_bytes_121983;
    char *free_mem_122328;
    int64_t free_bytes_122329;
    int64_t free_bytes_122332;
    char *free_mem_122386;
};
static int futhark_mc_segmap_parloop_131307(void *args, int64_t start,
                                            int64_t end, int flat_tid_117604,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131306
    *futhark_mc_segmap_parloop_struct_131306 =
    (struct futhark_mc_segmap_parloop_struct_131306 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131306->ctx;
    uint64_t futhark_mc_segmap_parloop_131307_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131307_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131306->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131306->free_n_114534;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131306->free_n_p_114536;
    float i64_res_114576 =
          futhark_mc_segmap_parloop_struct_131306->free_i64_res_114576;
    int64_t C_len_114582 =
            futhark_mc_segmap_parloop_struct_131306->free_C_len_114582;
    int64_t lifted_single_ma_arg_114959 =
            futhark_mc_segmap_parloop_struct_131306->free_lifted_single_ma_arg_114959;
    int64_t lifted_single_ma_arg_114976 =
            futhark_mc_segmap_parloop_struct_131306->free_lifted_single_ma_arg_114976;
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131306->free_bytes_121983;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_segmap_parloop_struct_131306->free_mem_122328,
                                  .size =0, .references =NULL};
    int64_t bytes_122329 =
            futhark_mc_segmap_parloop_struct_131306->free_bytes_122329;
    int64_t bytes_122332 =
            futhark_mc_segmap_parloop_struct_131306->free_bytes_122332;
    struct memblock mem_122386 = {.desc ="mem_122386", .mem =
                                  futhark_mc_segmap_parloop_struct_131306->free_mem_122386,
                                  .size =0, .references =NULL};
    size_t mem_122340_cached_sizze_131308 = 0;
    char *mem_122340 = NULL;
    size_t mem_122355_cached_sizze_131309 = 0;
    char *mem_122355 = NULL;
    size_t mem_122370_cached_sizze_131310 = 0;
    char *mem_122370 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125174 = start;
    
    if (mem_122340_cached_sizze_131308 < (size_t) bytes_122329) {
        mem_122340 = realloc(mem_122340, bytes_122329);
        mem_122340_cached_sizze_131308 = bytes_122329;
    }
    if (mem_122355_cached_sizze_131309 < (size_t) bytes_122332) {
        mem_122355 = realloc(mem_122355, bytes_122332);
        mem_122355_cached_sizze_131309 = bytes_122332;
    }
    if (mem_122370_cached_sizze_131310 < (size_t) bytes_121983) {
        mem_122370 = realloc(mem_122370, bytes_121983);
        mem_122370_cached_sizze_131310 = bytes_121983;
    }
    for (; iter_125174 < end; iter_125174++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125257 = m_114533;
        int64_t gtid_117605 = iter_125174;
        int64_t remnant_125258 = iter_125174 - gtid_117605;
        float defunc_2_reduce_res_115076;
        float redout_125176 = 0.0F;
        
        for (int64_t i_125175 = 0; i_125175 < n_p_114536; i_125175++) {
            float x_125177 = ((float *) mem_122328.mem)[gtid_117605 *
                                                        C_len_114582 +
                                                        i_125175];
            float defunc_1_op_res_125178 = x_125177 + redout_125176;
            float redout_tmp_125259 = defunc_1_op_res_125178;
            
            redout_125176 = redout_tmp_125259;
        }
        defunc_2_reduce_res_115076 = redout_125176;
        
        float discard_121374;
        float scanacc_125180 = 0.0F;
        
        for (int64_t i_125179 = 0; i_125179 < lifted_single_ma_arg_114959;
             i_125179++) {
            bool cond_125182 = i_125179 == (int64_t) 0;
            float defunc_0_f_res_125183;
            
            if (cond_125182) {
                float defunc_0_f_res_t_res_125184 = defunc_2_reduce_res_115076 /
                      i64_res_114576;
                
                defunc_0_f_res_125183 = defunc_0_f_res_t_res_125184;
            } else {
                int64_t x_125185 = add64(n_p_114536, i_125179);
                int64_t i_125186 = sub64(x_125185, (int64_t) 1);
                bool x_125187 = sle64((int64_t) 0, i_125186);
                bool y_125188 = slt64(i_125186, C_len_114582);
                bool bounds_check_125189 = x_125187 && y_125188;
                bool index_certs_125190;
                
                if (!bounds_check_125189) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125186,
                                  "] out of bounds for array of shape [",
                                  C_len_114582, "].",
                                  "-> #0  stl.fut:38:26-39\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  stl.fut:43:3-32\n   #5  stl.fut:223:30-50\n   #6  stl.fut:222:23-224:31\n   #7  stl.fut:394:3-405:33\n   #8  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float x_125191 = ((float *) mem_122328.mem)[gtid_117605 *
                                                            C_len_114582 +
                                                            i_125186];
                int64_t i_125192 = sub64(i_125179, (int64_t) 1);
                bool x_125193 = sle64((int64_t) 0, i_125192);
                bool y_125194 = slt64(i_125192, C_len_114582);
                bool bounds_check_125195 = x_125193 && y_125194;
                bool index_certs_125196;
                
                if (!bounds_check_125195) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125192,
                                  "] out of bounds for array of shape [",
                                  C_len_114582, "].",
                                  "-> #0  stl.fut:38:43-50\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  stl.fut:43:3-32\n   #5  stl.fut:223:30-50\n   #6  stl.fut:222:23-224:31\n   #7  stl.fut:394:3-405:33\n   #8  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float y_125197 = ((float *) mem_122328.mem)[gtid_117605 *
                                                            C_len_114582 +
                                                            i_125192];
                float x_125198 = x_125191 - y_125197;
                float defunc_0_f_res_f_res_125199 = x_125198 / i64_res_114576;
                
                defunc_0_f_res_125183 = defunc_0_f_res_f_res_125199;
            }
            
            float defunc_1_op_res_125200 = defunc_0_f_res_125183 +
                  scanacc_125180;
            
            ((float *) mem_122340)[i_125179] = defunc_1_op_res_125200;
            
            float scanacc_tmp_125260 = defunc_1_op_res_125200;
            
            scanacc_125180 = scanacc_tmp_125260;
        }
        discard_121374 = scanacc_125180;
        
        float defunc_2_reduce_res_115105;
        float redout_125203 = 0.0F;
        
        for (int64_t i_125202 = 0; i_125202 < n_p_114536; i_125202++) {
            float x_125204 = ((float *) mem_122340)[i_125202];
            float defunc_1_op_res_125205 = x_125204 + redout_125203;
            float redout_tmp_125262 = defunc_1_op_res_125205;
            
            redout_125203 = redout_tmp_125262;
        }
        defunc_2_reduce_res_115105 = redout_125203;
        
        float discard_121382;
        float scanacc_125207 = 0.0F;
        
        for (int64_t i_125206 = 0; i_125206 < lifted_single_ma_arg_114976;
             i_125206++) {
            bool cond_125209 = i_125206 == (int64_t) 0;
            float defunc_0_f_res_125210;
            
            if (cond_125209) {
                float defunc_0_f_res_t_res_125211 = defunc_2_reduce_res_115105 /
                      i64_res_114576;
                
                defunc_0_f_res_125210 = defunc_0_f_res_t_res_125211;
            } else {
                int64_t x_125212 = add64(n_p_114536, i_125206);
                int64_t i_125213 = sub64(x_125212, (int64_t) 1);
                bool x_125214 = sle64((int64_t) 0, i_125213);
                bool y_125215 = slt64(i_125213, lifted_single_ma_arg_114959);
                bool bounds_check_125216 = x_125214 && y_125215;
                bool index_certs_125217;
                
                if (!bounds_check_125216) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125213,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114959, "].",
                                  "-> #0  stl.fut:38:26-39\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-58\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float x_125218 = ((float *) mem_122340)[i_125213];
                int64_t i_125219 = sub64(i_125206, (int64_t) 1);
                bool x_125220 = sle64((int64_t) 0, i_125219);
                bool y_125221 = slt64(i_125219, lifted_single_ma_arg_114959);
                bool bounds_check_125222 = x_125220 && y_125221;
                bool index_certs_125223;
                
                if (!bounds_check_125222) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125219,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114959, "].",
                                  "-> #0  stl.fut:38:43-50\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-58\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float y_125224 = ((float *) mem_122340)[i_125219];
                float x_125225 = x_125218 - y_125224;
                float defunc_0_f_res_f_res_125226 = x_125225 / i64_res_114576;
                
                defunc_0_f_res_125210 = defunc_0_f_res_f_res_125226;
            }
            
            float defunc_1_op_res_125227 = defunc_0_f_res_125210 +
                  scanacc_125207;
            
            ((float *) mem_122355)[i_125206] = defunc_1_op_res_125227;
            
            float scanacc_tmp_125263 = defunc_1_op_res_125227;
            
            scanacc_125207 = scanacc_tmp_125263;
        }
        discard_121382 = scanacc_125207;
        
        float defunc_2_reduce_res_115134;
        float redout_125230 = 0.0F;
        
        for (int32_t i_125229 = 0; i_125229 < 3; i_125229++) {
            int64_t i_125231 = sext_i32_i64(i_125229);
            float x_125232 = ((float *) mem_122355)[i_125231];
            float defunc_1_op_res_125233 = x_125232 + redout_125230;
            float redout_tmp_125265 = defunc_1_op_res_125233;
            
            redout_125230 = redout_tmp_125265;
        }
        defunc_2_reduce_res_115134 = redout_125230;
        
        float discard_121390;
        float scanacc_125235 = 0.0F;
        
        for (int64_t i_125234 = 0; i_125234 < n_114534; i_125234++) {
            bool cond_125237 = i_125234 == (int64_t) 0;
            float defunc_0_f_res_125238;
            
            if (cond_125237) {
                float defunc_0_f_res_t_res_125239 = defunc_2_reduce_res_115134 /
                      3.0F;
                
                defunc_0_f_res_125238 = defunc_0_f_res_t_res_125239;
            } else {
                int64_t x_125240 = add64((int64_t) 3, i_125234);
                int64_t i_125241 = sub64(x_125240, (int64_t) 1);
                bool x_125242 = sle64((int64_t) 0, i_125241);
                bool y_125243 = slt64(i_125241, lifted_single_ma_arg_114976);
                bool bounds_check_125244 = x_125242 && y_125243;
                bool index_certs_125245;
                
                if (!bounds_check_125244) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125241,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114976, "].",
                                  "-> #0  stl.fut:38:26-39\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-76\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float x_125246 = ((float *) mem_122355)[i_125241];
                int64_t i_125247 = sub64(i_125234, (int64_t) 1);
                bool x_125248 = sle64((int64_t) 0, i_125247);
                bool y_125249 = slt64(i_125247, lifted_single_ma_arg_114976);
                bool bounds_check_125250 = x_125248 && y_125249;
                bool index_certs_125251;
                
                if (!bounds_check_125250) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125247,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114976, "].",
                                  "-> #0  stl.fut:38:43-50\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-76\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float y_125252 = ((float *) mem_122355)[i_125247];
                float x_125253 = x_125246 - y_125252;
                float defunc_0_f_res_f_res_125254 = x_125253 / 3.0F;
                
                defunc_0_f_res_125238 = defunc_0_f_res_f_res_125254;
            }
            
            float defunc_1_op_res_125255 = defunc_0_f_res_125238 +
                  scanacc_125235;
            
            ((float *) mem_122370)[i_125234] = defunc_1_op_res_125255;
            
            float scanacc_tmp_125266 = defunc_1_op_res_125255;
            
            scanacc_125235 = scanacc_tmp_125266;
        }
        discard_121390 = scanacc_125235;
        memmove(mem_122386.mem + gtid_117605 * n_114534 * (int64_t) 4,
                mem_122370 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122340);
    free(mem_122355);
    free(mem_122370);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131307_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131307_end -
                 futhark_mc_segmap_parloop_131307_start;
        
        ctx->futhark_mc_segmap_parloop_131307_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131307_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131307_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131305(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117604 = tid;
    int num_tasks_125173 = info.nsubtasks;
    struct futhark_mc_task_131304 *futhark_mc_task_131304 =
                                  (struct futhark_mc_task_131304 *) args;
    struct futhark_context *ctx = futhark_mc_task_131304->ctx;
    uint64_t futhark_mc_segmap_task_131305_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131305_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131304->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131304->free_n_114534;
    int64_t n_p_114536 = futhark_mc_task_131304->free_n_p_114536;
    float i64_res_114576 = futhark_mc_task_131304->free_i64_res_114576;
    int64_t C_len_114582 = futhark_mc_task_131304->free_C_len_114582;
    int64_t lifted_single_ma_arg_114959 =
            futhark_mc_task_131304->free_lifted_single_ma_arg_114959;
    int64_t lifted_single_ma_arg_114976 =
            futhark_mc_task_131304->free_lifted_single_ma_arg_114976;
    int64_t bytes_121983 = futhark_mc_task_131304->free_bytes_121983;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_task_131304->free_mem_122328,
                                  .size =0, .references =NULL};
    int64_t bytes_122329 = futhark_mc_task_131304->free_bytes_122329;
    int64_t bytes_122332 = futhark_mc_task_131304->free_bytes_122332;
    struct memblock mem_122386 = {.desc ="mem_122386", .mem =
                                  futhark_mc_task_131304->free_mem_122386,
                                  .size =0, .references =NULL};
    int64_t iter_125174;
    struct futhark_mc_segmap_parloop_struct_131306
    futhark_mc_segmap_parloop_struct_131306;
    
    futhark_mc_segmap_parloop_struct_131306.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131306.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131306.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131306.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131306.free_i64_res_114576 =
        i64_res_114576;
    futhark_mc_segmap_parloop_struct_131306.free_C_len_114582 = C_len_114582;
    futhark_mc_segmap_parloop_struct_131306.free_lifted_single_ma_arg_114959 =
        lifted_single_ma_arg_114959;
    futhark_mc_segmap_parloop_struct_131306.free_lifted_single_ma_arg_114976 =
        lifted_single_ma_arg_114976;
    futhark_mc_segmap_parloop_struct_131306.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131306.free_mem_122328 = mem_122328.mem;
    futhark_mc_segmap_parloop_struct_131306.free_bytes_122329 = bytes_122329;
    futhark_mc_segmap_parloop_struct_131306.free_bytes_122332 = bytes_122332;
    futhark_mc_segmap_parloop_struct_131306.free_mem_122386 = mem_122386.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131307_task;
    
    futhark_mc_segmap_parloop_131307_task.name =
        "futhark_mc_segmap_parloop_131307";
    futhark_mc_segmap_parloop_131307_task.fn = futhark_mc_segmap_parloop_131307;
    futhark_mc_segmap_parloop_131307_task.args =
        &futhark_mc_segmap_parloop_struct_131306;
    futhark_mc_segmap_parloop_131307_task.iterations = iterations;
    futhark_mc_segmap_parloop_131307_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131307_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131307_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131307_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131307_task);
    
    if (futhark_mc_segmap_parloop_131307_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131307_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131307_total_end -
                 futhark_mc_segmap_parloop_131307_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131307_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131307_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131307_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131305_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131305_end -
                 futhark_mc_segmap_task_131305_start;
        
        ctx->futhark_mc_segmap_task_131305_runs[tid]++;
        ctx->futhark_mc_segmap_task_131305_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131305_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131312 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    float free_i64_res_114576;
    int64_t free_C_len_114582;
    int64_t free_lifted_single_ma_arg_114959;
    int64_t free_lifted_single_ma_arg_114976;
    int64_t free_bytes_121983;
    char *free_mem_122328;
    int64_t free_bytes_122329;
    int64_t free_bytes_122332;
    char *free_mem_122386;
};
struct futhark_mc_task_131317 {
    struct futhark_context *ctx;
    int64_t free_C_len_114582;
    int64_t free_gtid_117607;
    char *free_mem_122328;
    float *retval_defunc_2_reduce_res_117622;
};
struct futhark_mc_segred_stage_1_parloop_struct_131320 {
    struct futhark_context *ctx;
    int64_t free_C_len_114582;
    int64_t free_gtid_117607;
    char *free_mem_122328;
    char *free_reduce_stage_1_tid_res_arr_mem_125347;
};
static int futhark_mc_segred_stage_1_parloop_131321(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_117608,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131320
    *futhark_mc_segred_stage_1_parloop_struct_131320 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131320 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131320->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131321_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131321_start = get_wall_time();
    
    int64_t C_len_114582 =
            futhark_mc_segred_stage_1_parloop_struct_131320->free_C_len_114582;
    int64_t gtid_117607 =
            futhark_mc_segred_stage_1_parloop_struct_131320->free_gtid_117607;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131320->free_mem_122328,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_125347 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_125347",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131320->free_reduce_stage_1_tid_res_arr_mem_125347,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125349 = start;
    float x_125269;
    float x_125270;
    float local_acc_125350 = 0.0F;
    
    for (; iter_125349 < end; iter_125349++) {
        int64_t gtid_117609 = iter_125349;
        float x_125272 = ((float *) mem_122328.mem)[gtid_117607 * C_len_114582 +
                                                    gtid_117609];
        
        // save map-out results
        { }
        // Load accum params
        {
            x_125269 = local_acc_125350;
        }
        // Load next params
        {
            x_125270 = x_125272;
        }
        // Red body
        {
            float defunc_1_op_res_125271 = x_125269 + x_125270;
            
            local_acc_125350 = defunc_1_op_res_125271;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_125347.mem)[flat_tid_117608] =
        local_acc_125350;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131321_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131321_end -
                 futhark_mc_segred_stage_1_parloop_131321_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131321_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131321_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131321_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131318(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117608 = tid;
    int num_tasks_125346 = info.nsubtasks;
    struct futhark_mc_task_131317 *futhark_mc_task_131317 =
                                  (struct futhark_mc_task_131317 *) args;
    struct futhark_context *ctx = futhark_mc_task_131317->ctx;
    uint64_t futhark_mc_segred_task_131318_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131318_start = get_wall_time();
    
    int64_t C_len_114582 = futhark_mc_task_131317->free_C_len_114582;
    int64_t gtid_117607 = futhark_mc_task_131317->free_gtid_117607;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_task_131317->free_mem_122328,
                                  .size =0, .references =NULL};
    float defunc_2_reduce_res_117622 =
          *futhark_mc_task_131317->retval_defunc_2_reduce_res_117622;
    size_t reduce_stage_1_tid_res_arr_mem_125347_cached_sizze_131319 = 0;
    char *reduce_stage_1_tid_res_arr_mem_125347 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_125347_cached_sizze_131319 <
        (size_t) ((int64_t) 4 * num_tasks_125346)) {
        reduce_stage_1_tid_res_arr_mem_125347 =
            realloc(reduce_stage_1_tid_res_arr_mem_125347, (int64_t) 4 *
                    num_tasks_125346);
        reduce_stage_1_tid_res_arr_mem_125347_cached_sizze_131319 =
            (int64_t) 4 * num_tasks_125346;
    }
    
    int64_t iter_125349;
    struct futhark_mc_segred_stage_1_parloop_struct_131320
    futhark_mc_segred_stage_1_parloop_struct_131320;
    
    futhark_mc_segred_stage_1_parloop_struct_131320.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131320.free_C_len_114582 =
        C_len_114582;
    futhark_mc_segred_stage_1_parloop_struct_131320.free_gtid_117607 =
        gtid_117607;
    futhark_mc_segred_stage_1_parloop_struct_131320.free_mem_122328 =
        mem_122328.mem;
    futhark_mc_segred_stage_1_parloop_struct_131320.free_reduce_stage_1_tid_res_arr_mem_125347 =
        reduce_stage_1_tid_res_arr_mem_125347;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131321_task;
    
    futhark_mc_segred_stage_1_parloop_131321_task.name =
        "futhark_mc_segred_stage_1_parloop_131321";
    futhark_mc_segred_stage_1_parloop_131321_task.fn =
        futhark_mc_segred_stage_1_parloop_131321;
    futhark_mc_segred_stage_1_parloop_131321_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131320;
    futhark_mc_segred_stage_1_parloop_131321_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131321_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131321_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131321_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131321_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131321_task);
    
    if (futhark_mc_segred_stage_1_parloop_131321_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131321_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131321_total_end -
                 futhark_mc_segred_stage_1_parloop_131321_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131321_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131321_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131321_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_117622 = 0.0F;
    }
    
    float x_125351;
    float x_125352;
    
    for (int32_t i_125354 = 0; i_125354 < num_tasks_125346; i_125354++) {
        flat_tid_117608 = i_125354;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_125351 = defunc_2_reduce_res_117622;
            }
            // load next params
            {
                x_125352 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_125347)[flat_tid_117608];
            }
            // red body
            {
                float defunc_1_op_res_125353 = x_125351 + x_125352;
                
                defunc_2_reduce_res_117622 = defunc_1_op_res_125353;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_125347);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131318_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131318_end -
                 futhark_mc_segred_task_131318_start;
        
        ctx->futhark_mc_segred_task_131318_runs[tid]++;
        ctx->futhark_mc_segred_task_131318_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131318_iter[tid] += iterations;
    }
    *futhark_mc_task_131317->retval_defunc_2_reduce_res_117622 =
        defunc_2_reduce_res_117622;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131322 {
    struct futhark_context *ctx;
    int64_t free_n_p_114536;
    float free_i64_res_114576;
    int64_t free_C_len_114582;
    int64_t free_lifted_single_ma_arg_114959;
    int64_t free_gtid_117607;
    float free_defunc_2_reduce_res_117622;
    char *free_mem_122328;
    char *free_mem_122331;
};
struct futhark_mc_scan_stage_1_parloop_struct_131325 {
    struct futhark_context *ctx;
    int64_t free_n_p_114536;
    float free_i64_res_114576;
    int64_t free_C_len_114582;
    int64_t free_gtid_117607;
    float free_defunc_2_reduce_res_117622;
    char *free_mem_122328;
    char *free_mem_122331;
};
static int futhark_mc_scan_stage_1_parloop_131326(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_117610, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_131325
    *futhark_mc_scan_stage_1_parloop_struct_131325 =
    (struct futhark_mc_scan_stage_1_parloop_struct_131325 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_131325->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_131326_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_131326_start = get_wall_time();
    
    int64_t n_p_114536 =
            futhark_mc_scan_stage_1_parloop_struct_131325->free_n_p_114536;
    float i64_res_114576 =
          futhark_mc_scan_stage_1_parloop_struct_131325->free_i64_res_114576;
    int64_t C_len_114582 =
            futhark_mc_scan_stage_1_parloop_struct_131325->free_C_len_114582;
    int64_t gtid_117607 =
            futhark_mc_scan_stage_1_parloop_struct_131325->free_gtid_117607;
    float defunc_2_reduce_res_117622 =
          futhark_mc_scan_stage_1_parloop_struct_131325->free_defunc_2_reduce_res_117622;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_131325->free_mem_122328,
                                  .size =0, .references =NULL};
    struct memblock mem_122331 = {.desc ="mem_122331", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_131325->free_mem_122331,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125356 = start;
    float x_125273;
    float x_125274;
    
    x_125273 = 0.0F;
    for (; iter_125356 < end; iter_125356++) {
        int64_t gtid_117611 = iter_125356;
        
        // stage 1 scan body
        {
            bool cond_125276 = gtid_117611 == (int64_t) 0;
            float defunc_0_f_res_125277;
            
            if (cond_125276) {
                float defunc_0_f_res_t_res_125278 = defunc_2_reduce_res_117622 /
                      i64_res_114576;
                
                defunc_0_f_res_125277 = defunc_0_f_res_t_res_125278;
            } else {
                int64_t x_125279 = add64(n_p_114536, gtid_117611);
                int64_t i_125280 = sub64(x_125279, (int64_t) 1);
                bool x_125281 = sle64((int64_t) 0, i_125280);
                bool y_125282 = slt64(i_125280, C_len_114582);
                bool bounds_check_125283 = x_125281 && y_125282;
                bool index_certs_125284;
                
                if (!bounds_check_125283) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125280,
                                  "] out of bounds for array of shape [",
                                  C_len_114582, "].",
                                  "-> #0  stl.fut:38:26-39\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  stl.fut:43:3-32\n   #5  stl.fut:223:30-50\n   #6  stl.fut:222:23-224:31\n   #7  stl.fut:394:3-405:33\n   #8  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float x_125285 = ((float *) mem_122328.mem)[gtid_117607 *
                                                            C_len_114582 +
                                                            i_125280];
                int64_t i_125286 = sub64(gtid_117611, (int64_t) 1);
                bool x_125287 = sle64((int64_t) 0, i_125286);
                bool y_125288 = slt64(i_125286, C_len_114582);
                bool bounds_check_125289 = x_125287 && y_125288;
                bool index_certs_125290;
                
                if (!bounds_check_125289) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125286,
                                  "] out of bounds for array of shape [",
                                  C_len_114582, "].",
                                  "-> #0  stl.fut:38:43-50\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  stl.fut:43:3-32\n   #5  stl.fut:223:30-50\n   #6  stl.fut:222:23-224:31\n   #7  stl.fut:394:3-405:33\n   #8  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float y_125291 = ((float *) mem_122328.mem)[gtid_117607 *
                                                            C_len_114582 +
                                                            i_125286];
                float x_125292 = x_125285 - y_125291;
                float defunc_0_f_res_f_res_125293 = x_125292 / i64_res_114576;
                
                defunc_0_f_res_125277 = defunc_0_f_res_f_res_125293;
            }
            // write mapped values results to memory
            { }
            x_125273 = x_125273;
            // Read next values
            {
                x_125274 = defunc_0_f_res_125277;
            }
            
            float defunc_1_op_res_125275 = x_125273 + x_125274;
            
            ((float *) mem_122331.mem)[gtid_117611] = defunc_1_op_res_125275;
            x_125273 = defunc_1_op_res_125275;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_131326_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_131326_end -
                 futhark_mc_scan_stage_1_parloop_131326_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_131326_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_131326_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_131326_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_131327 {
    struct futhark_context *ctx;
    int64_t free_n_p_114536;
    float free_i64_res_114576;
    int64_t free_C_len_114582;
    int64_t free_gtid_117607;
    float free_defunc_2_reduce_res_117622;
    char *free_mem_122328;
    char *free_mem_122331;
};
static int futhark_mc_scan_stage_3_parloop_131328(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_117610, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_131327
    *futhark_mc_scan_stage_3_parloop_struct_131327 =
    (struct futhark_mc_scan_stage_3_parloop_struct_131327 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_131327->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_131328_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_131328_start = get_wall_time();
    
    int64_t n_p_114536 =
            futhark_mc_scan_stage_3_parloop_struct_131327->free_n_p_114536;
    float i64_res_114576 =
          futhark_mc_scan_stage_3_parloop_struct_131327->free_i64_res_114576;
    int64_t C_len_114582 =
            futhark_mc_scan_stage_3_parloop_struct_131327->free_C_len_114582;
    int64_t gtid_117607 =
            futhark_mc_scan_stage_3_parloop_struct_131327->free_gtid_117607;
    float defunc_2_reduce_res_117622 =
          futhark_mc_scan_stage_3_parloop_struct_131327->free_defunc_2_reduce_res_117622;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_131327->free_mem_122328,
                                  .size =0, .references =NULL};
    struct memblock mem_122331 = {.desc ="mem_122331", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_131327->free_mem_122331,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125368 = start;
    float x_125365;
    float x_125366;
    
    if (iter_125368 == (int64_t) 0) {
        x_125365 = 0.0F;
    } else {
        x_125365 = ((float *) mem_122331.mem)[iter_125368 - (int64_t) 1];
    }
    for (; iter_125368 < end; iter_125368++) {
        int64_t gtid_117611 = iter_125368;
        
        // stage 3 scan body
        {
            bool cond_125276 = gtid_117611 == (int64_t) 0;
            float defunc_0_f_res_125277;
            
            if (cond_125276) {
                float defunc_0_f_res_t_res_125278 = defunc_2_reduce_res_117622 /
                      i64_res_114576;
                
                defunc_0_f_res_125277 = defunc_0_f_res_t_res_125278;
            } else {
                int64_t x_125279 = add64(n_p_114536, gtid_117611);
                int64_t i_125280 = sub64(x_125279, (int64_t) 1);
                bool x_125281 = sle64((int64_t) 0, i_125280);
                bool y_125282 = slt64(i_125280, C_len_114582);
                bool bounds_check_125283 = x_125281 && y_125282;
                bool index_certs_125284;
                
                if (!bounds_check_125283) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125280,
                                  "] out of bounds for array of shape [",
                                  C_len_114582, "].",
                                  "-> #0  stl.fut:38:26-39\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  stl.fut:43:3-32\n   #5  stl.fut:223:30-50\n   #6  stl.fut:222:23-224:31\n   #7  stl.fut:394:3-405:33\n   #8  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float x_125285 = ((float *) mem_122328.mem)[gtid_117607 *
                                                            C_len_114582 +
                                                            i_125280];
                int64_t i_125286 = sub64(gtid_117611, (int64_t) 1);
                bool x_125287 = sle64((int64_t) 0, i_125286);
                bool y_125288 = slt64(i_125286, C_len_114582);
                bool bounds_check_125289 = x_125287 && y_125288;
                bool index_certs_125290;
                
                if (!bounds_check_125289) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125286,
                                  "] out of bounds for array of shape [",
                                  C_len_114582, "].",
                                  "-> #0  stl.fut:38:43-50\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  stl.fut:43:3-32\n   #5  stl.fut:223:30-50\n   #6  stl.fut:222:23-224:31\n   #7  stl.fut:394:3-405:33\n   #8  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float y_125291 = ((float *) mem_122328.mem)[gtid_117607 *
                                                            C_len_114582 +
                                                            i_125286];
                float x_125292 = x_125285 - y_125291;
                float defunc_0_f_res_f_res_125293 = x_125292 / i64_res_114576;
                
                defunc_0_f_res_125277 = defunc_0_f_res_f_res_125293;
            }
            x_125365 = x_125365;
            x_125366 = defunc_0_f_res_125277;
            
            float defunc_1_op_res_125367 = x_125365 + x_125366;
            
            ((float *) mem_122331.mem)[gtid_117611] = defunc_1_op_res_125367;
            x_125365 = defunc_1_op_res_125367;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_131328_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_131328_end -
                 futhark_mc_scan_stage_3_parloop_131328_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_131328_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_131328_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_131328_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_131323(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117610 = tid;
    int num_tasks_125355 = info.nsubtasks;
    struct futhark_mc_task_131322 *futhark_mc_task_131322 =
                                  (struct futhark_mc_task_131322 *) args;
    struct futhark_context *ctx = futhark_mc_task_131322->ctx;
    uint64_t futhark_mc_segscan_task_131323_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_131323_start = get_wall_time();
    
    int64_t n_p_114536 = futhark_mc_task_131322->free_n_p_114536;
    float i64_res_114576 = futhark_mc_task_131322->free_i64_res_114576;
    int64_t C_len_114582 = futhark_mc_task_131322->free_C_len_114582;
    int64_t lifted_single_ma_arg_114959 =
            futhark_mc_task_131322->free_lifted_single_ma_arg_114959;
    int64_t gtid_117607 = futhark_mc_task_131322->free_gtid_117607;
    float defunc_2_reduce_res_117622 =
          futhark_mc_task_131322->free_defunc_2_reduce_res_117622;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_task_131322->free_mem_122328,
                                  .size =0, .references =NULL};
    struct memblock mem_122331 = {.desc ="mem_122331", .mem =
                                  futhark_mc_task_131322->free_mem_122331,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_125362_cached_sizze_131324 = 0;
    char *scan_stage_2_accum_mem_125362 = NULL;
    int64_t iter_125356;
    struct futhark_mc_scan_stage_1_parloop_struct_131325
    futhark_mc_scan_stage_1_parloop_struct_131325;
    
    futhark_mc_scan_stage_1_parloop_struct_131325.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_131325.free_n_p_114536 = n_p_114536;
    futhark_mc_scan_stage_1_parloop_struct_131325.free_i64_res_114576 =
        i64_res_114576;
    futhark_mc_scan_stage_1_parloop_struct_131325.free_C_len_114582 =
        C_len_114582;
    futhark_mc_scan_stage_1_parloop_struct_131325.free_gtid_117607 =
        gtid_117607;
    futhark_mc_scan_stage_1_parloop_struct_131325.free_defunc_2_reduce_res_117622 =
        defunc_2_reduce_res_117622;
    futhark_mc_scan_stage_1_parloop_struct_131325.free_mem_122328 =
        mem_122328.mem;
    futhark_mc_scan_stage_1_parloop_struct_131325.free_mem_122331 =
        mem_122331.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_131326_task;
    
    futhark_mc_scan_stage_1_parloop_131326_task.name =
        "futhark_mc_scan_stage_1_parloop_131326";
    futhark_mc_scan_stage_1_parloop_131326_task.fn =
        futhark_mc_scan_stage_1_parloop_131326;
    futhark_mc_scan_stage_1_parloop_131326_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_131325;
    futhark_mc_scan_stage_1_parloop_131326_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_131326_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_131326_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_131326_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_131326_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_131326_task);
    
    if (futhark_mc_scan_stage_1_parloop_131326_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_131326_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_131326_total_end -
                 futhark_mc_scan_stage_1_parloop_131326_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131326_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131326_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131326_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_125355)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        float x_125357;
        float x_125358;
        int64_t offset_125360 = (int64_t) 0;
        int64_t offset_index_125361 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_125362_cached_sizze_131324 <
            (size_t) (int64_t) 4) {
            scan_stage_2_accum_mem_125362 =
                realloc(scan_stage_2_accum_mem_125362, (int64_t) 4);
            scan_stage_2_accum_mem_125362_cached_sizze_131324 = (int64_t) 4;
        }
        ((float *) scan_stage_2_accum_mem_125362)[(int64_t) 0] = 0.0F;
        for (int32_t i_125364 = 0; i_125364 < num_tasks_125355 - 1;
             i_125364++) {
            offset_125360 = squot64(lifted_single_ma_arg_114959,
                                    sext_i32_i64(num_tasks_125355));
            if (slt64(sext_i32_i64(i_125364),
                      srem64(lifted_single_ma_arg_114959,
                             sext_i32_i64(num_tasks_125355)))) {
                offset_125360 += (int64_t) 1;
            }
            offset_index_125361 += offset_125360;
            
            int64_t gtid_117611 = offset_index_125361;
            bool cond_125276 = gtid_117611 == (int64_t) 0;
            float defunc_0_f_res_125277;
            
            if (cond_125276) {
                float defunc_0_f_res_t_res_125278 = defunc_2_reduce_res_117622 /
                      i64_res_114576;
                
                defunc_0_f_res_125277 = defunc_0_f_res_t_res_125278;
            } else {
                int64_t x_125279 = add64(n_p_114536, gtid_117611);
                int64_t i_125280 = sub64(x_125279, (int64_t) 1);
                bool x_125281 = sle64((int64_t) 0, i_125280);
                bool y_125282 = slt64(i_125280, C_len_114582);
                bool bounds_check_125283 = x_125281 && y_125282;
                bool index_certs_125284;
                
                if (!bounds_check_125283) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125280,
                                  "] out of bounds for array of shape [",
                                  C_len_114582, "].",
                                  "-> #0  stl.fut:38:26-39\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  stl.fut:43:3-32\n   #5  stl.fut:223:30-50\n   #6  stl.fut:222:23-224:31\n   #7  stl.fut:394:3-405:33\n   #8  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float x_125285 = ((float *) mem_122328.mem)[gtid_117607 *
                                                            C_len_114582 +
                                                            i_125280];
                int64_t i_125286 = sub64(gtid_117611, (int64_t) 1);
                bool x_125287 = sle64((int64_t) 0, i_125286);
                bool y_125288 = slt64(i_125286, C_len_114582);
                bool bounds_check_125289 = x_125287 && y_125288;
                bool index_certs_125290;
                
                if (!bounds_check_125289) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125286,
                                  "] out of bounds for array of shape [",
                                  C_len_114582, "].",
                                  "-> #0  stl.fut:38:43-50\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  stl.fut:43:3-32\n   #5  stl.fut:223:30-50\n   #6  stl.fut:222:23-224:31\n   #7  stl.fut:394:3-405:33\n   #8  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float y_125291 = ((float *) mem_122328.mem)[gtid_117607 *
                                                            C_len_114582 +
                                                            i_125286];
                float x_125292 = x_125285 - y_125291;
                float defunc_0_f_res_f_res_125293 = x_125292 / i64_res_114576;
                
                defunc_0_f_res_125277 = defunc_0_f_res_f_res_125293;
            }
            // Read carry in
            {
                x_125357 =
                    ((float *) scan_stage_2_accum_mem_125362)[(int64_t) 0];
            }
            // Read next values
            {
                x_125358 = ((float *) mem_122331.mem)[offset_index_125361 -
                                                      (int64_t) 1];
            }
            
            float defunc_1_op_res_125359 = x_125357 + x_125358;
            
            ((float *) mem_122331.mem)[offset_index_125361 - (int64_t) 1] =
                defunc_1_op_res_125359;
            ((float *) scan_stage_2_accum_mem_125362)[(int64_t) 0] =
                defunc_1_op_res_125359;
        }
        
        int64_t iter_125368 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_131327
        futhark_mc_scan_stage_3_parloop_struct_131327;
        
        futhark_mc_scan_stage_3_parloop_struct_131327.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_131327.free_n_p_114536 =
            n_p_114536;
        futhark_mc_scan_stage_3_parloop_struct_131327.free_i64_res_114576 =
            i64_res_114576;
        futhark_mc_scan_stage_3_parloop_struct_131327.free_C_len_114582 =
            C_len_114582;
        futhark_mc_scan_stage_3_parloop_struct_131327.free_gtid_117607 =
            gtid_117607;
        futhark_mc_scan_stage_3_parloop_struct_131327.free_defunc_2_reduce_res_117622 =
            defunc_2_reduce_res_117622;
        futhark_mc_scan_stage_3_parloop_struct_131327.free_mem_122328 =
            mem_122328.mem;
        futhark_mc_scan_stage_3_parloop_struct_131327.free_mem_122331 =
            mem_122331.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_131328_task;
        
        futhark_mc_scan_stage_3_parloop_131328_task.name =
            "futhark_mc_scan_stage_3_parloop_131328";
        futhark_mc_scan_stage_3_parloop_131328_task.fn =
            futhark_mc_scan_stage_3_parloop_131328;
        futhark_mc_scan_stage_3_parloop_131328_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_131327;
        futhark_mc_scan_stage_3_parloop_131328_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_131328_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_131328_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_131328_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_131328_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_131328_task);
        
        if (futhark_mc_scan_stage_3_parloop_131328_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_131328_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_131328_total_end -
                     futhark_mc_scan_stage_3_parloop_131328_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131328_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131328_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131328_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    free(scan_stage_2_accum_mem_125362);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_131323_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_131323_end -
                 futhark_mc_segscan_task_131323_start;
        
        ctx->futhark_mc_segscan_task_131323_runs[tid]++;
        ctx->futhark_mc_segscan_task_131323_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_131323_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131329 {
    struct futhark_context *ctx;
    char *free_mem_122331;
    float *retval_defunc_2_reduce_res_117651;
};
struct futhark_mc_segred_stage_1_parloop_struct_131332 {
    struct futhark_context *ctx;
    char *free_mem_122331;
    char *free_reduce_stage_1_tid_res_arr_mem_125370;
};
static int futhark_mc_segred_stage_1_parloop_131333(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_117612,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131332
    *futhark_mc_segred_stage_1_parloop_struct_131332 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131332 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131332->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131333_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131333_start = get_wall_time();
    
    struct memblock mem_122331 = {.desc ="mem_122331", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131332->free_mem_122331,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_125370 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_125370",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131332->free_reduce_stage_1_tid_res_arr_mem_125370,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125372 = start;
    float x_125294;
    float x_125295;
    float local_acc_125373 = 0.0F;
    
    for (; iter_125372 < end; iter_125372++) {
        int64_t gtid_117613 = iter_125372;
        float x_125297 = ((float *) mem_122331.mem)[gtid_117613];
        
        // save map-out results
        { }
        // Load accum params
        {
            x_125294 = local_acc_125373;
        }
        // Load next params
        {
            x_125295 = x_125297;
        }
        // Red body
        {
            float defunc_1_op_res_125296 = x_125294 + x_125295;
            
            local_acc_125373 = defunc_1_op_res_125296;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_125370.mem)[flat_tid_117612] =
        local_acc_125373;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131333_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131333_end -
                 futhark_mc_segred_stage_1_parloop_131333_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131333_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131333_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131333_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131330(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117612 = tid;
    int num_tasks_125369 = info.nsubtasks;
    struct futhark_mc_task_131329 *futhark_mc_task_131329 =
                                  (struct futhark_mc_task_131329 *) args;
    struct futhark_context *ctx = futhark_mc_task_131329->ctx;
    uint64_t futhark_mc_segred_task_131330_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131330_start = get_wall_time();
    
    struct memblock mem_122331 = {.desc ="mem_122331", .mem =
                                  futhark_mc_task_131329->free_mem_122331,
                                  .size =0, .references =NULL};
    float defunc_2_reduce_res_117651 =
          *futhark_mc_task_131329->retval_defunc_2_reduce_res_117651;
    size_t reduce_stage_1_tid_res_arr_mem_125370_cached_sizze_131331 = 0;
    char *reduce_stage_1_tid_res_arr_mem_125370 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_125370_cached_sizze_131331 <
        (size_t) ((int64_t) 4 * num_tasks_125369)) {
        reduce_stage_1_tid_res_arr_mem_125370 =
            realloc(reduce_stage_1_tid_res_arr_mem_125370, (int64_t) 4 *
                    num_tasks_125369);
        reduce_stage_1_tid_res_arr_mem_125370_cached_sizze_131331 =
            (int64_t) 4 * num_tasks_125369;
    }
    
    int64_t iter_125372;
    struct futhark_mc_segred_stage_1_parloop_struct_131332
    futhark_mc_segred_stage_1_parloop_struct_131332;
    
    futhark_mc_segred_stage_1_parloop_struct_131332.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131332.free_mem_122331 =
        mem_122331.mem;
    futhark_mc_segred_stage_1_parloop_struct_131332.free_reduce_stage_1_tid_res_arr_mem_125370 =
        reduce_stage_1_tid_res_arr_mem_125370;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131333_task;
    
    futhark_mc_segred_stage_1_parloop_131333_task.name =
        "futhark_mc_segred_stage_1_parloop_131333";
    futhark_mc_segred_stage_1_parloop_131333_task.fn =
        futhark_mc_segred_stage_1_parloop_131333;
    futhark_mc_segred_stage_1_parloop_131333_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131332;
    futhark_mc_segred_stage_1_parloop_131333_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131333_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131333_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131333_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131333_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131333_task);
    
    if (futhark_mc_segred_stage_1_parloop_131333_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131333_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131333_total_end -
                 futhark_mc_segred_stage_1_parloop_131333_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131333_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131333_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131333_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_117651 = 0.0F;
    }
    
    float x_125374;
    float x_125375;
    
    for (int32_t i_125377 = 0; i_125377 < num_tasks_125369; i_125377++) {
        flat_tid_117612 = i_125377;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_125374 = defunc_2_reduce_res_117651;
            }
            // load next params
            {
                x_125375 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_125370)[flat_tid_117612];
            }
            // red body
            {
                float defunc_1_op_res_125376 = x_125374 + x_125375;
                
                defunc_2_reduce_res_117651 = defunc_1_op_res_125376;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_125370);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131330_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131330_end -
                 futhark_mc_segred_task_131330_start;
        
        ctx->futhark_mc_segred_task_131330_runs[tid]++;
        ctx->futhark_mc_segred_task_131330_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131330_iter[tid] += iterations;
    }
    *futhark_mc_task_131329->retval_defunc_2_reduce_res_117651 =
        defunc_2_reduce_res_117651;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131334 {
    struct futhark_context *ctx;
    int64_t free_n_p_114536;
    float free_i64_res_114576;
    int64_t free_lifted_single_ma_arg_114959;
    int64_t free_lifted_single_ma_arg_114976;
    float free_defunc_2_reduce_res_117651;
    char *free_mem_122331;
    char *free_mem_122334;
};
struct futhark_mc_scan_stage_1_parloop_struct_131337 {
    struct futhark_context *ctx;
    int64_t free_n_p_114536;
    float free_i64_res_114576;
    int64_t free_lifted_single_ma_arg_114959;
    float free_defunc_2_reduce_res_117651;
    char *free_mem_122331;
    char *free_mem_122334;
};
static int futhark_mc_scan_stage_1_parloop_131338(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_117614, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_131337
    *futhark_mc_scan_stage_1_parloop_struct_131337 =
    (struct futhark_mc_scan_stage_1_parloop_struct_131337 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_131337->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_131338_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_131338_start = get_wall_time();
    
    int64_t n_p_114536 =
            futhark_mc_scan_stage_1_parloop_struct_131337->free_n_p_114536;
    float i64_res_114576 =
          futhark_mc_scan_stage_1_parloop_struct_131337->free_i64_res_114576;
    int64_t lifted_single_ma_arg_114959 =
            futhark_mc_scan_stage_1_parloop_struct_131337->free_lifted_single_ma_arg_114959;
    float defunc_2_reduce_res_117651 =
          futhark_mc_scan_stage_1_parloop_struct_131337->free_defunc_2_reduce_res_117651;
    struct memblock mem_122331 = {.desc ="mem_122331", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_131337->free_mem_122331,
                                  .size =0, .references =NULL};
    struct memblock mem_122334 = {.desc ="mem_122334", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_131337->free_mem_122334,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125379 = start;
    float x_125298;
    float x_125299;
    
    x_125298 = 0.0F;
    for (; iter_125379 < end; iter_125379++) {
        int64_t gtid_117615 = iter_125379;
        
        // stage 1 scan body
        {
            bool cond_125301 = gtid_117615 == (int64_t) 0;
            float defunc_0_f_res_125302;
            
            if (cond_125301) {
                float defunc_0_f_res_t_res_125303 = defunc_2_reduce_res_117651 /
                      i64_res_114576;
                
                defunc_0_f_res_125302 = defunc_0_f_res_t_res_125303;
            } else {
                int64_t x_125304 = add64(n_p_114536, gtid_117615);
                int64_t i_125305 = sub64(x_125304, (int64_t) 1);
                bool x_125306 = sle64((int64_t) 0, i_125305);
                bool y_125307 = slt64(i_125305, lifted_single_ma_arg_114959);
                bool bounds_check_125308 = x_125306 && y_125307;
                bool index_certs_125309;
                
                if (!bounds_check_125308) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125305,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114959, "].",
                                  "-> #0  stl.fut:38:26-39\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-58\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float x_125310 = ((float *) mem_122331.mem)[i_125305];
                int64_t i_125311 = sub64(gtid_117615, (int64_t) 1);
                bool x_125312 = sle64((int64_t) 0, i_125311);
                bool y_125313 = slt64(i_125311, lifted_single_ma_arg_114959);
                bool bounds_check_125314 = x_125312 && y_125313;
                bool index_certs_125315;
                
                if (!bounds_check_125314) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125311,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114959, "].",
                                  "-> #0  stl.fut:38:43-50\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-58\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float y_125316 = ((float *) mem_122331.mem)[i_125311];
                float x_125317 = x_125310 - y_125316;
                float defunc_0_f_res_f_res_125318 = x_125317 / i64_res_114576;
                
                defunc_0_f_res_125302 = defunc_0_f_res_f_res_125318;
            }
            // write mapped values results to memory
            { }
            x_125298 = x_125298;
            // Read next values
            {
                x_125299 = defunc_0_f_res_125302;
            }
            
            float defunc_1_op_res_125300 = x_125298 + x_125299;
            
            ((float *) mem_122334.mem)[gtid_117615] = defunc_1_op_res_125300;
            x_125298 = defunc_1_op_res_125300;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_131338_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_131338_end -
                 futhark_mc_scan_stage_1_parloop_131338_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_131338_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_131338_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_131338_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_131339 {
    struct futhark_context *ctx;
    int64_t free_n_p_114536;
    float free_i64_res_114576;
    int64_t free_lifted_single_ma_arg_114959;
    float free_defunc_2_reduce_res_117651;
    char *free_mem_122331;
    char *free_mem_122334;
};
static int futhark_mc_scan_stage_3_parloop_131340(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_117614, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_131339
    *futhark_mc_scan_stage_3_parloop_struct_131339 =
    (struct futhark_mc_scan_stage_3_parloop_struct_131339 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_131339->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_131340_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_131340_start = get_wall_time();
    
    int64_t n_p_114536 =
            futhark_mc_scan_stage_3_parloop_struct_131339->free_n_p_114536;
    float i64_res_114576 =
          futhark_mc_scan_stage_3_parloop_struct_131339->free_i64_res_114576;
    int64_t lifted_single_ma_arg_114959 =
            futhark_mc_scan_stage_3_parloop_struct_131339->free_lifted_single_ma_arg_114959;
    float defunc_2_reduce_res_117651 =
          futhark_mc_scan_stage_3_parloop_struct_131339->free_defunc_2_reduce_res_117651;
    struct memblock mem_122331 = {.desc ="mem_122331", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_131339->free_mem_122331,
                                  .size =0, .references =NULL};
    struct memblock mem_122334 = {.desc ="mem_122334", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_131339->free_mem_122334,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125391 = start;
    float x_125388;
    float x_125389;
    
    if (iter_125391 == (int64_t) 0) {
        x_125388 = 0.0F;
    } else {
        x_125388 = ((float *) mem_122334.mem)[iter_125391 - (int64_t) 1];
    }
    for (; iter_125391 < end; iter_125391++) {
        int64_t gtid_117615 = iter_125391;
        
        // stage 3 scan body
        {
            bool cond_125301 = gtid_117615 == (int64_t) 0;
            float defunc_0_f_res_125302;
            
            if (cond_125301) {
                float defunc_0_f_res_t_res_125303 = defunc_2_reduce_res_117651 /
                      i64_res_114576;
                
                defunc_0_f_res_125302 = defunc_0_f_res_t_res_125303;
            } else {
                int64_t x_125304 = add64(n_p_114536, gtid_117615);
                int64_t i_125305 = sub64(x_125304, (int64_t) 1);
                bool x_125306 = sle64((int64_t) 0, i_125305);
                bool y_125307 = slt64(i_125305, lifted_single_ma_arg_114959);
                bool bounds_check_125308 = x_125306 && y_125307;
                bool index_certs_125309;
                
                if (!bounds_check_125308) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125305,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114959, "].",
                                  "-> #0  stl.fut:38:26-39\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-58\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float x_125310 = ((float *) mem_122331.mem)[i_125305];
                int64_t i_125311 = sub64(gtid_117615, (int64_t) 1);
                bool x_125312 = sle64((int64_t) 0, i_125311);
                bool y_125313 = slt64(i_125311, lifted_single_ma_arg_114959);
                bool bounds_check_125314 = x_125312 && y_125313;
                bool index_certs_125315;
                
                if (!bounds_check_125314) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125311,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114959, "].",
                                  "-> #0  stl.fut:38:43-50\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-58\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float y_125316 = ((float *) mem_122331.mem)[i_125311];
                float x_125317 = x_125310 - y_125316;
                float defunc_0_f_res_f_res_125318 = x_125317 / i64_res_114576;
                
                defunc_0_f_res_125302 = defunc_0_f_res_f_res_125318;
            }
            x_125388 = x_125388;
            x_125389 = defunc_0_f_res_125302;
            
            float defunc_1_op_res_125390 = x_125388 + x_125389;
            
            ((float *) mem_122334.mem)[gtid_117615] = defunc_1_op_res_125390;
            x_125388 = defunc_1_op_res_125390;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_131340_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_131340_end -
                 futhark_mc_scan_stage_3_parloop_131340_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_131340_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_131340_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_131340_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_131335(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117614 = tid;
    int num_tasks_125378 = info.nsubtasks;
    struct futhark_mc_task_131334 *futhark_mc_task_131334 =
                                  (struct futhark_mc_task_131334 *) args;
    struct futhark_context *ctx = futhark_mc_task_131334->ctx;
    uint64_t futhark_mc_segscan_task_131335_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_131335_start = get_wall_time();
    
    int64_t n_p_114536 = futhark_mc_task_131334->free_n_p_114536;
    float i64_res_114576 = futhark_mc_task_131334->free_i64_res_114576;
    int64_t lifted_single_ma_arg_114959 =
            futhark_mc_task_131334->free_lifted_single_ma_arg_114959;
    int64_t lifted_single_ma_arg_114976 =
            futhark_mc_task_131334->free_lifted_single_ma_arg_114976;
    float defunc_2_reduce_res_117651 =
          futhark_mc_task_131334->free_defunc_2_reduce_res_117651;
    struct memblock mem_122331 = {.desc ="mem_122331", .mem =
                                  futhark_mc_task_131334->free_mem_122331,
                                  .size =0, .references =NULL};
    struct memblock mem_122334 = {.desc ="mem_122334", .mem =
                                  futhark_mc_task_131334->free_mem_122334,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_125385_cached_sizze_131336 = 0;
    char *scan_stage_2_accum_mem_125385 = NULL;
    int64_t iter_125379;
    struct futhark_mc_scan_stage_1_parloop_struct_131337
    futhark_mc_scan_stage_1_parloop_struct_131337;
    
    futhark_mc_scan_stage_1_parloop_struct_131337.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_131337.free_n_p_114536 = n_p_114536;
    futhark_mc_scan_stage_1_parloop_struct_131337.free_i64_res_114576 =
        i64_res_114576;
    futhark_mc_scan_stage_1_parloop_struct_131337.free_lifted_single_ma_arg_114959 =
        lifted_single_ma_arg_114959;
    futhark_mc_scan_stage_1_parloop_struct_131337.free_defunc_2_reduce_res_117651 =
        defunc_2_reduce_res_117651;
    futhark_mc_scan_stage_1_parloop_struct_131337.free_mem_122331 =
        mem_122331.mem;
    futhark_mc_scan_stage_1_parloop_struct_131337.free_mem_122334 =
        mem_122334.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_131338_task;
    
    futhark_mc_scan_stage_1_parloop_131338_task.name =
        "futhark_mc_scan_stage_1_parloop_131338";
    futhark_mc_scan_stage_1_parloop_131338_task.fn =
        futhark_mc_scan_stage_1_parloop_131338;
    futhark_mc_scan_stage_1_parloop_131338_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_131337;
    futhark_mc_scan_stage_1_parloop_131338_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_131338_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_131338_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_131338_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_131338_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_131338_task);
    
    if (futhark_mc_scan_stage_1_parloop_131338_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_131338_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_131338_total_end -
                 futhark_mc_scan_stage_1_parloop_131338_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131338_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131338_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131338_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_125378)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        float x_125380;
        float x_125381;
        int64_t offset_125383 = (int64_t) 0;
        int64_t offset_index_125384 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_125385_cached_sizze_131336 <
            (size_t) (int64_t) 4) {
            scan_stage_2_accum_mem_125385 =
                realloc(scan_stage_2_accum_mem_125385, (int64_t) 4);
            scan_stage_2_accum_mem_125385_cached_sizze_131336 = (int64_t) 4;
        }
        ((float *) scan_stage_2_accum_mem_125385)[(int64_t) 0] = 0.0F;
        for (int32_t i_125387 = 0; i_125387 < num_tasks_125378 - 1;
             i_125387++) {
            offset_125383 = squot64(lifted_single_ma_arg_114976,
                                    sext_i32_i64(num_tasks_125378));
            if (slt64(sext_i32_i64(i_125387),
                      srem64(lifted_single_ma_arg_114976,
                             sext_i32_i64(num_tasks_125378)))) {
                offset_125383 += (int64_t) 1;
            }
            offset_index_125384 += offset_125383;
            
            int64_t gtid_117615 = offset_index_125384;
            bool cond_125301 = gtid_117615 == (int64_t) 0;
            float defunc_0_f_res_125302;
            
            if (cond_125301) {
                float defunc_0_f_res_t_res_125303 = defunc_2_reduce_res_117651 /
                      i64_res_114576;
                
                defunc_0_f_res_125302 = defunc_0_f_res_t_res_125303;
            } else {
                int64_t x_125304 = add64(n_p_114536, gtid_117615);
                int64_t i_125305 = sub64(x_125304, (int64_t) 1);
                bool x_125306 = sle64((int64_t) 0, i_125305);
                bool y_125307 = slt64(i_125305, lifted_single_ma_arg_114959);
                bool bounds_check_125308 = x_125306 && y_125307;
                bool index_certs_125309;
                
                if (!bounds_check_125308) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125305,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114959, "].",
                                  "-> #0  stl.fut:38:26-39\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-58\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float x_125310 = ((float *) mem_122331.mem)[i_125305];
                int64_t i_125311 = sub64(gtid_117615, (int64_t) 1);
                bool x_125312 = sle64((int64_t) 0, i_125311);
                bool y_125313 = slt64(i_125311, lifted_single_ma_arg_114959);
                bool bounds_check_125314 = x_125312 && y_125313;
                bool index_certs_125315;
                
                if (!bounds_check_125314) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125311,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114959, "].",
                                  "-> #0  stl.fut:38:43-50\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-58\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float y_125316 = ((float *) mem_122331.mem)[i_125311];
                float x_125317 = x_125310 - y_125316;
                float defunc_0_f_res_f_res_125318 = x_125317 / i64_res_114576;
                
                defunc_0_f_res_125302 = defunc_0_f_res_f_res_125318;
            }
            // Read carry in
            {
                x_125380 =
                    ((float *) scan_stage_2_accum_mem_125385)[(int64_t) 0];
            }
            // Read next values
            {
                x_125381 = ((float *) mem_122334.mem)[offset_index_125384 -
                                                      (int64_t) 1];
            }
            
            float defunc_1_op_res_125382 = x_125380 + x_125381;
            
            ((float *) mem_122334.mem)[offset_index_125384 - (int64_t) 1] =
                defunc_1_op_res_125382;
            ((float *) scan_stage_2_accum_mem_125385)[(int64_t) 0] =
                defunc_1_op_res_125382;
        }
        
        int64_t iter_125391 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_131339
        futhark_mc_scan_stage_3_parloop_struct_131339;
        
        futhark_mc_scan_stage_3_parloop_struct_131339.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_131339.free_n_p_114536 =
            n_p_114536;
        futhark_mc_scan_stage_3_parloop_struct_131339.free_i64_res_114576 =
            i64_res_114576;
        futhark_mc_scan_stage_3_parloop_struct_131339.free_lifted_single_ma_arg_114959 =
            lifted_single_ma_arg_114959;
        futhark_mc_scan_stage_3_parloop_struct_131339.free_defunc_2_reduce_res_117651 =
            defunc_2_reduce_res_117651;
        futhark_mc_scan_stage_3_parloop_struct_131339.free_mem_122331 =
            mem_122331.mem;
        futhark_mc_scan_stage_3_parloop_struct_131339.free_mem_122334 =
            mem_122334.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_131340_task;
        
        futhark_mc_scan_stage_3_parloop_131340_task.name =
            "futhark_mc_scan_stage_3_parloop_131340";
        futhark_mc_scan_stage_3_parloop_131340_task.fn =
            futhark_mc_scan_stage_3_parloop_131340;
        futhark_mc_scan_stage_3_parloop_131340_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_131339;
        futhark_mc_scan_stage_3_parloop_131340_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_131340_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_131340_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_131340_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_131340_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_131340_task);
        
        if (futhark_mc_scan_stage_3_parloop_131340_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_131340_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_131340_total_end -
                     futhark_mc_scan_stage_3_parloop_131340_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131340_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131340_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131340_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    free(scan_stage_2_accum_mem_125385);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_131335_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_131335_end -
                 futhark_mc_segscan_task_131335_start;
        
        ctx->futhark_mc_segscan_task_131335_runs[tid]++;
        ctx->futhark_mc_segscan_task_131335_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_131335_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131341 {
    struct futhark_context *ctx;
    char *free_mem_122334;
    float *retval_defunc_2_reduce_res_117680;
};
struct futhark_mc_segred_stage_1_parloop_struct_131344 {
    struct futhark_context *ctx;
    char *free_mem_122334;
    char *free_reduce_stage_1_tid_res_arr_mem_125393;
};
static int futhark_mc_segred_stage_1_parloop_131345(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_117616,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131344
    *futhark_mc_segred_stage_1_parloop_struct_131344 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131344 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131344->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131345_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131345_start = get_wall_time();
    
    struct memblock mem_122334 = {.desc ="mem_122334", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131344->free_mem_122334,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_125393 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_125393",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131344->free_reduce_stage_1_tid_res_arr_mem_125393,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125395 = start;
    float x_125319;
    float x_125320;
    float local_acc_125396 = 0.0F;
    
    for (; iter_125395 < end; iter_125395++) {
        int64_t gtid_117617 = iter_125395;
        float x_125322 = ((float *) mem_122334.mem)[gtid_117617];
        
        // save map-out results
        { }
        // Load accum params
        {
            x_125319 = local_acc_125396;
        }
        // Load next params
        {
            x_125320 = x_125322;
        }
        // Red body
        {
            float defunc_1_op_res_125321 = x_125319 + x_125320;
            
            local_acc_125396 = defunc_1_op_res_125321;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_125393.mem)[flat_tid_117616] =
        local_acc_125396;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131345_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131345_end -
                 futhark_mc_segred_stage_1_parloop_131345_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131345_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131345_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131345_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131342(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117616 = tid;
    int num_tasks_125392 = info.nsubtasks;
    struct futhark_mc_task_131341 *futhark_mc_task_131341 =
                                  (struct futhark_mc_task_131341 *) args;
    struct futhark_context *ctx = futhark_mc_task_131341->ctx;
    uint64_t futhark_mc_segred_task_131342_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131342_start = get_wall_time();
    
    struct memblock mem_122334 = {.desc ="mem_122334", .mem =
                                  futhark_mc_task_131341->free_mem_122334,
                                  .size =0, .references =NULL};
    float defunc_2_reduce_res_117680 =
          *futhark_mc_task_131341->retval_defunc_2_reduce_res_117680;
    size_t reduce_stage_1_tid_res_arr_mem_125393_cached_sizze_131343 = 0;
    char *reduce_stage_1_tid_res_arr_mem_125393 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_125393_cached_sizze_131343 <
        (size_t) ((int64_t) 4 * num_tasks_125392)) {
        reduce_stage_1_tid_res_arr_mem_125393 =
            realloc(reduce_stage_1_tid_res_arr_mem_125393, (int64_t) 4 *
                    num_tasks_125392);
        reduce_stage_1_tid_res_arr_mem_125393_cached_sizze_131343 =
            (int64_t) 4 * num_tasks_125392;
    }
    
    int64_t iter_125395;
    struct futhark_mc_segred_stage_1_parloop_struct_131344
    futhark_mc_segred_stage_1_parloop_struct_131344;
    
    futhark_mc_segred_stage_1_parloop_struct_131344.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131344.free_mem_122334 =
        mem_122334.mem;
    futhark_mc_segred_stage_1_parloop_struct_131344.free_reduce_stage_1_tid_res_arr_mem_125393 =
        reduce_stage_1_tid_res_arr_mem_125393;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131345_task;
    
    futhark_mc_segred_stage_1_parloop_131345_task.name =
        "futhark_mc_segred_stage_1_parloop_131345";
    futhark_mc_segred_stage_1_parloop_131345_task.fn =
        futhark_mc_segred_stage_1_parloop_131345;
    futhark_mc_segred_stage_1_parloop_131345_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131344;
    futhark_mc_segred_stage_1_parloop_131345_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131345_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131345_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131345_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131345_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131345_task);
    
    if (futhark_mc_segred_stage_1_parloop_131345_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131345_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131345_total_end -
                 futhark_mc_segred_stage_1_parloop_131345_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131345_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131345_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131345_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_117680 = 0.0F;
    }
    
    float x_125397;
    float x_125398;
    
    for (int32_t i_125400 = 0; i_125400 < num_tasks_125392; i_125400++) {
        flat_tid_117616 = i_125400;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_125397 = defunc_2_reduce_res_117680;
            }
            // load next params
            {
                x_125398 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_125393)[flat_tid_117616];
            }
            // red body
            {
                float defunc_1_op_res_125399 = x_125397 + x_125398;
                
                defunc_2_reduce_res_117680 = defunc_1_op_res_125399;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_125393);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131342_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131342_end -
                 futhark_mc_segred_task_131342_start;
        
        ctx->futhark_mc_segred_task_131342_runs[tid]++;
        ctx->futhark_mc_segred_task_131342_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131342_iter[tid] += iterations;
    }
    *futhark_mc_task_131341->retval_defunc_2_reduce_res_117680 =
        defunc_2_reduce_res_117680;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131346 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_lifted_single_ma_arg_114976;
    float free_defunc_2_reduce_res_117680;
    char *free_mem_122334;
    char *free_mem_122337;
};
struct futhark_mc_scan_stage_1_parloop_struct_131349 {
    struct futhark_context *ctx;
    int64_t free_lifted_single_ma_arg_114976;
    float free_defunc_2_reduce_res_117680;
    char *free_mem_122334;
    char *free_mem_122337;
};
static int futhark_mc_scan_stage_1_parloop_131350(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_117618, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_131349
    *futhark_mc_scan_stage_1_parloop_struct_131349 =
    (struct futhark_mc_scan_stage_1_parloop_struct_131349 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_131349->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_131350_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_131350_start = get_wall_time();
    
    int64_t lifted_single_ma_arg_114976 =
            futhark_mc_scan_stage_1_parloop_struct_131349->free_lifted_single_ma_arg_114976;
    float defunc_2_reduce_res_117680 =
          futhark_mc_scan_stage_1_parloop_struct_131349->free_defunc_2_reduce_res_117680;
    struct memblock mem_122334 = {.desc ="mem_122334", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_131349->free_mem_122334,
                                  .size =0, .references =NULL};
    struct memblock mem_122337 = {.desc ="mem_122337", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_131349->free_mem_122337,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125402 = start;
    float x_125323;
    float x_125324;
    
    x_125323 = 0.0F;
    for (; iter_125402 < end; iter_125402++) {
        int64_t gtid_117619 = iter_125402;
        
        // stage 1 scan body
        {
            bool cond_125326 = gtid_117619 == (int64_t) 0;
            float defunc_0_f_res_125327;
            
            if (cond_125326) {
                float defunc_0_f_res_t_res_125328 = defunc_2_reduce_res_117680 /
                      3.0F;
                
                defunc_0_f_res_125327 = defunc_0_f_res_t_res_125328;
            } else {
                int64_t x_125329 = add64((int64_t) 3, gtid_117619);
                int64_t i_125330 = sub64(x_125329, (int64_t) 1);
                bool x_125331 = sle64((int64_t) 0, i_125330);
                bool y_125332 = slt64(i_125330, lifted_single_ma_arg_114976);
                bool bounds_check_125333 = x_125331 && y_125332;
                bool index_certs_125334;
                
                if (!bounds_check_125333) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125330,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114976, "].",
                                  "-> #0  stl.fut:38:26-39\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-76\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float x_125335 = ((float *) mem_122334.mem)[i_125330];
                int64_t i_125336 = sub64(gtid_117619, (int64_t) 1);
                bool x_125337 = sle64((int64_t) 0, i_125336);
                bool y_125338 = slt64(i_125336, lifted_single_ma_arg_114976);
                bool bounds_check_125339 = x_125337 && y_125338;
                bool index_certs_125340;
                
                if (!bounds_check_125339) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125336,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114976, "].",
                                  "-> #0  stl.fut:38:43-50\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-76\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float y_125341 = ((float *) mem_122334.mem)[i_125336];
                float x_125342 = x_125335 - y_125341;
                float defunc_0_f_res_f_res_125343 = x_125342 / 3.0F;
                
                defunc_0_f_res_125327 = defunc_0_f_res_f_res_125343;
            }
            // write mapped values results to memory
            { }
            x_125323 = x_125323;
            // Read next values
            {
                x_125324 = defunc_0_f_res_125327;
            }
            
            float defunc_1_op_res_125325 = x_125323 + x_125324;
            
            ((float *) mem_122337.mem)[gtid_117619] = defunc_1_op_res_125325;
            x_125323 = defunc_1_op_res_125325;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_131350_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_131350_end -
                 futhark_mc_scan_stage_1_parloop_131350_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_131350_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_131350_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_131350_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_131351 {
    struct futhark_context *ctx;
    int64_t free_lifted_single_ma_arg_114976;
    float free_defunc_2_reduce_res_117680;
    char *free_mem_122334;
    char *free_mem_122337;
};
static int futhark_mc_scan_stage_3_parloop_131352(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_117618, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_131351
    *futhark_mc_scan_stage_3_parloop_struct_131351 =
    (struct futhark_mc_scan_stage_3_parloop_struct_131351 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_131351->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_131352_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_131352_start = get_wall_time();
    
    int64_t lifted_single_ma_arg_114976 =
            futhark_mc_scan_stage_3_parloop_struct_131351->free_lifted_single_ma_arg_114976;
    float defunc_2_reduce_res_117680 =
          futhark_mc_scan_stage_3_parloop_struct_131351->free_defunc_2_reduce_res_117680;
    struct memblock mem_122334 = {.desc ="mem_122334", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_131351->free_mem_122334,
                                  .size =0, .references =NULL};
    struct memblock mem_122337 = {.desc ="mem_122337", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_131351->free_mem_122337,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125414 = start;
    float x_125411;
    float x_125412;
    
    if (iter_125414 == (int64_t) 0) {
        x_125411 = 0.0F;
    } else {
        x_125411 = ((float *) mem_122337.mem)[iter_125414 - (int64_t) 1];
    }
    for (; iter_125414 < end; iter_125414++) {
        int64_t gtid_117619 = iter_125414;
        
        // stage 3 scan body
        {
            bool cond_125326 = gtid_117619 == (int64_t) 0;
            float defunc_0_f_res_125327;
            
            if (cond_125326) {
                float defunc_0_f_res_t_res_125328 = defunc_2_reduce_res_117680 /
                      3.0F;
                
                defunc_0_f_res_125327 = defunc_0_f_res_t_res_125328;
            } else {
                int64_t x_125329 = add64((int64_t) 3, gtid_117619);
                int64_t i_125330 = sub64(x_125329, (int64_t) 1);
                bool x_125331 = sle64((int64_t) 0, i_125330);
                bool y_125332 = slt64(i_125330, lifted_single_ma_arg_114976);
                bool bounds_check_125333 = x_125331 && y_125332;
                bool index_certs_125334;
                
                if (!bounds_check_125333) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125330,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114976, "].",
                                  "-> #0  stl.fut:38:26-39\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-76\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float x_125335 = ((float *) mem_122334.mem)[i_125330];
                int64_t i_125336 = sub64(gtid_117619, (int64_t) 1);
                bool x_125337 = sle64((int64_t) 0, i_125336);
                bool y_125338 = slt64(i_125336, lifted_single_ma_arg_114976);
                bool bounds_check_125339 = x_125337 && y_125338;
                bool index_certs_125340;
                
                if (!bounds_check_125339) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125336,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114976, "].",
                                  "-> #0  stl.fut:38:43-50\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-76\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float y_125341 = ((float *) mem_122334.mem)[i_125336];
                float x_125342 = x_125335 - y_125341;
                float defunc_0_f_res_f_res_125343 = x_125342 / 3.0F;
                
                defunc_0_f_res_125327 = defunc_0_f_res_f_res_125343;
            }
            x_125411 = x_125411;
            x_125412 = defunc_0_f_res_125327;
            
            float defunc_1_op_res_125413 = x_125411 + x_125412;
            
            ((float *) mem_122337.mem)[gtid_117619] = defunc_1_op_res_125413;
            x_125411 = defunc_1_op_res_125413;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_131352_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_131352_end -
                 futhark_mc_scan_stage_3_parloop_131352_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_131352_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_131352_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_131352_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_131347(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117618 = tid;
    int num_tasks_125401 = info.nsubtasks;
    struct futhark_mc_task_131346 *futhark_mc_task_131346 =
                                  (struct futhark_mc_task_131346 *) args;
    struct futhark_context *ctx = futhark_mc_task_131346->ctx;
    uint64_t futhark_mc_segscan_task_131347_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_131347_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131346->free_n_114534;
    int64_t lifted_single_ma_arg_114976 =
            futhark_mc_task_131346->free_lifted_single_ma_arg_114976;
    float defunc_2_reduce_res_117680 =
          futhark_mc_task_131346->free_defunc_2_reduce_res_117680;
    struct memblock mem_122334 = {.desc ="mem_122334", .mem =
                                  futhark_mc_task_131346->free_mem_122334,
                                  .size =0, .references =NULL};
    struct memblock mem_122337 = {.desc ="mem_122337", .mem =
                                  futhark_mc_task_131346->free_mem_122337,
                                  .size =0, .references =NULL};
    size_t scan_stage_2_accum_mem_125408_cached_sizze_131348 = 0;
    char *scan_stage_2_accum_mem_125408 = NULL;
    int64_t iter_125402;
    struct futhark_mc_scan_stage_1_parloop_struct_131349
    futhark_mc_scan_stage_1_parloop_struct_131349;
    
    futhark_mc_scan_stage_1_parloop_struct_131349.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_131349.free_lifted_single_ma_arg_114976 =
        lifted_single_ma_arg_114976;
    futhark_mc_scan_stage_1_parloop_struct_131349.free_defunc_2_reduce_res_117680 =
        defunc_2_reduce_res_117680;
    futhark_mc_scan_stage_1_parloop_struct_131349.free_mem_122334 =
        mem_122334.mem;
    futhark_mc_scan_stage_1_parloop_struct_131349.free_mem_122337 =
        mem_122337.mem;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_131350_task;
    
    futhark_mc_scan_stage_1_parloop_131350_task.name =
        "futhark_mc_scan_stage_1_parloop_131350";
    futhark_mc_scan_stage_1_parloop_131350_task.fn =
        futhark_mc_scan_stage_1_parloop_131350;
    futhark_mc_scan_stage_1_parloop_131350_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_131349;
    futhark_mc_scan_stage_1_parloop_131350_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_131350_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_131350_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_131350_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_131350_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_131350_task);
    
    if (futhark_mc_scan_stage_1_parloop_131350_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_131350_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_131350_total_end -
                 futhark_mc_scan_stage_1_parloop_131350_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131350_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131350_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131350_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_125401)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        float x_125403;
        float x_125404;
        int64_t offset_125406 = (int64_t) 0;
        int64_t offset_index_125407 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_125408_cached_sizze_131348 <
            (size_t) (int64_t) 4) {
            scan_stage_2_accum_mem_125408 =
                realloc(scan_stage_2_accum_mem_125408, (int64_t) 4);
            scan_stage_2_accum_mem_125408_cached_sizze_131348 = (int64_t) 4;
        }
        ((float *) scan_stage_2_accum_mem_125408)[(int64_t) 0] = 0.0F;
        for (int32_t i_125410 = 0; i_125410 < num_tasks_125401 - 1;
             i_125410++) {
            offset_125406 = squot64(n_114534, sext_i32_i64(num_tasks_125401));
            if (slt64(sext_i32_i64(i_125410), srem64(n_114534,
                                                     sext_i32_i64(num_tasks_125401)))) {
                offset_125406 += (int64_t) 1;
            }
            offset_index_125407 += offset_125406;
            
            int64_t gtid_117619 = offset_index_125407;
            bool cond_125326 = gtid_117619 == (int64_t) 0;
            float defunc_0_f_res_125327;
            
            if (cond_125326) {
                float defunc_0_f_res_t_res_125328 = defunc_2_reduce_res_117680 /
                      3.0F;
                
                defunc_0_f_res_125327 = defunc_0_f_res_t_res_125328;
            } else {
                int64_t x_125329 = add64((int64_t) 3, gtid_117619);
                int64_t i_125330 = sub64(x_125329, (int64_t) 1);
                bool x_125331 = sle64((int64_t) 0, i_125330);
                bool y_125332 = slt64(i_125330, lifted_single_ma_arg_114976);
                bool bounds_check_125333 = x_125331 && y_125332;
                bool index_certs_125334;
                
                if (!bounds_check_125333) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125330,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114976, "].",
                                  "-> #0  stl.fut:38:26-39\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-76\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float x_125335 = ((float *) mem_122334.mem)[i_125330];
                int64_t i_125336 = sub64(gtid_117619, (int64_t) 1);
                bool x_125337 = sle64((int64_t) 0, i_125336);
                bool y_125338 = slt64(i_125336, lifted_single_ma_arg_114976);
                bool bounds_check_125339 = x_125337 && y_125338;
                bool index_certs_125340;
                
                if (!bounds_check_125339) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", i_125336,
                                  "] out of bounds for array of shape [",
                                  lifted_single_ma_arg_114976, "].",
                                  "-> #0  stl.fut:38:43-50\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:33:9-39:16\n   #4  /prelude/functional.fut:9:42-44\n   #5  stl.fut:43:3-76\n   #6  stl.fut:223:30-50\n   #7  stl.fut:222:23-224:31\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float y_125341 = ((float *) mem_122334.mem)[i_125336];
                float x_125342 = x_125335 - y_125341;
                float defunc_0_f_res_f_res_125343 = x_125342 / 3.0F;
                
                defunc_0_f_res_125327 = defunc_0_f_res_f_res_125343;
            }
            // Read carry in
            {
                x_125403 =
                    ((float *) scan_stage_2_accum_mem_125408)[(int64_t) 0];
            }
            // Read next values
            {
                x_125404 = ((float *) mem_122337.mem)[offset_index_125407 -
                                                      (int64_t) 1];
            }
            
            float defunc_1_op_res_125405 = x_125403 + x_125404;
            
            ((float *) mem_122337.mem)[offset_index_125407 - (int64_t) 1] =
                defunc_1_op_res_125405;
            ((float *) scan_stage_2_accum_mem_125408)[(int64_t) 0] =
                defunc_1_op_res_125405;
        }
        
        int64_t iter_125414 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_131351
        futhark_mc_scan_stage_3_parloop_struct_131351;
        
        futhark_mc_scan_stage_3_parloop_struct_131351.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_131351.free_lifted_single_ma_arg_114976 =
            lifted_single_ma_arg_114976;
        futhark_mc_scan_stage_3_parloop_struct_131351.free_defunc_2_reduce_res_117680 =
            defunc_2_reduce_res_117680;
        futhark_mc_scan_stage_3_parloop_struct_131351.free_mem_122334 =
            mem_122334.mem;
        futhark_mc_scan_stage_3_parloop_struct_131351.free_mem_122337 =
            mem_122337.mem;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_131352_task;
        
        futhark_mc_scan_stage_3_parloop_131352_task.name =
            "futhark_mc_scan_stage_3_parloop_131352";
        futhark_mc_scan_stage_3_parloop_131352_task.fn =
            futhark_mc_scan_stage_3_parloop_131352;
        futhark_mc_scan_stage_3_parloop_131352_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_131351;
        futhark_mc_scan_stage_3_parloop_131352_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_131352_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_131352_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_131352_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_131352_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_131352_task);
        
        if (futhark_mc_scan_stage_3_parloop_131352_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_131352_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_131352_total_end -
                     futhark_mc_scan_stage_3_parloop_131352_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131352_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131352_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131352_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    free(scan_stage_2_accum_mem_125408);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_131347_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_131347_end -
                 futhark_mc_segscan_task_131347_start;
        
        ctx->futhark_mc_segscan_task_131347_runs[tid]++;
        ctx->futhark_mc_segscan_task_131347_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_131347_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131313(void *args, int64_t start,
                                            int64_t end, int flat_tid_117606,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131312
    *futhark_mc_segmap_parloop_struct_131312 =
    (struct futhark_mc_segmap_parloop_struct_131312 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131312->ctx;
    uint64_t futhark_mc_segmap_parloop_131313_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131313_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131312->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131312->free_n_114534;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131312->free_n_p_114536;
    float i64_res_114576 =
          futhark_mc_segmap_parloop_struct_131312->free_i64_res_114576;
    int64_t C_len_114582 =
            futhark_mc_segmap_parloop_struct_131312->free_C_len_114582;
    int64_t lifted_single_ma_arg_114959 =
            futhark_mc_segmap_parloop_struct_131312->free_lifted_single_ma_arg_114959;
    int64_t lifted_single_ma_arg_114976 =
            futhark_mc_segmap_parloop_struct_131312->free_lifted_single_ma_arg_114976;
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131312->free_bytes_121983;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_segmap_parloop_struct_131312->free_mem_122328,
                                  .size =0, .references =NULL};
    int64_t bytes_122329 =
            futhark_mc_segmap_parloop_struct_131312->free_bytes_122329;
    int64_t bytes_122332 =
            futhark_mc_segmap_parloop_struct_131312->free_bytes_122332;
    struct memblock mem_122386 = {.desc ="mem_122386", .mem =
                                  futhark_mc_segmap_parloop_struct_131312->free_mem_122386,
                                  .size =0, .references =NULL};
    size_t mem_122331_cached_sizze_131314 = 0;
    char *mem_122331 = NULL;
    size_t mem_122334_cached_sizze_131315 = 0;
    char *mem_122334 = NULL;
    size_t mem_122337_cached_sizze_131316 = 0;
    char *mem_122337 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125268 = start;
    
    if (mem_122331_cached_sizze_131314 < (size_t) bytes_122329) {
        mem_122331 = realloc(mem_122331, bytes_122329);
        mem_122331_cached_sizze_131314 = bytes_122329;
    }
    if (mem_122334_cached_sizze_131315 < (size_t) bytes_122332) {
        mem_122334 = realloc(mem_122334, bytes_122332);
        mem_122334_cached_sizze_131315 = bytes_122332;
    }
    if (mem_122337_cached_sizze_131316 < (size_t) bytes_121983) {
        mem_122337 = realloc(mem_122337, bytes_121983);
        mem_122337_cached_sizze_131316 = bytes_121983;
    }
    for (; iter_125268 < end; iter_125268++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125344 = m_114533;
        int64_t gtid_117607 = iter_125268;
        int64_t remnant_125345 = iter_125268 - gtid_117607;
        float defunc_2_reduce_res_117622;
        int64_t flat_tid_117608 = (int64_t) 0;
        int32_t num_tasks_125346;
        struct futhark_mc_task_131317 futhark_mc_task_131317;
        
        futhark_mc_task_131317.ctx = ctx;
        futhark_mc_task_131317.free_C_len_114582 = C_len_114582;
        futhark_mc_task_131317.free_gtid_117607 = gtid_117607;
        futhark_mc_task_131317.free_mem_122328 = mem_122328.mem;
        futhark_mc_task_131317.retval_defunc_2_reduce_res_117622 =
            &defunc_2_reduce_res_117622;
        
        struct scheduler_segop futhark_mc_task_131317_task;
        
        futhark_mc_task_131317_task.args = &futhark_mc_task_131317;
        futhark_mc_task_131317_task.top_level_fn =
            futhark_mc_segred_task_131318;
        futhark_mc_task_131317_task.name = "futhark_mc_segred_task_131318";
        futhark_mc_task_131317_task.iterations = n_p_114536;
        futhark_mc_task_131317_task.task_time =
            &ctx->futhark_mc_segred_task_131318_total_time;
        futhark_mc_task_131317_task.task_iter =
            &ctx->futhark_mc_segred_task_131318_total_iter;
        futhark_mc_task_131317_task.sched = STATIC;
        futhark_mc_task_131317_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131318_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131317_task);
        
        if (futhark_mc_segred_task_131318_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_117610 = (int64_t) 0;
        int32_t num_tasks_125355;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_131322 futhark_mc_task_131322;
        
        futhark_mc_task_131322.ctx = ctx;
        futhark_mc_task_131322.free_n_p_114536 = n_p_114536;
        futhark_mc_task_131322.free_i64_res_114576 = i64_res_114576;
        futhark_mc_task_131322.free_C_len_114582 = C_len_114582;
        futhark_mc_task_131322.free_lifted_single_ma_arg_114959 =
            lifted_single_ma_arg_114959;
        futhark_mc_task_131322.free_gtid_117607 = gtid_117607;
        futhark_mc_task_131322.free_defunc_2_reduce_res_117622 =
            defunc_2_reduce_res_117622;
        futhark_mc_task_131322.free_mem_122328 = mem_122328.mem;
        futhark_mc_task_131322.free_mem_122331 = mem_122331;
        
        struct scheduler_segop futhark_mc_task_131322_task;
        
        futhark_mc_task_131322_task.args = &futhark_mc_task_131322;
        futhark_mc_task_131322_task.top_level_fn =
            futhark_mc_segscan_task_131323;
        futhark_mc_task_131322_task.name = "futhark_mc_segscan_task_131323";
        futhark_mc_task_131322_task.iterations = lifted_single_ma_arg_114959;
        futhark_mc_task_131322_task.task_time =
            &ctx->futhark_mc_segscan_task_131323_total_time;
        futhark_mc_task_131322_task.task_iter =
            &ctx->futhark_mc_segscan_task_131323_total_iter;
        futhark_mc_task_131322_task.sched = STATIC;
        futhark_mc_task_131322_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_131323_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131322_task);
        
        if (futhark_mc_segscan_task_131323_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float defunc_2_reduce_res_117651;
        int64_t flat_tid_117612 = (int64_t) 0;
        int32_t num_tasks_125369;
        struct futhark_mc_task_131329 futhark_mc_task_131329;
        
        futhark_mc_task_131329.ctx = ctx;
        futhark_mc_task_131329.free_mem_122331 = mem_122331;
        futhark_mc_task_131329.retval_defunc_2_reduce_res_117651 =
            &defunc_2_reduce_res_117651;
        
        struct scheduler_segop futhark_mc_task_131329_task;
        
        futhark_mc_task_131329_task.args = &futhark_mc_task_131329;
        futhark_mc_task_131329_task.top_level_fn =
            futhark_mc_segred_task_131330;
        futhark_mc_task_131329_task.name = "futhark_mc_segred_task_131330";
        futhark_mc_task_131329_task.iterations = n_p_114536;
        futhark_mc_task_131329_task.task_time =
            &ctx->futhark_mc_segred_task_131330_total_time;
        futhark_mc_task_131329_task.task_iter =
            &ctx->futhark_mc_segred_task_131330_total_iter;
        futhark_mc_task_131329_task.sched = STATIC;
        futhark_mc_task_131329_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131330_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131329_task);
        
        if (futhark_mc_segred_task_131330_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_117614 = (int64_t) 0;
        int32_t num_tasks_125378;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_131334 futhark_mc_task_131334;
        
        futhark_mc_task_131334.ctx = ctx;
        futhark_mc_task_131334.free_n_p_114536 = n_p_114536;
        futhark_mc_task_131334.free_i64_res_114576 = i64_res_114576;
        futhark_mc_task_131334.free_lifted_single_ma_arg_114959 =
            lifted_single_ma_arg_114959;
        futhark_mc_task_131334.free_lifted_single_ma_arg_114976 =
            lifted_single_ma_arg_114976;
        futhark_mc_task_131334.free_defunc_2_reduce_res_117651 =
            defunc_2_reduce_res_117651;
        futhark_mc_task_131334.free_mem_122331 = mem_122331;
        futhark_mc_task_131334.free_mem_122334 = mem_122334;
        
        struct scheduler_segop futhark_mc_task_131334_task;
        
        futhark_mc_task_131334_task.args = &futhark_mc_task_131334;
        futhark_mc_task_131334_task.top_level_fn =
            futhark_mc_segscan_task_131335;
        futhark_mc_task_131334_task.name = "futhark_mc_segscan_task_131335";
        futhark_mc_task_131334_task.iterations = lifted_single_ma_arg_114976;
        futhark_mc_task_131334_task.task_time =
            &ctx->futhark_mc_segscan_task_131335_total_time;
        futhark_mc_task_131334_task.task_iter =
            &ctx->futhark_mc_segscan_task_131335_total_iter;
        futhark_mc_task_131334_task.sched = STATIC;
        futhark_mc_task_131334_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_131335_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131334_task);
        
        if (futhark_mc_segscan_task_131335_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float defunc_2_reduce_res_117680;
        int64_t flat_tid_117616 = (int64_t) 0;
        int32_t num_tasks_125392;
        struct futhark_mc_task_131341 futhark_mc_task_131341;
        
        futhark_mc_task_131341.ctx = ctx;
        futhark_mc_task_131341.free_mem_122334 = mem_122334;
        futhark_mc_task_131341.retval_defunc_2_reduce_res_117680 =
            &defunc_2_reduce_res_117680;
        
        struct scheduler_segop futhark_mc_task_131341_task;
        
        futhark_mc_task_131341_task.args = &futhark_mc_task_131341;
        futhark_mc_task_131341_task.top_level_fn =
            futhark_mc_segred_task_131342;
        futhark_mc_task_131341_task.name = "futhark_mc_segred_task_131342";
        futhark_mc_task_131341_task.iterations = (int64_t) 3;
        futhark_mc_task_131341_task.task_time =
            &ctx->futhark_mc_segred_task_131342_total_time;
        futhark_mc_task_131341_task.task_iter =
            &ctx->futhark_mc_segred_task_131342_total_iter;
        futhark_mc_task_131341_task.sched = STATIC;
        futhark_mc_task_131341_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131342_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131341_task);
        
        if (futhark_mc_segred_task_131342_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_117618 = (int64_t) 0;
        int32_t num_tasks_125401;
        
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmented segScan");
        
        struct futhark_mc_task_131346 futhark_mc_task_131346;
        
        futhark_mc_task_131346.ctx = ctx;
        futhark_mc_task_131346.free_n_114534 = n_114534;
        futhark_mc_task_131346.free_lifted_single_ma_arg_114976 =
            lifted_single_ma_arg_114976;
        futhark_mc_task_131346.free_defunc_2_reduce_res_117680 =
            defunc_2_reduce_res_117680;
        futhark_mc_task_131346.free_mem_122334 = mem_122334;
        futhark_mc_task_131346.free_mem_122337 = mem_122337;
        
        struct scheduler_segop futhark_mc_task_131346_task;
        
        futhark_mc_task_131346_task.args = &futhark_mc_task_131346;
        futhark_mc_task_131346_task.top_level_fn =
            futhark_mc_segscan_task_131347;
        futhark_mc_task_131346_task.name = "futhark_mc_segscan_task_131347";
        futhark_mc_task_131346_task.iterations = n_114534;
        futhark_mc_task_131346_task.task_time =
            &ctx->futhark_mc_segscan_task_131347_total_time;
        futhark_mc_task_131346_task.task_iter =
            &ctx->futhark_mc_segscan_task_131347_total_iter;
        futhark_mc_task_131346_task.sched = STATIC;
        futhark_mc_task_131346_task.nested_fn = NULL;
        
        int futhark_mc_segscan_task_131347_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131346_task);
        
        if (futhark_mc_segscan_task_131347_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122386.mem + gtid_117607 * n_114534 * (int64_t) 4,
                mem_122337 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122331);
    free(mem_122334);
    free(mem_122337);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131313_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131313_end -
                 futhark_mc_segmap_parloop_131313_start;
        
        ctx->futhark_mc_segmap_parloop_131313_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131313_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131313_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131311(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117606 = tid;
    int num_tasks_125173 = info.nsubtasks;
    struct futhark_mc_task_131304 *futhark_mc_task_131304 =
                                  (struct futhark_mc_task_131304 *) args;
    struct futhark_context *ctx = futhark_mc_task_131304->ctx;
    uint64_t futhark_mc_segmap_nested_task_131311_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131311_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131304->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131304->free_n_114534;
    int64_t n_p_114536 = futhark_mc_task_131304->free_n_p_114536;
    float i64_res_114576 = futhark_mc_task_131304->free_i64_res_114576;
    int64_t C_len_114582 = futhark_mc_task_131304->free_C_len_114582;
    int64_t lifted_single_ma_arg_114959 =
            futhark_mc_task_131304->free_lifted_single_ma_arg_114959;
    int64_t lifted_single_ma_arg_114976 =
            futhark_mc_task_131304->free_lifted_single_ma_arg_114976;
    int64_t bytes_121983 = futhark_mc_task_131304->free_bytes_121983;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_task_131304->free_mem_122328,
                                  .size =0, .references =NULL};
    int64_t bytes_122329 = futhark_mc_task_131304->free_bytes_122329;
    int64_t bytes_122332 = futhark_mc_task_131304->free_bytes_122332;
    struct memblock mem_122386 = {.desc ="mem_122386", .mem =
                                  futhark_mc_task_131304->free_mem_122386,
                                  .size =0, .references =NULL};
    int64_t iter_125268;
    struct futhark_mc_segmap_parloop_struct_131312
    futhark_mc_segmap_parloop_struct_131312;
    
    futhark_mc_segmap_parloop_struct_131312.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131312.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131312.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131312.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131312.free_i64_res_114576 =
        i64_res_114576;
    futhark_mc_segmap_parloop_struct_131312.free_C_len_114582 = C_len_114582;
    futhark_mc_segmap_parloop_struct_131312.free_lifted_single_ma_arg_114959 =
        lifted_single_ma_arg_114959;
    futhark_mc_segmap_parloop_struct_131312.free_lifted_single_ma_arg_114976 =
        lifted_single_ma_arg_114976;
    futhark_mc_segmap_parloop_struct_131312.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131312.free_mem_122328 = mem_122328.mem;
    futhark_mc_segmap_parloop_struct_131312.free_bytes_122329 = bytes_122329;
    futhark_mc_segmap_parloop_struct_131312.free_bytes_122332 = bytes_122332;
    futhark_mc_segmap_parloop_struct_131312.free_mem_122386 = mem_122386.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131313_task;
    
    futhark_mc_segmap_parloop_131313_task.name =
        "futhark_mc_segmap_parloop_131313";
    futhark_mc_segmap_parloop_131313_task.fn = futhark_mc_segmap_parloop_131313;
    futhark_mc_segmap_parloop_131313_task.args =
        &futhark_mc_segmap_parloop_struct_131312;
    futhark_mc_segmap_parloop_131313_task.iterations = iterations;
    futhark_mc_segmap_parloop_131313_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131313_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131313_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131313_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131313_task);
    
    if (futhark_mc_segmap_parloop_131313_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131313_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131313_total_end -
                 futhark_mc_segmap_parloop_131313_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131313_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131313_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131313_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131311_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131311_end -
                 futhark_mc_segmap_nested_task_131311_start;
        
        ctx->futhark_mc_segmap_nested_task_131311_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131311_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131311_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131353 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_loopz2081Uz2085Uz2089U_115023;
    char *free_mem_121979;
    int64_t free_bytes_121983;
    int64_t free_ctx_param_ext_122235;
    int64_t free_ctx_param_ext_122236;
    int64_t free_ctx_param_ext_122238;
    char *free_mem_param_122240;
    char *free_mem_122386;
    char *free_mem_122426;
    char *free_mem_122430;
};
struct futhark_mc_segmap_parloop_struct_131355 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_loopz2081Uz2085Uz2089U_115023;
    char *free_mem_121979;
    int64_t free_bytes_121983;
    int64_t free_ctx_param_ext_122235;
    int64_t free_ctx_param_ext_122236;
    int64_t free_ctx_param_ext_122238;
    char *free_mem_param_122240;
    char *free_mem_122386;
    char *free_mem_122426;
    char *free_mem_122430;
};
static int futhark_mc_segmap_parloop_131356(void *args, int64_t start,
                                            int64_t end, int flat_tid_117708,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131355
    *futhark_mc_segmap_parloop_struct_131355 =
    (struct futhark_mc_segmap_parloop_struct_131355 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131355->ctx;
    uint64_t futhark_mc_segmap_parloop_131356_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131356_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131355->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131355->free_n_114534;
    int64_t loopz2081Uz2085Uz2089U_115023 =
            futhark_mc_segmap_parloop_struct_131355->free_loopz2081Uz2085Uz2089U_115023;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131355->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131355->free_bytes_121983;
    int64_t ctx_param_ext_122235 =
            futhark_mc_segmap_parloop_struct_131355->free_ctx_param_ext_122235;
    int64_t ctx_param_ext_122236 =
            futhark_mc_segmap_parloop_struct_131355->free_ctx_param_ext_122236;
    int64_t ctx_param_ext_122238 =
            futhark_mc_segmap_parloop_struct_131355->free_ctx_param_ext_122238;
    struct memblock mem_param_122240 = {.desc ="mem_param_122240", .mem =
                                        futhark_mc_segmap_parloop_struct_131355->free_mem_param_122240,
                                        .size =0, .references =NULL};
    struct memblock mem_122386 = {.desc ="mem_122386", .mem =
                                  futhark_mc_segmap_parloop_struct_131355->free_mem_122386,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131355->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131355->free_mem_122430,
                                  .size =0, .references =NULL};
    size_t mem_122395_cached_sizze_131357 = 0;
    char *mem_122395 = NULL;
    size_t mem_122398_cached_sizze_131358 = 0;
    char *mem_122398 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125416 = start;
    
    if (mem_122395_cached_sizze_131357 < (size_t) bytes_121983) {
        mem_122395 = realloc(mem_122395, bytes_121983);
        mem_122395_cached_sizze_131357 = bytes_121983;
    }
    if (mem_122398_cached_sizze_131358 < (size_t) bytes_121983) {
        mem_122398 = realloc(mem_122398, bytes_121983);
        mem_122398_cached_sizze_131358 = bytes_121983;
    }
    for (; iter_125416 < end; iter_125416++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125434 = m_114533;
        int64_t gtid_117709 = iter_125416;
        int64_t remnant_125435 = iter_125416 - gtid_117709;
        
        for (int64_t i_125417 = 0; i_125417 < n_114534; i_125417++) {
            int64_t x_125420 = ((int64_t *) mem_121979.mem)[gtid_117709 *
                                                            n_114534 +
                                                            i_125417];
            bool cond_125421 = sle64((int64_t) 0, x_125420);
            float defunc_0_f_res_125422;
            
            if (cond_125421) {
                bool y_125423 = slt64(x_125420, n_114534);
                bool bounds_check_125424 = cond_125421 && y_125423;
                bool index_certs_125425;
                
                if (!bounds_check_125424) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", x_125420,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:231:36-58\n   #3  /prelude/soacs.fut:75:22-28\n   #4  /prelude/soacs.fut:75:3-45\n   #5  stl.fut:229:13-234:43\n   #6  stl.fut:394:3-405:33\n   #7  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float defunc_0_f_res_t_res_125426 =
                      ((float *) mem_122386.mem)[gtid_117709 * n_114534 +
                                                 x_125420];
                
                defunc_0_f_res_125422 = defunc_0_f_res_t_res_125426;
            } else {
                defunc_0_f_res_125422 = 0.0F;
            }
            
            float defunc_0_f_res_125427;
            
            if (cond_125421) {
                bool y_125428 = slt64(x_125420, loopz2081Uz2085Uz2089U_115023);
                bool bounds_check_125429 = cond_125421 && y_125428;
                bool index_certs_125430;
                
                if (!bounds_check_125429) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", x_125420,
                                  "] out of bounds for array of shape [",
                                  loopz2081Uz2085Uz2089U_115023, "].",
                                  "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:232:34-60\n   #3  /prelude/soacs.fut:75:22-28\n   #4  /prelude/soacs.fut:75:3-45\n   #5  stl.fut:229:13-234:43\n   #6  stl.fut:394:3-405:33\n   #7  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float defunc_0_f_res_t_res_125431 =
                      ((float *) mem_param_122240.mem)[ctx_param_ext_122235 +
                                                       (gtid_117709 *
                                                        ctx_param_ext_122236 +
                                                        x_125420 *
                                                        ctx_param_ext_122238)];
                
                defunc_0_f_res_125427 = defunc_0_f_res_t_res_125431;
            } else {
                defunc_0_f_res_125427 = 0.0F;
            }
            ((float *) mem_122395)[i_125417] = defunc_0_f_res_125427;
            ((float *) mem_122398)[i_125417] = defunc_0_f_res_125422;
        }
        memmove(mem_122426.mem + gtid_117709 * n_114534 * (int64_t) 4,
                mem_122398 + (int64_t) 0, n_114534 * (int64_t) 4);
        memmove(mem_122430.mem + gtid_117709 * n_114534 * (int64_t) 4,
                mem_122395 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122395);
    free(mem_122398);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131356_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131356_end -
                 futhark_mc_segmap_parloop_131356_start;
        
        ctx->futhark_mc_segmap_parloop_131356_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131356_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131356_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131354(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117708 = tid;
    int num_tasks_125415 = info.nsubtasks;
    struct futhark_mc_task_131353 *futhark_mc_task_131353 =
                                  (struct futhark_mc_task_131353 *) args;
    struct futhark_context *ctx = futhark_mc_task_131353->ctx;
    uint64_t futhark_mc_segmap_task_131354_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131354_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131353->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131353->free_n_114534;
    int64_t loopz2081Uz2085Uz2089U_115023 =
            futhark_mc_task_131353->free_loopz2081Uz2085Uz2089U_115023;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131353->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131353->free_bytes_121983;
    int64_t ctx_param_ext_122235 =
            futhark_mc_task_131353->free_ctx_param_ext_122235;
    int64_t ctx_param_ext_122236 =
            futhark_mc_task_131353->free_ctx_param_ext_122236;
    int64_t ctx_param_ext_122238 =
            futhark_mc_task_131353->free_ctx_param_ext_122238;
    struct memblock mem_param_122240 = {.desc ="mem_param_122240", .mem =
                                        futhark_mc_task_131353->free_mem_param_122240,
                                        .size =0, .references =NULL};
    struct memblock mem_122386 = {.desc ="mem_122386", .mem =
                                  futhark_mc_task_131353->free_mem_122386,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131353->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131353->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t iter_125416;
    struct futhark_mc_segmap_parloop_struct_131355
    futhark_mc_segmap_parloop_struct_131355;
    
    futhark_mc_segmap_parloop_struct_131355.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131355.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131355.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131355.free_loopz2081Uz2085Uz2089U_115023 =
        loopz2081Uz2085Uz2089U_115023;
    futhark_mc_segmap_parloop_struct_131355.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131355.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131355.free_ctx_param_ext_122235 =
        ctx_param_ext_122235;
    futhark_mc_segmap_parloop_struct_131355.free_ctx_param_ext_122236 =
        ctx_param_ext_122236;
    futhark_mc_segmap_parloop_struct_131355.free_ctx_param_ext_122238 =
        ctx_param_ext_122238;
    futhark_mc_segmap_parloop_struct_131355.free_mem_param_122240 =
        mem_param_122240.mem;
    futhark_mc_segmap_parloop_struct_131355.free_mem_122386 = mem_122386.mem;
    futhark_mc_segmap_parloop_struct_131355.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131355.free_mem_122430 = mem_122430.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131356_task;
    
    futhark_mc_segmap_parloop_131356_task.name =
        "futhark_mc_segmap_parloop_131356";
    futhark_mc_segmap_parloop_131356_task.fn = futhark_mc_segmap_parloop_131356;
    futhark_mc_segmap_parloop_131356_task.args =
        &futhark_mc_segmap_parloop_struct_131355;
    futhark_mc_segmap_parloop_131356_task.iterations = iterations;
    futhark_mc_segmap_parloop_131356_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131356_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131356_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131356_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131356_task);
    
    if (futhark_mc_segmap_parloop_131356_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131356_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131356_total_end -
                 futhark_mc_segmap_parloop_131356_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131356_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131356_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131356_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131354_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131354_end -
                 futhark_mc_segmap_task_131354_start;
        
        ctx->futhark_mc_segmap_task_131354_runs[tid]++;
        ctx->futhark_mc_segmap_task_131354_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131354_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131360 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_loopz2081Uz2085Uz2089U_115023;
    char *free_mem_121979;
    int64_t free_bytes_121983;
    int64_t free_ctx_param_ext_122235;
    int64_t free_ctx_param_ext_122236;
    int64_t free_ctx_param_ext_122238;
    char *free_mem_param_122240;
    char *free_mem_122386;
    char *free_mem_122426;
    char *free_mem_122430;
};
struct futhark_mc_task_131364 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_loopz2081Uz2085Uz2089U_115023;
    int64_t free_gtid_117711;
    char *free_mem_121979;
    int64_t free_ctx_param_ext_122235;
    int64_t free_ctx_param_ext_122236;
    int64_t free_ctx_param_ext_122238;
    char *free_mem_param_122240;
    char *free_mem_122386;
    char *free_mem_122389;
    char *free_mem_122392;
};
struct futhark_mc_segmap_parloop_struct_131366 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_loopz2081Uz2085Uz2089U_115023;
    int64_t free_gtid_117711;
    char *free_mem_121979;
    int64_t free_ctx_param_ext_122235;
    int64_t free_ctx_param_ext_122236;
    int64_t free_ctx_param_ext_122238;
    char *free_mem_param_122240;
    char *free_mem_122386;
    char *free_mem_122389;
    char *free_mem_122392;
};
static int futhark_mc_segmap_parloop_131367(void *args, int64_t start,
                                            int64_t end, int flat_tid_117712,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131366
    *futhark_mc_segmap_parloop_struct_131366 =
    (struct futhark_mc_segmap_parloop_struct_131366 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131366->ctx;
    uint64_t futhark_mc_segmap_parloop_131367_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131367_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131366->free_n_114534;
    int64_t loopz2081Uz2085Uz2089U_115023 =
            futhark_mc_segmap_parloop_struct_131366->free_loopz2081Uz2085Uz2089U_115023;
    int64_t gtid_117711 =
            futhark_mc_segmap_parloop_struct_131366->free_gtid_117711;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131366->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_122235 =
            futhark_mc_segmap_parloop_struct_131366->free_ctx_param_ext_122235;
    int64_t ctx_param_ext_122236 =
            futhark_mc_segmap_parloop_struct_131366->free_ctx_param_ext_122236;
    int64_t ctx_param_ext_122238 =
            futhark_mc_segmap_parloop_struct_131366->free_ctx_param_ext_122238;
    struct memblock mem_param_122240 = {.desc ="mem_param_122240", .mem =
                                        futhark_mc_segmap_parloop_struct_131366->free_mem_param_122240,
                                        .size =0, .references =NULL};
    struct memblock mem_122386 = {.desc ="mem_122386", .mem =
                                  futhark_mc_segmap_parloop_struct_131366->free_mem_122386,
                                  .size =0, .references =NULL};
    struct memblock mem_122389 = {.desc ="mem_122389", .mem =
                                  futhark_mc_segmap_parloop_struct_131366->free_mem_122389,
                                  .size =0, .references =NULL};
    struct memblock mem_122392 = {.desc ="mem_122392", .mem =
                                  futhark_mc_segmap_parloop_struct_131366->free_mem_122392,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125454 = start;
    
    for (; iter_125454 < end; iter_125454++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125463 = n_114534;
        int64_t gtid_117713 = iter_125454;
        int64_t remnant_125464 = iter_125454 - gtid_117713;
        int64_t x_125439 = ((int64_t *) mem_121979.mem)[gtid_117711 * n_114534 +
                                                        gtid_117713];
        bool cond_125440 = sle64((int64_t) 0, x_125439);
        float defunc_0_f_res_125441;
        
        if (cond_125440) {
            bool y_125455 = slt64(x_125439, n_114534);
            bool bounds_check_125456 = cond_125440 && y_125455;
            bool index_certs_125457;
            
            if (!bounds_check_125456) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", x_125439,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:231:36-58\n   #3  /prelude/soacs.fut:75:22-28\n   #4  /prelude/soacs.fut:75:3-45\n   #5  stl.fut:229:13-234:43\n   #6  stl.fut:394:3-405:33\n   #7  stl.fut:381:1-405:33\n");
                return 1;
            }
            
            float defunc_0_f_res_t_res_125458 =
                  ((float *) mem_122386.mem)[gtid_117711 * n_114534 + x_125439];
            
            defunc_0_f_res_125441 = defunc_0_f_res_t_res_125458;
        } else {
            defunc_0_f_res_125441 = 0.0F;
        }
        
        float defunc_0_f_res_125446;
        
        if (cond_125440) {
            bool y_125459 = slt64(x_125439, loopz2081Uz2085Uz2089U_115023);
            bool bounds_check_125460 = cond_125440 && y_125459;
            bool index_certs_125461;
            
            if (!bounds_check_125460) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", x_125439,
                              "] out of bounds for array of shape [",
                              loopz2081Uz2085Uz2089U_115023, "].",
                              "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:232:34-60\n   #3  /prelude/soacs.fut:75:22-28\n   #4  /prelude/soacs.fut:75:3-45\n   #5  stl.fut:229:13-234:43\n   #6  stl.fut:394:3-405:33\n   #7  stl.fut:381:1-405:33\n");
                return 1;
            }
            
            float defunc_0_f_res_t_res_125462 =
                  ((float *) mem_param_122240.mem)[ctx_param_ext_122235 +
                                                   (gtid_117711 *
                                                    ctx_param_ext_122236 +
                                                    x_125439 *
                                                    ctx_param_ext_122238)];
            
            defunc_0_f_res_125446 = defunc_0_f_res_t_res_125462;
        } else {
            defunc_0_f_res_125446 = 0.0F;
        }
        ((float *) mem_122389.mem)[gtid_117713] = defunc_0_f_res_125446;
        ((float *) mem_122392.mem)[gtid_117713] = defunc_0_f_res_125441;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131367_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131367_end -
                 futhark_mc_segmap_parloop_131367_start;
        
        ctx->futhark_mc_segmap_parloop_131367_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131367_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131367_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131365(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117712 = tid;
    int num_tasks_125453 = info.nsubtasks;
    struct futhark_mc_task_131364 *futhark_mc_task_131364 =
                                  (struct futhark_mc_task_131364 *) args;
    struct futhark_context *ctx = futhark_mc_task_131364->ctx;
    uint64_t futhark_mc_segmap_task_131365_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131365_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131364->free_n_114534;
    int64_t loopz2081Uz2085Uz2089U_115023 =
            futhark_mc_task_131364->free_loopz2081Uz2085Uz2089U_115023;
    int64_t gtid_117711 = futhark_mc_task_131364->free_gtid_117711;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131364->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t ctx_param_ext_122235 =
            futhark_mc_task_131364->free_ctx_param_ext_122235;
    int64_t ctx_param_ext_122236 =
            futhark_mc_task_131364->free_ctx_param_ext_122236;
    int64_t ctx_param_ext_122238 =
            futhark_mc_task_131364->free_ctx_param_ext_122238;
    struct memblock mem_param_122240 = {.desc ="mem_param_122240", .mem =
                                        futhark_mc_task_131364->free_mem_param_122240,
                                        .size =0, .references =NULL};
    struct memblock mem_122386 = {.desc ="mem_122386", .mem =
                                  futhark_mc_task_131364->free_mem_122386,
                                  .size =0, .references =NULL};
    struct memblock mem_122389 = {.desc ="mem_122389", .mem =
                                  futhark_mc_task_131364->free_mem_122389,
                                  .size =0, .references =NULL};
    struct memblock mem_122392 = {.desc ="mem_122392", .mem =
                                  futhark_mc_task_131364->free_mem_122392,
                                  .size =0, .references =NULL};
    int64_t iter_125454;
    struct futhark_mc_segmap_parloop_struct_131366
    futhark_mc_segmap_parloop_struct_131366;
    
    futhark_mc_segmap_parloop_struct_131366.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131366.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131366.free_loopz2081Uz2085Uz2089U_115023 =
        loopz2081Uz2085Uz2089U_115023;
    futhark_mc_segmap_parloop_struct_131366.free_gtid_117711 = gtid_117711;
    futhark_mc_segmap_parloop_struct_131366.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131366.free_ctx_param_ext_122235 =
        ctx_param_ext_122235;
    futhark_mc_segmap_parloop_struct_131366.free_ctx_param_ext_122236 =
        ctx_param_ext_122236;
    futhark_mc_segmap_parloop_struct_131366.free_ctx_param_ext_122238 =
        ctx_param_ext_122238;
    futhark_mc_segmap_parloop_struct_131366.free_mem_param_122240 =
        mem_param_122240.mem;
    futhark_mc_segmap_parloop_struct_131366.free_mem_122386 = mem_122386.mem;
    futhark_mc_segmap_parloop_struct_131366.free_mem_122389 = mem_122389.mem;
    futhark_mc_segmap_parloop_struct_131366.free_mem_122392 = mem_122392.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131367_task;
    
    futhark_mc_segmap_parloop_131367_task.name =
        "futhark_mc_segmap_parloop_131367";
    futhark_mc_segmap_parloop_131367_task.fn = futhark_mc_segmap_parloop_131367;
    futhark_mc_segmap_parloop_131367_task.args =
        &futhark_mc_segmap_parloop_struct_131366;
    futhark_mc_segmap_parloop_131367_task.iterations = iterations;
    futhark_mc_segmap_parloop_131367_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131367_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131367_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131367_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131367_task);
    
    if (futhark_mc_segmap_parloop_131367_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131367_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131367_total_end -
                 futhark_mc_segmap_parloop_131367_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131367_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131367_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131367_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131365_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131365_end -
                 futhark_mc_segmap_task_131365_start;
        
        ctx->futhark_mc_segmap_task_131365_runs[tid]++;
        ctx->futhark_mc_segmap_task_131365_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131365_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131361(void *args, int64_t start,
                                            int64_t end, int flat_tid_117710,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131360
    *futhark_mc_segmap_parloop_struct_131360 =
    (struct futhark_mc_segmap_parloop_struct_131360 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131360->ctx;
    uint64_t futhark_mc_segmap_parloop_131361_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131361_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131360->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131360->free_n_114534;
    int64_t loopz2081Uz2085Uz2089U_115023 =
            futhark_mc_segmap_parloop_struct_131360->free_loopz2081Uz2085Uz2089U_115023;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131360->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131360->free_bytes_121983;
    int64_t ctx_param_ext_122235 =
            futhark_mc_segmap_parloop_struct_131360->free_ctx_param_ext_122235;
    int64_t ctx_param_ext_122236 =
            futhark_mc_segmap_parloop_struct_131360->free_ctx_param_ext_122236;
    int64_t ctx_param_ext_122238 =
            futhark_mc_segmap_parloop_struct_131360->free_ctx_param_ext_122238;
    struct memblock mem_param_122240 = {.desc ="mem_param_122240", .mem =
                                        futhark_mc_segmap_parloop_struct_131360->free_mem_param_122240,
                                        .size =0, .references =NULL};
    struct memblock mem_122386 = {.desc ="mem_122386", .mem =
                                  futhark_mc_segmap_parloop_struct_131360->free_mem_122386,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131360->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131360->free_mem_122430,
                                  .size =0, .references =NULL};
    size_t mem_122389_cached_sizze_131362 = 0;
    char *mem_122389 = NULL;
    size_t mem_122392_cached_sizze_131363 = 0;
    char *mem_122392 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125438 = start;
    
    if (mem_122389_cached_sizze_131362 < (size_t) bytes_121983) {
        mem_122389 = realloc(mem_122389, bytes_121983);
        mem_122389_cached_sizze_131362 = bytes_121983;
    }
    if (mem_122392_cached_sizze_131363 < (size_t) bytes_121983) {
        mem_122392 = realloc(mem_122392, bytes_121983);
        mem_122392_cached_sizze_131363 = bytes_121983;
    }
    for (; iter_125438 < end; iter_125438++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125451 = m_114533;
        int64_t gtid_117711 = iter_125438;
        int64_t remnant_125452 = iter_125438 - gtid_117711;
        int64_t flat_tid_117712 = (int64_t) 0;
        int32_t num_tasks_125453;
        struct futhark_mc_task_131364 futhark_mc_task_131364;
        
        futhark_mc_task_131364.ctx = ctx;
        futhark_mc_task_131364.free_n_114534 = n_114534;
        futhark_mc_task_131364.free_loopz2081Uz2085Uz2089U_115023 =
            loopz2081Uz2085Uz2089U_115023;
        futhark_mc_task_131364.free_gtid_117711 = gtid_117711;
        futhark_mc_task_131364.free_mem_121979 = mem_121979.mem;
        futhark_mc_task_131364.free_ctx_param_ext_122235 = ctx_param_ext_122235;
        futhark_mc_task_131364.free_ctx_param_ext_122236 = ctx_param_ext_122236;
        futhark_mc_task_131364.free_ctx_param_ext_122238 = ctx_param_ext_122238;
        futhark_mc_task_131364.free_mem_param_122240 = mem_param_122240.mem;
        futhark_mc_task_131364.free_mem_122386 = mem_122386.mem;
        futhark_mc_task_131364.free_mem_122389 = mem_122389;
        futhark_mc_task_131364.free_mem_122392 = mem_122392;
        
        struct scheduler_segop futhark_mc_task_131364_task;
        
        futhark_mc_task_131364_task.args = &futhark_mc_task_131364;
        futhark_mc_task_131364_task.top_level_fn =
            futhark_mc_segmap_task_131365;
        futhark_mc_task_131364_task.name = "futhark_mc_segmap_task_131365";
        futhark_mc_task_131364_task.iterations = n_114534;
        futhark_mc_task_131364_task.task_time =
            &ctx->futhark_mc_segmap_task_131365_total_time;
        futhark_mc_task_131364_task.task_iter =
            &ctx->futhark_mc_segmap_task_131365_total_iter;
        futhark_mc_task_131364_task.sched = STATIC;
        futhark_mc_task_131364_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131365_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131364_task);
        
        if (futhark_mc_segmap_task_131365_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122426.mem + gtid_117711 * n_114534 * (int64_t) 4,
                mem_122392 + (int64_t) 0, n_114534 * (int64_t) 4);
        memmove(mem_122430.mem + gtid_117711 * n_114534 * (int64_t) 4,
                mem_122389 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122389);
    free(mem_122392);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131361_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131361_end -
                 futhark_mc_segmap_parloop_131361_start;
        
        ctx->futhark_mc_segmap_parloop_131361_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131361_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131361_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131359(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117710 = tid;
    int num_tasks_125415 = info.nsubtasks;
    struct futhark_mc_task_131353 *futhark_mc_task_131353 =
                                  (struct futhark_mc_task_131353 *) args;
    struct futhark_context *ctx = futhark_mc_task_131353->ctx;
    uint64_t futhark_mc_segmap_nested_task_131359_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131359_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131353->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131353->free_n_114534;
    int64_t loopz2081Uz2085Uz2089U_115023 =
            futhark_mc_task_131353->free_loopz2081Uz2085Uz2089U_115023;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131353->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131353->free_bytes_121983;
    int64_t ctx_param_ext_122235 =
            futhark_mc_task_131353->free_ctx_param_ext_122235;
    int64_t ctx_param_ext_122236 =
            futhark_mc_task_131353->free_ctx_param_ext_122236;
    int64_t ctx_param_ext_122238 =
            futhark_mc_task_131353->free_ctx_param_ext_122238;
    struct memblock mem_param_122240 = {.desc ="mem_param_122240", .mem =
                                        futhark_mc_task_131353->free_mem_param_122240,
                                        .size =0, .references =NULL};
    struct memblock mem_122386 = {.desc ="mem_122386", .mem =
                                  futhark_mc_task_131353->free_mem_122386,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131353->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131353->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t iter_125438;
    struct futhark_mc_segmap_parloop_struct_131360
    futhark_mc_segmap_parloop_struct_131360;
    
    futhark_mc_segmap_parloop_struct_131360.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131360.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131360.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131360.free_loopz2081Uz2085Uz2089U_115023 =
        loopz2081Uz2085Uz2089U_115023;
    futhark_mc_segmap_parloop_struct_131360.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131360.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131360.free_ctx_param_ext_122235 =
        ctx_param_ext_122235;
    futhark_mc_segmap_parloop_struct_131360.free_ctx_param_ext_122236 =
        ctx_param_ext_122236;
    futhark_mc_segmap_parloop_struct_131360.free_ctx_param_ext_122238 =
        ctx_param_ext_122238;
    futhark_mc_segmap_parloop_struct_131360.free_mem_param_122240 =
        mem_param_122240.mem;
    futhark_mc_segmap_parloop_struct_131360.free_mem_122386 = mem_122386.mem;
    futhark_mc_segmap_parloop_struct_131360.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131360.free_mem_122430 = mem_122430.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131361_task;
    
    futhark_mc_segmap_parloop_131361_task.name =
        "futhark_mc_segmap_parloop_131361";
    futhark_mc_segmap_parloop_131361_task.fn = futhark_mc_segmap_parloop_131361;
    futhark_mc_segmap_parloop_131361_task.args =
        &futhark_mc_segmap_parloop_struct_131360;
    futhark_mc_segmap_parloop_131361_task.iterations = iterations;
    futhark_mc_segmap_parloop_131361_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131361_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131361_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131361_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131361_task);
    
    if (futhark_mc_segmap_parloop_131361_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131361_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131361_total_end -
                 futhark_mc_segmap_parloop_131361_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131361_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131361_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131361_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131359_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131359_end -
                 futhark_mc_segmap_nested_task_131359_start;
        
        ctx->futhark_mc_segmap_nested_task_131359_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131359_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131359_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131368 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122456;
};
struct futhark_mc_segmap_parloop_struct_131370 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122456;
};
static int futhark_mc_segmap_parloop_131371(void *args, int64_t start,
                                            int64_t end, int flat_tid_117731,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131370
    *futhark_mc_segmap_parloop_struct_131370 =
    (struct futhark_mc_segmap_parloop_struct_131370 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131370->ctx;
    uint64_t futhark_mc_segmap_parloop_131371_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131371_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131370->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131370->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131370->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131370->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131370->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131370->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131370->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131370->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131370->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131370->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131370->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131370->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131370->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122456 = {.desc ="mem_122456", .mem =
                                  futhark_mc_segmap_parloop_struct_131370->free_mem_122456,
                                  .size =0, .references =NULL};
    size_t mem_122440_cached_sizze_131372 = 0;
    char *mem_122440 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125468 = start;
    
    if (mem_122440_cached_sizze_131372 < (size_t) bytes_122055) {
        mem_122440 = realloc(mem_122440, bytes_122055);
        mem_122440_cached_sizze_131372 = bytes_122055;
    }
    for (; iter_125468 < end; iter_125468++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125525 = m_114533;
        int64_t gtid_117732 = iter_125468;
        int64_t remnant_125526 = iter_125468 - gtid_117732;
        int64_t x_115197 = ((int64_t *) mem_121982.mem)[gtid_117732];
        
        for (int64_t i_125469 = 0; i_125469 < l_n_m_114584; i_125469++) {
            int64_t x_125471 = ((int64_t *) mem_122124.mem)[gtid_117732 *
                                                            l_n_m_114584 +
                                                            i_125469];
            float x_125472 = ((float *) mem_122128.mem)[gtid_117732 *
                                                        l_n_m_114584 +
                                                        i_125469];
            int64_t min_arg_125473 = mul64(t_jump_114541, i_125469);
            int64_t min_res_125474 = smin64(i_114610, min_arg_125473);
            float defunc_0_f_res_125475 = sitofp_i64_f32(min_res_125474);
            float defunc_2_reduce_res_125476;
            float redout_125478 = 0.0F;
            
            for (int64_t i_125477 = 0; i_125477 < l_window_114538; i_125477++) {
                bool cond_125479 = sle64(x_115197, i_125477);
                float defunc_0_f_res_125480;
                
                if (cond_125479) {
                    defunc_0_f_res_125480 = 0.0F;
                } else {
                    int64_t i_125481 = add64(x_125471, i_125477);
                    float x_125482 = ((float *) mem_122004.mem)[gtid_117732 *
                                                                n_114534 +
                                                                i_125481];
                    float defunc_0_f_res_f_res_125483 = 1.0F + x_125482;
                    
                    defunc_0_f_res_125480 = defunc_0_f_res_f_res_125483;
                }
                
                float defunc_0_f_res_125484;
                
                if (cond_125479) {
                    defunc_0_f_res_125484 = 0.0F;
                } else {
                    int64_t i_125485 = add64(x_125471, i_125477);
                    float x_125486 = ((float *) mem_122430.mem)[gtid_117732 *
                                                                n_114534 +
                                                                i_125485];
                    
                    defunc_0_f_res_125484 = x_125486;
                }
                
                float x_j_125487 = defunc_0_f_res_125480 -
                      defunc_0_f_res_125475;
                float abs_res_125488 = (float) fabs(x_j_125487);
                float tmp1_125489 = abs_res_125488 / x_125472;
                float x_125490 = tmp1_125489 * tmp1_125489;
                float y_125491 = tmp1_125489 * x_125490;
                float tmp2_125492 = 1.0F - y_125491;
                float x_125493 = tmp2_125492 * tmp2_125492;
                float tmp3_125494 = tmp2_125492 * x_125493;
                float w_j_125495 = defunc_0_f_res_125484 * tmp3_125494;
                float defunc_1_op_res_125496 = w_j_125495 + redout_125478;
                float redout_tmp_125528 = defunc_1_op_res_125496;
                
                redout_125478 = redout_tmp_125528;
            }
            defunc_2_reduce_res_125476 = redout_125478;
            
            float a0_125497 = 1.0F / defunc_2_reduce_res_125476;
            float defunc_2_reduce_res_125498;
            float redout_125500 = 0.0F;
            
            for (int64_t i_125499 = 0; i_125499 < l_window_114538; i_125499++) {
                bool cond_125501 = sle64(x_115197, i_125499);
                float defunc_0_f_res_125502;
                
                if (cond_125501) {
                    defunc_0_f_res_125502 = 0.0F;
                } else {
                    int64_t i_125503 = add64(x_125471, i_125499);
                    float x_125504 = ((float *) mem_122004.mem)[gtid_117732 *
                                                                n_114534 +
                                                                i_125503];
                    float defunc_0_f_res_f_res_125505 = 1.0F + x_125504;
                    
                    defunc_0_f_res_125502 = defunc_0_f_res_f_res_125505;
                }
                
                float defunc_0_f_res_125506;
                
                if (cond_125501) {
                    defunc_0_f_res_125506 = 0.0F;
                } else {
                    int64_t i_125507 = add64(x_125471, i_125499);
                    float x_125508 = ((float *) mem_122430.mem)[gtid_117732 *
                                                                n_114534 +
                                                                i_125507];
                    
                    defunc_0_f_res_125506 = x_125508;
                }
                
                float x_j_125509 = defunc_0_f_res_125502 -
                      defunc_0_f_res_125475;
                float abs_res_125510 = (float) fabs(x_j_125509);
                float tmp1_125511 = abs_res_125510 / x_125472;
                float x_125512 = tmp1_125511 * tmp1_125511;
                float y_125513 = tmp1_125511 * x_125512;
                float tmp2_125514 = 1.0F - y_125513;
                float x_125515 = tmp2_125514 * tmp2_125514;
                float tmp3_125516 = tmp2_125514 * x_125515;
                float tmp4_125517 = defunc_0_f_res_125506 * tmp3_125516;
                float defunc_0_f_res_125518;
                
                if (cond_125501) {
                    defunc_0_f_res_125518 = 0.0F;
                } else {
                    int64_t i_125519 = add64(x_125471, i_125499);
                    float x_125520 = ((float *) mem_122426.mem)[gtid_117732 *
                                                                n_114534 +
                                                                i_125519];
                    
                    defunc_0_f_res_125518 = x_125520;
                }
                
                float x_125521 = a0_125497 * tmp4_125517;
                float defunc_9_fit_fun_res_125522 = defunc_0_f_res_125518 *
                      x_125521;
                float defunc_1_op_res_125523 = defunc_9_fit_fun_res_125522 +
                      redout_125500;
                float redout_tmp_125529 = defunc_1_op_res_125523;
                
                redout_125500 = redout_tmp_125529;
            }
            defunc_2_reduce_res_125498 = redout_125500;
            ((float *) mem_122440)[i_125469] = defunc_2_reduce_res_125498;
        }
        memmove(mem_122456.mem + gtid_117732 * l_n_m_114584 * (int64_t) 4,
                mem_122440 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122440);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131371_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131371_end -
                 futhark_mc_segmap_parloop_131371_start;
        
        ctx->futhark_mc_segmap_parloop_131371_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131371_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131371_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131369(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117731 = tid;
    int num_tasks_125467 = info.nsubtasks;
    struct futhark_mc_task_131368 *futhark_mc_task_131368 =
                                  (struct futhark_mc_task_131368 *) args;
    struct futhark_context *ctx = futhark_mc_task_131368->ctx;
    uint64_t futhark_mc_segmap_task_131369_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131369_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131368->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131368->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131368->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131368->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131368->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131368->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131368->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131368->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131368->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131368->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131368->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131368->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131368->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122456 = {.desc ="mem_122456", .mem =
                                  futhark_mc_task_131368->free_mem_122456,
                                  .size =0, .references =NULL};
    int64_t iter_125468;
    struct futhark_mc_segmap_parloop_struct_131370
    futhark_mc_segmap_parloop_struct_131370;
    
    futhark_mc_segmap_parloop_struct_131370.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131370.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131370.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131370.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131370.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131370.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131370.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131370.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131370.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131370.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131370.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131370.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131370.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131370.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131370.free_mem_122456 = mem_122456.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131371_task;
    
    futhark_mc_segmap_parloop_131371_task.name =
        "futhark_mc_segmap_parloop_131371";
    futhark_mc_segmap_parloop_131371_task.fn = futhark_mc_segmap_parloop_131371;
    futhark_mc_segmap_parloop_131371_task.args =
        &futhark_mc_segmap_parloop_struct_131370;
    futhark_mc_segmap_parloop_131371_task.iterations = iterations;
    futhark_mc_segmap_parloop_131371_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131371_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131371_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131371_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131371_task);
    
    if (futhark_mc_segmap_parloop_131371_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131371_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131371_total_end -
                 futhark_mc_segmap_parloop_131371_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131371_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131371_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131371_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131369_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131369_end -
                 futhark_mc_segmap_task_131369_start;
        
        ctx->futhark_mc_segmap_task_131369_runs[tid]++;
        ctx->futhark_mc_segmap_task_131369_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131369_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131374 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122456;
};
struct futhark_mc_task_131377 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_117734;
    int64_t free_x_117804;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122437;
};
struct futhark_mc_segmap_parloop_struct_131379 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_117734;
    int64_t free_x_117804;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122437;
};
static int futhark_mc_segmap_parloop_131380(void *args, int64_t start,
                                            int64_t end, int flat_tid_117735,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131379
    *futhark_mc_segmap_parloop_struct_131379 =
    (struct futhark_mc_segmap_parloop_struct_131379 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131379->ctx;
    uint64_t futhark_mc_segmap_parloop_131380_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131380_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131379->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131379->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131379->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131379->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131379->free_i_114610;
    int64_t gtid_117734 =
            futhark_mc_segmap_parloop_struct_131379->free_gtid_117734;
    int64_t x_117804 = futhark_mc_segmap_parloop_struct_131379->free_x_117804;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131379->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131379->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131379->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131379->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131379->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122437 = {.desc ="mem_122437", .mem =
                                  futhark_mc_segmap_parloop_struct_131379->free_mem_122437,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125640 = start;
    
    for (; iter_125640 < end; iter_125640++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125686 = l_n_m_114584;
        int64_t gtid_117736 = iter_125640;
        int64_t remnant_125687 = iter_125640 - gtid_117736;
        int64_t x_125584 = ((int64_t *) mem_122124.mem)[gtid_117734 *
                                                        l_n_m_114584 +
                                                        gtid_117736];
        float x_125585 = ((float *) mem_122128.mem)[gtid_117734 * l_n_m_114584 +
                                                    gtid_117736];
        int64_t min_arg_125586 = mul64(t_jump_114541, gtid_117736);
        int64_t min_res_125587 = smin64(i_114610, min_arg_125586);
        float defunc_0_f_res_125588 = sitofp_i64_f32(min_res_125587);
        float defunc_2_reduce_res_125589;
        float redout_125642 = 0.0F;
        
        for (int64_t i_125641 = 0; i_125641 < l_window_114538; i_125641++) {
            bool cond_125643 = sle64(x_117804, i_125641);
            float defunc_0_f_res_125644;
            
            if (cond_125643) {
                defunc_0_f_res_125644 = 0.0F;
            } else {
                int64_t i_125645 = add64(x_125584, i_125641);
                float x_125646 = ((float *) mem_122004.mem)[gtid_117734 *
                                                            n_114534 +
                                                            i_125645];
                float defunc_0_f_res_f_res_125647 = 1.0F + x_125646;
                
                defunc_0_f_res_125644 = defunc_0_f_res_f_res_125647;
            }
            
            float defunc_0_f_res_125648;
            
            if (cond_125643) {
                defunc_0_f_res_125648 = 0.0F;
            } else {
                int64_t i_125649 = add64(x_125584, i_125641);
                float x_125650 = ((float *) mem_122430.mem)[gtid_117734 *
                                                            n_114534 +
                                                            i_125649];
                
                defunc_0_f_res_125648 = x_125650;
            }
            
            float x_j_125651 = defunc_0_f_res_125644 - defunc_0_f_res_125588;
            float abs_res_125652 = (float) fabs(x_j_125651);
            float tmp1_125653 = abs_res_125652 / x_125585;
            float x_125654 = tmp1_125653 * tmp1_125653;
            float y_125655 = tmp1_125653 * x_125654;
            float tmp2_125656 = 1.0F - y_125655;
            float x_125657 = tmp2_125656 * tmp2_125656;
            float tmp3_125658 = tmp2_125656 * x_125657;
            float w_j_125659 = defunc_0_f_res_125648 * tmp3_125658;
            float defunc_1_op_res_125660 = w_j_125659 + redout_125642;
            float redout_tmp_125688 = defunc_1_op_res_125660;
            
            redout_125642 = redout_tmp_125688;
        }
        defunc_2_reduce_res_125589 = redout_125642;
        
        float a0_125610 = 1.0F / defunc_2_reduce_res_125589;
        float defunc_2_reduce_res_125611;
        float redout_125662 = 0.0F;
        
        for (int64_t i_125661 = 0; i_125661 < l_window_114538; i_125661++) {
            bool cond_125663 = sle64(x_117804, i_125661);
            float defunc_0_f_res_125664;
            
            if (cond_125663) {
                defunc_0_f_res_125664 = 0.0F;
            } else {
                int64_t i_125665 = add64(x_125584, i_125661);
                float x_125666 = ((float *) mem_122004.mem)[gtid_117734 *
                                                            n_114534 +
                                                            i_125665];
                float defunc_0_f_res_f_res_125667 = 1.0F + x_125666;
                
                defunc_0_f_res_125664 = defunc_0_f_res_f_res_125667;
            }
            
            float defunc_0_f_res_125668;
            
            if (cond_125663) {
                defunc_0_f_res_125668 = 0.0F;
            } else {
                int64_t i_125669 = add64(x_125584, i_125661);
                float x_125670 = ((float *) mem_122430.mem)[gtid_117734 *
                                                            n_114534 +
                                                            i_125669];
                
                defunc_0_f_res_125668 = x_125670;
            }
            
            float x_j_125671 = defunc_0_f_res_125664 - defunc_0_f_res_125588;
            float abs_res_125672 = (float) fabs(x_j_125671);
            float tmp1_125673 = abs_res_125672 / x_125585;
            float x_125674 = tmp1_125673 * tmp1_125673;
            float y_125675 = tmp1_125673 * x_125674;
            float tmp2_125676 = 1.0F - y_125675;
            float x_125677 = tmp2_125676 * tmp2_125676;
            float tmp3_125678 = tmp2_125676 * x_125677;
            float tmp4_125679 = defunc_0_f_res_125668 * tmp3_125678;
            float defunc_0_f_res_125680;
            
            if (cond_125663) {
                defunc_0_f_res_125680 = 0.0F;
            } else {
                int64_t i_125681 = add64(x_125584, i_125661);
                float x_125682 = ((float *) mem_122426.mem)[gtid_117734 *
                                                            n_114534 +
                                                            i_125681];
                
                defunc_0_f_res_125680 = x_125682;
            }
            
            float x_125683 = a0_125610 * tmp4_125679;
            float defunc_9_fit_fun_res_125684 = defunc_0_f_res_125680 *
                  x_125683;
            float defunc_1_op_res_125685 = defunc_9_fit_fun_res_125684 +
                  redout_125662;
            float redout_tmp_125689 = defunc_1_op_res_125685;
            
            redout_125662 = redout_tmp_125689;
        }
        defunc_2_reduce_res_125611 = redout_125662;
        ((float *) mem_122437.mem)[gtid_117736] = defunc_2_reduce_res_125611;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131380_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131380_end -
                 futhark_mc_segmap_parloop_131380_start;
        
        ctx->futhark_mc_segmap_parloop_131380_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131380_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131380_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131378(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117735 = tid;
    int num_tasks_125639 = info.nsubtasks;
    struct futhark_mc_task_131377 *futhark_mc_task_131377 =
                                  (struct futhark_mc_task_131377 *) args;
    struct futhark_context *ctx = futhark_mc_task_131377->ctx;
    uint64_t futhark_mc_segmap_task_131378_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131378_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131377->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131377->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131377->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131377->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131377->free_i_114610;
    int64_t gtid_117734 = futhark_mc_task_131377->free_gtid_117734;
    int64_t x_117804 = futhark_mc_task_131377->free_x_117804;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131377->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131377->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131377->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131377->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131377->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122437 = {.desc ="mem_122437", .mem =
                                  futhark_mc_task_131377->free_mem_122437,
                                  .size =0, .references =NULL};
    int64_t iter_125640;
    struct futhark_mc_segmap_parloop_struct_131379
    futhark_mc_segmap_parloop_struct_131379;
    
    futhark_mc_segmap_parloop_struct_131379.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131379.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131379.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131379.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131379.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131379.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131379.free_gtid_117734 = gtid_117734;
    futhark_mc_segmap_parloop_struct_131379.free_x_117804 = x_117804;
    futhark_mc_segmap_parloop_struct_131379.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131379.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131379.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131379.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131379.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131379.free_mem_122437 = mem_122437.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131380_task;
    
    futhark_mc_segmap_parloop_131380_task.name =
        "futhark_mc_segmap_parloop_131380";
    futhark_mc_segmap_parloop_131380_task.fn = futhark_mc_segmap_parloop_131380;
    futhark_mc_segmap_parloop_131380_task.args =
        &futhark_mc_segmap_parloop_struct_131379;
    futhark_mc_segmap_parloop_131380_task.iterations = iterations;
    futhark_mc_segmap_parloop_131380_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131380_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131380_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131380_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131380_task);
    
    if (futhark_mc_segmap_parloop_131380_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131380_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131380_total_end -
                 futhark_mc_segmap_parloop_131380_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131380_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131380_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131380_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131378_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131378_end -
                 futhark_mc_segmap_task_131378_start;
        
        ctx->futhark_mc_segmap_task_131378_runs[tid]++;
        ctx->futhark_mc_segmap_task_131378_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131378_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131382 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_117734;
    int64_t free_x_117804;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122437;
};
struct futhark_mc_task_131384 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_117734;
    int64_t free_x_117804;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_125531;
    float free_x_125532;
    float free_defunc_0_f_res_125535;
    float *retval_defunc_2_reduce_res_125536;
};
struct futhark_mc_segred_stage_1_parloop_struct_131387 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_117734;
    int64_t free_x_117804;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_125531;
    float free_x_125532;
    float free_defunc_0_f_res_125535;
    char *free_reduce_stage_1_tid_res_arr_mem_125739;
};
static int futhark_mc_segred_stage_1_parloop_131388(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_117739,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131387
    *futhark_mc_segred_stage_1_parloop_struct_131387 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131387 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131387->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131388_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131388_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131387->free_n_114534;
    int64_t gtid_117734 =
            futhark_mc_segred_stage_1_parloop_struct_131387->free_gtid_117734;
    int64_t x_117804 =
            futhark_mc_segred_stage_1_parloop_struct_131387->free_x_117804;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131387->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131387->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_125531 =
            futhark_mc_segred_stage_1_parloop_struct_131387->free_x_125531;
    float x_125532 =
          futhark_mc_segred_stage_1_parloop_struct_131387->free_x_125532;
    float defunc_0_f_res_125535 =
          futhark_mc_segred_stage_1_parloop_struct_131387->free_defunc_0_f_res_125535;
    struct memblock reduce_stage_1_tid_res_arr_mem_125739 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_125739",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131387->free_reduce_stage_1_tid_res_arr_mem_125739,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125741 = start;
    float x_125691;
    float x_125692;
    float local_acc_125742 = 0.0F;
    
    for (; iter_125741 < end; iter_125741++) {
        int64_t gtid_117740 = iter_125741;
        bool cond_125694 = sle64(x_117804, gtid_117740);
        float defunc_0_f_res_125695;
        
        if (cond_125694) {
            defunc_0_f_res_125695 = 0.0F;
        } else {
            int64_t i_125696 = add64(gtid_117740, x_125531);
            float x_125697 = ((float *) mem_122004.mem)[gtid_117734 * n_114534 +
                                                        i_125696];
            float defunc_0_f_res_f_res_125698 = 1.0F + x_125697;
            
            defunc_0_f_res_125695 = defunc_0_f_res_f_res_125698;
        }
        
        float defunc_0_f_res_125699;
        
        if (cond_125694) {
            defunc_0_f_res_125699 = 0.0F;
        } else {
            int64_t i_125700 = add64(gtid_117740, x_125531);
            float x_125701 = ((float *) mem_122430.mem)[gtid_117734 * n_114534 +
                                                        i_125700];
            
            defunc_0_f_res_125699 = x_125701;
        }
        
        float x_j_125702 = defunc_0_f_res_125695 - defunc_0_f_res_125535;
        float abs_res_125703 = (float) fabs(x_j_125702);
        float tmp1_125704 = abs_res_125703 / x_125532;
        float x_125705 = tmp1_125704 * tmp1_125704;
        float y_125706 = tmp1_125704 * x_125705;
        float tmp2_125707 = 1.0F - y_125706;
        float x_125708 = tmp2_125707 * tmp2_125707;
        float tmp3_125709 = tmp2_125707 * x_125708;
        float w_j_125710 = defunc_0_f_res_125699 * tmp3_125709;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_125691 = local_acc_125742;
        }
        // Load next params
        {
            x_125692 = w_j_125710;
        }
        // Red body
        {
            float defunc_1_op_res_125693 = x_125691 + x_125692;
            
            local_acc_125742 = defunc_1_op_res_125693;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_125739.mem)[flat_tid_117739] =
        local_acc_125742;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131388_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131388_end -
                 futhark_mc_segred_stage_1_parloop_131388_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131388_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131388_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131388_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131385(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117739 = tid;
    int num_tasks_125738 = info.nsubtasks;
    struct futhark_mc_task_131384 *futhark_mc_task_131384 =
                                  (struct futhark_mc_task_131384 *) args;
    struct futhark_context *ctx = futhark_mc_task_131384->ctx;
    uint64_t futhark_mc_segred_task_131385_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131385_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131384->free_n_114534;
    int64_t gtid_117734 = futhark_mc_task_131384->free_gtid_117734;
    int64_t x_117804 = futhark_mc_task_131384->free_x_117804;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131384->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131384->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_125531 = futhark_mc_task_131384->free_x_125531;
    float x_125532 = futhark_mc_task_131384->free_x_125532;
    float defunc_0_f_res_125535 =
          futhark_mc_task_131384->free_defunc_0_f_res_125535;
    float defunc_2_reduce_res_125536 =
          *futhark_mc_task_131384->retval_defunc_2_reduce_res_125536;
    size_t reduce_stage_1_tid_res_arr_mem_125739_cached_sizze_131386 = 0;
    char *reduce_stage_1_tid_res_arr_mem_125739 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_125739_cached_sizze_131386 <
        (size_t) ((int64_t) 4 * num_tasks_125738)) {
        reduce_stage_1_tid_res_arr_mem_125739 =
            realloc(reduce_stage_1_tid_res_arr_mem_125739, (int64_t) 4 *
                    num_tasks_125738);
        reduce_stage_1_tid_res_arr_mem_125739_cached_sizze_131386 =
            (int64_t) 4 * num_tasks_125738;
    }
    
    int64_t iter_125741;
    struct futhark_mc_segred_stage_1_parloop_struct_131387
    futhark_mc_segred_stage_1_parloop_struct_131387;
    
    futhark_mc_segred_stage_1_parloop_struct_131387.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131387.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131387.free_gtid_117734 =
        gtid_117734;
    futhark_mc_segred_stage_1_parloop_struct_131387.free_x_117804 = x_117804;
    futhark_mc_segred_stage_1_parloop_struct_131387.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131387.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131387.free_x_125531 = x_125531;
    futhark_mc_segred_stage_1_parloop_struct_131387.free_x_125532 = x_125532;
    futhark_mc_segred_stage_1_parloop_struct_131387.free_defunc_0_f_res_125535 =
        defunc_0_f_res_125535;
    futhark_mc_segred_stage_1_parloop_struct_131387.free_reduce_stage_1_tid_res_arr_mem_125739 =
        reduce_stage_1_tid_res_arr_mem_125739;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131388_task;
    
    futhark_mc_segred_stage_1_parloop_131388_task.name =
        "futhark_mc_segred_stage_1_parloop_131388";
    futhark_mc_segred_stage_1_parloop_131388_task.fn =
        futhark_mc_segred_stage_1_parloop_131388;
    futhark_mc_segred_stage_1_parloop_131388_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131387;
    futhark_mc_segred_stage_1_parloop_131388_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131388_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131388_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131388_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131388_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131388_task);
    
    if (futhark_mc_segred_stage_1_parloop_131388_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131388_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131388_total_end -
                 futhark_mc_segred_stage_1_parloop_131388_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131388_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131388_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131388_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_125536 = 0.0F;
    }
    
    float x_125743;
    float x_125744;
    
    for (int32_t i_125746 = 0; i_125746 < num_tasks_125738; i_125746++) {
        flat_tid_117739 = i_125746;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_125743 = defunc_2_reduce_res_125536;
            }
            // load next params
            {
                x_125744 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_125739)[flat_tid_117739];
            }
            // red body
            {
                float defunc_1_op_res_125745 = x_125743 + x_125744;
                
                defunc_2_reduce_res_125536 = defunc_1_op_res_125745;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_125739);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131385_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131385_end -
                 futhark_mc_segred_task_131385_start;
        
        ctx->futhark_mc_segred_task_131385_runs[tid]++;
        ctx->futhark_mc_segred_task_131385_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131385_iter[tid] += iterations;
    }
    *futhark_mc_task_131384->retval_defunc_2_reduce_res_125536 =
        defunc_2_reduce_res_125536;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131389 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_117734;
    int64_t free_x_117804;
    char *free_mem_122004;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_x_125531;
    float free_x_125532;
    float free_defunc_0_f_res_125535;
    float free_a0_125557;
    float *retval_defunc_2_reduce_res_125558;
};
struct futhark_mc_segred_stage_1_parloop_struct_131392 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_117734;
    int64_t free_x_117804;
    char *free_mem_122004;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_x_125531;
    float free_x_125532;
    float free_defunc_0_f_res_125535;
    float free_a0_125557;
    char *free_reduce_stage_1_tid_res_arr_mem_125748;
};
static int futhark_mc_segred_stage_1_parloop_131393(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_117741,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131392
    *futhark_mc_segred_stage_1_parloop_struct_131392 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131392 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131392->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131393_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131393_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131392->free_n_114534;
    int64_t gtid_117734 =
            futhark_mc_segred_stage_1_parloop_struct_131392->free_gtid_117734;
    int64_t x_117804 =
            futhark_mc_segred_stage_1_parloop_struct_131392->free_x_117804;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131392->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131392->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131392->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_125531 =
            futhark_mc_segred_stage_1_parloop_struct_131392->free_x_125531;
    float x_125532 =
          futhark_mc_segred_stage_1_parloop_struct_131392->free_x_125532;
    float defunc_0_f_res_125535 =
          futhark_mc_segred_stage_1_parloop_struct_131392->free_defunc_0_f_res_125535;
    float a0_125557 =
          futhark_mc_segred_stage_1_parloop_struct_131392->free_a0_125557;
    struct memblock reduce_stage_1_tid_res_arr_mem_125748 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_125748",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131392->free_reduce_stage_1_tid_res_arr_mem_125748,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125750 = start;
    float x_125711;
    float x_125712;
    float local_acc_125751 = 0.0F;
    
    for (; iter_125750 < end; iter_125750++) {
        int64_t gtid_117742 = iter_125750;
        bool cond_125714 = sle64(x_117804, gtid_117742);
        float defunc_0_f_res_125715;
        
        if (cond_125714) {
            defunc_0_f_res_125715 = 0.0F;
        } else {
            int64_t i_125716 = add64(gtid_117742, x_125531);
            float x_125717 = ((float *) mem_122004.mem)[gtid_117734 * n_114534 +
                                                        i_125716];
            float defunc_0_f_res_f_res_125718 = 1.0F + x_125717;
            
            defunc_0_f_res_125715 = defunc_0_f_res_f_res_125718;
        }
        
        float defunc_0_f_res_125719;
        
        if (cond_125714) {
            defunc_0_f_res_125719 = 0.0F;
        } else {
            int64_t i_125720 = add64(gtid_117742, x_125531);
            float x_125721 = ((float *) mem_122430.mem)[gtid_117734 * n_114534 +
                                                        i_125720];
            
            defunc_0_f_res_125719 = x_125721;
        }
        
        float x_j_125722 = defunc_0_f_res_125715 - defunc_0_f_res_125535;
        float abs_res_125723 = (float) fabs(x_j_125722);
        float tmp1_125724 = abs_res_125723 / x_125532;
        float x_125725 = tmp1_125724 * tmp1_125724;
        float y_125726 = tmp1_125724 * x_125725;
        float tmp2_125727 = 1.0F - y_125726;
        float x_125728 = tmp2_125727 * tmp2_125727;
        float tmp3_125729 = tmp2_125727 * x_125728;
        float tmp4_125730 = defunc_0_f_res_125719 * tmp3_125729;
        float defunc_0_f_res_125731;
        
        if (cond_125714) {
            defunc_0_f_res_125731 = 0.0F;
        } else {
            int64_t i_125732 = add64(gtid_117742, x_125531);
            float x_125733 = ((float *) mem_122426.mem)[gtid_117734 * n_114534 +
                                                        i_125732];
            
            defunc_0_f_res_125731 = x_125733;
        }
        
        float x_125734 = a0_125557 * tmp4_125730;
        float defunc_9_fit_fun_res_125735 = defunc_0_f_res_125731 * x_125734;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_125711 = local_acc_125751;
        }
        // Load next params
        {
            x_125712 = defunc_9_fit_fun_res_125735;
        }
        // Red body
        {
            float defunc_1_op_res_125713 = x_125711 + x_125712;
            
            local_acc_125751 = defunc_1_op_res_125713;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_125748.mem)[flat_tid_117741] =
        local_acc_125751;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131393_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131393_end -
                 futhark_mc_segred_stage_1_parloop_131393_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131393_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131393_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131393_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131390(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117741 = tid;
    int num_tasks_125747 = info.nsubtasks;
    struct futhark_mc_task_131389 *futhark_mc_task_131389 =
                                  (struct futhark_mc_task_131389 *) args;
    struct futhark_context *ctx = futhark_mc_task_131389->ctx;
    uint64_t futhark_mc_segred_task_131390_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131390_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131389->free_n_114534;
    int64_t gtid_117734 = futhark_mc_task_131389->free_gtid_117734;
    int64_t x_117804 = futhark_mc_task_131389->free_x_117804;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131389->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131389->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131389->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_125531 = futhark_mc_task_131389->free_x_125531;
    float x_125532 = futhark_mc_task_131389->free_x_125532;
    float defunc_0_f_res_125535 =
          futhark_mc_task_131389->free_defunc_0_f_res_125535;
    float a0_125557 = futhark_mc_task_131389->free_a0_125557;
    float defunc_2_reduce_res_125558 =
          *futhark_mc_task_131389->retval_defunc_2_reduce_res_125558;
    size_t reduce_stage_1_tid_res_arr_mem_125748_cached_sizze_131391 = 0;
    char *reduce_stage_1_tid_res_arr_mem_125748 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_125748_cached_sizze_131391 <
        (size_t) ((int64_t) 4 * num_tasks_125747)) {
        reduce_stage_1_tid_res_arr_mem_125748 =
            realloc(reduce_stage_1_tid_res_arr_mem_125748, (int64_t) 4 *
                    num_tasks_125747);
        reduce_stage_1_tid_res_arr_mem_125748_cached_sizze_131391 =
            (int64_t) 4 * num_tasks_125747;
    }
    
    int64_t iter_125750;
    struct futhark_mc_segred_stage_1_parloop_struct_131392
    futhark_mc_segred_stage_1_parloop_struct_131392;
    
    futhark_mc_segred_stage_1_parloop_struct_131392.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131392.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131392.free_gtid_117734 =
        gtid_117734;
    futhark_mc_segred_stage_1_parloop_struct_131392.free_x_117804 = x_117804;
    futhark_mc_segred_stage_1_parloop_struct_131392.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131392.free_mem_122426 =
        mem_122426.mem;
    futhark_mc_segred_stage_1_parloop_struct_131392.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131392.free_x_125531 = x_125531;
    futhark_mc_segred_stage_1_parloop_struct_131392.free_x_125532 = x_125532;
    futhark_mc_segred_stage_1_parloop_struct_131392.free_defunc_0_f_res_125535 =
        defunc_0_f_res_125535;
    futhark_mc_segred_stage_1_parloop_struct_131392.free_a0_125557 = a0_125557;
    futhark_mc_segred_stage_1_parloop_struct_131392.free_reduce_stage_1_tid_res_arr_mem_125748 =
        reduce_stage_1_tid_res_arr_mem_125748;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131393_task;
    
    futhark_mc_segred_stage_1_parloop_131393_task.name =
        "futhark_mc_segred_stage_1_parloop_131393";
    futhark_mc_segred_stage_1_parloop_131393_task.fn =
        futhark_mc_segred_stage_1_parloop_131393;
    futhark_mc_segred_stage_1_parloop_131393_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131392;
    futhark_mc_segred_stage_1_parloop_131393_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131393_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131393_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131393_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131393_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131393_task);
    
    if (futhark_mc_segred_stage_1_parloop_131393_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131393_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131393_total_end -
                 futhark_mc_segred_stage_1_parloop_131393_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131393_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131393_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131393_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_125558 = 0.0F;
    }
    
    float x_125752;
    float x_125753;
    
    for (int32_t i_125755 = 0; i_125755 < num_tasks_125747; i_125755++) {
        flat_tid_117741 = i_125755;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_125752 = defunc_2_reduce_res_125558;
            }
            // load next params
            {
                x_125753 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_125748)[flat_tid_117741];
            }
            // red body
            {
                float defunc_1_op_res_125754 = x_125752 + x_125753;
                
                defunc_2_reduce_res_125558 = defunc_1_op_res_125754;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_125748);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131390_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131390_end -
                 futhark_mc_segred_task_131390_start;
        
        ctx->futhark_mc_segred_task_131390_runs[tid]++;
        ctx->futhark_mc_segred_task_131390_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131390_iter[tid] += iterations;
    }
    *futhark_mc_task_131389->retval_defunc_2_reduce_res_125558 =
        defunc_2_reduce_res_125558;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131383(void *args, int64_t start,
                                            int64_t end, int flat_tid_117737,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131382
    *futhark_mc_segmap_parloop_struct_131382 =
    (struct futhark_mc_segmap_parloop_struct_131382 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131382->ctx;
    uint64_t futhark_mc_segmap_parloop_131383_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131383_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131382->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131382->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131382->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131382->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131382->free_i_114610;
    int64_t gtid_117734 =
            futhark_mc_segmap_parloop_struct_131382->free_gtid_117734;
    int64_t x_117804 = futhark_mc_segmap_parloop_struct_131382->free_x_117804;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131382->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131382->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131382->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131382->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131382->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122437 = {.desc ="mem_122437", .mem =
                                  futhark_mc_segmap_parloop_struct_131382->free_mem_122437,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_125690 = start;
    
    for (; iter_125690 < end; iter_125690++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125736 = l_n_m_114584;
        int64_t gtid_117738 = iter_125690;
        int64_t remnant_125737 = iter_125690 - gtid_117738;
        int64_t x_125531 = ((int64_t *) mem_122124.mem)[gtid_117734 *
                                                        l_n_m_114584 +
                                                        gtid_117738];
        float x_125532 = ((float *) mem_122128.mem)[gtid_117734 * l_n_m_114584 +
                                                    gtid_117738];
        int64_t min_arg_125533 = mul64(t_jump_114541, gtid_117738);
        int64_t min_res_125534 = smin64(i_114610, min_arg_125533);
        float defunc_0_f_res_125535 = sitofp_i64_f32(min_res_125534);
        float defunc_2_reduce_res_125536;
        int64_t flat_tid_117739 = (int64_t) 0;
        int32_t num_tasks_125738;
        struct futhark_mc_task_131384 futhark_mc_task_131384;
        
        futhark_mc_task_131384.ctx = ctx;
        futhark_mc_task_131384.free_n_114534 = n_114534;
        futhark_mc_task_131384.free_gtid_117734 = gtid_117734;
        futhark_mc_task_131384.free_x_117804 = x_117804;
        futhark_mc_task_131384.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131384.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131384.free_x_125531 = x_125531;
        futhark_mc_task_131384.free_x_125532 = x_125532;
        futhark_mc_task_131384.free_defunc_0_f_res_125535 =
            defunc_0_f_res_125535;
        futhark_mc_task_131384.retval_defunc_2_reduce_res_125536 =
            &defunc_2_reduce_res_125536;
        
        struct scheduler_segop futhark_mc_task_131384_task;
        
        futhark_mc_task_131384_task.args = &futhark_mc_task_131384;
        futhark_mc_task_131384_task.top_level_fn =
            futhark_mc_segred_task_131385;
        futhark_mc_task_131384_task.name = "futhark_mc_segred_task_131385";
        futhark_mc_task_131384_task.iterations = l_window_114538;
        futhark_mc_task_131384_task.task_time =
            &ctx->futhark_mc_segred_task_131385_total_time;
        futhark_mc_task_131384_task.task_iter =
            &ctx->futhark_mc_segred_task_131385_total_iter;
        futhark_mc_task_131384_task.sched = STATIC;
        futhark_mc_task_131384_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131385_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131384_task);
        
        if (futhark_mc_segred_task_131385_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float a0_125557 = 1.0F / defunc_2_reduce_res_125536;
        float defunc_2_reduce_res_125558;
        int64_t flat_tid_117741 = (int64_t) 0;
        int32_t num_tasks_125747;
        struct futhark_mc_task_131389 futhark_mc_task_131389;
        
        futhark_mc_task_131389.ctx = ctx;
        futhark_mc_task_131389.free_n_114534 = n_114534;
        futhark_mc_task_131389.free_gtid_117734 = gtid_117734;
        futhark_mc_task_131389.free_x_117804 = x_117804;
        futhark_mc_task_131389.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131389.free_mem_122426 = mem_122426.mem;
        futhark_mc_task_131389.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131389.free_x_125531 = x_125531;
        futhark_mc_task_131389.free_x_125532 = x_125532;
        futhark_mc_task_131389.free_defunc_0_f_res_125535 =
            defunc_0_f_res_125535;
        futhark_mc_task_131389.free_a0_125557 = a0_125557;
        futhark_mc_task_131389.retval_defunc_2_reduce_res_125558 =
            &defunc_2_reduce_res_125558;
        
        struct scheduler_segop futhark_mc_task_131389_task;
        
        futhark_mc_task_131389_task.args = &futhark_mc_task_131389;
        futhark_mc_task_131389_task.top_level_fn =
            futhark_mc_segred_task_131390;
        futhark_mc_task_131389_task.name = "futhark_mc_segred_task_131390";
        futhark_mc_task_131389_task.iterations = l_window_114538;
        futhark_mc_task_131389_task.task_time =
            &ctx->futhark_mc_segred_task_131390_total_time;
        futhark_mc_task_131389_task.task_iter =
            &ctx->futhark_mc_segred_task_131390_total_iter;
        futhark_mc_task_131389_task.sched = STATIC;
        futhark_mc_task_131389_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131390_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131389_task);
        
        if (futhark_mc_segred_task_131390_err != 0) {
            err = 1;
            goto cleanup;
        }
        ((float *) mem_122437.mem)[gtid_117738] = defunc_2_reduce_res_125558;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131383_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131383_end -
                 futhark_mc_segmap_parloop_131383_start;
        
        ctx->futhark_mc_segmap_parloop_131383_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131383_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131383_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131381(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117737 = tid;
    int num_tasks_125639 = info.nsubtasks;
    struct futhark_mc_task_131377 *futhark_mc_task_131377 =
                                  (struct futhark_mc_task_131377 *) args;
    struct futhark_context *ctx = futhark_mc_task_131377->ctx;
    uint64_t futhark_mc_segmap_nested_task_131381_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131381_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131377->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131377->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131377->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131377->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131377->free_i_114610;
    int64_t gtid_117734 = futhark_mc_task_131377->free_gtid_117734;
    int64_t x_117804 = futhark_mc_task_131377->free_x_117804;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131377->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131377->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131377->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131377->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131377->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122437 = {.desc ="mem_122437", .mem =
                                  futhark_mc_task_131377->free_mem_122437,
                                  .size =0, .references =NULL};
    int64_t iter_125690;
    struct futhark_mc_segmap_parloop_struct_131382
    futhark_mc_segmap_parloop_struct_131382;
    
    futhark_mc_segmap_parloop_struct_131382.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131382.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131382.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131382.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131382.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131382.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131382.free_gtid_117734 = gtid_117734;
    futhark_mc_segmap_parloop_struct_131382.free_x_117804 = x_117804;
    futhark_mc_segmap_parloop_struct_131382.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131382.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131382.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131382.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131382.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131382.free_mem_122437 = mem_122437.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131383_task;
    
    futhark_mc_segmap_parloop_131383_task.name =
        "futhark_mc_segmap_parloop_131383";
    futhark_mc_segmap_parloop_131383_task.fn = futhark_mc_segmap_parloop_131383;
    futhark_mc_segmap_parloop_131383_task.args =
        &futhark_mc_segmap_parloop_struct_131382;
    futhark_mc_segmap_parloop_131383_task.iterations = iterations;
    futhark_mc_segmap_parloop_131383_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131383_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131383_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131383_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131383_task);
    
    if (futhark_mc_segmap_parloop_131383_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131383_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131383_total_end -
                 futhark_mc_segmap_parloop_131383_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131383_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131383_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131383_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131381_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131381_end -
                 futhark_mc_segmap_nested_task_131381_start;
        
        ctx->futhark_mc_segmap_nested_task_131381_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131381_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131381_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131375(void *args, int64_t start,
                                            int64_t end, int flat_tid_117733,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131374
    *futhark_mc_segmap_parloop_struct_131374 =
    (struct futhark_mc_segmap_parloop_struct_131374 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131374->ctx;
    uint64_t futhark_mc_segmap_parloop_131375_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131375_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131374->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131374->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131374->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131374->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131374->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131374->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131374->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131374->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131374->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131374->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131374->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131374->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131374->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122456 = {.desc ="mem_122456", .mem =
                                  futhark_mc_segmap_parloop_struct_131374->free_mem_122456,
                                  .size =0, .references =NULL};
    size_t mem_122437_cached_sizze_131376 = 0;
    char *mem_122437 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125530 = start;
    
    if (mem_122437_cached_sizze_131376 < (size_t) bytes_122055) {
        mem_122437 = realloc(mem_122437, bytes_122055);
        mem_122437_cached_sizze_131376 = bytes_122055;
    }
    for (; iter_125530 < end; iter_125530++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125637 = m_114533;
        int64_t gtid_117734 = iter_125530;
        int64_t remnant_125638 = iter_125530 - gtid_117734;
        int64_t x_117804 = ((int64_t *) mem_121982.mem)[gtid_117734];
        int64_t flat_tid_117735 = (int64_t) 0;
        int32_t num_tasks_125639;
        int64_t flat_tid_117737 = (int64_t) 0;
        struct futhark_mc_task_131377 futhark_mc_task_131377;
        
        futhark_mc_task_131377.ctx = ctx;
        futhark_mc_task_131377.free_n_114534 = n_114534;
        futhark_mc_task_131377.free_l_window_114538 = l_window_114538;
        futhark_mc_task_131377.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131377.free_l_n_m_114584 = l_n_m_114584;
        futhark_mc_task_131377.free_i_114610 = i_114610;
        futhark_mc_task_131377.free_gtid_117734 = gtid_117734;
        futhark_mc_task_131377.free_x_117804 = x_117804;
        futhark_mc_task_131377.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131377.free_mem_122124 = mem_122124.mem;
        futhark_mc_task_131377.free_mem_122128 = mem_122128.mem;
        futhark_mc_task_131377.free_mem_122426 = mem_122426.mem;
        futhark_mc_task_131377.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131377.free_mem_122437 = mem_122437;
        
        struct scheduler_segop futhark_mc_task_131377_task;
        
        futhark_mc_task_131377_task.args = &futhark_mc_task_131377;
        futhark_mc_task_131377_task.top_level_fn =
            futhark_mc_segmap_task_131378;
        futhark_mc_task_131377_task.name = "futhark_mc_segmap_task_131378";
        futhark_mc_task_131377_task.iterations = l_n_m_114584;
        futhark_mc_task_131377_task.task_time =
            &ctx->futhark_mc_segmap_task_131378_total_time;
        futhark_mc_task_131377_task.task_iter =
            &ctx->futhark_mc_segmap_task_131378_total_iter;
        futhark_mc_task_131377_task.sched = STATIC;
        futhark_mc_task_131377_task.nested_fn =
            futhark_mc_segmap_nested_task_131381;
        
        int futhark_mc_segmap_task_131378_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131377_task);
        
        if (futhark_mc_segmap_task_131378_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122456.mem + gtid_117734 * l_n_m_114584 * (int64_t) 4,
                mem_122437 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122437);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131375_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131375_end -
                 futhark_mc_segmap_parloop_131375_start;
        
        ctx->futhark_mc_segmap_parloop_131375_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131375_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131375_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131373(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117733 = tid;
    int num_tasks_125467 = info.nsubtasks;
    struct futhark_mc_task_131368 *futhark_mc_task_131368 =
                                  (struct futhark_mc_task_131368 *) args;
    struct futhark_context *ctx = futhark_mc_task_131368->ctx;
    uint64_t futhark_mc_segmap_nested_task_131373_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131373_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131368->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131368->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131368->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131368->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131368->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131368->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131368->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131368->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131368->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131368->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131368->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131368->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131368->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122456 = {.desc ="mem_122456", .mem =
                                  futhark_mc_task_131368->free_mem_122456,
                                  .size =0, .references =NULL};
    int64_t iter_125530;
    struct futhark_mc_segmap_parloop_struct_131374
    futhark_mc_segmap_parloop_struct_131374;
    
    futhark_mc_segmap_parloop_struct_131374.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131374.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131374.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131374.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131374.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131374.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131374.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131374.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131374.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131374.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131374.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131374.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131374.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131374.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131374.free_mem_122456 = mem_122456.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131375_task;
    
    futhark_mc_segmap_parloop_131375_task.name =
        "futhark_mc_segmap_parloop_131375";
    futhark_mc_segmap_parloop_131375_task.fn = futhark_mc_segmap_parloop_131375;
    futhark_mc_segmap_parloop_131375_task.args =
        &futhark_mc_segmap_parloop_struct_131374;
    futhark_mc_segmap_parloop_131375_task.iterations = iterations;
    futhark_mc_segmap_parloop_131375_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131375_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131375_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131375_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131375_task);
    
    if (futhark_mc_segmap_parloop_131375_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131375_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131375_total_end -
                 futhark_mc_segmap_parloop_131375_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131375_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131375_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131375_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131373_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131373_end -
                 futhark_mc_segmap_nested_task_131373_start;
        
        ctx->futhark_mc_segmap_nested_task_131373_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131373_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131373_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131394 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122496;
    char *free_mem_122500;
};
struct futhark_mc_segmap_parloop_struct_131396 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122496;
    char *free_mem_122500;
};
static int futhark_mc_segmap_parloop_131397(void *args, int64_t start,
                                            int64_t end, int flat_tid_117918,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131396
    *futhark_mc_segmap_parloop_struct_131396 =
    (struct futhark_mc_segmap_parloop_struct_131396 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131396->ctx;
    uint64_t futhark_mc_segmap_parloop_131397_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131397_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131396->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131396->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131396->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131396->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131396->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131396->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131396->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131396->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131396->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131396->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131396->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131396->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131396->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122496 = {.desc ="mem_122496", .mem =
                                  futhark_mc_segmap_parloop_struct_131396->free_mem_122496,
                                  .size =0, .references =NULL};
    struct memblock mem_122500 = {.desc ="mem_122500", .mem =
                                  futhark_mc_segmap_parloop_struct_131396->free_mem_122500,
                                  .size =0, .references =NULL};
    size_t mem_122465_cached_sizze_131398 = 0;
    char *mem_122465 = NULL;
    size_t mem_122468_cached_sizze_131399 = 0;
    char *mem_122468 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125757 = start;
    
    if (mem_122465_cached_sizze_131398 < (size_t) bytes_122055) {
        mem_122465 = realloc(mem_122465, bytes_122055);
        mem_122465_cached_sizze_131398 = bytes_122055;
    }
    if (mem_122468_cached_sizze_131399 < (size_t) bytes_122055) {
        mem_122468 = realloc(mem_122468, bytes_122055);
        mem_122468_cached_sizze_131399 = bytes_122055;
    }
    for (; iter_125757 < end; iter_125757++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_125841 = m_114533;
        int64_t gtid_117919 = iter_125757;
        int64_t remnant_125842 = iter_125757 - gtid_117919;
        int64_t x_115268 = ((int64_t *) mem_121982.mem)[gtid_117919];
        
        for (int64_t i_125758 = 0; i_125758 < l_n_m_114584; i_125758++) {
            int64_t x_125761 = ((int64_t *) mem_122124.mem)[gtid_117919 *
                                                            l_n_m_114584 +
                                                            i_125758];
            float x_125762 = ((float *) mem_122128.mem)[gtid_117919 *
                                                        l_n_m_114584 +
                                                        i_125758];
            int64_t min_arg_125763 = mul64(t_jump_114541, i_125758);
            int64_t min_res_125764 = smin64(i_114610, min_arg_125763);
            float defunc_0_f_res_125765 = sitofp_i64_f32(min_res_125764);
            float defunc_2_reduce_res_125766;
            float defunc_2_reduce_res_125767;
            float defunc_2_reduce_res_125768;
            float redout_125770;
            float redout_125771;
            float redout_125772;
            
            redout_125770 = 0.0F;
            redout_125771 = 0.0F;
            redout_125772 = 0.0F;
            for (int64_t i_125769 = 0; i_125769 < l_window_114538; i_125769++) {
                bool cond_125773 = sle64(x_115268, i_125769);
                float defunc_0_f_res_125774;
                
                if (cond_125773) {
                    defunc_0_f_res_125774 = 0.0F;
                } else {
                    int64_t i_125775 = add64(x_125761, i_125769);
                    float x_125776 = ((float *) mem_122004.mem)[gtid_117919 *
                                                                n_114534 +
                                                                i_125775];
                    float defunc_0_f_res_f_res_125777 = 1.0F + x_125776;
                    
                    defunc_0_f_res_125774 = defunc_0_f_res_f_res_125777;
                }
                
                float defunc_0_f_res_125778;
                
                if (cond_125773) {
                    defunc_0_f_res_125778 = 0.0F;
                } else {
                    int64_t i_125779 = add64(x_125761, i_125769);
                    float x_125780 = ((float *) mem_122430.mem)[gtid_117919 *
                                                                n_114534 +
                                                                i_125779];
                    
                    defunc_0_f_res_125778 = x_125780;
                }
                
                float x_j_125781 = defunc_0_f_res_125774 -
                      defunc_0_f_res_125765;
                float abs_res_125782 = (float) fabs(x_j_125781);
                float tmp1_125783 = abs_res_125782 / x_125762;
                float x_125784 = tmp1_125783 * tmp1_125783;
                float y_125785 = tmp1_125783 * x_125784;
                float tmp2_125786 = 1.0F - y_125785;
                float x_125787 = tmp2_125786 * tmp2_125786;
                float tmp3_125788 = tmp2_125786 * x_125787;
                float w_j_125789 = defunc_0_f_res_125778 * tmp3_125788;
                float xw_j_125790 = x_j_125781 * w_j_125789;
                float x2w_j_125791 = x_j_125781 * xw_j_125790;
                float defunc_1_op_res_125792 = w_j_125789 + redout_125770;
                float defunc_1_op_res_125793 = xw_j_125790 + redout_125771;
                float defunc_1_op_res_125794 = x2w_j_125791 + redout_125772;
                float redout_tmp_125845 = defunc_1_op_res_125792;
                float redout_tmp_125846 = defunc_1_op_res_125793;
                float redout_tmp_125847 = defunc_1_op_res_125794;
                
                redout_125770 = redout_tmp_125845;
                redout_125771 = redout_tmp_125846;
                redout_125772 = redout_tmp_125847;
            }
            defunc_2_reduce_res_125766 = redout_125770;
            defunc_2_reduce_res_125767 = redout_125771;
            defunc_2_reduce_res_125768 = redout_125772;
            
            float x_125795 = defunc_2_reduce_res_125766 *
                  defunc_2_reduce_res_125768;
            float y_125796 = defunc_2_reduce_res_125767 *
                  defunc_2_reduce_res_125767;
            float y_125797 = x_125795 - y_125796;
            float det1_125798 = 1.0F / y_125797;
            float a11_125799 = defunc_2_reduce_res_125768 * det1_125798;
            float negate_arg_125800 = defunc_2_reduce_res_125767 * det1_125798;
            float b11_125801 = 0.0F - negate_arg_125800;
            float c11_125802 = defunc_2_reduce_res_125766 * det1_125798;
            float defunc_2_reduce_res_125803;
            float defunc_2_reduce_res_125804;
            float redout_125806;
            float redout_125807;
            
            redout_125806 = 0.0F;
            redout_125807 = 0.0F;
            for (int64_t i_125805 = 0; i_125805 < l_window_114538; i_125805++) {
                bool cond_125808 = sle64(x_115268, i_125805);
                float defunc_0_f_res_125809;
                
                if (cond_125808) {
                    defunc_0_f_res_125809 = 0.0F;
                } else {
                    int64_t i_125810 = add64(x_125761, i_125805);
                    float x_125811 = ((float *) mem_122004.mem)[gtid_117919 *
                                                                n_114534 +
                                                                i_125810];
                    float defunc_0_f_res_f_res_125812 = 1.0F + x_125811;
                    
                    defunc_0_f_res_125809 = defunc_0_f_res_f_res_125812;
                }
                
                float defunc_0_f_res_125813;
                
                if (cond_125808) {
                    defunc_0_f_res_125813 = 0.0F;
                } else {
                    int64_t i_125814 = add64(x_125761, i_125805);
                    float x_125815 = ((float *) mem_122430.mem)[gtid_117919 *
                                                                n_114534 +
                                                                i_125814];
                    
                    defunc_0_f_res_125813 = x_125815;
                }
                
                float x_j_125816 = defunc_0_f_res_125809 -
                      defunc_0_f_res_125765;
                float abs_res_125817 = (float) fabs(x_j_125816);
                float tmp1_125818 = abs_res_125817 / x_125762;
                float x_125819 = tmp1_125818 * tmp1_125818;
                float y_125820 = tmp1_125818 * x_125819;
                float tmp2_125821 = 1.0F - y_125820;
                float x_125822 = tmp2_125821 * tmp2_125821;
                float tmp3_125823 = tmp2_125821 * x_125822;
                float tmp4_125824 = defunc_0_f_res_125813 * tmp3_125823;
                float defunc_1_f_res_125825 = x_j_125816 * tmp4_125824;
                float defunc_0_f_res_125826;
                
                if (cond_125808) {
                    defunc_0_f_res_125826 = 0.0F;
                } else {
                    int64_t i_125827 = add64(x_125761, i_125805);
                    float x_125828 = ((float *) mem_122426.mem)[gtid_117919 *
                                                                n_114534 +
                                                                i_125827];
                    
                    defunc_0_f_res_125826 = x_125828;
                }
                
                float x_125829 = a11_125799 * tmp4_125824;
                float y_125830 = b11_125801 * defunc_1_f_res_125825;
                float x_125831 = x_125829 + y_125830;
                float defunc_9_fit_fun_res_125832 = defunc_0_f_res_125826 *
                      x_125831;
                float x_125833 = b11_125801 * tmp4_125824;
                float y_125834 = c11_125802 * defunc_1_f_res_125825;
                float x_125835 = x_125833 + y_125834;
                float defunc_9_slope_fun_res_125836 = defunc_0_f_res_125826 *
                      x_125835;
                float defunc_1_op_res_125837 = defunc_9_fit_fun_res_125832 +
                      redout_125806;
                float defunc_1_op_res_125838 = defunc_9_slope_fun_res_125836 +
                      redout_125807;
                float redout_tmp_125848 = defunc_1_op_res_125837;
                float redout_tmp_125849 = defunc_1_op_res_125838;
                
                redout_125806 = redout_tmp_125848;
                redout_125807 = redout_tmp_125849;
            }
            defunc_2_reduce_res_125803 = redout_125806;
            defunc_2_reduce_res_125804 = redout_125807;
            ((float *) mem_122465)[i_125758] = defunc_2_reduce_res_125803;
            ((float *) mem_122468)[i_125758] = defunc_2_reduce_res_125804;
        }
        memmove(mem_122496.mem + gtid_117919 * l_n_m_114584 * (int64_t) 4,
                mem_122465 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
        memmove(mem_122500.mem + gtid_117919 * l_n_m_114584 * (int64_t) 4,
                mem_122468 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122465);
    free(mem_122468);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131397_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131397_end -
                 futhark_mc_segmap_parloop_131397_start;
        
        ctx->futhark_mc_segmap_parloop_131397_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131397_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131397_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131395(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117918 = tid;
    int num_tasks_125756 = info.nsubtasks;
    struct futhark_mc_task_131394 *futhark_mc_task_131394 =
                                  (struct futhark_mc_task_131394 *) args;
    struct futhark_context *ctx = futhark_mc_task_131394->ctx;
    uint64_t futhark_mc_segmap_task_131395_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131395_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131394->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131394->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131394->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131394->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131394->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131394->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131394->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131394->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131394->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131394->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131394->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131394->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131394->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122496 = {.desc ="mem_122496", .mem =
                                  futhark_mc_task_131394->free_mem_122496,
                                  .size =0, .references =NULL};
    struct memblock mem_122500 = {.desc ="mem_122500", .mem =
                                  futhark_mc_task_131394->free_mem_122500,
                                  .size =0, .references =NULL};
    int64_t iter_125757;
    struct futhark_mc_segmap_parloop_struct_131396
    futhark_mc_segmap_parloop_struct_131396;
    
    futhark_mc_segmap_parloop_struct_131396.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131396.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131396.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131396.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131396.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131396.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131396.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131396.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131396.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131396.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131396.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131396.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131396.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131396.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131396.free_mem_122496 = mem_122496.mem;
    futhark_mc_segmap_parloop_struct_131396.free_mem_122500 = mem_122500.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131397_task;
    
    futhark_mc_segmap_parloop_131397_task.name =
        "futhark_mc_segmap_parloop_131397";
    futhark_mc_segmap_parloop_131397_task.fn = futhark_mc_segmap_parloop_131397;
    futhark_mc_segmap_parloop_131397_task.args =
        &futhark_mc_segmap_parloop_struct_131396;
    futhark_mc_segmap_parloop_131397_task.iterations = iterations;
    futhark_mc_segmap_parloop_131397_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131397_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131397_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131397_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131397_task);
    
    if (futhark_mc_segmap_parloop_131397_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131397_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131397_total_end -
                 futhark_mc_segmap_parloop_131397_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131397_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131397_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131397_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131395_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131395_end -
                 futhark_mc_segmap_task_131395_start;
        
        ctx->futhark_mc_segmap_task_131395_runs[tid]++;
        ctx->futhark_mc_segmap_task_131395_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131395_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131401 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122496;
    char *free_mem_122500;
};
struct futhark_mc_task_131405 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_117921;
    int64_t free_x_118019;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122459;
    char *free_mem_122462;
};
struct futhark_mc_segmap_parloop_struct_131407 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_117921;
    int64_t free_x_118019;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122459;
    char *free_mem_122462;
};
static int futhark_mc_segmap_parloop_131408(void *args, int64_t start,
                                            int64_t end, int flat_tid_117922,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131407
    *futhark_mc_segmap_parloop_struct_131407 =
    (struct futhark_mc_segmap_parloop_struct_131407 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131407->ctx;
    uint64_t futhark_mc_segmap_parloop_131408_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131408_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131407->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131407->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131407->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131407->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131407->free_i_114610;
    int64_t gtid_117921 =
            futhark_mc_segmap_parloop_struct_131407->free_gtid_117921;
    int64_t x_118019 = futhark_mc_segmap_parloop_struct_131407->free_x_118019;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131407->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131407->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131407->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131407->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131407->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122459 = {.desc ="mem_122459", .mem =
                                  futhark_mc_segmap_parloop_struct_131407->free_mem_122459,
                                  .size =0, .references =NULL};
    struct memblock mem_122462 = {.desc ="mem_122462", .mem =
                                  futhark_mc_segmap_parloop_struct_131407->free_mem_122462,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_126013 = start;
    
    for (; iter_126013 < end; iter_126013++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_126074 = l_n_m_114584;
        int64_t gtid_117923 = iter_126013;
        int64_t remnant_126075 = iter_126013 - gtid_117923;
        int64_t x_125932 = ((int64_t *) mem_122124.mem)[gtid_117921 *
                                                        l_n_m_114584 +
                                                        gtid_117923];
        float x_125933 = ((float *) mem_122128.mem)[gtid_117921 * l_n_m_114584 +
                                                    gtid_117923];
        int64_t min_arg_125934 = mul64(t_jump_114541, gtid_117923);
        int64_t min_res_125935 = smin64(i_114610, min_arg_125934);
        float defunc_0_f_res_125936 = sitofp_i64_f32(min_res_125935);
        float defunc_2_reduce_res_125937;
        float defunc_2_reduce_res_125938;
        float defunc_2_reduce_res_125939;
        float redout_126015;
        float redout_126016;
        float redout_126017;
        
        redout_126015 = 0.0F;
        redout_126016 = 0.0F;
        redout_126017 = 0.0F;
        for (int64_t i_126014 = 0; i_126014 < l_window_114538; i_126014++) {
            bool cond_126018 = sle64(x_118019, i_126014);
            float defunc_0_f_res_126019;
            
            if (cond_126018) {
                defunc_0_f_res_126019 = 0.0F;
            } else {
                int64_t i_126020 = add64(x_125932, i_126014);
                float x_126021 = ((float *) mem_122004.mem)[gtid_117921 *
                                                            n_114534 +
                                                            i_126020];
                float defunc_0_f_res_f_res_126022 = 1.0F + x_126021;
                
                defunc_0_f_res_126019 = defunc_0_f_res_f_res_126022;
            }
            
            float defunc_0_f_res_126023;
            
            if (cond_126018) {
                defunc_0_f_res_126023 = 0.0F;
            } else {
                int64_t i_126024 = add64(x_125932, i_126014);
                float x_126025 = ((float *) mem_122430.mem)[gtid_117921 *
                                                            n_114534 +
                                                            i_126024];
                
                defunc_0_f_res_126023 = x_126025;
            }
            
            float x_j_126026 = defunc_0_f_res_126019 - defunc_0_f_res_125936;
            float abs_res_126027 = (float) fabs(x_j_126026);
            float tmp1_126028 = abs_res_126027 / x_125933;
            float x_126029 = tmp1_126028 * tmp1_126028;
            float y_126030 = tmp1_126028 * x_126029;
            float tmp2_126031 = 1.0F - y_126030;
            float x_126032 = tmp2_126031 * tmp2_126031;
            float tmp3_126033 = tmp2_126031 * x_126032;
            float w_j_126034 = defunc_0_f_res_126023 * tmp3_126033;
            float xw_j_126035 = x_j_126026 * w_j_126034;
            float x2w_j_126036 = x_j_126026 * xw_j_126035;
            float defunc_1_op_res_126037 = w_j_126034 + redout_126015;
            float defunc_1_op_res_126038 = xw_j_126035 + redout_126016;
            float defunc_1_op_res_126039 = x2w_j_126036 + redout_126017;
            float redout_tmp_126076 = defunc_1_op_res_126037;
            float redout_tmp_126077 = defunc_1_op_res_126038;
            float redout_tmp_126078 = defunc_1_op_res_126039;
            
            redout_126015 = redout_tmp_126076;
            redout_126016 = redout_tmp_126077;
            redout_126017 = redout_tmp_126078;
        }
        defunc_2_reduce_res_125937 = redout_126015;
        defunc_2_reduce_res_125938 = redout_126016;
        defunc_2_reduce_res_125939 = redout_126017;
        
        float x_125966 = defunc_2_reduce_res_125937 *
              defunc_2_reduce_res_125939;
        float y_125967 = defunc_2_reduce_res_125938 *
              defunc_2_reduce_res_125938;
        float y_125968 = x_125966 - y_125967;
        float det1_125969 = 1.0F / y_125968;
        float a11_125970 = defunc_2_reduce_res_125939 * det1_125969;
        float negate_arg_125971 = defunc_2_reduce_res_125938 * det1_125969;
        float b11_125972 = 0.0F - negate_arg_125971;
        float c11_125973 = defunc_2_reduce_res_125937 * det1_125969;
        float defunc_2_reduce_res_125974;
        float defunc_2_reduce_res_125975;
        float redout_126041;
        float redout_126042;
        
        redout_126041 = 0.0F;
        redout_126042 = 0.0F;
        for (int64_t i_126040 = 0; i_126040 < l_window_114538; i_126040++) {
            bool cond_126043 = sle64(x_118019, i_126040);
            float defunc_0_f_res_126044;
            
            if (cond_126043) {
                defunc_0_f_res_126044 = 0.0F;
            } else {
                int64_t i_126045 = add64(x_125932, i_126040);
                float x_126046 = ((float *) mem_122004.mem)[gtid_117921 *
                                                            n_114534 +
                                                            i_126045];
                float defunc_0_f_res_f_res_126047 = 1.0F + x_126046;
                
                defunc_0_f_res_126044 = defunc_0_f_res_f_res_126047;
            }
            
            float defunc_0_f_res_126048;
            
            if (cond_126043) {
                defunc_0_f_res_126048 = 0.0F;
            } else {
                int64_t i_126049 = add64(x_125932, i_126040);
                float x_126050 = ((float *) mem_122430.mem)[gtid_117921 *
                                                            n_114534 +
                                                            i_126049];
                
                defunc_0_f_res_126048 = x_126050;
            }
            
            float x_j_126051 = defunc_0_f_res_126044 - defunc_0_f_res_125936;
            float abs_res_126052 = (float) fabs(x_j_126051);
            float tmp1_126053 = abs_res_126052 / x_125933;
            float x_126054 = tmp1_126053 * tmp1_126053;
            float y_126055 = tmp1_126053 * x_126054;
            float tmp2_126056 = 1.0F - y_126055;
            float x_126057 = tmp2_126056 * tmp2_126056;
            float tmp3_126058 = tmp2_126056 * x_126057;
            float tmp4_126059 = defunc_0_f_res_126048 * tmp3_126058;
            float defunc_1_f_res_126060 = x_j_126051 * tmp4_126059;
            float defunc_0_f_res_126061;
            
            if (cond_126043) {
                defunc_0_f_res_126061 = 0.0F;
            } else {
                int64_t i_126062 = add64(x_125932, i_126040);
                float x_126063 = ((float *) mem_122426.mem)[gtid_117921 *
                                                            n_114534 +
                                                            i_126062];
                
                defunc_0_f_res_126061 = x_126063;
            }
            
            float x_126064 = a11_125970 * tmp4_126059;
            float y_126065 = b11_125972 * defunc_1_f_res_126060;
            float x_126066 = x_126064 + y_126065;
            float defunc_9_fit_fun_res_126067 = defunc_0_f_res_126061 *
                  x_126066;
            float x_126068 = b11_125972 * tmp4_126059;
            float y_126069 = c11_125973 * defunc_1_f_res_126060;
            float x_126070 = x_126068 + y_126069;
            float defunc_9_slope_fun_res_126071 = defunc_0_f_res_126061 *
                  x_126070;
            float defunc_1_op_res_126072 = defunc_9_fit_fun_res_126067 +
                  redout_126041;
            float defunc_1_op_res_126073 = defunc_9_slope_fun_res_126071 +
                  redout_126042;
            float redout_tmp_126079 = defunc_1_op_res_126072;
            float redout_tmp_126080 = defunc_1_op_res_126073;
            
            redout_126041 = redout_tmp_126079;
            redout_126042 = redout_tmp_126080;
        }
        defunc_2_reduce_res_125974 = redout_126041;
        defunc_2_reduce_res_125975 = redout_126042;
        ((float *) mem_122459.mem)[gtid_117923] = defunc_2_reduce_res_125974;
        ((float *) mem_122462.mem)[gtid_117923] = defunc_2_reduce_res_125975;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131408_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131408_end -
                 futhark_mc_segmap_parloop_131408_start;
        
        ctx->futhark_mc_segmap_parloop_131408_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131408_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131408_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131406(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117922 = tid;
    int num_tasks_126012 = info.nsubtasks;
    struct futhark_mc_task_131405 *futhark_mc_task_131405 =
                                  (struct futhark_mc_task_131405 *) args;
    struct futhark_context *ctx = futhark_mc_task_131405->ctx;
    uint64_t futhark_mc_segmap_task_131406_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131406_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131405->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131405->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131405->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131405->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131405->free_i_114610;
    int64_t gtid_117921 = futhark_mc_task_131405->free_gtid_117921;
    int64_t x_118019 = futhark_mc_task_131405->free_x_118019;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131405->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131405->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131405->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131405->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131405->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122459 = {.desc ="mem_122459", .mem =
                                  futhark_mc_task_131405->free_mem_122459,
                                  .size =0, .references =NULL};
    struct memblock mem_122462 = {.desc ="mem_122462", .mem =
                                  futhark_mc_task_131405->free_mem_122462,
                                  .size =0, .references =NULL};
    int64_t iter_126013;
    struct futhark_mc_segmap_parloop_struct_131407
    futhark_mc_segmap_parloop_struct_131407;
    
    futhark_mc_segmap_parloop_struct_131407.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131407.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131407.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131407.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131407.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131407.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131407.free_gtid_117921 = gtid_117921;
    futhark_mc_segmap_parloop_struct_131407.free_x_118019 = x_118019;
    futhark_mc_segmap_parloop_struct_131407.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131407.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131407.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131407.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131407.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131407.free_mem_122459 = mem_122459.mem;
    futhark_mc_segmap_parloop_struct_131407.free_mem_122462 = mem_122462.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131408_task;
    
    futhark_mc_segmap_parloop_131408_task.name =
        "futhark_mc_segmap_parloop_131408";
    futhark_mc_segmap_parloop_131408_task.fn = futhark_mc_segmap_parloop_131408;
    futhark_mc_segmap_parloop_131408_task.args =
        &futhark_mc_segmap_parloop_struct_131407;
    futhark_mc_segmap_parloop_131408_task.iterations = iterations;
    futhark_mc_segmap_parloop_131408_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131408_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131408_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131408_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131408_task);
    
    if (futhark_mc_segmap_parloop_131408_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131408_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131408_total_end -
                 futhark_mc_segmap_parloop_131408_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131408_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131408_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131408_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131406_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131406_end -
                 futhark_mc_segmap_task_131406_start;
        
        ctx->futhark_mc_segmap_task_131406_runs[tid]++;
        ctx->futhark_mc_segmap_task_131406_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131406_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131410 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_117921;
    int64_t free_x_118019;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122459;
    char *free_mem_122462;
};
struct futhark_mc_task_131412 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_117921;
    int64_t free_x_118019;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_125851;
    float free_x_125852;
    float free_defunc_0_f_res_125855;
    float *retval_defunc_2_reduce_res_125856;
    float *retval_defunc_2_reduce_res_125857;
    float *retval_defunc_2_reduce_res_125858;
};
struct futhark_mc_segred_stage_1_parloop_struct_131417 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_117921;
    int64_t free_x_118019;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_125851;
    float free_x_125852;
    float free_defunc_0_f_res_125855;
    char *free_reduce_stage_1_tid_res_arr_mem_126148;
    char *free_reduce_stage_1_tid_res_arr_mem_126150;
    char *free_reduce_stage_1_tid_res_arr_mem_126152;
};
static int futhark_mc_segred_stage_1_parloop_131418(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_117926,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131417
    *futhark_mc_segred_stage_1_parloop_struct_131417 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131417 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131417->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131418_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131418_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131417->free_n_114534;
    int64_t gtid_117921 =
            futhark_mc_segred_stage_1_parloop_struct_131417->free_gtid_117921;
    int64_t x_118019 =
            futhark_mc_segred_stage_1_parloop_struct_131417->free_x_118019;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131417->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131417->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_125851 =
            futhark_mc_segred_stage_1_parloop_struct_131417->free_x_125851;
    float x_125852 =
          futhark_mc_segred_stage_1_parloop_struct_131417->free_x_125852;
    float defunc_0_f_res_125855 =
          futhark_mc_segred_stage_1_parloop_struct_131417->free_defunc_0_f_res_125855;
    struct memblock reduce_stage_1_tid_res_arr_mem_126148 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126148",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131417->free_reduce_stage_1_tid_res_arr_mem_126148,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_126150 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126150",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131417->free_reduce_stage_1_tid_res_arr_mem_126150,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_126152 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126152",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131417->free_reduce_stage_1_tid_res_arr_mem_126152,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_126154 = start;
    float x_126082;
    float x_126083;
    float x_126085;
    float x_126086;
    float x_126088;
    float x_126089;
    float local_acc_126155 = 0.0F;
    float local_acc_126156 = 0.0F;
    float local_acc_126157 = 0.0F;
    
    for (; iter_126154 < end; iter_126154++) {
        int64_t gtid_117927 = iter_126154;
        bool cond_126091 = sle64(x_118019, gtid_117927);
        float defunc_0_f_res_126092;
        
        if (cond_126091) {
            defunc_0_f_res_126092 = 0.0F;
        } else {
            int64_t i_126093 = add64(gtid_117927, x_125851);
            float x_126094 = ((float *) mem_122004.mem)[gtid_117921 * n_114534 +
                                                        i_126093];
            float defunc_0_f_res_f_res_126095 = 1.0F + x_126094;
            
            defunc_0_f_res_126092 = defunc_0_f_res_f_res_126095;
        }
        
        float defunc_0_f_res_126096;
        
        if (cond_126091) {
            defunc_0_f_res_126096 = 0.0F;
        } else {
            int64_t i_126097 = add64(gtid_117927, x_125851);
            float x_126098 = ((float *) mem_122430.mem)[gtid_117921 * n_114534 +
                                                        i_126097];
            
            defunc_0_f_res_126096 = x_126098;
        }
        
        float x_j_126099 = defunc_0_f_res_126092 - defunc_0_f_res_125855;
        float abs_res_126100 = (float) fabs(x_j_126099);
        float tmp1_126101 = abs_res_126100 / x_125852;
        float x_126102 = tmp1_126101 * tmp1_126101;
        float y_126103 = tmp1_126101 * x_126102;
        float tmp2_126104 = 1.0F - y_126103;
        float x_126105 = tmp2_126104 * tmp2_126104;
        float tmp3_126106 = tmp2_126104 * x_126105;
        float w_j_126107 = defunc_0_f_res_126096 * tmp3_126106;
        float xw_j_126108 = x_j_126099 * w_j_126107;
        float x2w_j_126109 = x_j_126099 * xw_j_126108;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_126082 = local_acc_126155;
        }
        // Load next params
        {
            x_126083 = w_j_126107;
        }
        // Red body
        {
            float defunc_1_op_res_126084 = x_126082 + x_126083;
            
            local_acc_126155 = defunc_1_op_res_126084;
        }
        // Load accum params
        {
            x_126085 = local_acc_126156;
        }
        // Load next params
        {
            x_126086 = xw_j_126108;
        }
        // Red body
        {
            float defunc_1_op_res_126087 = x_126085 + x_126086;
            
            local_acc_126156 = defunc_1_op_res_126087;
        }
        // Load accum params
        {
            x_126088 = local_acc_126157;
        }
        // Load next params
        {
            x_126089 = x2w_j_126109;
        }
        // Red body
        {
            float defunc_1_op_res_126090 = x_126088 + x_126089;
            
            local_acc_126157 = defunc_1_op_res_126090;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_126148.mem)[flat_tid_117926] =
        local_acc_126155;
    ((float *) reduce_stage_1_tid_res_arr_mem_126150.mem)[flat_tid_117926] =
        local_acc_126156;
    ((float *) reduce_stage_1_tid_res_arr_mem_126152.mem)[flat_tid_117926] =
        local_acc_126157;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131418_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131418_end -
                 futhark_mc_segred_stage_1_parloop_131418_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131418_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131418_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131418_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131413(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117926 = tid;
    int num_tasks_126147 = info.nsubtasks;
    struct futhark_mc_task_131412 *futhark_mc_task_131412 =
                                  (struct futhark_mc_task_131412 *) args;
    struct futhark_context *ctx = futhark_mc_task_131412->ctx;
    uint64_t futhark_mc_segred_task_131413_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131413_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131412->free_n_114534;
    int64_t gtid_117921 = futhark_mc_task_131412->free_gtid_117921;
    int64_t x_118019 = futhark_mc_task_131412->free_x_118019;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131412->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131412->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_125851 = futhark_mc_task_131412->free_x_125851;
    float x_125852 = futhark_mc_task_131412->free_x_125852;
    float defunc_0_f_res_125855 =
          futhark_mc_task_131412->free_defunc_0_f_res_125855;
    float defunc_2_reduce_res_125856 =
          *futhark_mc_task_131412->retval_defunc_2_reduce_res_125856;
    float defunc_2_reduce_res_125857 =
          *futhark_mc_task_131412->retval_defunc_2_reduce_res_125857;
    float defunc_2_reduce_res_125858 =
          *futhark_mc_task_131412->retval_defunc_2_reduce_res_125858;
    size_t reduce_stage_1_tid_res_arr_mem_126148_cached_sizze_131414 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126148 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_126150_cached_sizze_131415 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126150 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_126152_cached_sizze_131416 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126152 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_126148_cached_sizze_131414 <
        (size_t) ((int64_t) 4 * num_tasks_126147)) {
        reduce_stage_1_tid_res_arr_mem_126148 =
            realloc(reduce_stage_1_tid_res_arr_mem_126148, (int64_t) 4 *
                    num_tasks_126147);
        reduce_stage_1_tid_res_arr_mem_126148_cached_sizze_131414 =
            (int64_t) 4 * num_tasks_126147;
    }
    if (reduce_stage_1_tid_res_arr_mem_126150_cached_sizze_131415 <
        (size_t) ((int64_t) 4 * num_tasks_126147)) {
        reduce_stage_1_tid_res_arr_mem_126150 =
            realloc(reduce_stage_1_tid_res_arr_mem_126150, (int64_t) 4 *
                    num_tasks_126147);
        reduce_stage_1_tid_res_arr_mem_126150_cached_sizze_131415 =
            (int64_t) 4 * num_tasks_126147;
    }
    if (reduce_stage_1_tid_res_arr_mem_126152_cached_sizze_131416 <
        (size_t) ((int64_t) 4 * num_tasks_126147)) {
        reduce_stage_1_tid_res_arr_mem_126152 =
            realloc(reduce_stage_1_tid_res_arr_mem_126152, (int64_t) 4 *
                    num_tasks_126147);
        reduce_stage_1_tid_res_arr_mem_126152_cached_sizze_131416 =
            (int64_t) 4 * num_tasks_126147;
    }
    
    int64_t iter_126154;
    struct futhark_mc_segred_stage_1_parloop_struct_131417
    futhark_mc_segred_stage_1_parloop_struct_131417;
    
    futhark_mc_segred_stage_1_parloop_struct_131417.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131417.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131417.free_gtid_117921 =
        gtid_117921;
    futhark_mc_segred_stage_1_parloop_struct_131417.free_x_118019 = x_118019;
    futhark_mc_segred_stage_1_parloop_struct_131417.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131417.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131417.free_x_125851 = x_125851;
    futhark_mc_segred_stage_1_parloop_struct_131417.free_x_125852 = x_125852;
    futhark_mc_segred_stage_1_parloop_struct_131417.free_defunc_0_f_res_125855 =
        defunc_0_f_res_125855;
    futhark_mc_segred_stage_1_parloop_struct_131417.free_reduce_stage_1_tid_res_arr_mem_126148 =
        reduce_stage_1_tid_res_arr_mem_126148;
    futhark_mc_segred_stage_1_parloop_struct_131417.free_reduce_stage_1_tid_res_arr_mem_126150 =
        reduce_stage_1_tid_res_arr_mem_126150;
    futhark_mc_segred_stage_1_parloop_struct_131417.free_reduce_stage_1_tid_res_arr_mem_126152 =
        reduce_stage_1_tid_res_arr_mem_126152;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131418_task;
    
    futhark_mc_segred_stage_1_parloop_131418_task.name =
        "futhark_mc_segred_stage_1_parloop_131418";
    futhark_mc_segred_stage_1_parloop_131418_task.fn =
        futhark_mc_segred_stage_1_parloop_131418;
    futhark_mc_segred_stage_1_parloop_131418_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131417;
    futhark_mc_segred_stage_1_parloop_131418_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131418_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131418_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131418_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131418_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131418_task);
    
    if (futhark_mc_segred_stage_1_parloop_131418_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131418_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131418_total_end -
                 futhark_mc_segred_stage_1_parloop_131418_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131418_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131418_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131418_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_125856 = 0.0F;
        defunc_2_reduce_res_125857 = 0.0F;
        defunc_2_reduce_res_125858 = 0.0F;
    }
    
    float x_126158;
    float x_126159;
    float x_126161;
    float x_126162;
    float x_126164;
    float x_126165;
    
    for (int32_t i_126167 = 0; i_126167 < num_tasks_126147; i_126167++) {
        flat_tid_117926 = i_126167;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_126158 = defunc_2_reduce_res_125856;
            }
            // load next params
            {
                x_126159 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126148)[flat_tid_117926];
            }
            // red body
            {
                float defunc_1_op_res_126160 = x_126158 + x_126159;
                
                defunc_2_reduce_res_125856 = defunc_1_op_res_126160;
            }
            // load acc params
            {
                x_126161 = defunc_2_reduce_res_125857;
            }
            // load next params
            {
                x_126162 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126150)[flat_tid_117926];
            }
            // red body
            {
                float defunc_1_op_res_126163 = x_126161 + x_126162;
                
                defunc_2_reduce_res_125857 = defunc_1_op_res_126163;
            }
            // load acc params
            {
                x_126164 = defunc_2_reduce_res_125858;
            }
            // load next params
            {
                x_126165 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126152)[flat_tid_117926];
            }
            // red body
            {
                float defunc_1_op_res_126166 = x_126164 + x_126165;
                
                defunc_2_reduce_res_125858 = defunc_1_op_res_126166;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_126148);
    free(reduce_stage_1_tid_res_arr_mem_126150);
    free(reduce_stage_1_tid_res_arr_mem_126152);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131413_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131413_end -
                 futhark_mc_segred_task_131413_start;
        
        ctx->futhark_mc_segred_task_131413_runs[tid]++;
        ctx->futhark_mc_segred_task_131413_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131413_iter[tid] += iterations;
    }
    *futhark_mc_task_131412->retval_defunc_2_reduce_res_125856 =
        defunc_2_reduce_res_125856;
    *futhark_mc_task_131412->retval_defunc_2_reduce_res_125857 =
        defunc_2_reduce_res_125857;
    *futhark_mc_task_131412->retval_defunc_2_reduce_res_125858 =
        defunc_2_reduce_res_125858;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131419 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_117921;
    int64_t free_x_118019;
    char *free_mem_122004;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_x_125851;
    float free_x_125852;
    float free_defunc_0_f_res_125855;
    float free_a11_125891;
    float free_b11_125893;
    float free_c11_125894;
    float *retval_defunc_2_reduce_res_125895;
    float *retval_defunc_2_reduce_res_125896;
};
struct futhark_mc_segred_stage_1_parloop_struct_131423 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_117921;
    int64_t free_x_118019;
    char *free_mem_122004;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_x_125851;
    float free_x_125852;
    float free_defunc_0_f_res_125855;
    float free_a11_125891;
    float free_b11_125893;
    float free_c11_125894;
    char *free_reduce_stage_1_tid_res_arr_mem_126169;
    char *free_reduce_stage_1_tid_res_arr_mem_126171;
};
static int futhark_mc_segred_stage_1_parloop_131424(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_117928,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131423
    *futhark_mc_segred_stage_1_parloop_struct_131423 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131423 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131423->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131424_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131424_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131423->free_n_114534;
    int64_t gtid_117921 =
            futhark_mc_segred_stage_1_parloop_struct_131423->free_gtid_117921;
    int64_t x_118019 =
            futhark_mc_segred_stage_1_parloop_struct_131423->free_x_118019;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131423->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131423->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131423->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_125851 =
            futhark_mc_segred_stage_1_parloop_struct_131423->free_x_125851;
    float x_125852 =
          futhark_mc_segred_stage_1_parloop_struct_131423->free_x_125852;
    float defunc_0_f_res_125855 =
          futhark_mc_segred_stage_1_parloop_struct_131423->free_defunc_0_f_res_125855;
    float a11_125891 =
          futhark_mc_segred_stage_1_parloop_struct_131423->free_a11_125891;
    float b11_125893 =
          futhark_mc_segred_stage_1_parloop_struct_131423->free_b11_125893;
    float c11_125894 =
          futhark_mc_segred_stage_1_parloop_struct_131423->free_c11_125894;
    struct memblock reduce_stage_1_tid_res_arr_mem_126169 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126169",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131423->free_reduce_stage_1_tid_res_arr_mem_126169,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_126171 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126171",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131423->free_reduce_stage_1_tid_res_arr_mem_126171,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_126173 = start;
    float x_126110;
    float x_126111;
    float x_126113;
    float x_126114;
    float local_acc_126174 = 0.0F;
    float local_acc_126175 = 0.0F;
    
    for (; iter_126173 < end; iter_126173++) {
        int64_t gtid_117929 = iter_126173;
        bool cond_126116 = sle64(x_118019, gtid_117929);
        float defunc_0_f_res_126117;
        
        if (cond_126116) {
            defunc_0_f_res_126117 = 0.0F;
        } else {
            int64_t i_126118 = add64(gtid_117929, x_125851);
            float x_126119 = ((float *) mem_122004.mem)[gtid_117921 * n_114534 +
                                                        i_126118];
            float defunc_0_f_res_f_res_126120 = 1.0F + x_126119;
            
            defunc_0_f_res_126117 = defunc_0_f_res_f_res_126120;
        }
        
        float defunc_0_f_res_126121;
        
        if (cond_126116) {
            defunc_0_f_res_126121 = 0.0F;
        } else {
            int64_t i_126122 = add64(gtid_117929, x_125851);
            float x_126123 = ((float *) mem_122430.mem)[gtid_117921 * n_114534 +
                                                        i_126122];
            
            defunc_0_f_res_126121 = x_126123;
        }
        
        float x_j_126124 = defunc_0_f_res_126117 - defunc_0_f_res_125855;
        float abs_res_126125 = (float) fabs(x_j_126124);
        float tmp1_126126 = abs_res_126125 / x_125852;
        float x_126127 = tmp1_126126 * tmp1_126126;
        float y_126128 = tmp1_126126 * x_126127;
        float tmp2_126129 = 1.0F - y_126128;
        float x_126130 = tmp2_126129 * tmp2_126129;
        float tmp3_126131 = tmp2_126129 * x_126130;
        float tmp4_126132 = defunc_0_f_res_126121 * tmp3_126131;
        float defunc_1_f_res_126133 = x_j_126124 * tmp4_126132;
        float defunc_0_f_res_126134;
        
        if (cond_126116) {
            defunc_0_f_res_126134 = 0.0F;
        } else {
            int64_t i_126135 = add64(gtid_117929, x_125851);
            float x_126136 = ((float *) mem_122426.mem)[gtid_117921 * n_114534 +
                                                        i_126135];
            
            defunc_0_f_res_126134 = x_126136;
        }
        
        float x_126137 = a11_125891 * tmp4_126132;
        float y_126138 = b11_125893 * defunc_1_f_res_126133;
        float x_126139 = x_126137 + y_126138;
        float defunc_9_fit_fun_res_126140 = defunc_0_f_res_126134 * x_126139;
        float x_126141 = b11_125893 * tmp4_126132;
        float y_126142 = c11_125894 * defunc_1_f_res_126133;
        float x_126143 = x_126141 + y_126142;
        float defunc_9_slope_fun_res_126144 = defunc_0_f_res_126134 * x_126143;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_126110 = local_acc_126174;
        }
        // Load next params
        {
            x_126111 = defunc_9_fit_fun_res_126140;
        }
        // Red body
        {
            float defunc_1_op_res_126112 = x_126110 + x_126111;
            
            local_acc_126174 = defunc_1_op_res_126112;
        }
        // Load accum params
        {
            x_126113 = local_acc_126175;
        }
        // Load next params
        {
            x_126114 = defunc_9_slope_fun_res_126144;
        }
        // Red body
        {
            float defunc_1_op_res_126115 = x_126113 + x_126114;
            
            local_acc_126175 = defunc_1_op_res_126115;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_126169.mem)[flat_tid_117928] =
        local_acc_126174;
    ((float *) reduce_stage_1_tid_res_arr_mem_126171.mem)[flat_tid_117928] =
        local_acc_126175;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131424_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131424_end -
                 futhark_mc_segred_stage_1_parloop_131424_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131424_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131424_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131424_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131420(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117928 = tid;
    int num_tasks_126168 = info.nsubtasks;
    struct futhark_mc_task_131419 *futhark_mc_task_131419 =
                                  (struct futhark_mc_task_131419 *) args;
    struct futhark_context *ctx = futhark_mc_task_131419->ctx;
    uint64_t futhark_mc_segred_task_131420_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131420_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131419->free_n_114534;
    int64_t gtid_117921 = futhark_mc_task_131419->free_gtid_117921;
    int64_t x_118019 = futhark_mc_task_131419->free_x_118019;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131419->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131419->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131419->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_125851 = futhark_mc_task_131419->free_x_125851;
    float x_125852 = futhark_mc_task_131419->free_x_125852;
    float defunc_0_f_res_125855 =
          futhark_mc_task_131419->free_defunc_0_f_res_125855;
    float a11_125891 = futhark_mc_task_131419->free_a11_125891;
    float b11_125893 = futhark_mc_task_131419->free_b11_125893;
    float c11_125894 = futhark_mc_task_131419->free_c11_125894;
    float defunc_2_reduce_res_125895 =
          *futhark_mc_task_131419->retval_defunc_2_reduce_res_125895;
    float defunc_2_reduce_res_125896 =
          *futhark_mc_task_131419->retval_defunc_2_reduce_res_125896;
    size_t reduce_stage_1_tid_res_arr_mem_126169_cached_sizze_131421 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126169 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_126171_cached_sizze_131422 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126171 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_126169_cached_sizze_131421 <
        (size_t) ((int64_t) 4 * num_tasks_126168)) {
        reduce_stage_1_tid_res_arr_mem_126169 =
            realloc(reduce_stage_1_tid_res_arr_mem_126169, (int64_t) 4 *
                    num_tasks_126168);
        reduce_stage_1_tid_res_arr_mem_126169_cached_sizze_131421 =
            (int64_t) 4 * num_tasks_126168;
    }
    if (reduce_stage_1_tid_res_arr_mem_126171_cached_sizze_131422 <
        (size_t) ((int64_t) 4 * num_tasks_126168)) {
        reduce_stage_1_tid_res_arr_mem_126171 =
            realloc(reduce_stage_1_tid_res_arr_mem_126171, (int64_t) 4 *
                    num_tasks_126168);
        reduce_stage_1_tid_res_arr_mem_126171_cached_sizze_131422 =
            (int64_t) 4 * num_tasks_126168;
    }
    
    int64_t iter_126173;
    struct futhark_mc_segred_stage_1_parloop_struct_131423
    futhark_mc_segred_stage_1_parloop_struct_131423;
    
    futhark_mc_segred_stage_1_parloop_struct_131423.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_gtid_117921 =
        gtid_117921;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_x_118019 = x_118019;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_mem_122426 =
        mem_122426.mem;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_x_125851 = x_125851;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_x_125852 = x_125852;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_defunc_0_f_res_125855 =
        defunc_0_f_res_125855;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_a11_125891 =
        a11_125891;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_b11_125893 =
        b11_125893;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_c11_125894 =
        c11_125894;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_reduce_stage_1_tid_res_arr_mem_126169 =
        reduce_stage_1_tid_res_arr_mem_126169;
    futhark_mc_segred_stage_1_parloop_struct_131423.free_reduce_stage_1_tid_res_arr_mem_126171 =
        reduce_stage_1_tid_res_arr_mem_126171;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131424_task;
    
    futhark_mc_segred_stage_1_parloop_131424_task.name =
        "futhark_mc_segred_stage_1_parloop_131424";
    futhark_mc_segred_stage_1_parloop_131424_task.fn =
        futhark_mc_segred_stage_1_parloop_131424;
    futhark_mc_segred_stage_1_parloop_131424_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131423;
    futhark_mc_segred_stage_1_parloop_131424_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131424_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131424_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131424_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131424_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131424_task);
    
    if (futhark_mc_segred_stage_1_parloop_131424_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131424_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131424_total_end -
                 futhark_mc_segred_stage_1_parloop_131424_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131424_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131424_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131424_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_125895 = 0.0F;
        defunc_2_reduce_res_125896 = 0.0F;
    }
    
    float x_126176;
    float x_126177;
    float x_126179;
    float x_126180;
    
    for (int32_t i_126182 = 0; i_126182 < num_tasks_126168; i_126182++) {
        flat_tid_117928 = i_126182;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_126176 = defunc_2_reduce_res_125895;
            }
            // load next params
            {
                x_126177 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126169)[flat_tid_117928];
            }
            // red body
            {
                float defunc_1_op_res_126178 = x_126176 + x_126177;
                
                defunc_2_reduce_res_125895 = defunc_1_op_res_126178;
            }
            // load acc params
            {
                x_126179 = defunc_2_reduce_res_125896;
            }
            // load next params
            {
                x_126180 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126171)[flat_tid_117928];
            }
            // red body
            {
                float defunc_1_op_res_126181 = x_126179 + x_126180;
                
                defunc_2_reduce_res_125896 = defunc_1_op_res_126181;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_126169);
    free(reduce_stage_1_tid_res_arr_mem_126171);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131420_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131420_end -
                 futhark_mc_segred_task_131420_start;
        
        ctx->futhark_mc_segred_task_131420_runs[tid]++;
        ctx->futhark_mc_segred_task_131420_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131420_iter[tid] += iterations;
    }
    *futhark_mc_task_131419->retval_defunc_2_reduce_res_125895 =
        defunc_2_reduce_res_125895;
    *futhark_mc_task_131419->retval_defunc_2_reduce_res_125896 =
        defunc_2_reduce_res_125896;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131411(void *args, int64_t start,
                                            int64_t end, int flat_tid_117924,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131410
    *futhark_mc_segmap_parloop_struct_131410 =
    (struct futhark_mc_segmap_parloop_struct_131410 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131410->ctx;
    uint64_t futhark_mc_segmap_parloop_131411_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131411_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131410->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131410->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131410->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131410->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131410->free_i_114610;
    int64_t gtid_117921 =
            futhark_mc_segmap_parloop_struct_131410->free_gtid_117921;
    int64_t x_118019 = futhark_mc_segmap_parloop_struct_131410->free_x_118019;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131410->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131410->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131410->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131410->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131410->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122459 = {.desc ="mem_122459", .mem =
                                  futhark_mc_segmap_parloop_struct_131410->free_mem_122459,
                                  .size =0, .references =NULL};
    struct memblock mem_122462 = {.desc ="mem_122462", .mem =
                                  futhark_mc_segmap_parloop_struct_131410->free_mem_122462,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_126081 = start;
    
    for (; iter_126081 < end; iter_126081++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_126145 = l_n_m_114584;
        int64_t gtid_117925 = iter_126081;
        int64_t remnant_126146 = iter_126081 - gtid_117925;
        int64_t x_125851 = ((int64_t *) mem_122124.mem)[gtid_117921 *
                                                        l_n_m_114584 +
                                                        gtid_117925];
        float x_125852 = ((float *) mem_122128.mem)[gtid_117921 * l_n_m_114584 +
                                                    gtid_117925];
        int64_t min_arg_125853 = mul64(t_jump_114541, gtid_117925);
        int64_t min_res_125854 = smin64(i_114610, min_arg_125853);
        float defunc_0_f_res_125855 = sitofp_i64_f32(min_res_125854);
        float defunc_2_reduce_res_125856;
        float defunc_2_reduce_res_125857;
        float defunc_2_reduce_res_125858;
        int64_t flat_tid_117926 = (int64_t) 0;
        int32_t num_tasks_126147;
        struct futhark_mc_task_131412 futhark_mc_task_131412;
        
        futhark_mc_task_131412.ctx = ctx;
        futhark_mc_task_131412.free_n_114534 = n_114534;
        futhark_mc_task_131412.free_gtid_117921 = gtid_117921;
        futhark_mc_task_131412.free_x_118019 = x_118019;
        futhark_mc_task_131412.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131412.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131412.free_x_125851 = x_125851;
        futhark_mc_task_131412.free_x_125852 = x_125852;
        futhark_mc_task_131412.free_defunc_0_f_res_125855 =
            defunc_0_f_res_125855;
        futhark_mc_task_131412.retval_defunc_2_reduce_res_125856 =
            &defunc_2_reduce_res_125856;
        futhark_mc_task_131412.retval_defunc_2_reduce_res_125857 =
            &defunc_2_reduce_res_125857;
        futhark_mc_task_131412.retval_defunc_2_reduce_res_125858 =
            &defunc_2_reduce_res_125858;
        
        struct scheduler_segop futhark_mc_task_131412_task;
        
        futhark_mc_task_131412_task.args = &futhark_mc_task_131412;
        futhark_mc_task_131412_task.top_level_fn =
            futhark_mc_segred_task_131413;
        futhark_mc_task_131412_task.name = "futhark_mc_segred_task_131413";
        futhark_mc_task_131412_task.iterations = l_window_114538;
        futhark_mc_task_131412_task.task_time =
            &ctx->futhark_mc_segred_task_131413_total_time;
        futhark_mc_task_131412_task.task_iter =
            &ctx->futhark_mc_segred_task_131413_total_iter;
        futhark_mc_task_131412_task.sched = STATIC;
        futhark_mc_task_131412_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131413_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131412_task);
        
        if (futhark_mc_segred_task_131413_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float x_125887 = defunc_2_reduce_res_125856 *
              defunc_2_reduce_res_125858;
        float y_125888 = defunc_2_reduce_res_125857 *
              defunc_2_reduce_res_125857;
        float y_125889 = x_125887 - y_125888;
        float det1_125890 = 1.0F / y_125889;
        float a11_125891 = defunc_2_reduce_res_125858 * det1_125890;
        float negate_arg_125892 = defunc_2_reduce_res_125857 * det1_125890;
        float b11_125893 = 0.0F - negate_arg_125892;
        float c11_125894 = defunc_2_reduce_res_125856 * det1_125890;
        float defunc_2_reduce_res_125895;
        float defunc_2_reduce_res_125896;
        int64_t flat_tid_117928 = (int64_t) 0;
        int32_t num_tasks_126168;
        struct futhark_mc_task_131419 futhark_mc_task_131419;
        
        futhark_mc_task_131419.ctx = ctx;
        futhark_mc_task_131419.free_n_114534 = n_114534;
        futhark_mc_task_131419.free_gtid_117921 = gtid_117921;
        futhark_mc_task_131419.free_x_118019 = x_118019;
        futhark_mc_task_131419.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131419.free_mem_122426 = mem_122426.mem;
        futhark_mc_task_131419.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131419.free_x_125851 = x_125851;
        futhark_mc_task_131419.free_x_125852 = x_125852;
        futhark_mc_task_131419.free_defunc_0_f_res_125855 =
            defunc_0_f_res_125855;
        futhark_mc_task_131419.free_a11_125891 = a11_125891;
        futhark_mc_task_131419.free_b11_125893 = b11_125893;
        futhark_mc_task_131419.free_c11_125894 = c11_125894;
        futhark_mc_task_131419.retval_defunc_2_reduce_res_125895 =
            &defunc_2_reduce_res_125895;
        futhark_mc_task_131419.retval_defunc_2_reduce_res_125896 =
            &defunc_2_reduce_res_125896;
        
        struct scheduler_segop futhark_mc_task_131419_task;
        
        futhark_mc_task_131419_task.args = &futhark_mc_task_131419;
        futhark_mc_task_131419_task.top_level_fn =
            futhark_mc_segred_task_131420;
        futhark_mc_task_131419_task.name = "futhark_mc_segred_task_131420";
        futhark_mc_task_131419_task.iterations = l_window_114538;
        futhark_mc_task_131419_task.task_time =
            &ctx->futhark_mc_segred_task_131420_total_time;
        futhark_mc_task_131419_task.task_iter =
            &ctx->futhark_mc_segred_task_131420_total_iter;
        futhark_mc_task_131419_task.sched = STATIC;
        futhark_mc_task_131419_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131420_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131419_task);
        
        if (futhark_mc_segred_task_131420_err != 0) {
            err = 1;
            goto cleanup;
        }
        ((float *) mem_122459.mem)[gtid_117925] = defunc_2_reduce_res_125895;
        ((float *) mem_122462.mem)[gtid_117925] = defunc_2_reduce_res_125896;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131411_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131411_end -
                 futhark_mc_segmap_parloop_131411_start;
        
        ctx->futhark_mc_segmap_parloop_131411_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131411_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131411_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131409(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117924 = tid;
    int num_tasks_126012 = info.nsubtasks;
    struct futhark_mc_task_131405 *futhark_mc_task_131405 =
                                  (struct futhark_mc_task_131405 *) args;
    struct futhark_context *ctx = futhark_mc_task_131405->ctx;
    uint64_t futhark_mc_segmap_nested_task_131409_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131409_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131405->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131405->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131405->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131405->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131405->free_i_114610;
    int64_t gtid_117921 = futhark_mc_task_131405->free_gtid_117921;
    int64_t x_118019 = futhark_mc_task_131405->free_x_118019;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131405->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131405->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131405->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131405->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131405->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122459 = {.desc ="mem_122459", .mem =
                                  futhark_mc_task_131405->free_mem_122459,
                                  .size =0, .references =NULL};
    struct memblock mem_122462 = {.desc ="mem_122462", .mem =
                                  futhark_mc_task_131405->free_mem_122462,
                                  .size =0, .references =NULL};
    int64_t iter_126081;
    struct futhark_mc_segmap_parloop_struct_131410
    futhark_mc_segmap_parloop_struct_131410;
    
    futhark_mc_segmap_parloop_struct_131410.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131410.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131410.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131410.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131410.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131410.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131410.free_gtid_117921 = gtid_117921;
    futhark_mc_segmap_parloop_struct_131410.free_x_118019 = x_118019;
    futhark_mc_segmap_parloop_struct_131410.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131410.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131410.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131410.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131410.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131410.free_mem_122459 = mem_122459.mem;
    futhark_mc_segmap_parloop_struct_131410.free_mem_122462 = mem_122462.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131411_task;
    
    futhark_mc_segmap_parloop_131411_task.name =
        "futhark_mc_segmap_parloop_131411";
    futhark_mc_segmap_parloop_131411_task.fn = futhark_mc_segmap_parloop_131411;
    futhark_mc_segmap_parloop_131411_task.args =
        &futhark_mc_segmap_parloop_struct_131410;
    futhark_mc_segmap_parloop_131411_task.iterations = iterations;
    futhark_mc_segmap_parloop_131411_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131411_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131411_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131411_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131411_task);
    
    if (futhark_mc_segmap_parloop_131411_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131411_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131411_total_end -
                 futhark_mc_segmap_parloop_131411_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131411_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131411_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131411_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131409_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131409_end -
                 futhark_mc_segmap_nested_task_131409_start;
        
        ctx->futhark_mc_segmap_nested_task_131409_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131409_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131409_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131402(void *args, int64_t start,
                                            int64_t end, int flat_tid_117920,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131401
    *futhark_mc_segmap_parloop_struct_131401 =
    (struct futhark_mc_segmap_parloop_struct_131401 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131401->ctx;
    uint64_t futhark_mc_segmap_parloop_131402_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131402_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131401->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131401->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131401->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131401->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131401->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131401->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131401->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131401->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131401->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131401->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131401->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131401->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131401->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122496 = {.desc ="mem_122496", .mem =
                                  futhark_mc_segmap_parloop_struct_131401->free_mem_122496,
                                  .size =0, .references =NULL};
    struct memblock mem_122500 = {.desc ="mem_122500", .mem =
                                  futhark_mc_segmap_parloop_struct_131401->free_mem_122500,
                                  .size =0, .references =NULL};
    size_t mem_122459_cached_sizze_131403 = 0;
    char *mem_122459 = NULL;
    size_t mem_122462_cached_sizze_131404 = 0;
    char *mem_122462 = NULL;
    int64_t iterations = end - start;
    int64_t iter_125850 = start;
    
    if (mem_122459_cached_sizze_131403 < (size_t) bytes_122055) {
        mem_122459 = realloc(mem_122459, bytes_122055);
        mem_122459_cached_sizze_131403 = bytes_122055;
    }
    if (mem_122462_cached_sizze_131404 < (size_t) bytes_122055) {
        mem_122462 = realloc(mem_122462, bytes_122055);
        mem_122462_cached_sizze_131404 = bytes_122055;
    }
    for (; iter_125850 < end; iter_125850++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_126010 = m_114533;
        int64_t gtid_117921 = iter_125850;
        int64_t remnant_126011 = iter_125850 - gtid_117921;
        int64_t x_118019 = ((int64_t *) mem_121982.mem)[gtid_117921];
        int64_t flat_tid_117922 = (int64_t) 0;
        int32_t num_tasks_126012;
        int64_t flat_tid_117924 = (int64_t) 0;
        struct futhark_mc_task_131405 futhark_mc_task_131405;
        
        futhark_mc_task_131405.ctx = ctx;
        futhark_mc_task_131405.free_n_114534 = n_114534;
        futhark_mc_task_131405.free_l_window_114538 = l_window_114538;
        futhark_mc_task_131405.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131405.free_l_n_m_114584 = l_n_m_114584;
        futhark_mc_task_131405.free_i_114610 = i_114610;
        futhark_mc_task_131405.free_gtid_117921 = gtid_117921;
        futhark_mc_task_131405.free_x_118019 = x_118019;
        futhark_mc_task_131405.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131405.free_mem_122124 = mem_122124.mem;
        futhark_mc_task_131405.free_mem_122128 = mem_122128.mem;
        futhark_mc_task_131405.free_mem_122426 = mem_122426.mem;
        futhark_mc_task_131405.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131405.free_mem_122459 = mem_122459;
        futhark_mc_task_131405.free_mem_122462 = mem_122462;
        
        struct scheduler_segop futhark_mc_task_131405_task;
        
        futhark_mc_task_131405_task.args = &futhark_mc_task_131405;
        futhark_mc_task_131405_task.top_level_fn =
            futhark_mc_segmap_task_131406;
        futhark_mc_task_131405_task.name = "futhark_mc_segmap_task_131406";
        futhark_mc_task_131405_task.iterations = l_n_m_114584;
        futhark_mc_task_131405_task.task_time =
            &ctx->futhark_mc_segmap_task_131406_total_time;
        futhark_mc_task_131405_task.task_iter =
            &ctx->futhark_mc_segmap_task_131406_total_iter;
        futhark_mc_task_131405_task.sched = STATIC;
        futhark_mc_task_131405_task.nested_fn =
            futhark_mc_segmap_nested_task_131409;
        
        int futhark_mc_segmap_task_131406_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131405_task);
        
        if (futhark_mc_segmap_task_131406_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122496.mem + gtid_117921 * l_n_m_114584 * (int64_t) 4,
                mem_122459 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
        memmove(mem_122500.mem + gtid_117921 * l_n_m_114584 * (int64_t) 4,
                mem_122462 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122459);
    free(mem_122462);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131402_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131402_end -
                 futhark_mc_segmap_parloop_131402_start;
        
        ctx->futhark_mc_segmap_parloop_131402_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131402_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131402_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131400(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_117920 = tid;
    int num_tasks_125756 = info.nsubtasks;
    struct futhark_mc_task_131394 *futhark_mc_task_131394 =
                                  (struct futhark_mc_task_131394 *) args;
    struct futhark_context *ctx = futhark_mc_task_131394->ctx;
    uint64_t futhark_mc_segmap_nested_task_131400_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131400_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131394->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131394->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131394->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131394->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131394->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131394->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131394->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131394->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131394->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131394->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131394->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131394->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131394->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122496 = {.desc ="mem_122496", .mem =
                                  futhark_mc_task_131394->free_mem_122496,
                                  .size =0, .references =NULL};
    struct memblock mem_122500 = {.desc ="mem_122500", .mem =
                                  futhark_mc_task_131394->free_mem_122500,
                                  .size =0, .references =NULL};
    int64_t iter_125850;
    struct futhark_mc_segmap_parloop_struct_131401
    futhark_mc_segmap_parloop_struct_131401;
    
    futhark_mc_segmap_parloop_struct_131401.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131401.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131401.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131401.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131401.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131401.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131401.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131401.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131401.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131401.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131401.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131401.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131401.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131401.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131401.free_mem_122496 = mem_122496.mem;
    futhark_mc_segmap_parloop_struct_131401.free_mem_122500 = mem_122500.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131402_task;
    
    futhark_mc_segmap_parloop_131402_task.name =
        "futhark_mc_segmap_parloop_131402";
    futhark_mc_segmap_parloop_131402_task.fn = futhark_mc_segmap_parloop_131402;
    futhark_mc_segmap_parloop_131402_task.args =
        &futhark_mc_segmap_parloop_struct_131401;
    futhark_mc_segmap_parloop_131402_task.iterations = iterations;
    futhark_mc_segmap_parloop_131402_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131402_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131402_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131402_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131402_task);
    
    if (futhark_mc_segmap_parloop_131402_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131402_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131402_total_end -
                 futhark_mc_segmap_parloop_131402_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131402_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131402_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131402_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131400_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131400_end -
                 futhark_mc_segmap_nested_task_131400_start;
        
        ctx->futhark_mc_segmap_nested_task_131400_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131400_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131400_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131425 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122540;
    char *free_mem_122544;
};
struct futhark_mc_segmap_parloop_struct_131427 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122540;
    char *free_mem_122544;
};
static int futhark_mc_segmap_parloop_131428(void *args, int64_t start,
                                            int64_t end, int flat_tid_118190,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131427
    *futhark_mc_segmap_parloop_struct_131427 =
    (struct futhark_mc_segmap_parloop_struct_131427 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131427->ctx;
    uint64_t futhark_mc_segmap_parloop_131428_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131428_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131427->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131427->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131427->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131427->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131427->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131427->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131427->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131427->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131427->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131427->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131427->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131427->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131427->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122540 = {.desc ="mem_122540", .mem =
                                  futhark_mc_segmap_parloop_struct_131427->free_mem_122540,
                                  .size =0, .references =NULL};
    struct memblock mem_122544 = {.desc ="mem_122544", .mem =
                                  futhark_mc_segmap_parloop_struct_131427->free_mem_122544,
                                  .size =0, .references =NULL};
    size_t mem_122509_cached_sizze_131429 = 0;
    char *mem_122509 = NULL;
    size_t mem_122512_cached_sizze_131430 = 0;
    char *mem_122512 = NULL;
    int64_t iterations = end - start;
    int64_t iter_126184 = start;
    
    if (mem_122509_cached_sizze_131429 < (size_t) bytes_122055) {
        mem_122509 = realloc(mem_122509, bytes_122055);
        mem_122509_cached_sizze_131429 = bytes_122055;
    }
    if (mem_122512_cached_sizze_131430 < (size_t) bytes_122055) {
        mem_122512 = realloc(mem_122512, bytes_122055);
        mem_122512_cached_sizze_131430 = bytes_122055;
    }
    for (; iter_126184 < end; iter_126184++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_126298 = m_114533;
        int64_t gtid_118191 = iter_126184;
        int64_t remnant_126299 = iter_126184 - gtid_118191;
        int64_t x_115365 = ((int64_t *) mem_121982.mem)[gtid_118191];
        
        for (int64_t i_126185 = 0; i_126185 < l_n_m_114584; i_126185++) {
            int64_t x_126188 = ((int64_t *) mem_122124.mem)[gtid_118191 *
                                                            l_n_m_114584 +
                                                            i_126185];
            float x_126189 = ((float *) mem_122128.mem)[gtid_118191 *
                                                        l_n_m_114584 +
                                                        i_126185];
            int64_t min_arg_126190 = mul64(t_jump_114541, i_126185);
            int64_t min_res_126191 = smin64(i_114610, min_arg_126190);
            float defunc_0_f_res_126192 = sitofp_i64_f32(min_res_126191);
            float defunc_2_reduce_res_126193;
            float defunc_2_reduce_res_126194;
            float defunc_2_reduce_res_126195;
            float defunc_2_reduce_res_126196;
            float defunc_2_reduce_res_126197;
            float redout_126199;
            float redout_126200;
            float redout_126201;
            float redout_126202;
            float redout_126203;
            
            redout_126199 = 0.0F;
            redout_126200 = 0.0F;
            redout_126201 = 0.0F;
            redout_126202 = 0.0F;
            redout_126203 = 0.0F;
            for (int64_t i_126198 = 0; i_126198 < l_window_114538; i_126198++) {
                bool cond_126204 = sle64(x_115365, i_126198);
                float defunc_0_f_res_126205;
                
                if (cond_126204) {
                    defunc_0_f_res_126205 = 0.0F;
                } else {
                    int64_t i_126206 = add64(x_126188, i_126198);
                    float x_126207 = ((float *) mem_122004.mem)[gtid_118191 *
                                                                n_114534 +
                                                                i_126206];
                    float defunc_0_f_res_f_res_126208 = 1.0F + x_126207;
                    
                    defunc_0_f_res_126205 = defunc_0_f_res_f_res_126208;
                }
                
                float defunc_0_f_res_126209;
                
                if (cond_126204) {
                    defunc_0_f_res_126209 = 0.0F;
                } else {
                    int64_t i_126210 = add64(x_126188, i_126198);
                    float x_126211 = ((float *) mem_122430.mem)[gtid_118191 *
                                                                n_114534 +
                                                                i_126210];
                    
                    defunc_0_f_res_126209 = x_126211;
                }
                
                float x_j_126212 = defunc_0_f_res_126205 -
                      defunc_0_f_res_126192;
                float abs_res_126213 = (float) fabs(x_j_126212);
                float tmp1_126214 = abs_res_126213 / x_126189;
                float x_126215 = tmp1_126214 * tmp1_126214;
                float y_126216 = tmp1_126214 * x_126215;
                float tmp2_126217 = 1.0F - y_126216;
                float x_126218 = tmp2_126217 * tmp2_126217;
                float tmp3_126219 = tmp2_126217 * x_126218;
                float w_j_126220 = defunc_0_f_res_126209 * tmp3_126219;
                float xw_j_126221 = x_j_126212 * w_j_126220;
                float x2w_j_126222 = x_j_126212 * xw_j_126221;
                float x3w_j_126223 = x_j_126212 * x2w_j_126222;
                float x4w_j_126224 = x_j_126212 * x3w_j_126223;
                float defunc_1_op_res_126225 = w_j_126220 + redout_126199;
                float defunc_1_op_res_126226 = xw_j_126221 + redout_126200;
                float defunc_1_op_res_126227 = x2w_j_126222 + redout_126201;
                float defunc_1_op_res_126228 = x3w_j_126223 + redout_126202;
                float defunc_1_op_res_126229 = x4w_j_126224 + redout_126203;
                float redout_tmp_126302 = defunc_1_op_res_126225;
                float redout_tmp_126303 = defunc_1_op_res_126226;
                float redout_tmp_126304 = defunc_1_op_res_126227;
                float redout_tmp_126305 = defunc_1_op_res_126228;
                float redout_tmp_126306 = defunc_1_op_res_126229;
                
                redout_126199 = redout_tmp_126302;
                redout_126200 = redout_tmp_126303;
                redout_126201 = redout_tmp_126304;
                redout_126202 = redout_tmp_126305;
                redout_126203 = redout_tmp_126306;
            }
            defunc_2_reduce_res_126193 = redout_126199;
            defunc_2_reduce_res_126194 = redout_126200;
            defunc_2_reduce_res_126195 = redout_126201;
            defunc_2_reduce_res_126196 = redout_126202;
            defunc_2_reduce_res_126197 = redout_126203;
            
            float x_126230 = defunc_2_reduce_res_126195 *
                  defunc_2_reduce_res_126197;
            float y_126231 = defunc_2_reduce_res_126196 *
                  defunc_2_reduce_res_126196;
            float a12_126232 = x_126230 - y_126231;
            float x_126233 = defunc_2_reduce_res_126195 *
                  defunc_2_reduce_res_126196;
            float y_126234 = defunc_2_reduce_res_126194 *
                  defunc_2_reduce_res_126197;
            float b12_126235 = x_126233 - y_126234;
            float x_126236 = defunc_2_reduce_res_126194 *
                  defunc_2_reduce_res_126196;
            float y_126237 = defunc_2_reduce_res_126195 *
                  defunc_2_reduce_res_126195;
            float c12_126238 = x_126236 - y_126237;
            float x_126239 = defunc_2_reduce_res_126193 *
                  defunc_2_reduce_res_126197;
            float b2_126240 = x_126239 - y_126237;
            float x_126241 = defunc_2_reduce_res_126194 *
                  defunc_2_reduce_res_126195;
            float y_126242 = defunc_2_reduce_res_126193 *
                  defunc_2_reduce_res_126196;
            float c2_126243 = x_126241 - y_126242;
            float x_126244 = defunc_2_reduce_res_126193 * a12_126232;
            float y_126245 = defunc_2_reduce_res_126194 * b12_126235;
            float x_126246 = x_126244 + y_126245;
            float y_126247 = defunc_2_reduce_res_126195 * c12_126238;
            float y_126248 = x_126246 + y_126247;
            float det_126249 = 1.0F / y_126248;
            float a12_126250 = a12_126232 * det_126249;
            float b12_126251 = b12_126235 * det_126249;
            float c12_126252 = c12_126238 * det_126249;
            float b2_126253 = b2_126240 * det_126249;
            float c2_126254 = c2_126243 * det_126249;
            float defunc_2_reduce_res_126255;
            float defunc_2_reduce_res_126256;
            float redout_126258;
            float redout_126259;
            
            redout_126258 = 0.0F;
            redout_126259 = 0.0F;
            for (int64_t i_126257 = 0; i_126257 < l_window_114538; i_126257++) {
                bool cond_126260 = sle64(x_115365, i_126257);
                float defunc_0_f_res_126261;
                
                if (cond_126260) {
                    defunc_0_f_res_126261 = 0.0F;
                } else {
                    int64_t i_126262 = add64(x_126188, i_126257);
                    float x_126263 = ((float *) mem_122004.mem)[gtid_118191 *
                                                                n_114534 +
                                                                i_126262];
                    float defunc_0_f_res_f_res_126264 = 1.0F + x_126263;
                    
                    defunc_0_f_res_126261 = defunc_0_f_res_f_res_126264;
                }
                
                float defunc_0_f_res_126265;
                
                if (cond_126260) {
                    defunc_0_f_res_126265 = 0.0F;
                } else {
                    int64_t i_126266 = add64(x_126188, i_126257);
                    float x_126267 = ((float *) mem_122430.mem)[gtid_118191 *
                                                                n_114534 +
                                                                i_126266];
                    
                    defunc_0_f_res_126265 = x_126267;
                }
                
                float x_j_126268 = defunc_0_f_res_126261 -
                      defunc_0_f_res_126192;
                float abs_res_126269 = (float) fabs(x_j_126268);
                float tmp1_126270 = abs_res_126269 / x_126189;
                float x_126271 = tmp1_126270 * tmp1_126270;
                float y_126272 = tmp1_126270 * x_126271;
                float tmp2_126273 = 1.0F - y_126272;
                float x_126274 = tmp2_126273 * tmp2_126273;
                float tmp3_126275 = tmp2_126273 * x_126274;
                float tmp4_126276 = defunc_0_f_res_126265 * tmp3_126275;
                float defunc_1_f_res_126277 = x_j_126268 * tmp4_126276;
                float defunc_1_f_res_126278 = x_j_126268 *
                      defunc_1_f_res_126277;
                float defunc_0_f_res_126279;
                
                if (cond_126260) {
                    defunc_0_f_res_126279 = 0.0F;
                } else {
                    int64_t i_126280 = add64(x_126188, i_126257);
                    float x_126281 = ((float *) mem_122426.mem)[gtid_118191 *
                                                                n_114534 +
                                                                i_126280];
                    
                    defunc_0_f_res_126279 = x_126281;
                }
                
                float x_126282 = a12_126250 * tmp4_126276;
                float y_126283 = b12_126251 * defunc_1_f_res_126277;
                float x_126284 = x_126282 + y_126283;
                float y_126285 = c12_126252 * defunc_1_f_res_126278;
                float x_126286 = x_126284 + y_126285;
                float defunc_9_fit_fun_res_126287 = defunc_0_f_res_126279 *
                      x_126286;
                float x_126288 = b12_126251 * tmp4_126276;
                float y_126289 = b2_126253 * defunc_1_f_res_126277;
                float x_126290 = x_126288 + y_126289;
                float y_126291 = c2_126254 * defunc_1_f_res_126278;
                float x_126292 = x_126290 + y_126291;
                float defunc_9_slope_fun_res_126293 = defunc_0_f_res_126279 *
                      x_126292;
                float defunc_1_op_res_126294 = defunc_9_fit_fun_res_126287 +
                      redout_126258;
                float defunc_1_op_res_126295 = defunc_9_slope_fun_res_126293 +
                      redout_126259;
                float redout_tmp_126307 = defunc_1_op_res_126294;
                float redout_tmp_126308 = defunc_1_op_res_126295;
                
                redout_126258 = redout_tmp_126307;
                redout_126259 = redout_tmp_126308;
            }
            defunc_2_reduce_res_126255 = redout_126258;
            defunc_2_reduce_res_126256 = redout_126259;
            ((float *) mem_122509)[i_126185] = defunc_2_reduce_res_126255;
            ((float *) mem_122512)[i_126185] = defunc_2_reduce_res_126256;
        }
        memmove(mem_122540.mem + gtid_118191 * l_n_m_114584 * (int64_t) 4,
                mem_122509 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
        memmove(mem_122544.mem + gtid_118191 * l_n_m_114584 * (int64_t) 4,
                mem_122512 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122509);
    free(mem_122512);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131428_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131428_end -
                 futhark_mc_segmap_parloop_131428_start;
        
        ctx->futhark_mc_segmap_parloop_131428_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131428_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131428_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131426(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118190 = tid;
    int num_tasks_126183 = info.nsubtasks;
    struct futhark_mc_task_131425 *futhark_mc_task_131425 =
                                  (struct futhark_mc_task_131425 *) args;
    struct futhark_context *ctx = futhark_mc_task_131425->ctx;
    uint64_t futhark_mc_segmap_task_131426_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131426_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131425->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131425->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131425->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131425->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131425->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131425->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131425->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131425->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131425->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131425->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131425->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131425->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131425->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122540 = {.desc ="mem_122540", .mem =
                                  futhark_mc_task_131425->free_mem_122540,
                                  .size =0, .references =NULL};
    struct memblock mem_122544 = {.desc ="mem_122544", .mem =
                                  futhark_mc_task_131425->free_mem_122544,
                                  .size =0, .references =NULL};
    int64_t iter_126184;
    struct futhark_mc_segmap_parloop_struct_131427
    futhark_mc_segmap_parloop_struct_131427;
    
    futhark_mc_segmap_parloop_struct_131427.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131427.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131427.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131427.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131427.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131427.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131427.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131427.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131427.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131427.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131427.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131427.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131427.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131427.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131427.free_mem_122540 = mem_122540.mem;
    futhark_mc_segmap_parloop_struct_131427.free_mem_122544 = mem_122544.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131428_task;
    
    futhark_mc_segmap_parloop_131428_task.name =
        "futhark_mc_segmap_parloop_131428";
    futhark_mc_segmap_parloop_131428_task.fn = futhark_mc_segmap_parloop_131428;
    futhark_mc_segmap_parloop_131428_task.args =
        &futhark_mc_segmap_parloop_struct_131427;
    futhark_mc_segmap_parloop_131428_task.iterations = iterations;
    futhark_mc_segmap_parloop_131428_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131428_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131428_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131428_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131428_task);
    
    if (futhark_mc_segmap_parloop_131428_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131428_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131428_total_end -
                 futhark_mc_segmap_parloop_131428_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131428_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131428_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131428_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131426_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131426_end -
                 futhark_mc_segmap_task_131426_start;
        
        ctx->futhark_mc_segmap_task_131426_runs[tid]++;
        ctx->futhark_mc_segmap_task_131426_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131426_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131432 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122540;
    char *free_mem_122544;
};
struct futhark_mc_task_131436 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_118193;
    int64_t free_x_118323;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122503;
    char *free_mem_122506;
};
struct futhark_mc_segmap_parloop_struct_131438 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_118193;
    int64_t free_x_118323;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122503;
    char *free_mem_122506;
};
static int futhark_mc_segmap_parloop_131439(void *args, int64_t start,
                                            int64_t end, int flat_tid_118194,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131438
    *futhark_mc_segmap_parloop_struct_131438 =
    (struct futhark_mc_segmap_parloop_struct_131438 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131438->ctx;
    uint64_t futhark_mc_segmap_parloop_131439_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131439_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131438->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131438->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131438->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131438->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131438->free_i_114610;
    int64_t gtid_118193 =
            futhark_mc_segmap_parloop_struct_131438->free_gtid_118193;
    int64_t x_118323 = futhark_mc_segmap_parloop_struct_131438->free_x_118323;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131438->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131438->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131438->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131438->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131438->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122503 = {.desc ="mem_122503", .mem =
                                  futhark_mc_segmap_parloop_struct_131438->free_mem_122503,
                                  .size =0, .references =NULL};
    struct memblock mem_122506 = {.desc ="mem_122506", .mem =
                                  futhark_mc_segmap_parloop_struct_131438->free_mem_122506,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_126534 = start;
    
    for (; iter_126534 < end; iter_126534++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_126606 = l_n_m_114584;
        int64_t gtid_118195 = iter_126534;
        int64_t remnant_126607 = iter_126534 - gtid_118195;
        int64_t x_126423 = ((int64_t *) mem_122124.mem)[gtid_118193 *
                                                        l_n_m_114584 +
                                                        gtid_118195];
        float x_126424 = ((float *) mem_122128.mem)[gtid_118193 * l_n_m_114584 +
                                                    gtid_118195];
        int64_t min_arg_126425 = mul64(t_jump_114541, gtid_118195);
        int64_t min_res_126426 = smin64(i_114610, min_arg_126425);
        float defunc_0_f_res_126427 = sitofp_i64_f32(min_res_126426);
        float defunc_2_reduce_res_126428;
        float defunc_2_reduce_res_126429;
        float defunc_2_reduce_res_126430;
        float defunc_2_reduce_res_126431;
        float defunc_2_reduce_res_126432;
        float redout_126536;
        float redout_126537;
        float redout_126538;
        float redout_126539;
        float redout_126540;
        
        redout_126536 = 0.0F;
        redout_126537 = 0.0F;
        redout_126538 = 0.0F;
        redout_126539 = 0.0F;
        redout_126540 = 0.0F;
        for (int64_t i_126535 = 0; i_126535 < l_window_114538; i_126535++) {
            bool cond_126541 = sle64(x_118323, i_126535);
            float defunc_0_f_res_126542;
            
            if (cond_126541) {
                defunc_0_f_res_126542 = 0.0F;
            } else {
                int64_t i_126543 = add64(x_126423, i_126535);
                float x_126544 = ((float *) mem_122004.mem)[gtid_118193 *
                                                            n_114534 +
                                                            i_126543];
                float defunc_0_f_res_f_res_126545 = 1.0F + x_126544;
                
                defunc_0_f_res_126542 = defunc_0_f_res_f_res_126545;
            }
            
            float defunc_0_f_res_126546;
            
            if (cond_126541) {
                defunc_0_f_res_126546 = 0.0F;
            } else {
                int64_t i_126547 = add64(x_126423, i_126535);
                float x_126548 = ((float *) mem_122430.mem)[gtid_118193 *
                                                            n_114534 +
                                                            i_126547];
                
                defunc_0_f_res_126546 = x_126548;
            }
            
            float x_j_126549 = defunc_0_f_res_126542 - defunc_0_f_res_126427;
            float abs_res_126550 = (float) fabs(x_j_126549);
            float tmp1_126551 = abs_res_126550 / x_126424;
            float x_126552 = tmp1_126551 * tmp1_126551;
            float y_126553 = tmp1_126551 * x_126552;
            float tmp2_126554 = 1.0F - y_126553;
            float x_126555 = tmp2_126554 * tmp2_126554;
            float tmp3_126556 = tmp2_126554 * x_126555;
            float w_j_126557 = defunc_0_f_res_126546 * tmp3_126556;
            float xw_j_126558 = x_j_126549 * w_j_126557;
            float x2w_j_126559 = x_j_126549 * xw_j_126558;
            float x3w_j_126560 = x_j_126549 * x2w_j_126559;
            float x4w_j_126561 = x_j_126549 * x3w_j_126560;
            float defunc_1_op_res_126562 = w_j_126557 + redout_126536;
            float defunc_1_op_res_126563 = xw_j_126558 + redout_126537;
            float defunc_1_op_res_126564 = x2w_j_126559 + redout_126538;
            float defunc_1_op_res_126565 = x3w_j_126560 + redout_126539;
            float defunc_1_op_res_126566 = x4w_j_126561 + redout_126540;
            float redout_tmp_126608 = defunc_1_op_res_126562;
            float redout_tmp_126609 = defunc_1_op_res_126563;
            float redout_tmp_126610 = defunc_1_op_res_126564;
            float redout_tmp_126611 = defunc_1_op_res_126565;
            float redout_tmp_126612 = defunc_1_op_res_126566;
            
            redout_126536 = redout_tmp_126608;
            redout_126537 = redout_tmp_126609;
            redout_126538 = redout_tmp_126610;
            redout_126539 = redout_tmp_126611;
            redout_126540 = redout_tmp_126612;
        }
        defunc_2_reduce_res_126428 = redout_126536;
        defunc_2_reduce_res_126429 = redout_126537;
        defunc_2_reduce_res_126430 = redout_126538;
        defunc_2_reduce_res_126431 = redout_126539;
        defunc_2_reduce_res_126432 = redout_126540;
        
        float x_126465 = defunc_2_reduce_res_126430 *
              defunc_2_reduce_res_126432;
        float y_126466 = defunc_2_reduce_res_126431 *
              defunc_2_reduce_res_126431;
        float a12_126467 = x_126465 - y_126466;
        float x_126468 = defunc_2_reduce_res_126430 *
              defunc_2_reduce_res_126431;
        float y_126469 = defunc_2_reduce_res_126429 *
              defunc_2_reduce_res_126432;
        float b12_126470 = x_126468 - y_126469;
        float x_126471 = defunc_2_reduce_res_126429 *
              defunc_2_reduce_res_126431;
        float y_126472 = defunc_2_reduce_res_126430 *
              defunc_2_reduce_res_126430;
        float c12_126473 = x_126471 - y_126472;
        float x_126474 = defunc_2_reduce_res_126428 *
              defunc_2_reduce_res_126432;
        float b2_126475 = x_126474 - y_126472;
        float x_126476 = defunc_2_reduce_res_126429 *
              defunc_2_reduce_res_126430;
        float y_126477 = defunc_2_reduce_res_126428 *
              defunc_2_reduce_res_126431;
        float c2_126478 = x_126476 - y_126477;
        float x_126479 = defunc_2_reduce_res_126428 * a12_126467;
        float y_126480 = defunc_2_reduce_res_126429 * b12_126470;
        float x_126481 = x_126479 + y_126480;
        float y_126482 = defunc_2_reduce_res_126430 * c12_126473;
        float y_126483 = x_126481 + y_126482;
        float det_126484 = 1.0F / y_126483;
        float a12_126485 = a12_126467 * det_126484;
        float b12_126486 = b12_126470 * det_126484;
        float c12_126487 = c12_126473 * det_126484;
        float b2_126488 = b2_126475 * det_126484;
        float c2_126489 = c2_126478 * det_126484;
        float defunc_2_reduce_res_126490;
        float defunc_2_reduce_res_126491;
        float redout_126568;
        float redout_126569;
        
        redout_126568 = 0.0F;
        redout_126569 = 0.0F;
        for (int64_t i_126567 = 0; i_126567 < l_window_114538; i_126567++) {
            bool cond_126570 = sle64(x_118323, i_126567);
            float defunc_0_f_res_126571;
            
            if (cond_126570) {
                defunc_0_f_res_126571 = 0.0F;
            } else {
                int64_t i_126572 = add64(x_126423, i_126567);
                float x_126573 = ((float *) mem_122004.mem)[gtid_118193 *
                                                            n_114534 +
                                                            i_126572];
                float defunc_0_f_res_f_res_126574 = 1.0F + x_126573;
                
                defunc_0_f_res_126571 = defunc_0_f_res_f_res_126574;
            }
            
            float defunc_0_f_res_126575;
            
            if (cond_126570) {
                defunc_0_f_res_126575 = 0.0F;
            } else {
                int64_t i_126576 = add64(x_126423, i_126567);
                float x_126577 = ((float *) mem_122430.mem)[gtid_118193 *
                                                            n_114534 +
                                                            i_126576];
                
                defunc_0_f_res_126575 = x_126577;
            }
            
            float x_j_126578 = defunc_0_f_res_126571 - defunc_0_f_res_126427;
            float abs_res_126579 = (float) fabs(x_j_126578);
            float tmp1_126580 = abs_res_126579 / x_126424;
            float x_126581 = tmp1_126580 * tmp1_126580;
            float y_126582 = tmp1_126580 * x_126581;
            float tmp2_126583 = 1.0F - y_126582;
            float x_126584 = tmp2_126583 * tmp2_126583;
            float tmp3_126585 = tmp2_126583 * x_126584;
            float tmp4_126586 = defunc_0_f_res_126575 * tmp3_126585;
            float defunc_1_f_res_126587 = x_j_126578 * tmp4_126586;
            float defunc_1_f_res_126588 = x_j_126578 * defunc_1_f_res_126587;
            float defunc_0_f_res_126589;
            
            if (cond_126570) {
                defunc_0_f_res_126589 = 0.0F;
            } else {
                int64_t i_126590 = add64(x_126423, i_126567);
                float x_126591 = ((float *) mem_122426.mem)[gtid_118193 *
                                                            n_114534 +
                                                            i_126590];
                
                defunc_0_f_res_126589 = x_126591;
            }
            
            float x_126592 = a12_126485 * tmp4_126586;
            float y_126593 = b12_126486 * defunc_1_f_res_126587;
            float x_126594 = x_126592 + y_126593;
            float y_126595 = c12_126487 * defunc_1_f_res_126588;
            float x_126596 = x_126594 + y_126595;
            float defunc_9_fit_fun_res_126597 = defunc_0_f_res_126589 *
                  x_126596;
            float x_126598 = b12_126486 * tmp4_126586;
            float y_126599 = b2_126488 * defunc_1_f_res_126587;
            float x_126600 = x_126598 + y_126599;
            float y_126601 = c2_126489 * defunc_1_f_res_126588;
            float x_126602 = x_126600 + y_126601;
            float defunc_9_slope_fun_res_126603 = defunc_0_f_res_126589 *
                  x_126602;
            float defunc_1_op_res_126604 = defunc_9_fit_fun_res_126597 +
                  redout_126568;
            float defunc_1_op_res_126605 = defunc_9_slope_fun_res_126603 +
                  redout_126569;
            float redout_tmp_126613 = defunc_1_op_res_126604;
            float redout_tmp_126614 = defunc_1_op_res_126605;
            
            redout_126568 = redout_tmp_126613;
            redout_126569 = redout_tmp_126614;
        }
        defunc_2_reduce_res_126490 = redout_126568;
        defunc_2_reduce_res_126491 = redout_126569;
        ((float *) mem_122503.mem)[gtid_118195] = defunc_2_reduce_res_126490;
        ((float *) mem_122506.mem)[gtid_118195] = defunc_2_reduce_res_126491;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131439_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131439_end -
                 futhark_mc_segmap_parloop_131439_start;
        
        ctx->futhark_mc_segmap_parloop_131439_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131439_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131439_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131437(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118194 = tid;
    int num_tasks_126533 = info.nsubtasks;
    struct futhark_mc_task_131436 *futhark_mc_task_131436 =
                                  (struct futhark_mc_task_131436 *) args;
    struct futhark_context *ctx = futhark_mc_task_131436->ctx;
    uint64_t futhark_mc_segmap_task_131437_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131437_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131436->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131436->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131436->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131436->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131436->free_i_114610;
    int64_t gtid_118193 = futhark_mc_task_131436->free_gtid_118193;
    int64_t x_118323 = futhark_mc_task_131436->free_x_118323;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131436->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131436->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131436->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131436->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131436->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122503 = {.desc ="mem_122503", .mem =
                                  futhark_mc_task_131436->free_mem_122503,
                                  .size =0, .references =NULL};
    struct memblock mem_122506 = {.desc ="mem_122506", .mem =
                                  futhark_mc_task_131436->free_mem_122506,
                                  .size =0, .references =NULL};
    int64_t iter_126534;
    struct futhark_mc_segmap_parloop_struct_131438
    futhark_mc_segmap_parloop_struct_131438;
    
    futhark_mc_segmap_parloop_struct_131438.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131438.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131438.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131438.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131438.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131438.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131438.free_gtid_118193 = gtid_118193;
    futhark_mc_segmap_parloop_struct_131438.free_x_118323 = x_118323;
    futhark_mc_segmap_parloop_struct_131438.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131438.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131438.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131438.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131438.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131438.free_mem_122503 = mem_122503.mem;
    futhark_mc_segmap_parloop_struct_131438.free_mem_122506 = mem_122506.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131439_task;
    
    futhark_mc_segmap_parloop_131439_task.name =
        "futhark_mc_segmap_parloop_131439";
    futhark_mc_segmap_parloop_131439_task.fn = futhark_mc_segmap_parloop_131439;
    futhark_mc_segmap_parloop_131439_task.args =
        &futhark_mc_segmap_parloop_struct_131438;
    futhark_mc_segmap_parloop_131439_task.iterations = iterations;
    futhark_mc_segmap_parloop_131439_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131439_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131439_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131439_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131439_task);
    
    if (futhark_mc_segmap_parloop_131439_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131439_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131439_total_end -
                 futhark_mc_segmap_parloop_131439_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131439_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131439_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131439_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131437_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131437_end -
                 futhark_mc_segmap_task_131437_start;
        
        ctx->futhark_mc_segmap_task_131437_runs[tid]++;
        ctx->futhark_mc_segmap_task_131437_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131437_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131441 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_118193;
    int64_t free_x_118323;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    char *free_mem_122503;
    char *free_mem_122506;
};
struct futhark_mc_task_131443 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118193;
    int64_t free_x_118323;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_126310;
    float free_x_126311;
    float free_defunc_0_f_res_126314;
    float *retval_defunc_2_reduce_res_126315;
    float *retval_defunc_2_reduce_res_126316;
    float *retval_defunc_2_reduce_res_126317;
    float *retval_defunc_2_reduce_res_126318;
    float *retval_defunc_2_reduce_res_126319;
};
struct futhark_mc_segred_stage_1_parloop_struct_131450 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118193;
    int64_t free_x_118323;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_126310;
    float free_x_126311;
    float free_defunc_0_f_res_126314;
    char *free_reduce_stage_1_tid_res_arr_mem_126695;
    char *free_reduce_stage_1_tid_res_arr_mem_126697;
    char *free_reduce_stage_1_tid_res_arr_mem_126699;
    char *free_reduce_stage_1_tid_res_arr_mem_126701;
    char *free_reduce_stage_1_tid_res_arr_mem_126703;
};
static int futhark_mc_segred_stage_1_parloop_131451(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_118198,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131450
    *futhark_mc_segred_stage_1_parloop_struct_131450 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131450 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131450->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131451_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131451_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131450->free_n_114534;
    int64_t gtid_118193 =
            futhark_mc_segred_stage_1_parloop_struct_131450->free_gtid_118193;
    int64_t x_118323 =
            futhark_mc_segred_stage_1_parloop_struct_131450->free_x_118323;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131450->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131450->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_126310 =
            futhark_mc_segred_stage_1_parloop_struct_131450->free_x_126310;
    float x_126311 =
          futhark_mc_segred_stage_1_parloop_struct_131450->free_x_126311;
    float defunc_0_f_res_126314 =
          futhark_mc_segred_stage_1_parloop_struct_131450->free_defunc_0_f_res_126314;
    struct memblock reduce_stage_1_tid_res_arr_mem_126695 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126695",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131450->free_reduce_stage_1_tid_res_arr_mem_126695,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_126697 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126697",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131450->free_reduce_stage_1_tid_res_arr_mem_126697,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_126699 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126699",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131450->free_reduce_stage_1_tid_res_arr_mem_126699,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_126701 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126701",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131450->free_reduce_stage_1_tid_res_arr_mem_126701,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_126703 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126703",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131450->free_reduce_stage_1_tid_res_arr_mem_126703,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_126705 = start;
    float x_126616;
    float x_126617;
    float x_126619;
    float x_126620;
    float x_126622;
    float x_126623;
    float x_126625;
    float x_126626;
    float x_126628;
    float x_126629;
    float local_acc_126706 = 0.0F;
    float local_acc_126707 = 0.0F;
    float local_acc_126708 = 0.0F;
    float local_acc_126709 = 0.0F;
    float local_acc_126710 = 0.0F;
    
    for (; iter_126705 < end; iter_126705++) {
        int64_t gtid_118199 = iter_126705;
        bool cond_126631 = sle64(x_118323, gtid_118199);
        float defunc_0_f_res_126632;
        
        if (cond_126631) {
            defunc_0_f_res_126632 = 0.0F;
        } else {
            int64_t i_126633 = add64(gtid_118199, x_126310);
            float x_126634 = ((float *) mem_122004.mem)[gtid_118193 * n_114534 +
                                                        i_126633];
            float defunc_0_f_res_f_res_126635 = 1.0F + x_126634;
            
            defunc_0_f_res_126632 = defunc_0_f_res_f_res_126635;
        }
        
        float defunc_0_f_res_126636;
        
        if (cond_126631) {
            defunc_0_f_res_126636 = 0.0F;
        } else {
            int64_t i_126637 = add64(gtid_118199, x_126310);
            float x_126638 = ((float *) mem_122430.mem)[gtid_118193 * n_114534 +
                                                        i_126637];
            
            defunc_0_f_res_126636 = x_126638;
        }
        
        float x_j_126639 = defunc_0_f_res_126632 - defunc_0_f_res_126314;
        float abs_res_126640 = (float) fabs(x_j_126639);
        float tmp1_126641 = abs_res_126640 / x_126311;
        float x_126642 = tmp1_126641 * tmp1_126641;
        float y_126643 = tmp1_126641 * x_126642;
        float tmp2_126644 = 1.0F - y_126643;
        float x_126645 = tmp2_126644 * tmp2_126644;
        float tmp3_126646 = tmp2_126644 * x_126645;
        float w_j_126647 = defunc_0_f_res_126636 * tmp3_126646;
        float xw_j_126648 = x_j_126639 * w_j_126647;
        float x2w_j_126649 = x_j_126639 * xw_j_126648;
        float x3w_j_126650 = x_j_126639 * x2w_j_126649;
        float x4w_j_126651 = x_j_126639 * x3w_j_126650;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_126616 = local_acc_126706;
        }
        // Load next params
        {
            x_126617 = w_j_126647;
        }
        // Red body
        {
            float defunc_1_op_res_126618 = x_126616 + x_126617;
            
            local_acc_126706 = defunc_1_op_res_126618;
        }
        // Load accum params
        {
            x_126619 = local_acc_126707;
        }
        // Load next params
        {
            x_126620 = xw_j_126648;
        }
        // Red body
        {
            float defunc_1_op_res_126621 = x_126619 + x_126620;
            
            local_acc_126707 = defunc_1_op_res_126621;
        }
        // Load accum params
        {
            x_126622 = local_acc_126708;
        }
        // Load next params
        {
            x_126623 = x2w_j_126649;
        }
        // Red body
        {
            float defunc_1_op_res_126624 = x_126622 + x_126623;
            
            local_acc_126708 = defunc_1_op_res_126624;
        }
        // Load accum params
        {
            x_126625 = local_acc_126709;
        }
        // Load next params
        {
            x_126626 = x3w_j_126650;
        }
        // Red body
        {
            float defunc_1_op_res_126627 = x_126625 + x_126626;
            
            local_acc_126709 = defunc_1_op_res_126627;
        }
        // Load accum params
        {
            x_126628 = local_acc_126710;
        }
        // Load next params
        {
            x_126629 = x4w_j_126651;
        }
        // Red body
        {
            float defunc_1_op_res_126630 = x_126628 + x_126629;
            
            local_acc_126710 = defunc_1_op_res_126630;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_126695.mem)[flat_tid_118198] =
        local_acc_126706;
    ((float *) reduce_stage_1_tid_res_arr_mem_126697.mem)[flat_tid_118198] =
        local_acc_126707;
    ((float *) reduce_stage_1_tid_res_arr_mem_126699.mem)[flat_tid_118198] =
        local_acc_126708;
    ((float *) reduce_stage_1_tid_res_arr_mem_126701.mem)[flat_tid_118198] =
        local_acc_126709;
    ((float *) reduce_stage_1_tid_res_arr_mem_126703.mem)[flat_tid_118198] =
        local_acc_126710;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131451_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131451_end -
                 futhark_mc_segred_stage_1_parloop_131451_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131451_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131451_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131451_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131444(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118198 = tid;
    int num_tasks_126694 = info.nsubtasks;
    struct futhark_mc_task_131443 *futhark_mc_task_131443 =
                                  (struct futhark_mc_task_131443 *) args;
    struct futhark_context *ctx = futhark_mc_task_131443->ctx;
    uint64_t futhark_mc_segred_task_131444_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131444_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131443->free_n_114534;
    int64_t gtid_118193 = futhark_mc_task_131443->free_gtid_118193;
    int64_t x_118323 = futhark_mc_task_131443->free_x_118323;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131443->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131443->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_126310 = futhark_mc_task_131443->free_x_126310;
    float x_126311 = futhark_mc_task_131443->free_x_126311;
    float defunc_0_f_res_126314 =
          futhark_mc_task_131443->free_defunc_0_f_res_126314;
    float defunc_2_reduce_res_126315 =
          *futhark_mc_task_131443->retval_defunc_2_reduce_res_126315;
    float defunc_2_reduce_res_126316 =
          *futhark_mc_task_131443->retval_defunc_2_reduce_res_126316;
    float defunc_2_reduce_res_126317 =
          *futhark_mc_task_131443->retval_defunc_2_reduce_res_126317;
    float defunc_2_reduce_res_126318 =
          *futhark_mc_task_131443->retval_defunc_2_reduce_res_126318;
    float defunc_2_reduce_res_126319 =
          *futhark_mc_task_131443->retval_defunc_2_reduce_res_126319;
    size_t reduce_stage_1_tid_res_arr_mem_126695_cached_sizze_131445 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126695 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_126697_cached_sizze_131446 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126697 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_126699_cached_sizze_131447 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126699 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_126701_cached_sizze_131448 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126701 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_126703_cached_sizze_131449 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126703 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_126695_cached_sizze_131445 <
        (size_t) ((int64_t) 4 * num_tasks_126694)) {
        reduce_stage_1_tid_res_arr_mem_126695 =
            realloc(reduce_stage_1_tid_res_arr_mem_126695, (int64_t) 4 *
                    num_tasks_126694);
        reduce_stage_1_tid_res_arr_mem_126695_cached_sizze_131445 =
            (int64_t) 4 * num_tasks_126694;
    }
    if (reduce_stage_1_tid_res_arr_mem_126697_cached_sizze_131446 <
        (size_t) ((int64_t) 4 * num_tasks_126694)) {
        reduce_stage_1_tid_res_arr_mem_126697 =
            realloc(reduce_stage_1_tid_res_arr_mem_126697, (int64_t) 4 *
                    num_tasks_126694);
        reduce_stage_1_tid_res_arr_mem_126697_cached_sizze_131446 =
            (int64_t) 4 * num_tasks_126694;
    }
    if (reduce_stage_1_tid_res_arr_mem_126699_cached_sizze_131447 <
        (size_t) ((int64_t) 4 * num_tasks_126694)) {
        reduce_stage_1_tid_res_arr_mem_126699 =
            realloc(reduce_stage_1_tid_res_arr_mem_126699, (int64_t) 4 *
                    num_tasks_126694);
        reduce_stage_1_tid_res_arr_mem_126699_cached_sizze_131447 =
            (int64_t) 4 * num_tasks_126694;
    }
    if (reduce_stage_1_tid_res_arr_mem_126701_cached_sizze_131448 <
        (size_t) ((int64_t) 4 * num_tasks_126694)) {
        reduce_stage_1_tid_res_arr_mem_126701 =
            realloc(reduce_stage_1_tid_res_arr_mem_126701, (int64_t) 4 *
                    num_tasks_126694);
        reduce_stage_1_tid_res_arr_mem_126701_cached_sizze_131448 =
            (int64_t) 4 * num_tasks_126694;
    }
    if (reduce_stage_1_tid_res_arr_mem_126703_cached_sizze_131449 <
        (size_t) ((int64_t) 4 * num_tasks_126694)) {
        reduce_stage_1_tid_res_arr_mem_126703 =
            realloc(reduce_stage_1_tid_res_arr_mem_126703, (int64_t) 4 *
                    num_tasks_126694);
        reduce_stage_1_tid_res_arr_mem_126703_cached_sizze_131449 =
            (int64_t) 4 * num_tasks_126694;
    }
    
    int64_t iter_126705;
    struct futhark_mc_segred_stage_1_parloop_struct_131450
    futhark_mc_segred_stage_1_parloop_struct_131450;
    
    futhark_mc_segred_stage_1_parloop_struct_131450.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131450.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131450.free_gtid_118193 =
        gtid_118193;
    futhark_mc_segred_stage_1_parloop_struct_131450.free_x_118323 = x_118323;
    futhark_mc_segred_stage_1_parloop_struct_131450.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131450.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131450.free_x_126310 = x_126310;
    futhark_mc_segred_stage_1_parloop_struct_131450.free_x_126311 = x_126311;
    futhark_mc_segred_stage_1_parloop_struct_131450.free_defunc_0_f_res_126314 =
        defunc_0_f_res_126314;
    futhark_mc_segred_stage_1_parloop_struct_131450.free_reduce_stage_1_tid_res_arr_mem_126695 =
        reduce_stage_1_tid_res_arr_mem_126695;
    futhark_mc_segred_stage_1_parloop_struct_131450.free_reduce_stage_1_tid_res_arr_mem_126697 =
        reduce_stage_1_tid_res_arr_mem_126697;
    futhark_mc_segred_stage_1_parloop_struct_131450.free_reduce_stage_1_tid_res_arr_mem_126699 =
        reduce_stage_1_tid_res_arr_mem_126699;
    futhark_mc_segred_stage_1_parloop_struct_131450.free_reduce_stage_1_tid_res_arr_mem_126701 =
        reduce_stage_1_tid_res_arr_mem_126701;
    futhark_mc_segred_stage_1_parloop_struct_131450.free_reduce_stage_1_tid_res_arr_mem_126703 =
        reduce_stage_1_tid_res_arr_mem_126703;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131451_task;
    
    futhark_mc_segred_stage_1_parloop_131451_task.name =
        "futhark_mc_segred_stage_1_parloop_131451";
    futhark_mc_segred_stage_1_parloop_131451_task.fn =
        futhark_mc_segred_stage_1_parloop_131451;
    futhark_mc_segred_stage_1_parloop_131451_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131450;
    futhark_mc_segred_stage_1_parloop_131451_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131451_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131451_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131451_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131451_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131451_task);
    
    if (futhark_mc_segred_stage_1_parloop_131451_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131451_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131451_total_end -
                 futhark_mc_segred_stage_1_parloop_131451_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131451_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131451_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131451_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_126315 = 0.0F;
        defunc_2_reduce_res_126316 = 0.0F;
        defunc_2_reduce_res_126317 = 0.0F;
        defunc_2_reduce_res_126318 = 0.0F;
        defunc_2_reduce_res_126319 = 0.0F;
    }
    
    float x_126711;
    float x_126712;
    float x_126714;
    float x_126715;
    float x_126717;
    float x_126718;
    float x_126720;
    float x_126721;
    float x_126723;
    float x_126724;
    
    for (int32_t i_126726 = 0; i_126726 < num_tasks_126694; i_126726++) {
        flat_tid_118198 = i_126726;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_126711 = defunc_2_reduce_res_126315;
            }
            // load next params
            {
                x_126712 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126695)[flat_tid_118198];
            }
            // red body
            {
                float defunc_1_op_res_126713 = x_126711 + x_126712;
                
                defunc_2_reduce_res_126315 = defunc_1_op_res_126713;
            }
            // load acc params
            {
                x_126714 = defunc_2_reduce_res_126316;
            }
            // load next params
            {
                x_126715 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126697)[flat_tid_118198];
            }
            // red body
            {
                float defunc_1_op_res_126716 = x_126714 + x_126715;
                
                defunc_2_reduce_res_126316 = defunc_1_op_res_126716;
            }
            // load acc params
            {
                x_126717 = defunc_2_reduce_res_126317;
            }
            // load next params
            {
                x_126718 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126699)[flat_tid_118198];
            }
            // red body
            {
                float defunc_1_op_res_126719 = x_126717 + x_126718;
                
                defunc_2_reduce_res_126317 = defunc_1_op_res_126719;
            }
            // load acc params
            {
                x_126720 = defunc_2_reduce_res_126318;
            }
            // load next params
            {
                x_126721 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126701)[flat_tid_118198];
            }
            // red body
            {
                float defunc_1_op_res_126722 = x_126720 + x_126721;
                
                defunc_2_reduce_res_126318 = defunc_1_op_res_126722;
            }
            // load acc params
            {
                x_126723 = defunc_2_reduce_res_126319;
            }
            // load next params
            {
                x_126724 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126703)[flat_tid_118198];
            }
            // red body
            {
                float defunc_1_op_res_126725 = x_126723 + x_126724;
                
                defunc_2_reduce_res_126319 = defunc_1_op_res_126725;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_126695);
    free(reduce_stage_1_tid_res_arr_mem_126697);
    free(reduce_stage_1_tid_res_arr_mem_126699);
    free(reduce_stage_1_tid_res_arr_mem_126701);
    free(reduce_stage_1_tid_res_arr_mem_126703);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131444_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131444_end -
                 futhark_mc_segred_task_131444_start;
        
        ctx->futhark_mc_segred_task_131444_runs[tid]++;
        ctx->futhark_mc_segred_task_131444_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131444_iter[tid] += iterations;
    }
    *futhark_mc_task_131443->retval_defunc_2_reduce_res_126315 =
        defunc_2_reduce_res_126315;
    *futhark_mc_task_131443->retval_defunc_2_reduce_res_126316 =
        defunc_2_reduce_res_126316;
    *futhark_mc_task_131443->retval_defunc_2_reduce_res_126317 =
        defunc_2_reduce_res_126317;
    *futhark_mc_task_131443->retval_defunc_2_reduce_res_126318 =
        defunc_2_reduce_res_126318;
    *futhark_mc_task_131443->retval_defunc_2_reduce_res_126319 =
        defunc_2_reduce_res_126319;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131452 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118193;
    int64_t free_x_118323;
    char *free_mem_122004;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_x_126310;
    float free_x_126311;
    float free_defunc_0_f_res_126314;
    float free_a12_126376;
    float free_b12_126377;
    float free_c12_126378;
    float free_b2_126379;
    float free_c2_126380;
    float *retval_defunc_2_reduce_res_126381;
    float *retval_defunc_2_reduce_res_126382;
};
struct futhark_mc_segred_stage_1_parloop_struct_131456 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118193;
    int64_t free_x_118323;
    char *free_mem_122004;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_x_126310;
    float free_x_126311;
    float free_defunc_0_f_res_126314;
    float free_a12_126376;
    float free_b12_126377;
    float free_c12_126378;
    float free_b2_126379;
    float free_c2_126380;
    char *free_reduce_stage_1_tid_res_arr_mem_126728;
    char *free_reduce_stage_1_tid_res_arr_mem_126730;
};
static int futhark_mc_segred_stage_1_parloop_131457(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_118200,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131456
    *futhark_mc_segred_stage_1_parloop_struct_131456 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131456 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131456->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131457_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131457_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131456->free_n_114534;
    int64_t gtid_118193 =
            futhark_mc_segred_stage_1_parloop_struct_131456->free_gtid_118193;
    int64_t x_118323 =
            futhark_mc_segred_stage_1_parloop_struct_131456->free_x_118323;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131456->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131456->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131456->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_126310 =
            futhark_mc_segred_stage_1_parloop_struct_131456->free_x_126310;
    float x_126311 =
          futhark_mc_segred_stage_1_parloop_struct_131456->free_x_126311;
    float defunc_0_f_res_126314 =
          futhark_mc_segred_stage_1_parloop_struct_131456->free_defunc_0_f_res_126314;
    float a12_126376 =
          futhark_mc_segred_stage_1_parloop_struct_131456->free_a12_126376;
    float b12_126377 =
          futhark_mc_segred_stage_1_parloop_struct_131456->free_b12_126377;
    float c12_126378 =
          futhark_mc_segred_stage_1_parloop_struct_131456->free_c12_126378;
    float b2_126379 =
          futhark_mc_segred_stage_1_parloop_struct_131456->free_b2_126379;
    float c2_126380 =
          futhark_mc_segred_stage_1_parloop_struct_131456->free_c2_126380;
    struct memblock reduce_stage_1_tid_res_arr_mem_126728 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126728",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131456->free_reduce_stage_1_tid_res_arr_mem_126728,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_126730 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126730",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131456->free_reduce_stage_1_tid_res_arr_mem_126730,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_126732 = start;
    float x_126652;
    float x_126653;
    float x_126655;
    float x_126656;
    float local_acc_126733 = 0.0F;
    float local_acc_126734 = 0.0F;
    
    for (; iter_126732 < end; iter_126732++) {
        int64_t gtid_118201 = iter_126732;
        bool cond_126658 = sle64(x_118323, gtid_118201);
        float defunc_0_f_res_126659;
        
        if (cond_126658) {
            defunc_0_f_res_126659 = 0.0F;
        } else {
            int64_t i_126660 = add64(gtid_118201, x_126310);
            float x_126661 = ((float *) mem_122004.mem)[gtid_118193 * n_114534 +
                                                        i_126660];
            float defunc_0_f_res_f_res_126662 = 1.0F + x_126661;
            
            defunc_0_f_res_126659 = defunc_0_f_res_f_res_126662;
        }
        
        float defunc_0_f_res_126663;
        
        if (cond_126658) {
            defunc_0_f_res_126663 = 0.0F;
        } else {
            int64_t i_126664 = add64(gtid_118201, x_126310);
            float x_126665 = ((float *) mem_122430.mem)[gtid_118193 * n_114534 +
                                                        i_126664];
            
            defunc_0_f_res_126663 = x_126665;
        }
        
        float x_j_126666 = defunc_0_f_res_126659 - defunc_0_f_res_126314;
        float abs_res_126667 = (float) fabs(x_j_126666);
        float tmp1_126668 = abs_res_126667 / x_126311;
        float x_126669 = tmp1_126668 * tmp1_126668;
        float y_126670 = tmp1_126668 * x_126669;
        float tmp2_126671 = 1.0F - y_126670;
        float x_126672 = tmp2_126671 * tmp2_126671;
        float tmp3_126673 = tmp2_126671 * x_126672;
        float tmp4_126674 = defunc_0_f_res_126663 * tmp3_126673;
        float defunc_1_f_res_126675 = x_j_126666 * tmp4_126674;
        float defunc_1_f_res_126676 = x_j_126666 * defunc_1_f_res_126675;
        float defunc_0_f_res_126677;
        
        if (cond_126658) {
            defunc_0_f_res_126677 = 0.0F;
        } else {
            int64_t i_126678 = add64(gtid_118201, x_126310);
            float x_126679 = ((float *) mem_122426.mem)[gtid_118193 * n_114534 +
                                                        i_126678];
            
            defunc_0_f_res_126677 = x_126679;
        }
        
        float x_126680 = a12_126376 * tmp4_126674;
        float y_126681 = b12_126377 * defunc_1_f_res_126675;
        float x_126682 = x_126680 + y_126681;
        float y_126683 = c12_126378 * defunc_1_f_res_126676;
        float x_126684 = x_126682 + y_126683;
        float defunc_9_fit_fun_res_126685 = defunc_0_f_res_126677 * x_126684;
        float x_126686 = b12_126377 * tmp4_126674;
        float y_126687 = b2_126379 * defunc_1_f_res_126675;
        float x_126688 = x_126686 + y_126687;
        float y_126689 = c2_126380 * defunc_1_f_res_126676;
        float x_126690 = x_126688 + y_126689;
        float defunc_9_slope_fun_res_126691 = defunc_0_f_res_126677 * x_126690;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_126652 = local_acc_126733;
        }
        // Load next params
        {
            x_126653 = defunc_9_fit_fun_res_126685;
        }
        // Red body
        {
            float defunc_1_op_res_126654 = x_126652 + x_126653;
            
            local_acc_126733 = defunc_1_op_res_126654;
        }
        // Load accum params
        {
            x_126655 = local_acc_126734;
        }
        // Load next params
        {
            x_126656 = defunc_9_slope_fun_res_126691;
        }
        // Red body
        {
            float defunc_1_op_res_126657 = x_126655 + x_126656;
            
            local_acc_126734 = defunc_1_op_res_126657;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_126728.mem)[flat_tid_118200] =
        local_acc_126733;
    ((float *) reduce_stage_1_tid_res_arr_mem_126730.mem)[flat_tid_118200] =
        local_acc_126734;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131457_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131457_end -
                 futhark_mc_segred_stage_1_parloop_131457_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131457_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131457_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131457_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131453(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118200 = tid;
    int num_tasks_126727 = info.nsubtasks;
    struct futhark_mc_task_131452 *futhark_mc_task_131452 =
                                  (struct futhark_mc_task_131452 *) args;
    struct futhark_context *ctx = futhark_mc_task_131452->ctx;
    uint64_t futhark_mc_segred_task_131453_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131453_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131452->free_n_114534;
    int64_t gtid_118193 = futhark_mc_task_131452->free_gtid_118193;
    int64_t x_118323 = futhark_mc_task_131452->free_x_118323;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131452->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131452->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131452->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_126310 = futhark_mc_task_131452->free_x_126310;
    float x_126311 = futhark_mc_task_131452->free_x_126311;
    float defunc_0_f_res_126314 =
          futhark_mc_task_131452->free_defunc_0_f_res_126314;
    float a12_126376 = futhark_mc_task_131452->free_a12_126376;
    float b12_126377 = futhark_mc_task_131452->free_b12_126377;
    float c12_126378 = futhark_mc_task_131452->free_c12_126378;
    float b2_126379 = futhark_mc_task_131452->free_b2_126379;
    float c2_126380 = futhark_mc_task_131452->free_c2_126380;
    float defunc_2_reduce_res_126381 =
          *futhark_mc_task_131452->retval_defunc_2_reduce_res_126381;
    float defunc_2_reduce_res_126382 =
          *futhark_mc_task_131452->retval_defunc_2_reduce_res_126382;
    size_t reduce_stage_1_tid_res_arr_mem_126728_cached_sizze_131454 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126728 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_126730_cached_sizze_131455 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126730 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_126728_cached_sizze_131454 <
        (size_t) ((int64_t) 4 * num_tasks_126727)) {
        reduce_stage_1_tid_res_arr_mem_126728 =
            realloc(reduce_stage_1_tid_res_arr_mem_126728, (int64_t) 4 *
                    num_tasks_126727);
        reduce_stage_1_tid_res_arr_mem_126728_cached_sizze_131454 =
            (int64_t) 4 * num_tasks_126727;
    }
    if (reduce_stage_1_tid_res_arr_mem_126730_cached_sizze_131455 <
        (size_t) ((int64_t) 4 * num_tasks_126727)) {
        reduce_stage_1_tid_res_arr_mem_126730 =
            realloc(reduce_stage_1_tid_res_arr_mem_126730, (int64_t) 4 *
                    num_tasks_126727);
        reduce_stage_1_tid_res_arr_mem_126730_cached_sizze_131455 =
            (int64_t) 4 * num_tasks_126727;
    }
    
    int64_t iter_126732;
    struct futhark_mc_segred_stage_1_parloop_struct_131456
    futhark_mc_segred_stage_1_parloop_struct_131456;
    
    futhark_mc_segred_stage_1_parloop_struct_131456.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_gtid_118193 =
        gtid_118193;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_x_118323 = x_118323;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_mem_122426 =
        mem_122426.mem;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_x_126310 = x_126310;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_x_126311 = x_126311;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_defunc_0_f_res_126314 =
        defunc_0_f_res_126314;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_a12_126376 =
        a12_126376;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_b12_126377 =
        b12_126377;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_c12_126378 =
        c12_126378;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_b2_126379 = b2_126379;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_c2_126380 = c2_126380;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_reduce_stage_1_tid_res_arr_mem_126728 =
        reduce_stage_1_tid_res_arr_mem_126728;
    futhark_mc_segred_stage_1_parloop_struct_131456.free_reduce_stage_1_tid_res_arr_mem_126730 =
        reduce_stage_1_tid_res_arr_mem_126730;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131457_task;
    
    futhark_mc_segred_stage_1_parloop_131457_task.name =
        "futhark_mc_segred_stage_1_parloop_131457";
    futhark_mc_segred_stage_1_parloop_131457_task.fn =
        futhark_mc_segred_stage_1_parloop_131457;
    futhark_mc_segred_stage_1_parloop_131457_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131456;
    futhark_mc_segred_stage_1_parloop_131457_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131457_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131457_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131457_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131457_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131457_task);
    
    if (futhark_mc_segred_stage_1_parloop_131457_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131457_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131457_total_end -
                 futhark_mc_segred_stage_1_parloop_131457_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131457_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131457_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131457_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_126381 = 0.0F;
        defunc_2_reduce_res_126382 = 0.0F;
    }
    
    float x_126735;
    float x_126736;
    float x_126738;
    float x_126739;
    
    for (int32_t i_126741 = 0; i_126741 < num_tasks_126727; i_126741++) {
        flat_tid_118200 = i_126741;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_126735 = defunc_2_reduce_res_126381;
            }
            // load next params
            {
                x_126736 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126728)[flat_tid_118200];
            }
            // red body
            {
                float defunc_1_op_res_126737 = x_126735 + x_126736;
                
                defunc_2_reduce_res_126381 = defunc_1_op_res_126737;
            }
            // load acc params
            {
                x_126738 = defunc_2_reduce_res_126382;
            }
            // load next params
            {
                x_126739 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126730)[flat_tid_118200];
            }
            // red body
            {
                float defunc_1_op_res_126740 = x_126738 + x_126739;
                
                defunc_2_reduce_res_126382 = defunc_1_op_res_126740;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_126728);
    free(reduce_stage_1_tid_res_arr_mem_126730);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131453_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131453_end -
                 futhark_mc_segred_task_131453_start;
        
        ctx->futhark_mc_segred_task_131453_runs[tid]++;
        ctx->futhark_mc_segred_task_131453_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131453_iter[tid] += iterations;
    }
    *futhark_mc_task_131452->retval_defunc_2_reduce_res_126381 =
        defunc_2_reduce_res_126381;
    *futhark_mc_task_131452->retval_defunc_2_reduce_res_126382 =
        defunc_2_reduce_res_126382;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131442(void *args, int64_t start,
                                            int64_t end, int flat_tid_118196,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131441
    *futhark_mc_segmap_parloop_struct_131441 =
    (struct futhark_mc_segmap_parloop_struct_131441 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131441->ctx;
    uint64_t futhark_mc_segmap_parloop_131442_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131442_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131441->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131441->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131441->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131441->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131441->free_i_114610;
    int64_t gtid_118193 =
            futhark_mc_segmap_parloop_struct_131441->free_gtid_118193;
    int64_t x_118323 = futhark_mc_segmap_parloop_struct_131441->free_x_118323;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131441->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131441->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131441->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131441->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131441->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122503 = {.desc ="mem_122503", .mem =
                                  futhark_mc_segmap_parloop_struct_131441->free_mem_122503,
                                  .size =0, .references =NULL};
    struct memblock mem_122506 = {.desc ="mem_122506", .mem =
                                  futhark_mc_segmap_parloop_struct_131441->free_mem_122506,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_126615 = start;
    
    for (; iter_126615 < end; iter_126615++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_126692 = l_n_m_114584;
        int64_t gtid_118197 = iter_126615;
        int64_t remnant_126693 = iter_126615 - gtid_118197;
        int64_t x_126310 = ((int64_t *) mem_122124.mem)[gtid_118193 *
                                                        l_n_m_114584 +
                                                        gtid_118197];
        float x_126311 = ((float *) mem_122128.mem)[gtid_118193 * l_n_m_114584 +
                                                    gtid_118197];
        int64_t min_arg_126312 = mul64(t_jump_114541, gtid_118197);
        int64_t min_res_126313 = smin64(i_114610, min_arg_126312);
        float defunc_0_f_res_126314 = sitofp_i64_f32(min_res_126313);
        float defunc_2_reduce_res_126315;
        float defunc_2_reduce_res_126316;
        float defunc_2_reduce_res_126317;
        float defunc_2_reduce_res_126318;
        float defunc_2_reduce_res_126319;
        int64_t flat_tid_118198 = (int64_t) 0;
        int32_t num_tasks_126694;
        struct futhark_mc_task_131443 futhark_mc_task_131443;
        
        futhark_mc_task_131443.ctx = ctx;
        futhark_mc_task_131443.free_n_114534 = n_114534;
        futhark_mc_task_131443.free_gtid_118193 = gtid_118193;
        futhark_mc_task_131443.free_x_118323 = x_118323;
        futhark_mc_task_131443.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131443.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131443.free_x_126310 = x_126310;
        futhark_mc_task_131443.free_x_126311 = x_126311;
        futhark_mc_task_131443.free_defunc_0_f_res_126314 =
            defunc_0_f_res_126314;
        futhark_mc_task_131443.retval_defunc_2_reduce_res_126315 =
            &defunc_2_reduce_res_126315;
        futhark_mc_task_131443.retval_defunc_2_reduce_res_126316 =
            &defunc_2_reduce_res_126316;
        futhark_mc_task_131443.retval_defunc_2_reduce_res_126317 =
            &defunc_2_reduce_res_126317;
        futhark_mc_task_131443.retval_defunc_2_reduce_res_126318 =
            &defunc_2_reduce_res_126318;
        futhark_mc_task_131443.retval_defunc_2_reduce_res_126319 =
            &defunc_2_reduce_res_126319;
        
        struct scheduler_segop futhark_mc_task_131443_task;
        
        futhark_mc_task_131443_task.args = &futhark_mc_task_131443;
        futhark_mc_task_131443_task.top_level_fn =
            futhark_mc_segred_task_131444;
        futhark_mc_task_131443_task.name = "futhark_mc_segred_task_131444";
        futhark_mc_task_131443_task.iterations = l_window_114538;
        futhark_mc_task_131443_task.task_time =
            &ctx->futhark_mc_segred_task_131444_total_time;
        futhark_mc_task_131443_task.task_iter =
            &ctx->futhark_mc_segred_task_131444_total_iter;
        futhark_mc_task_131443_task.sched = STATIC;
        futhark_mc_task_131443_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131444_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131443_task);
        
        if (futhark_mc_segred_task_131444_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float x_126356 = defunc_2_reduce_res_126317 *
              defunc_2_reduce_res_126319;
        float y_126357 = defunc_2_reduce_res_126318 *
              defunc_2_reduce_res_126318;
        float a12_126358 = x_126356 - y_126357;
        float x_126359 = defunc_2_reduce_res_126317 *
              defunc_2_reduce_res_126318;
        float y_126360 = defunc_2_reduce_res_126316 *
              defunc_2_reduce_res_126319;
        float b12_126361 = x_126359 - y_126360;
        float x_126362 = defunc_2_reduce_res_126316 *
              defunc_2_reduce_res_126318;
        float y_126363 = defunc_2_reduce_res_126317 *
              defunc_2_reduce_res_126317;
        float c12_126364 = x_126362 - y_126363;
        float x_126365 = defunc_2_reduce_res_126315 *
              defunc_2_reduce_res_126319;
        float b2_126366 = x_126365 - y_126363;
        float x_126367 = defunc_2_reduce_res_126316 *
              defunc_2_reduce_res_126317;
        float y_126368 = defunc_2_reduce_res_126315 *
              defunc_2_reduce_res_126318;
        float c2_126369 = x_126367 - y_126368;
        float x_126370 = defunc_2_reduce_res_126315 * a12_126358;
        float y_126371 = defunc_2_reduce_res_126316 * b12_126361;
        float x_126372 = x_126370 + y_126371;
        float y_126373 = defunc_2_reduce_res_126317 * c12_126364;
        float y_126374 = x_126372 + y_126373;
        float det_126375 = 1.0F / y_126374;
        float a12_126376 = a12_126358 * det_126375;
        float b12_126377 = b12_126361 * det_126375;
        float c12_126378 = c12_126364 * det_126375;
        float b2_126379 = b2_126366 * det_126375;
        float c2_126380 = c2_126369 * det_126375;
        float defunc_2_reduce_res_126381;
        float defunc_2_reduce_res_126382;
        int64_t flat_tid_118200 = (int64_t) 0;
        int32_t num_tasks_126727;
        struct futhark_mc_task_131452 futhark_mc_task_131452;
        
        futhark_mc_task_131452.ctx = ctx;
        futhark_mc_task_131452.free_n_114534 = n_114534;
        futhark_mc_task_131452.free_gtid_118193 = gtid_118193;
        futhark_mc_task_131452.free_x_118323 = x_118323;
        futhark_mc_task_131452.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131452.free_mem_122426 = mem_122426.mem;
        futhark_mc_task_131452.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131452.free_x_126310 = x_126310;
        futhark_mc_task_131452.free_x_126311 = x_126311;
        futhark_mc_task_131452.free_defunc_0_f_res_126314 =
            defunc_0_f_res_126314;
        futhark_mc_task_131452.free_a12_126376 = a12_126376;
        futhark_mc_task_131452.free_b12_126377 = b12_126377;
        futhark_mc_task_131452.free_c12_126378 = c12_126378;
        futhark_mc_task_131452.free_b2_126379 = b2_126379;
        futhark_mc_task_131452.free_c2_126380 = c2_126380;
        futhark_mc_task_131452.retval_defunc_2_reduce_res_126381 =
            &defunc_2_reduce_res_126381;
        futhark_mc_task_131452.retval_defunc_2_reduce_res_126382 =
            &defunc_2_reduce_res_126382;
        
        struct scheduler_segop futhark_mc_task_131452_task;
        
        futhark_mc_task_131452_task.args = &futhark_mc_task_131452;
        futhark_mc_task_131452_task.top_level_fn =
            futhark_mc_segred_task_131453;
        futhark_mc_task_131452_task.name = "futhark_mc_segred_task_131453";
        futhark_mc_task_131452_task.iterations = l_window_114538;
        futhark_mc_task_131452_task.task_time =
            &ctx->futhark_mc_segred_task_131453_total_time;
        futhark_mc_task_131452_task.task_iter =
            &ctx->futhark_mc_segred_task_131453_total_iter;
        futhark_mc_task_131452_task.sched = STATIC;
        futhark_mc_task_131452_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131453_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131452_task);
        
        if (futhark_mc_segred_task_131453_err != 0) {
            err = 1;
            goto cleanup;
        }
        ((float *) mem_122503.mem)[gtid_118197] = defunc_2_reduce_res_126381;
        ((float *) mem_122506.mem)[gtid_118197] = defunc_2_reduce_res_126382;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131442_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131442_end -
                 futhark_mc_segmap_parloop_131442_start;
        
        ctx->futhark_mc_segmap_parloop_131442_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131442_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131442_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131440(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118196 = tid;
    int num_tasks_126533 = info.nsubtasks;
    struct futhark_mc_task_131436 *futhark_mc_task_131436 =
                                  (struct futhark_mc_task_131436 *) args;
    struct futhark_context *ctx = futhark_mc_task_131436->ctx;
    uint64_t futhark_mc_segmap_nested_task_131440_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131440_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131436->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131436->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131436->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131436->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131436->free_i_114610;
    int64_t gtid_118193 = futhark_mc_task_131436->free_gtid_118193;
    int64_t x_118323 = futhark_mc_task_131436->free_x_118323;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131436->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131436->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131436->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131436->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131436->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122503 = {.desc ="mem_122503", .mem =
                                  futhark_mc_task_131436->free_mem_122503,
                                  .size =0, .references =NULL};
    struct memblock mem_122506 = {.desc ="mem_122506", .mem =
                                  futhark_mc_task_131436->free_mem_122506,
                                  .size =0, .references =NULL};
    int64_t iter_126615;
    struct futhark_mc_segmap_parloop_struct_131441
    futhark_mc_segmap_parloop_struct_131441;
    
    futhark_mc_segmap_parloop_struct_131441.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131441.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131441.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131441.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131441.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131441.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131441.free_gtid_118193 = gtid_118193;
    futhark_mc_segmap_parloop_struct_131441.free_x_118323 = x_118323;
    futhark_mc_segmap_parloop_struct_131441.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131441.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131441.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131441.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131441.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131441.free_mem_122503 = mem_122503.mem;
    futhark_mc_segmap_parloop_struct_131441.free_mem_122506 = mem_122506.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131442_task;
    
    futhark_mc_segmap_parloop_131442_task.name =
        "futhark_mc_segmap_parloop_131442";
    futhark_mc_segmap_parloop_131442_task.fn = futhark_mc_segmap_parloop_131442;
    futhark_mc_segmap_parloop_131442_task.args =
        &futhark_mc_segmap_parloop_struct_131441;
    futhark_mc_segmap_parloop_131442_task.iterations = iterations;
    futhark_mc_segmap_parloop_131442_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131442_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131442_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131442_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131442_task);
    
    if (futhark_mc_segmap_parloop_131442_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131442_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131442_total_end -
                 futhark_mc_segmap_parloop_131442_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131442_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131442_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131442_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131440_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131440_end -
                 futhark_mc_segmap_nested_task_131440_start;
        
        ctx->futhark_mc_segmap_nested_task_131440_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131440_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131440_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131433(void *args, int64_t start,
                                            int64_t end, int flat_tid_118192,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131432
    *futhark_mc_segmap_parloop_struct_131432 =
    (struct futhark_mc_segmap_parloop_struct_131432 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131432->ctx;
    uint64_t futhark_mc_segmap_parloop_131433_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131433_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131432->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131432->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131432->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131432->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131432->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131432->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131432->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131432->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131432->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131432->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131432->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131432->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131432->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122540 = {.desc ="mem_122540", .mem =
                                  futhark_mc_segmap_parloop_struct_131432->free_mem_122540,
                                  .size =0, .references =NULL};
    struct memblock mem_122544 = {.desc ="mem_122544", .mem =
                                  futhark_mc_segmap_parloop_struct_131432->free_mem_122544,
                                  .size =0, .references =NULL};
    size_t mem_122503_cached_sizze_131434 = 0;
    char *mem_122503 = NULL;
    size_t mem_122506_cached_sizze_131435 = 0;
    char *mem_122506 = NULL;
    int64_t iterations = end - start;
    int64_t iter_126309 = start;
    
    if (mem_122503_cached_sizze_131434 < (size_t) bytes_122055) {
        mem_122503 = realloc(mem_122503, bytes_122055);
        mem_122503_cached_sizze_131434 = bytes_122055;
    }
    if (mem_122506_cached_sizze_131435 < (size_t) bytes_122055) {
        mem_122506 = realloc(mem_122506, bytes_122055);
        mem_122506_cached_sizze_131435 = bytes_122055;
    }
    for (; iter_126309 < end; iter_126309++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_126531 = m_114533;
        int64_t gtid_118193 = iter_126309;
        int64_t remnant_126532 = iter_126309 - gtid_118193;
        int64_t x_118323 = ((int64_t *) mem_121982.mem)[gtid_118193];
        int64_t flat_tid_118194 = (int64_t) 0;
        int32_t num_tasks_126533;
        int64_t flat_tid_118196 = (int64_t) 0;
        struct futhark_mc_task_131436 futhark_mc_task_131436;
        
        futhark_mc_task_131436.ctx = ctx;
        futhark_mc_task_131436.free_n_114534 = n_114534;
        futhark_mc_task_131436.free_l_window_114538 = l_window_114538;
        futhark_mc_task_131436.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131436.free_l_n_m_114584 = l_n_m_114584;
        futhark_mc_task_131436.free_i_114610 = i_114610;
        futhark_mc_task_131436.free_gtid_118193 = gtid_118193;
        futhark_mc_task_131436.free_x_118323 = x_118323;
        futhark_mc_task_131436.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131436.free_mem_122124 = mem_122124.mem;
        futhark_mc_task_131436.free_mem_122128 = mem_122128.mem;
        futhark_mc_task_131436.free_mem_122426 = mem_122426.mem;
        futhark_mc_task_131436.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131436.free_mem_122503 = mem_122503;
        futhark_mc_task_131436.free_mem_122506 = mem_122506;
        
        struct scheduler_segop futhark_mc_task_131436_task;
        
        futhark_mc_task_131436_task.args = &futhark_mc_task_131436;
        futhark_mc_task_131436_task.top_level_fn =
            futhark_mc_segmap_task_131437;
        futhark_mc_task_131436_task.name = "futhark_mc_segmap_task_131437";
        futhark_mc_task_131436_task.iterations = l_n_m_114584;
        futhark_mc_task_131436_task.task_time =
            &ctx->futhark_mc_segmap_task_131437_total_time;
        futhark_mc_task_131436_task.task_iter =
            &ctx->futhark_mc_segmap_task_131437_total_iter;
        futhark_mc_task_131436_task.sched = STATIC;
        futhark_mc_task_131436_task.nested_fn =
            futhark_mc_segmap_nested_task_131440;
        
        int futhark_mc_segmap_task_131437_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131436_task);
        
        if (futhark_mc_segmap_task_131437_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122540.mem + gtid_118193 * l_n_m_114584 * (int64_t) 4,
                mem_122503 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
        memmove(mem_122544.mem + gtid_118193 * l_n_m_114584 * (int64_t) 4,
                mem_122506 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122503);
    free(mem_122506);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131433_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131433_end -
                 futhark_mc_segmap_parloop_131433_start;
        
        ctx->futhark_mc_segmap_parloop_131433_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131433_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131433_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131431(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118192 = tid;
    int num_tasks_126183 = info.nsubtasks;
    struct futhark_mc_task_131425 *futhark_mc_task_131425 =
                                  (struct futhark_mc_task_131425 *) args;
    struct futhark_context *ctx = futhark_mc_task_131425->ctx;
    uint64_t futhark_mc_segmap_nested_task_131431_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131431_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131425->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131425->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131425->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131425->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131425->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131425->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131425->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131425->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131425->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131425->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131425->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131425->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131425->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122540 = {.desc ="mem_122540", .mem =
                                  futhark_mc_task_131425->free_mem_122540,
                                  .size =0, .references =NULL};
    struct memblock mem_122544 = {.desc ="mem_122544", .mem =
                                  futhark_mc_task_131425->free_mem_122544,
                                  .size =0, .references =NULL};
    int64_t iter_126309;
    struct futhark_mc_segmap_parloop_struct_131432
    futhark_mc_segmap_parloop_struct_131432;
    
    futhark_mc_segmap_parloop_struct_131432.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131432.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131432.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131432.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131432.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131432.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131432.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131432.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131432.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131432.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131432.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131432.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131432.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131432.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131432.free_mem_122540 = mem_122540.mem;
    futhark_mc_segmap_parloop_struct_131432.free_mem_122544 = mem_122544.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131433_task;
    
    futhark_mc_segmap_parloop_131433_task.name =
        "futhark_mc_segmap_parloop_131433";
    futhark_mc_segmap_parloop_131433_task.fn = futhark_mc_segmap_parloop_131433;
    futhark_mc_segmap_parloop_131433_task.args =
        &futhark_mc_segmap_parloop_struct_131432;
    futhark_mc_segmap_parloop_131433_task.iterations = iterations;
    futhark_mc_segmap_parloop_131433_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131433_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131433_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131433_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131433_task);
    
    if (futhark_mc_segmap_parloop_131433_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131433_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131433_total_end -
                 futhark_mc_segmap_parloop_131433_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131433_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131433_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131433_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131431_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131431_end -
                 futhark_mc_segmap_nested_task_131431_start;
        
        ctx->futhark_mc_segmap_nested_task_131431_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131431_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131431_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131458 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122553;
    char *free_mem_122607;
};
struct futhark_mc_segmap_parloop_struct_131460 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122553;
    char *free_mem_122607;
};
static int futhark_mc_segmap_parloop_131461(void *args, int64_t start,
                                            int64_t end, int flat_tid_118558,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131460
    *futhark_mc_segmap_parloop_struct_131460 =
    (struct futhark_mc_segmap_parloop_struct_131460 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131460->ctx;
    uint64_t futhark_mc_segmap_parloop_131461_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131461_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131460->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131460->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131460->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131460->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131460->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131460->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131460->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131460->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131460->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131460->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131460->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131460->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131460->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122553 =
            futhark_mc_segmap_parloop_struct_131460->free_bytes_122553;
    struct memblock mem_122607 = {.desc ="mem_122607", .mem =
                                  futhark_mc_segmap_parloop_struct_131460->free_mem_122607,
                                  .size =0, .references =NULL};
    size_t mem_122576_cached_sizze_131462 = 0;
    char *mem_122576 = NULL;
    size_t mem_122586_cached_sizze_131463 = 0;
    char *mem_122586 = NULL;
    int64_t iterations = end - start;
    int64_t iter_126745 = start;
    
    if (mem_122576_cached_sizze_131462 < (size_t) bytes_122055) {
        mem_122576 = realloc(mem_122576, bytes_122055);
        mem_122576_cached_sizze_131462 = bytes_122055;
    }
    if (mem_122586_cached_sizze_131463 < (size_t) bytes_122553) {
        mem_122586 = realloc(mem_122586, bytes_122553);
        mem_122586_cached_sizze_131463 = bytes_122553;
    }
    for (; iter_126745 < end; iter_126745++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_126791 = m_114533;
        int64_t gtid_118559 = iter_126745;
        int64_t remnant_126792 = iter_126745 - gtid_118559;
        int64_t x_115497 = ((int64_t *) mem_121982.mem)[gtid_118559];
        
        for (int64_t i_126746 = 0; i_126746 < l_n_m_114584; i_126746++) {
            int64_t x_126748 = ((int64_t *) mem_122124.mem)[gtid_118559 *
                                                            l_n_m_114584 +
                                                            i_126746];
            float x_126749 = ((float *) mem_122128.mem)[gtid_118559 *
                                                        l_n_m_114584 +
                                                        i_126746];
            int64_t min_arg_126750 = mul64(t_jump_114541, i_126746);
            int64_t min_res_126751 = smin64(i_114610, min_arg_126750);
            float defunc_0_f_res_126752 = sitofp_i64_f32(min_res_126751);
            float defunc_2_reduce_res_126754;
            float redout_126757 = 0.0F;
            
            for (int64_t i_126756 = 0; i_126756 < l_window_114538; i_126756++) {
                bool cond_126759 = sle64(x_115497, i_126756);
                float defunc_0_f_res_126760;
                
                if (cond_126759) {
                    defunc_0_f_res_126760 = 0.0F;
                } else {
                    int64_t i_126761 = add64(x_126748, i_126756);
                    float x_126762 = ((float *) mem_122004.mem)[gtid_118559 *
                                                                n_114534 +
                                                                i_126761];
                    float defunc_0_f_res_f_res_126763 = 1.0F + x_126762;
                    
                    defunc_0_f_res_126760 = defunc_0_f_res_f_res_126763;
                }
                
                float defunc_0_f_res_126764;
                
                if (cond_126759) {
                    defunc_0_f_res_126764 = 0.0F;
                } else {
                    int64_t i_126765 = add64(x_126748, i_126756);
                    float x_126766 = ((float *) mem_122430.mem)[gtid_118559 *
                                                                n_114534 +
                                                                i_126765];
                    
                    defunc_0_f_res_126764 = x_126766;
                }
                
                float x_j_126767 = defunc_0_f_res_126760 -
                      defunc_0_f_res_126752;
                float abs_res_126768 = (float) fabs(x_j_126767);
                float tmp1_126769 = abs_res_126768 / x_126749;
                float x_126770 = tmp1_126769 * tmp1_126769;
                float y_126771 = tmp1_126769 * x_126770;
                float tmp2_126772 = 1.0F - y_126771;
                float x_126773 = tmp2_126772 * tmp2_126772;
                float tmp3_126774 = tmp2_126772 * x_126773;
                float tmp4_126775 = defunc_0_f_res_126764 * tmp3_126774;
                float defunc_1_op_res_126776 = tmp4_126775 + redout_126757;
                
                ((float *) mem_122586)[i_126756] = tmp4_126775;
                
                float redout_tmp_126794 = defunc_1_op_res_126776;
                
                redout_126757 = redout_tmp_126794;
            }
            defunc_2_reduce_res_126754 = redout_126757;
            
            float a0_126778 = 1.0F / defunc_2_reduce_res_126754;
            float defunc_2_reduce_res_126779;
            float redout_126781 = 0.0F;
            
            for (int64_t i_126780 = 0; i_126780 < l_window_114538; i_126780++) {
                float x_126782 = ((float *) mem_122586)[i_126780];
                bool cond_126783 = sle64(x_115497, i_126780);
                float defunc_0_f_res_126784;
                
                if (cond_126783) {
                    defunc_0_f_res_126784 = 0.0F;
                } else {
                    int64_t i_126785 = add64(x_126748, i_126780);
                    float x_126786 = ((float *) mem_122426.mem)[gtid_118559 *
                                                                n_114534 +
                                                                i_126785];
                    
                    defunc_0_f_res_126784 = x_126786;
                }
                
                float x_126787 = a0_126778 * x_126782;
                float defunc_9_fit_fun_res_126788 = defunc_0_f_res_126784 *
                      x_126787;
                float defunc_1_op_res_126789 = defunc_9_fit_fun_res_126788 +
                      redout_126781;
                float redout_tmp_126796 = defunc_1_op_res_126789;
                
                redout_126781 = redout_tmp_126796;
            }
            defunc_2_reduce_res_126779 = redout_126781;
            ((float *) mem_122576)[i_126746] = defunc_2_reduce_res_126779;
        }
        memmove(mem_122607.mem + gtid_118559 * l_n_m_114584 * (int64_t) 4,
                mem_122576 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122576);
    free(mem_122586);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131461_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131461_end -
                 futhark_mc_segmap_parloop_131461_start;
        
        ctx->futhark_mc_segmap_parloop_131461_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131461_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131461_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131459(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118558 = tid;
    int num_tasks_126744 = info.nsubtasks;
    struct futhark_mc_task_131458 *futhark_mc_task_131458 =
                                  (struct futhark_mc_task_131458 *) args;
    struct futhark_context *ctx = futhark_mc_task_131458->ctx;
    uint64_t futhark_mc_segmap_task_131459_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131459_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131458->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131458->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131458->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131458->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131458->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131458->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131458->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131458->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131458->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131458->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131458->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131458->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131458->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122553 = futhark_mc_task_131458->free_bytes_122553;
    struct memblock mem_122607 = {.desc ="mem_122607", .mem =
                                  futhark_mc_task_131458->free_mem_122607,
                                  .size =0, .references =NULL};
    int64_t iter_126745;
    struct futhark_mc_segmap_parloop_struct_131460
    futhark_mc_segmap_parloop_struct_131460;
    
    futhark_mc_segmap_parloop_struct_131460.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131460.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131460.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131460.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131460.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131460.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131460.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131460.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131460.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131460.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131460.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131460.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131460.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131460.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131460.free_bytes_122553 = bytes_122553;
    futhark_mc_segmap_parloop_struct_131460.free_mem_122607 = mem_122607.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131461_task;
    
    futhark_mc_segmap_parloop_131461_task.name =
        "futhark_mc_segmap_parloop_131461";
    futhark_mc_segmap_parloop_131461_task.fn = futhark_mc_segmap_parloop_131461;
    futhark_mc_segmap_parloop_131461_task.args =
        &futhark_mc_segmap_parloop_struct_131460;
    futhark_mc_segmap_parloop_131461_task.iterations = iterations;
    futhark_mc_segmap_parloop_131461_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131461_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131461_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131461_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131461_task);
    
    if (futhark_mc_segmap_parloop_131461_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131461_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131461_total_end -
                 futhark_mc_segmap_parloop_131461_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131461_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131461_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131461_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131459_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131459_end -
                 futhark_mc_segmap_task_131459_start;
        
        ctx->futhark_mc_segmap_task_131459_runs[tid]++;
        ctx->futhark_mc_segmap_task_131459_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131459_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131465 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122553;
    char *free_mem_122607;
};
struct futhark_mc_task_131468 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_118561;
    int64_t free_x_118617;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122553;
    char *free_mem_122573;
};
struct futhark_mc_segmap_parloop_struct_131470 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_118561;
    int64_t free_x_118617;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122553;
    char *free_mem_122573;
};
static int futhark_mc_segmap_parloop_131471(void *args, int64_t start,
                                            int64_t end, int flat_tid_118562,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131470
    *futhark_mc_segmap_parloop_struct_131470 =
    (struct futhark_mc_segmap_parloop_struct_131470 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131470->ctx;
    uint64_t futhark_mc_segmap_parloop_131471_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131471_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131470->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131470->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131470->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131470->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131470->free_i_114610;
    int64_t gtid_118561 =
            futhark_mc_segmap_parloop_struct_131470->free_gtid_118561;
    int64_t x_118617 = futhark_mc_segmap_parloop_struct_131470->free_x_118617;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131470->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131470->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131470->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131470->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131470->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122553 =
            futhark_mc_segmap_parloop_struct_131470->free_bytes_122553;
    struct memblock mem_122573 = {.desc ="mem_122573", .mem =
                                  futhark_mc_segmap_parloop_struct_131470->free_mem_122573,
                                  .size =0, .references =NULL};
    size_t mem_126843_cached_sizze_131472 = 0;
    char *mem_126843 = NULL;
    int64_t iterations = end - start;
    int64_t iter_126884 = start;
    
    if (mem_126843_cached_sizze_131472 < (size_t) bytes_122553) {
        mem_126843 = realloc(mem_126843, bytes_122553);
        mem_126843_cached_sizze_131472 = bytes_122553;
    }
    for (; iter_126884 < end; iter_126884++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_126917 = l_n_m_114584;
        int64_t gtid_118563 = iter_126884;
        int64_t remnant_126918 = iter_126884 - gtid_118563;
        int64_t x_126838 = ((int64_t *) mem_122124.mem)[gtid_118561 *
                                                        l_n_m_114584 +
                                                        gtid_118563];
        float x_126839 = ((float *) mem_122128.mem)[gtid_118561 * l_n_m_114584 +
                                                    gtid_118563];
        int64_t min_arg_126840 = mul64(t_jump_114541, gtid_118563);
        int64_t min_res_126841 = smin64(i_114610, min_arg_126840);
        float defunc_0_f_res_126842 = sitofp_i64_f32(min_res_126841);
        float defunc_2_reduce_res_126845;
        float redout_126886 = 0.0F;
        
        for (int64_t i_126885 = 0; i_126885 < l_window_114538; i_126885++) {
            bool cond_126888 = sle64(x_118617, i_126885);
            float defunc_0_f_res_126889;
            
            if (cond_126888) {
                defunc_0_f_res_126889 = 0.0F;
            } else {
                int64_t i_126890 = add64(x_126838, i_126885);
                float x_126891 = ((float *) mem_122004.mem)[gtid_118561 *
                                                            n_114534 +
                                                            i_126890];
                float defunc_0_f_res_f_res_126892 = 1.0F + x_126891;
                
                defunc_0_f_res_126889 = defunc_0_f_res_f_res_126892;
            }
            
            float defunc_0_f_res_126893;
            
            if (cond_126888) {
                defunc_0_f_res_126893 = 0.0F;
            } else {
                int64_t i_126894 = add64(x_126838, i_126885);
                float x_126895 = ((float *) mem_122430.mem)[gtid_118561 *
                                                            n_114534 +
                                                            i_126894];
                
                defunc_0_f_res_126893 = x_126895;
            }
            
            float x_j_126896 = defunc_0_f_res_126889 - defunc_0_f_res_126842;
            float abs_res_126897 = (float) fabs(x_j_126896);
            float tmp1_126898 = abs_res_126897 / x_126839;
            float x_126899 = tmp1_126898 * tmp1_126898;
            float y_126900 = tmp1_126898 * x_126899;
            float tmp2_126901 = 1.0F - y_126900;
            float x_126902 = tmp2_126901 * tmp2_126901;
            float tmp3_126903 = tmp2_126901 * x_126902;
            float tmp4_126904 = defunc_0_f_res_126893 * tmp3_126903;
            float defunc_1_op_res_126905 = tmp4_126904 + redout_126886;
            
            ((float *) mem_126843)[i_126885] = tmp4_126904;
            
            float redout_tmp_126919 = defunc_1_op_res_126905;
            
            redout_126886 = redout_tmp_126919;
        }
        defunc_2_reduce_res_126845 = redout_126886;
        
        float a0_126869 = 1.0F / defunc_2_reduce_res_126845;
        float defunc_2_reduce_res_126870;
        float redout_126908 = 0.0F;
        
        for (int64_t i_126907 = 0; i_126907 < l_window_114538; i_126907++) {
            float x_126909 = ((float *) mem_126843)[i_126907];
            bool cond_126910 = sle64(x_118617, i_126907);
            float defunc_0_f_res_126911;
            
            if (cond_126910) {
                defunc_0_f_res_126911 = 0.0F;
            } else {
                int64_t i_126912 = add64(x_126838, i_126907);
                float x_126913 = ((float *) mem_122426.mem)[gtid_118561 *
                                                            n_114534 +
                                                            i_126912];
                
                defunc_0_f_res_126911 = x_126913;
            }
            
            float x_126914 = a0_126869 * x_126909;
            float defunc_9_fit_fun_res_126915 = defunc_0_f_res_126911 *
                  x_126914;
            float defunc_1_op_res_126916 = defunc_9_fit_fun_res_126915 +
                  redout_126908;
            float redout_tmp_126921 = defunc_1_op_res_126916;
            
            redout_126908 = redout_tmp_126921;
        }
        defunc_2_reduce_res_126870 = redout_126908;
        ((float *) mem_122573.mem)[gtid_118563] = defunc_2_reduce_res_126870;
    }
    
  cleanup:
    { }
    free(mem_126843);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131471_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131471_end -
                 futhark_mc_segmap_parloop_131471_start;
        
        ctx->futhark_mc_segmap_parloop_131471_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131471_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131471_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131469(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118562 = tid;
    int num_tasks_126883 = info.nsubtasks;
    struct futhark_mc_task_131468 *futhark_mc_task_131468 =
                                  (struct futhark_mc_task_131468 *) args;
    struct futhark_context *ctx = futhark_mc_task_131468->ctx;
    uint64_t futhark_mc_segmap_task_131469_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131469_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131468->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131468->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131468->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131468->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131468->free_i_114610;
    int64_t gtid_118561 = futhark_mc_task_131468->free_gtid_118561;
    int64_t x_118617 = futhark_mc_task_131468->free_x_118617;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131468->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131468->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131468->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131468->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131468->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122553 = futhark_mc_task_131468->free_bytes_122553;
    struct memblock mem_122573 = {.desc ="mem_122573", .mem =
                                  futhark_mc_task_131468->free_mem_122573,
                                  .size =0, .references =NULL};
    int64_t iter_126884;
    struct futhark_mc_segmap_parloop_struct_131470
    futhark_mc_segmap_parloop_struct_131470;
    
    futhark_mc_segmap_parloop_struct_131470.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131470.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131470.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131470.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131470.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131470.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131470.free_gtid_118561 = gtid_118561;
    futhark_mc_segmap_parloop_struct_131470.free_x_118617 = x_118617;
    futhark_mc_segmap_parloop_struct_131470.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131470.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131470.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131470.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131470.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131470.free_bytes_122553 = bytes_122553;
    futhark_mc_segmap_parloop_struct_131470.free_mem_122573 = mem_122573.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131471_task;
    
    futhark_mc_segmap_parloop_131471_task.name =
        "futhark_mc_segmap_parloop_131471";
    futhark_mc_segmap_parloop_131471_task.fn = futhark_mc_segmap_parloop_131471;
    futhark_mc_segmap_parloop_131471_task.args =
        &futhark_mc_segmap_parloop_struct_131470;
    futhark_mc_segmap_parloop_131471_task.iterations = iterations;
    futhark_mc_segmap_parloop_131471_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131471_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131471_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131471_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131471_task);
    
    if (futhark_mc_segmap_parloop_131471_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131471_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131471_total_end -
                 futhark_mc_segmap_parloop_131471_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131471_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131471_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131471_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131469_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131469_end -
                 futhark_mc_segmap_task_131469_start;
        
        ctx->futhark_mc_segmap_task_131469_runs[tid]++;
        ctx->futhark_mc_segmap_task_131469_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131469_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131474 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_118561;
    int64_t free_x_118617;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122553;
    char *free_mem_122573;
};
struct futhark_mc_task_131477 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118561;
    int64_t free_x_118617;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_126798;
    float free_x_126799;
    float free_defunc_0_f_res_126802;
    float *retval_defunc_2_reduce_res_126804;
    char *retval_mem_126803;
};
struct futhark_mc_segred_stage_1_parloop_struct_131480 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118561;
    int64_t free_x_118617;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_126798;
    float free_x_126799;
    float free_defunc_0_f_res_126802;
    char *free_mem_126803;
    char *free_reduce_stage_1_tid_res_arr_mem_126956;
};
static int futhark_mc_segred_stage_1_parloop_131481(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_118566,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131480
    *futhark_mc_segred_stage_1_parloop_struct_131480 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131480 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131480->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131481_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131481_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131480->free_n_114534;
    int64_t gtid_118561 =
            futhark_mc_segred_stage_1_parloop_struct_131480->free_gtid_118561;
    int64_t x_118617 =
            futhark_mc_segred_stage_1_parloop_struct_131480->free_x_118617;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131480->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131480->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_126798 =
            futhark_mc_segred_stage_1_parloop_struct_131480->free_x_126798;
    float x_126799 =
          futhark_mc_segred_stage_1_parloop_struct_131480->free_x_126799;
    float defunc_0_f_res_126802 =
          futhark_mc_segred_stage_1_parloop_struct_131480->free_defunc_0_f_res_126802;
    struct memblock mem_126803 = {.desc ="mem_126803", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131480->free_mem_126803,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_126956 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126956",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131480->free_reduce_stage_1_tid_res_arr_mem_126956,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_126958 = start;
    float x_126923;
    float x_126924;
    float local_acc_126959 = 0.0F;
    
    for (; iter_126958 < end; iter_126958++) {
        int64_t gtid_118567 = iter_126958;
        bool cond_126926 = sle64(x_118617, gtid_118567);
        float defunc_0_f_res_126927;
        
        if (cond_126926) {
            defunc_0_f_res_126927 = 0.0F;
        } else {
            int64_t i_126928 = add64(gtid_118567, x_126798);
            float x_126929 = ((float *) mem_122004.mem)[gtid_118561 * n_114534 +
                                                        i_126928];
            float defunc_0_f_res_f_res_126930 = 1.0F + x_126929;
            
            defunc_0_f_res_126927 = defunc_0_f_res_f_res_126930;
        }
        
        float defunc_0_f_res_126931;
        
        if (cond_126926) {
            defunc_0_f_res_126931 = 0.0F;
        } else {
            int64_t i_126932 = add64(gtid_118567, x_126798);
            float x_126933 = ((float *) mem_122430.mem)[gtid_118561 * n_114534 +
                                                        i_126932];
            
            defunc_0_f_res_126931 = x_126933;
        }
        
        float x_j_126934 = defunc_0_f_res_126927 - defunc_0_f_res_126802;
        float abs_res_126935 = (float) fabs(x_j_126934);
        float tmp1_126936 = abs_res_126935 / x_126799;
        float x_126937 = tmp1_126936 * tmp1_126936;
        float y_126938 = tmp1_126936 * x_126937;
        float tmp2_126939 = 1.0F - y_126938;
        float x_126940 = tmp2_126939 * tmp2_126939;
        float tmp3_126941 = tmp2_126939 * x_126940;
        float tmp4_126942 = defunc_0_f_res_126931 * tmp3_126941;
        
        // save map-out results
        {
            ((float *) mem_126803.mem)[gtid_118567] = tmp4_126942;
        }
        // Load accum params
        {
            x_126923 = local_acc_126959;
        }
        // Load next params
        {
            x_126924 = tmp4_126942;
        }
        // Red body
        {
            float defunc_1_op_res_126925 = x_126923 + x_126924;
            
            local_acc_126959 = defunc_1_op_res_126925;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_126956.mem)[flat_tid_118566] =
        local_acc_126959;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131481_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131481_end -
                 futhark_mc_segred_stage_1_parloop_131481_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131481_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131481_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131481_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131478(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118566 = tid;
    int num_tasks_126955 = info.nsubtasks;
    struct futhark_mc_task_131477 *futhark_mc_task_131477 =
                                  (struct futhark_mc_task_131477 *) args;
    struct futhark_context *ctx = futhark_mc_task_131477->ctx;
    uint64_t futhark_mc_segred_task_131478_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131478_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131477->free_n_114534;
    int64_t gtid_118561 = futhark_mc_task_131477->free_gtid_118561;
    int64_t x_118617 = futhark_mc_task_131477->free_x_118617;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131477->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131477->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_126798 = futhark_mc_task_131477->free_x_126798;
    float x_126799 = futhark_mc_task_131477->free_x_126799;
    float defunc_0_f_res_126802 =
          futhark_mc_task_131477->free_defunc_0_f_res_126802;
    float defunc_2_reduce_res_126804 =
          *futhark_mc_task_131477->retval_defunc_2_reduce_res_126804;
    struct memblock mem_126803 = {.desc ="mem_126803", .mem =
                                  futhark_mc_task_131477->retval_mem_126803,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_126956_cached_sizze_131479 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126956 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_126956_cached_sizze_131479 <
        (size_t) ((int64_t) 4 * num_tasks_126955)) {
        reduce_stage_1_tid_res_arr_mem_126956 =
            realloc(reduce_stage_1_tid_res_arr_mem_126956, (int64_t) 4 *
                    num_tasks_126955);
        reduce_stage_1_tid_res_arr_mem_126956_cached_sizze_131479 =
            (int64_t) 4 * num_tasks_126955;
    }
    
    int64_t iter_126958;
    struct futhark_mc_segred_stage_1_parloop_struct_131480
    futhark_mc_segred_stage_1_parloop_struct_131480;
    
    futhark_mc_segred_stage_1_parloop_struct_131480.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131480.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131480.free_gtid_118561 =
        gtid_118561;
    futhark_mc_segred_stage_1_parloop_struct_131480.free_x_118617 = x_118617;
    futhark_mc_segred_stage_1_parloop_struct_131480.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131480.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131480.free_x_126798 = x_126798;
    futhark_mc_segred_stage_1_parloop_struct_131480.free_x_126799 = x_126799;
    futhark_mc_segred_stage_1_parloop_struct_131480.free_defunc_0_f_res_126802 =
        defunc_0_f_res_126802;
    futhark_mc_segred_stage_1_parloop_struct_131480.free_mem_126803 =
        mem_126803.mem;
    futhark_mc_segred_stage_1_parloop_struct_131480.free_reduce_stage_1_tid_res_arr_mem_126956 =
        reduce_stage_1_tid_res_arr_mem_126956;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131481_task;
    
    futhark_mc_segred_stage_1_parloop_131481_task.name =
        "futhark_mc_segred_stage_1_parloop_131481";
    futhark_mc_segred_stage_1_parloop_131481_task.fn =
        futhark_mc_segred_stage_1_parloop_131481;
    futhark_mc_segred_stage_1_parloop_131481_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131480;
    futhark_mc_segred_stage_1_parloop_131481_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131481_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131481_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131481_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131481_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131481_task);
    
    if (futhark_mc_segred_stage_1_parloop_131481_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131481_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131481_total_end -
                 futhark_mc_segred_stage_1_parloop_131481_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131481_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131481_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131481_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_126804 = 0.0F;
    }
    
    float x_126960;
    float x_126961;
    
    for (int32_t i_126963 = 0; i_126963 < num_tasks_126955; i_126963++) {
        flat_tid_118566 = i_126963;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_126960 = defunc_2_reduce_res_126804;
            }
            // load next params
            {
                x_126961 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126956)[flat_tid_118566];
            }
            // red body
            {
                float defunc_1_op_res_126962 = x_126960 + x_126961;
                
                defunc_2_reduce_res_126804 = defunc_1_op_res_126962;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_126956);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131478_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131478_end -
                 futhark_mc_segred_task_131478_start;
        
        ctx->futhark_mc_segred_task_131478_runs[tid]++;
        ctx->futhark_mc_segred_task_131478_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131478_iter[tid] += iterations;
    }
    *futhark_mc_task_131477->retval_defunc_2_reduce_res_126804 =
        defunc_2_reduce_res_126804;
    futhark_mc_task_131477->retval_mem_126803 = mem_126803.mem;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131482 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118561;
    int64_t free_x_118617;
    char *free_mem_122426;
    int64_t free_x_126798;
    char *free_mem_126803;
    float free_a0_126826;
    float *retval_defunc_2_reduce_res_126827;
};
struct futhark_mc_segred_stage_1_parloop_struct_131485 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118561;
    int64_t free_x_118617;
    char *free_mem_122426;
    int64_t free_x_126798;
    char *free_mem_126803;
    float free_a0_126826;
    char *free_reduce_stage_1_tid_res_arr_mem_126965;
};
static int futhark_mc_segred_stage_1_parloop_131486(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_118568,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131485
    *futhark_mc_segred_stage_1_parloop_struct_131485 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131485 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131485->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131486_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131486_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131485->free_n_114534;
    int64_t gtid_118561 =
            futhark_mc_segred_stage_1_parloop_struct_131485->free_gtid_118561;
    int64_t x_118617 =
            futhark_mc_segred_stage_1_parloop_struct_131485->free_x_118617;
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131485->free_mem_122426,
                                  .size =0, .references =NULL};
    int64_t x_126798 =
            futhark_mc_segred_stage_1_parloop_struct_131485->free_x_126798;
    struct memblock mem_126803 = {.desc ="mem_126803", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131485->free_mem_126803,
                                  .size =0, .references =NULL};
    float a0_126826 =
          futhark_mc_segred_stage_1_parloop_struct_131485->free_a0_126826;
    struct memblock reduce_stage_1_tid_res_arr_mem_126965 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_126965",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131485->free_reduce_stage_1_tid_res_arr_mem_126965,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_126967 = start;
    float x_126943;
    float x_126944;
    float local_acc_126968 = 0.0F;
    
    for (; iter_126967 < end; iter_126967++) {
        int64_t gtid_118569 = iter_126967;
        float x_126946 = ((float *) mem_126803.mem)[gtid_118569];
        bool cond_126947 = sle64(x_118617, gtid_118569);
        float defunc_0_f_res_126948;
        
        if (cond_126947) {
            defunc_0_f_res_126948 = 0.0F;
        } else {
            int64_t i_126949 = add64(gtid_118569, x_126798);
            float x_126950 = ((float *) mem_122426.mem)[gtid_118561 * n_114534 +
                                                        i_126949];
            
            defunc_0_f_res_126948 = x_126950;
        }
        
        float x_126951 = a0_126826 * x_126946;
        float defunc_9_fit_fun_res_126952 = defunc_0_f_res_126948 * x_126951;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_126943 = local_acc_126968;
        }
        // Load next params
        {
            x_126944 = defunc_9_fit_fun_res_126952;
        }
        // Red body
        {
            float defunc_1_op_res_126945 = x_126943 + x_126944;
            
            local_acc_126968 = defunc_1_op_res_126945;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_126965.mem)[flat_tid_118568] =
        local_acc_126968;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131486_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131486_end -
                 futhark_mc_segred_stage_1_parloop_131486_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131486_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131486_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131486_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131483(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118568 = tid;
    int num_tasks_126964 = info.nsubtasks;
    struct futhark_mc_task_131482 *futhark_mc_task_131482 =
                                  (struct futhark_mc_task_131482 *) args;
    struct futhark_context *ctx = futhark_mc_task_131482->ctx;
    uint64_t futhark_mc_segred_task_131483_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131483_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131482->free_n_114534;
    int64_t gtid_118561 = futhark_mc_task_131482->free_gtid_118561;
    int64_t x_118617 = futhark_mc_task_131482->free_x_118617;
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131482->free_mem_122426,
                                  .size =0, .references =NULL};
    int64_t x_126798 = futhark_mc_task_131482->free_x_126798;
    struct memblock mem_126803 = {.desc ="mem_126803", .mem =
                                  futhark_mc_task_131482->free_mem_126803,
                                  .size =0, .references =NULL};
    float a0_126826 = futhark_mc_task_131482->free_a0_126826;
    float defunc_2_reduce_res_126827 =
          *futhark_mc_task_131482->retval_defunc_2_reduce_res_126827;
    size_t reduce_stage_1_tid_res_arr_mem_126965_cached_sizze_131484 = 0;
    char *reduce_stage_1_tid_res_arr_mem_126965 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_126965_cached_sizze_131484 <
        (size_t) ((int64_t) 4 * num_tasks_126964)) {
        reduce_stage_1_tid_res_arr_mem_126965 =
            realloc(reduce_stage_1_tid_res_arr_mem_126965, (int64_t) 4 *
                    num_tasks_126964);
        reduce_stage_1_tid_res_arr_mem_126965_cached_sizze_131484 =
            (int64_t) 4 * num_tasks_126964;
    }
    
    int64_t iter_126967;
    struct futhark_mc_segred_stage_1_parloop_struct_131485
    futhark_mc_segred_stage_1_parloop_struct_131485;
    
    futhark_mc_segred_stage_1_parloop_struct_131485.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131485.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131485.free_gtid_118561 =
        gtid_118561;
    futhark_mc_segred_stage_1_parloop_struct_131485.free_x_118617 = x_118617;
    futhark_mc_segred_stage_1_parloop_struct_131485.free_mem_122426 =
        mem_122426.mem;
    futhark_mc_segred_stage_1_parloop_struct_131485.free_x_126798 = x_126798;
    futhark_mc_segred_stage_1_parloop_struct_131485.free_mem_126803 =
        mem_126803.mem;
    futhark_mc_segred_stage_1_parloop_struct_131485.free_a0_126826 = a0_126826;
    futhark_mc_segred_stage_1_parloop_struct_131485.free_reduce_stage_1_tid_res_arr_mem_126965 =
        reduce_stage_1_tid_res_arr_mem_126965;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131486_task;
    
    futhark_mc_segred_stage_1_parloop_131486_task.name =
        "futhark_mc_segred_stage_1_parloop_131486";
    futhark_mc_segred_stage_1_parloop_131486_task.fn =
        futhark_mc_segred_stage_1_parloop_131486;
    futhark_mc_segred_stage_1_parloop_131486_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131485;
    futhark_mc_segred_stage_1_parloop_131486_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131486_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131486_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131486_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131486_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131486_task);
    
    if (futhark_mc_segred_stage_1_parloop_131486_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131486_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131486_total_end -
                 futhark_mc_segred_stage_1_parloop_131486_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131486_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131486_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131486_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_126827 = 0.0F;
    }
    
    float x_126969;
    float x_126970;
    
    for (int32_t i_126972 = 0; i_126972 < num_tasks_126964; i_126972++) {
        flat_tid_118568 = i_126972;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_126969 = defunc_2_reduce_res_126827;
            }
            // load next params
            {
                x_126970 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_126965)[flat_tid_118568];
            }
            // red body
            {
                float defunc_1_op_res_126971 = x_126969 + x_126970;
                
                defunc_2_reduce_res_126827 = defunc_1_op_res_126971;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_126965);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131483_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131483_end -
                 futhark_mc_segred_task_131483_start;
        
        ctx->futhark_mc_segred_task_131483_runs[tid]++;
        ctx->futhark_mc_segred_task_131483_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131483_iter[tid] += iterations;
    }
    *futhark_mc_task_131482->retval_defunc_2_reduce_res_126827 =
        defunc_2_reduce_res_126827;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131475(void *args, int64_t start,
                                            int64_t end, int flat_tid_118564,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131474
    *futhark_mc_segmap_parloop_struct_131474 =
    (struct futhark_mc_segmap_parloop_struct_131474 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131474->ctx;
    uint64_t futhark_mc_segmap_parloop_131475_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131475_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131474->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131474->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131474->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131474->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131474->free_i_114610;
    int64_t gtid_118561 =
            futhark_mc_segmap_parloop_struct_131474->free_gtid_118561;
    int64_t x_118617 = futhark_mc_segmap_parloop_struct_131474->free_x_118617;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131474->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131474->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131474->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131474->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131474->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122553 =
            futhark_mc_segmap_parloop_struct_131474->free_bytes_122553;
    struct memblock mem_122573 = {.desc ="mem_122573", .mem =
                                  futhark_mc_segmap_parloop_struct_131474->free_mem_122573,
                                  .size =0, .references =NULL};
    size_t mem_126803_cached_sizze_131476 = 0;
    char *mem_126803 = NULL;
    int64_t iterations = end - start;
    int64_t iter_126922 = start;
    
    if (mem_126803_cached_sizze_131476 < (size_t) bytes_122553) {
        mem_126803 = realloc(mem_126803, bytes_122553);
        mem_126803_cached_sizze_131476 = bytes_122553;
    }
    for (; iter_126922 < end; iter_126922++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_126953 = l_n_m_114584;
        int64_t gtid_118565 = iter_126922;
        int64_t remnant_126954 = iter_126922 - gtid_118565;
        int64_t x_126798 = ((int64_t *) mem_122124.mem)[gtid_118561 *
                                                        l_n_m_114584 +
                                                        gtid_118565];
        float x_126799 = ((float *) mem_122128.mem)[gtid_118561 * l_n_m_114584 +
                                                    gtid_118565];
        int64_t min_arg_126800 = mul64(t_jump_114541, gtid_118565);
        int64_t min_res_126801 = smin64(i_114610, min_arg_126800);
        float defunc_0_f_res_126802 = sitofp_i64_f32(min_res_126801);
        float defunc_2_reduce_res_126804;
        int64_t flat_tid_118566 = (int64_t) 0;
        int32_t num_tasks_126955;
        struct futhark_mc_task_131477 futhark_mc_task_131477;
        
        futhark_mc_task_131477.ctx = ctx;
        futhark_mc_task_131477.free_n_114534 = n_114534;
        futhark_mc_task_131477.free_gtid_118561 = gtid_118561;
        futhark_mc_task_131477.free_x_118617 = x_118617;
        futhark_mc_task_131477.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131477.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131477.free_x_126798 = x_126798;
        futhark_mc_task_131477.free_x_126799 = x_126799;
        futhark_mc_task_131477.free_defunc_0_f_res_126802 =
            defunc_0_f_res_126802;
        futhark_mc_task_131477.retval_defunc_2_reduce_res_126804 =
            &defunc_2_reduce_res_126804;
        futhark_mc_task_131477.retval_mem_126803 = mem_126803;
        
        struct scheduler_segop futhark_mc_task_131477_task;
        
        futhark_mc_task_131477_task.args = &futhark_mc_task_131477;
        futhark_mc_task_131477_task.top_level_fn =
            futhark_mc_segred_task_131478;
        futhark_mc_task_131477_task.name = "futhark_mc_segred_task_131478";
        futhark_mc_task_131477_task.iterations = l_window_114538;
        futhark_mc_task_131477_task.task_time =
            &ctx->futhark_mc_segred_task_131478_total_time;
        futhark_mc_task_131477_task.task_iter =
            &ctx->futhark_mc_segred_task_131478_total_iter;
        futhark_mc_task_131477_task.sched = STATIC;
        futhark_mc_task_131477_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131478_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131477_task);
        
        if (futhark_mc_segred_task_131478_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float a0_126826 = 1.0F / defunc_2_reduce_res_126804;
        float defunc_2_reduce_res_126827;
        int64_t flat_tid_118568 = (int64_t) 0;
        int32_t num_tasks_126964;
        struct futhark_mc_task_131482 futhark_mc_task_131482;
        
        futhark_mc_task_131482.ctx = ctx;
        futhark_mc_task_131482.free_n_114534 = n_114534;
        futhark_mc_task_131482.free_gtid_118561 = gtid_118561;
        futhark_mc_task_131482.free_x_118617 = x_118617;
        futhark_mc_task_131482.free_mem_122426 = mem_122426.mem;
        futhark_mc_task_131482.free_x_126798 = x_126798;
        futhark_mc_task_131482.free_mem_126803 = mem_126803;
        futhark_mc_task_131482.free_a0_126826 = a0_126826;
        futhark_mc_task_131482.retval_defunc_2_reduce_res_126827 =
            &defunc_2_reduce_res_126827;
        
        struct scheduler_segop futhark_mc_task_131482_task;
        
        futhark_mc_task_131482_task.args = &futhark_mc_task_131482;
        futhark_mc_task_131482_task.top_level_fn =
            futhark_mc_segred_task_131483;
        futhark_mc_task_131482_task.name = "futhark_mc_segred_task_131483";
        futhark_mc_task_131482_task.iterations = l_window_114538;
        futhark_mc_task_131482_task.task_time =
            &ctx->futhark_mc_segred_task_131483_total_time;
        futhark_mc_task_131482_task.task_iter =
            &ctx->futhark_mc_segred_task_131483_total_iter;
        futhark_mc_task_131482_task.sched = STATIC;
        futhark_mc_task_131482_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131483_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131482_task);
        
        if (futhark_mc_segred_task_131483_err != 0) {
            err = 1;
            goto cleanup;
        }
        ((float *) mem_122573.mem)[gtid_118565] = defunc_2_reduce_res_126827;
    }
    
  cleanup:
    { }
    free(mem_126803);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131475_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131475_end -
                 futhark_mc_segmap_parloop_131475_start;
        
        ctx->futhark_mc_segmap_parloop_131475_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131475_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131475_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131473(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118564 = tid;
    int num_tasks_126883 = info.nsubtasks;
    struct futhark_mc_task_131468 *futhark_mc_task_131468 =
                                  (struct futhark_mc_task_131468 *) args;
    struct futhark_context *ctx = futhark_mc_task_131468->ctx;
    uint64_t futhark_mc_segmap_nested_task_131473_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131473_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131468->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131468->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131468->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131468->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131468->free_i_114610;
    int64_t gtid_118561 = futhark_mc_task_131468->free_gtid_118561;
    int64_t x_118617 = futhark_mc_task_131468->free_x_118617;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131468->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131468->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131468->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131468->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131468->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122553 = futhark_mc_task_131468->free_bytes_122553;
    struct memblock mem_122573 = {.desc ="mem_122573", .mem =
                                  futhark_mc_task_131468->free_mem_122573,
                                  .size =0, .references =NULL};
    int64_t iter_126922;
    struct futhark_mc_segmap_parloop_struct_131474
    futhark_mc_segmap_parloop_struct_131474;
    
    futhark_mc_segmap_parloop_struct_131474.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131474.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131474.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131474.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131474.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131474.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131474.free_gtid_118561 = gtid_118561;
    futhark_mc_segmap_parloop_struct_131474.free_x_118617 = x_118617;
    futhark_mc_segmap_parloop_struct_131474.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131474.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131474.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131474.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131474.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131474.free_bytes_122553 = bytes_122553;
    futhark_mc_segmap_parloop_struct_131474.free_mem_122573 = mem_122573.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131475_task;
    
    futhark_mc_segmap_parloop_131475_task.name =
        "futhark_mc_segmap_parloop_131475";
    futhark_mc_segmap_parloop_131475_task.fn = futhark_mc_segmap_parloop_131475;
    futhark_mc_segmap_parloop_131475_task.args =
        &futhark_mc_segmap_parloop_struct_131474;
    futhark_mc_segmap_parloop_131475_task.iterations = iterations;
    futhark_mc_segmap_parloop_131475_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131475_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131475_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131475_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131475_task);
    
    if (futhark_mc_segmap_parloop_131475_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131475_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131475_total_end -
                 futhark_mc_segmap_parloop_131475_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131475_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131475_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131475_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131473_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131473_end -
                 futhark_mc_segmap_nested_task_131473_start;
        
        ctx->futhark_mc_segmap_nested_task_131473_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131473_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131473_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131466(void *args, int64_t start,
                                            int64_t end, int flat_tid_118560,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131465
    *futhark_mc_segmap_parloop_struct_131465 =
    (struct futhark_mc_segmap_parloop_struct_131465 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131465->ctx;
    uint64_t futhark_mc_segmap_parloop_131466_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131466_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131465->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131465->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131465->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131465->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131465->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131465->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131465->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131465->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131465->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131465->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131465->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131465->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131465->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122553 =
            futhark_mc_segmap_parloop_struct_131465->free_bytes_122553;
    struct memblock mem_122607 = {.desc ="mem_122607", .mem =
                                  futhark_mc_segmap_parloop_struct_131465->free_mem_122607,
                                  .size =0, .references =NULL};
    size_t mem_122573_cached_sizze_131467 = 0;
    char *mem_122573 = NULL;
    int64_t iterations = end - start;
    int64_t iter_126797 = start;
    
    if (mem_122573_cached_sizze_131467 < (size_t) bytes_122055) {
        mem_122573 = realloc(mem_122573, bytes_122055);
        mem_122573_cached_sizze_131467 = bytes_122055;
    }
    for (; iter_126797 < end; iter_126797++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_126881 = m_114533;
        int64_t gtid_118561 = iter_126797;
        int64_t remnant_126882 = iter_126797 - gtid_118561;
        int64_t x_118617 = ((int64_t *) mem_121982.mem)[gtid_118561];
        int64_t flat_tid_118562 = (int64_t) 0;
        int32_t num_tasks_126883;
        int64_t flat_tid_118564 = (int64_t) 0;
        struct futhark_mc_task_131468 futhark_mc_task_131468;
        
        futhark_mc_task_131468.ctx = ctx;
        futhark_mc_task_131468.free_n_114534 = n_114534;
        futhark_mc_task_131468.free_l_window_114538 = l_window_114538;
        futhark_mc_task_131468.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131468.free_l_n_m_114584 = l_n_m_114584;
        futhark_mc_task_131468.free_i_114610 = i_114610;
        futhark_mc_task_131468.free_gtid_118561 = gtid_118561;
        futhark_mc_task_131468.free_x_118617 = x_118617;
        futhark_mc_task_131468.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131468.free_mem_122124 = mem_122124.mem;
        futhark_mc_task_131468.free_mem_122128 = mem_122128.mem;
        futhark_mc_task_131468.free_mem_122426 = mem_122426.mem;
        futhark_mc_task_131468.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131468.free_bytes_122553 = bytes_122553;
        futhark_mc_task_131468.free_mem_122573 = mem_122573;
        
        struct scheduler_segop futhark_mc_task_131468_task;
        
        futhark_mc_task_131468_task.args = &futhark_mc_task_131468;
        futhark_mc_task_131468_task.top_level_fn =
            futhark_mc_segmap_task_131469;
        futhark_mc_task_131468_task.name = "futhark_mc_segmap_task_131469";
        futhark_mc_task_131468_task.iterations = l_n_m_114584;
        futhark_mc_task_131468_task.task_time =
            &ctx->futhark_mc_segmap_task_131469_total_time;
        futhark_mc_task_131468_task.task_iter =
            &ctx->futhark_mc_segmap_task_131469_total_iter;
        futhark_mc_task_131468_task.sched = STATIC;
        futhark_mc_task_131468_task.nested_fn =
            futhark_mc_segmap_nested_task_131473;
        
        int futhark_mc_segmap_task_131469_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131468_task);
        
        if (futhark_mc_segmap_task_131469_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122607.mem + gtid_118561 * l_n_m_114584 * (int64_t) 4,
                mem_122573 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122573);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131466_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131466_end -
                 futhark_mc_segmap_parloop_131466_start;
        
        ctx->futhark_mc_segmap_parloop_131466_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131466_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131466_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131464(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118560 = tid;
    int num_tasks_126744 = info.nsubtasks;
    struct futhark_mc_task_131458 *futhark_mc_task_131458 =
                                  (struct futhark_mc_task_131458 *) args;
    struct futhark_context *ctx = futhark_mc_task_131458->ctx;
    uint64_t futhark_mc_segmap_nested_task_131464_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131464_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131458->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131458->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131458->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131458->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131458->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131458->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131458->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131458->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131458->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131458->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131458->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131458->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131458->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122553 = futhark_mc_task_131458->free_bytes_122553;
    struct memblock mem_122607 = {.desc ="mem_122607", .mem =
                                  futhark_mc_task_131458->free_mem_122607,
                                  .size =0, .references =NULL};
    int64_t iter_126797;
    struct futhark_mc_segmap_parloop_struct_131465
    futhark_mc_segmap_parloop_struct_131465;
    
    futhark_mc_segmap_parloop_struct_131465.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131465.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131465.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131465.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131465.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131465.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131465.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131465.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131465.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131465.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131465.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131465.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131465.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131465.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131465.free_bytes_122553 = bytes_122553;
    futhark_mc_segmap_parloop_struct_131465.free_mem_122607 = mem_122607.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131466_task;
    
    futhark_mc_segmap_parloop_131466_task.name =
        "futhark_mc_segmap_parloop_131466";
    futhark_mc_segmap_parloop_131466_task.fn = futhark_mc_segmap_parloop_131466;
    futhark_mc_segmap_parloop_131466_task.args =
        &futhark_mc_segmap_parloop_struct_131465;
    futhark_mc_segmap_parloop_131466_task.iterations = iterations;
    futhark_mc_segmap_parloop_131466_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131466_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131466_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131466_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131466_task);
    
    if (futhark_mc_segmap_parloop_131466_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131466_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131466_total_end -
                 futhark_mc_segmap_parloop_131466_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131466_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131466_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131466_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131464_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131464_end -
                 futhark_mc_segmap_nested_task_131464_start;
        
        ctx->futhark_mc_segmap_nested_task_131464_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131464_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131464_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131487 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122608;
    char *free_mem_122713;
    char *free_mem_122717;
};
struct futhark_mc_segmap_parloop_struct_131489 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122608;
    char *free_mem_122713;
    char *free_mem_122717;
};
static int futhark_mc_segmap_parloop_131490(void *args, int64_t start,
                                            int64_t end, int flat_tid_118703,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131489
    *futhark_mc_segmap_parloop_struct_131489 =
    (struct futhark_mc_segmap_parloop_struct_131489 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131489->ctx;
    uint64_t futhark_mc_segmap_parloop_131490_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131490_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131489->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131489->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131489->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131489->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131489->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131489->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131489->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131489->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131489->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131489->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131489->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131489->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131489->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122608 =
            futhark_mc_segmap_parloop_struct_131489->free_bytes_122608;
    struct memblock mem_122713 = {.desc ="mem_122713", .mem =
                                  futhark_mc_segmap_parloop_struct_131489->free_mem_122713,
                                  .size =0, .references =NULL};
    struct memblock mem_122717 = {.desc ="mem_122717", .mem =
                                  futhark_mc_segmap_parloop_struct_131489->free_mem_122717,
                                  .size =0, .references =NULL};
    size_t mem_122652_cached_sizze_131491 = 0;
    char *mem_122652 = NULL;
    size_t mem_122655_cached_sizze_131492 = 0;
    char *mem_122655 = NULL;
    size_t mem_122672_cached_sizze_131493 = 0;
    char *mem_122672 = NULL;
    size_t mem_122675_cached_sizze_131494 = 0;
    char *mem_122675 = NULL;
    int64_t iterations = end - start;
    int64_t iter_126974 = start;
    
    if (mem_122652_cached_sizze_131491 < (size_t) bytes_122055) {
        mem_122652 = realloc(mem_122652, bytes_122055);
        mem_122652_cached_sizze_131491 = bytes_122055;
    }
    if (mem_122655_cached_sizze_131492 < (size_t) bytes_122055) {
        mem_122655 = realloc(mem_122655, bytes_122055);
        mem_122655_cached_sizze_131492 = bytes_122055;
    }
    if (mem_122672_cached_sizze_131493 < (size_t) bytes_122608) {
        mem_122672 = realloc(mem_122672, bytes_122608);
        mem_122672_cached_sizze_131493 = bytes_122608;
    }
    if (mem_122675_cached_sizze_131494 < (size_t) bytes_122608) {
        mem_122675 = realloc(mem_122675, bytes_122608);
        mem_122675_cached_sizze_131494 = bytes_122608;
    }
    for (; iter_126974 < end; iter_126974++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_127051 = m_114533;
        int64_t gtid_118704 = iter_126974;
        int64_t remnant_127052 = iter_126974 - gtid_118704;
        int64_t x_115554 = ((int64_t *) mem_121982.mem)[gtid_118704];
        
        for (int64_t i_126975 = 0; i_126975 < l_n_m_114584; i_126975++) {
            int64_t x_126978 = ((int64_t *) mem_122124.mem)[gtid_118704 *
                                                            l_n_m_114584 +
                                                            i_126975];
            float x_126979 = ((float *) mem_122128.mem)[gtid_118704 *
                                                        l_n_m_114584 +
                                                        i_126975];
            int64_t min_arg_126980 = mul64(t_jump_114541, i_126975);
            int64_t min_res_126981 = smin64(i_114610, min_arg_126980);
            float defunc_0_f_res_126982 = sitofp_i64_f32(min_res_126981);
            float defunc_2_reduce_res_126985;
            float defunc_2_reduce_res_126986;
            float defunc_2_reduce_res_126987;
            float redout_126991;
            float redout_126992;
            float redout_126993;
            
            redout_126991 = 0.0F;
            redout_126992 = 0.0F;
            redout_126993 = 0.0F;
            for (int64_t i_126990 = 0; i_126990 < l_window_114538; i_126990++) {
                bool cond_126996 = sle64(x_115554, i_126990);
                float defunc_0_f_res_126997;
                
                if (cond_126996) {
                    defunc_0_f_res_126997 = 0.0F;
                } else {
                    int64_t i_126998 = add64(x_126978, i_126990);
                    float x_126999 = ((float *) mem_122004.mem)[gtid_118704 *
                                                                n_114534 +
                                                                i_126998];
                    float defunc_0_f_res_f_res_127000 = 1.0F + x_126999;
                    
                    defunc_0_f_res_126997 = defunc_0_f_res_f_res_127000;
                }
                
                float defunc_0_f_res_127001;
                
                if (cond_126996) {
                    defunc_0_f_res_127001 = 0.0F;
                } else {
                    int64_t i_127002 = add64(x_126978, i_126990);
                    float x_127003 = ((float *) mem_122430.mem)[gtid_118704 *
                                                                n_114534 +
                                                                i_127002];
                    
                    defunc_0_f_res_127001 = x_127003;
                }
                
                float x_j_127004 = defunc_0_f_res_126997 -
                      defunc_0_f_res_126982;
                float abs_res_127005 = (float) fabs(x_j_127004);
                float tmp1_127006 = abs_res_127005 / x_126979;
                float x_127007 = tmp1_127006 * tmp1_127006;
                float y_127008 = tmp1_127006 * x_127007;
                float tmp2_127009 = 1.0F - y_127008;
                float x_127010 = tmp2_127009 * tmp2_127009;
                float tmp3_127011 = tmp2_127009 * x_127010;
                float tmp4_127012 = defunc_0_f_res_127001 * tmp3_127011;
                float defunc_1_f_res_127013 = x_j_127004 * tmp4_127012;
                float defunc_1_f_res_127014 = x_j_127004 *
                      defunc_1_f_res_127013;
                float defunc_1_op_res_127015 = tmp4_127012 + redout_126991;
                float defunc_1_op_res_127016 = defunc_1_f_res_127013 +
                      redout_126992;
                float defunc_1_op_res_127017 = defunc_1_f_res_127014 +
                      redout_126993;
                
                ((float *) mem_122672)[i_126990] = defunc_1_f_res_127013;
                ((float *) mem_122675)[i_126990] = tmp4_127012;
                
                float redout_tmp_127055 = defunc_1_op_res_127015;
                float redout_tmp_127056 = defunc_1_op_res_127016;
                float redout_tmp_127057 = defunc_1_op_res_127017;
                
                redout_126991 = redout_tmp_127055;
                redout_126992 = redout_tmp_127056;
                redout_126993 = redout_tmp_127057;
            }
            defunc_2_reduce_res_126985 = redout_126991;
            defunc_2_reduce_res_126986 = redout_126992;
            defunc_2_reduce_res_126987 = redout_126993;
            
            float x_127020 = defunc_2_reduce_res_126985 *
                  defunc_2_reduce_res_126987;
            float y_127021 = defunc_2_reduce_res_126986 *
                  defunc_2_reduce_res_126986;
            float y_127022 = x_127020 - y_127021;
            float det1_127023 = 1.0F / y_127022;
            float a11_127024 = defunc_2_reduce_res_126987 * det1_127023;
            float negate_arg_127025 = defunc_2_reduce_res_126986 * det1_127023;
            float b11_127026 = 0.0F - negate_arg_127025;
            float c11_127027 = defunc_2_reduce_res_126985 * det1_127023;
            float defunc_2_reduce_res_127028;
            float defunc_2_reduce_res_127029;
            float redout_127031;
            float redout_127032;
            
            redout_127031 = 0.0F;
            redout_127032 = 0.0F;
            for (int64_t i_127030 = 0; i_127030 < l_window_114538; i_127030++) {
                float x_127033 = ((float *) mem_122675)[i_127030];
                float x_127034 = ((float *) mem_122672)[i_127030];
                bool cond_127035 = sle64(x_115554, i_127030);
                float defunc_0_f_res_127036;
                
                if (cond_127035) {
                    defunc_0_f_res_127036 = 0.0F;
                } else {
                    int64_t i_127037 = add64(x_126978, i_127030);
                    float x_127038 = ((float *) mem_122426.mem)[gtid_118704 *
                                                                n_114534 +
                                                                i_127037];
                    
                    defunc_0_f_res_127036 = x_127038;
                }
                
                float x_127039 = a11_127024 * x_127033;
                float y_127040 = b11_127026 * x_127034;
                float x_127041 = x_127039 + y_127040;
                float defunc_9_fit_fun_res_127042 = defunc_0_f_res_127036 *
                      x_127041;
                float x_127043 = b11_127026 * x_127033;
                float y_127044 = c11_127027 * x_127034;
                float x_127045 = x_127043 + y_127044;
                float defunc_9_slope_fun_res_127046 = defunc_0_f_res_127036 *
                      x_127045;
                float defunc_1_op_res_127047 = defunc_9_fit_fun_res_127042 +
                      redout_127031;
                float defunc_1_op_res_127048 = defunc_9_slope_fun_res_127046 +
                      redout_127032;
                float redout_tmp_127060 = defunc_1_op_res_127047;
                float redout_tmp_127061 = defunc_1_op_res_127048;
                
                redout_127031 = redout_tmp_127060;
                redout_127032 = redout_tmp_127061;
            }
            defunc_2_reduce_res_127028 = redout_127031;
            defunc_2_reduce_res_127029 = redout_127032;
            ((float *) mem_122652)[i_126975] = defunc_2_reduce_res_127028;
            ((float *) mem_122655)[i_126975] = defunc_2_reduce_res_127029;
        }
        memmove(mem_122713.mem + gtid_118704 * l_n_m_114584 * (int64_t) 4,
                mem_122652 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
        memmove(mem_122717.mem + gtid_118704 * l_n_m_114584 * (int64_t) 4,
                mem_122655 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122652);
    free(mem_122655);
    free(mem_122672);
    free(mem_122675);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131490_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131490_end -
                 futhark_mc_segmap_parloop_131490_start;
        
        ctx->futhark_mc_segmap_parloop_131490_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131490_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131490_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131488(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118703 = tid;
    int num_tasks_126973 = info.nsubtasks;
    struct futhark_mc_task_131487 *futhark_mc_task_131487 =
                                  (struct futhark_mc_task_131487 *) args;
    struct futhark_context *ctx = futhark_mc_task_131487->ctx;
    uint64_t futhark_mc_segmap_task_131488_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131488_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131487->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131487->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131487->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131487->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131487->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131487->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131487->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131487->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131487->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131487->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131487->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131487->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131487->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122608 = futhark_mc_task_131487->free_bytes_122608;
    struct memblock mem_122713 = {.desc ="mem_122713", .mem =
                                  futhark_mc_task_131487->free_mem_122713,
                                  .size =0, .references =NULL};
    struct memblock mem_122717 = {.desc ="mem_122717", .mem =
                                  futhark_mc_task_131487->free_mem_122717,
                                  .size =0, .references =NULL};
    int64_t iter_126974;
    struct futhark_mc_segmap_parloop_struct_131489
    futhark_mc_segmap_parloop_struct_131489;
    
    futhark_mc_segmap_parloop_struct_131489.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131489.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131489.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131489.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131489.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131489.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131489.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131489.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131489.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131489.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131489.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131489.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131489.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131489.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131489.free_bytes_122608 = bytes_122608;
    futhark_mc_segmap_parloop_struct_131489.free_mem_122713 = mem_122713.mem;
    futhark_mc_segmap_parloop_struct_131489.free_mem_122717 = mem_122717.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131490_task;
    
    futhark_mc_segmap_parloop_131490_task.name =
        "futhark_mc_segmap_parloop_131490";
    futhark_mc_segmap_parloop_131490_task.fn = futhark_mc_segmap_parloop_131490;
    futhark_mc_segmap_parloop_131490_task.args =
        &futhark_mc_segmap_parloop_struct_131489;
    futhark_mc_segmap_parloop_131490_task.iterations = iterations;
    futhark_mc_segmap_parloop_131490_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131490_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131490_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131490_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131490_task);
    
    if (futhark_mc_segmap_parloop_131490_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131490_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131490_total_end -
                 futhark_mc_segmap_parloop_131490_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131490_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131490_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131490_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131488_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131488_end -
                 futhark_mc_segmap_task_131488_start;
        
        ctx->futhark_mc_segmap_task_131488_runs[tid]++;
        ctx->futhark_mc_segmap_task_131488_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131488_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131496 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122608;
    char *free_mem_122713;
    char *free_mem_122717;
};
struct futhark_mc_task_131500 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_118706;
    int64_t free_x_118791;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122608;
    char *free_mem_122646;
    char *free_mem_122649;
};
struct futhark_mc_segmap_parloop_struct_131502 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_118706;
    int64_t free_x_118791;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122608;
    char *free_mem_122646;
    char *free_mem_122649;
};
static int futhark_mc_segmap_parloop_131503(void *args, int64_t start,
                                            int64_t end, int flat_tid_118707,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131502
    *futhark_mc_segmap_parloop_struct_131502 =
    (struct futhark_mc_segmap_parloop_struct_131502 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131502->ctx;
    uint64_t futhark_mc_segmap_parloop_131503_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131503_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131502->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131502->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131502->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131502->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131502->free_i_114610;
    int64_t gtid_118706 =
            futhark_mc_segmap_parloop_struct_131502->free_gtid_118706;
    int64_t x_118791 = futhark_mc_segmap_parloop_struct_131502->free_x_118791;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131502->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131502->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131502->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131502->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131502->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122608 =
            futhark_mc_segmap_parloop_struct_131502->free_bytes_122608;
    struct memblock mem_122646 = {.desc ="mem_122646", .mem =
                                  futhark_mc_segmap_parloop_struct_131502->free_mem_122646,
                                  .size =0, .references =NULL};
    struct memblock mem_122649 = {.desc ="mem_122649", .mem =
                                  futhark_mc_segmap_parloop_struct_131502->free_mem_122649,
                                  .size =0, .references =NULL};
    size_t mem_127138_cached_sizze_131504 = 0;
    char *mem_127138 = NULL;
    size_t mem_127140_cached_sizze_131505 = 0;
    char *mem_127140 = NULL;
    int64_t iterations = end - start;
    int64_t iter_127209 = start;
    
    if (mem_127138_cached_sizze_131504 < (size_t) bytes_122608) {
        mem_127138 = realloc(mem_127138, bytes_122608);
        mem_127138_cached_sizze_131504 = bytes_122608;
    }
    if (mem_127140_cached_sizze_131505 < (size_t) bytes_122608) {
        mem_127140 = realloc(mem_127140, bytes_122608);
        mem_127140_cached_sizze_131505 = bytes_122608;
    }
    for (; iter_127209 < end; iter_127209++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_127259 = l_n_m_114584;
        int64_t gtid_118708 = iter_127209;
        int64_t remnant_127260 = iter_127209 - gtid_118708;
        int64_t x_127133 = ((int64_t *) mem_122124.mem)[gtid_118706 *
                                                        l_n_m_114584 +
                                                        gtid_118708];
        float x_127134 = ((float *) mem_122128.mem)[gtid_118706 * l_n_m_114584 +
                                                    gtid_118708];
        int64_t min_arg_127135 = mul64(t_jump_114541, gtid_118708);
        int64_t min_res_127136 = smin64(i_114610, min_arg_127135);
        float defunc_0_f_res_127137 = sitofp_i64_f32(min_res_127136);
        float defunc_2_reduce_res_127142;
        float defunc_2_reduce_res_127143;
        float defunc_2_reduce_res_127144;
        float redout_127211;
        float redout_127212;
        float redout_127213;
        
        redout_127211 = 0.0F;
        redout_127212 = 0.0F;
        redout_127213 = 0.0F;
        for (int64_t i_127210 = 0; i_127210 < l_window_114538; i_127210++) {
            bool cond_127216 = sle64(x_118791, i_127210);
            float defunc_0_f_res_127217;
            
            if (cond_127216) {
                defunc_0_f_res_127217 = 0.0F;
            } else {
                int64_t i_127218 = add64(x_127133, i_127210);
                float x_127219 = ((float *) mem_122004.mem)[gtid_118706 *
                                                            n_114534 +
                                                            i_127218];
                float defunc_0_f_res_f_res_127220 = 1.0F + x_127219;
                
                defunc_0_f_res_127217 = defunc_0_f_res_f_res_127220;
            }
            
            float defunc_0_f_res_127221;
            
            if (cond_127216) {
                defunc_0_f_res_127221 = 0.0F;
            } else {
                int64_t i_127222 = add64(x_127133, i_127210);
                float x_127223 = ((float *) mem_122430.mem)[gtid_118706 *
                                                            n_114534 +
                                                            i_127222];
                
                defunc_0_f_res_127221 = x_127223;
            }
            
            float x_j_127224 = defunc_0_f_res_127217 - defunc_0_f_res_127137;
            float abs_res_127225 = (float) fabs(x_j_127224);
            float tmp1_127226 = abs_res_127225 / x_127134;
            float x_127227 = tmp1_127226 * tmp1_127226;
            float y_127228 = tmp1_127226 * x_127227;
            float tmp2_127229 = 1.0F - y_127228;
            float x_127230 = tmp2_127229 * tmp2_127229;
            float tmp3_127231 = tmp2_127229 * x_127230;
            float tmp4_127232 = defunc_0_f_res_127221 * tmp3_127231;
            float defunc_1_f_res_127233 = x_j_127224 * tmp4_127232;
            float defunc_1_f_res_127234 = x_j_127224 * defunc_1_f_res_127233;
            float defunc_1_op_res_127235 = tmp4_127232 + redout_127211;
            float defunc_1_op_res_127236 = defunc_1_f_res_127233 +
                  redout_127212;
            float defunc_1_op_res_127237 = defunc_1_f_res_127234 +
                  redout_127213;
            
            ((float *) mem_127138)[i_127210] = defunc_1_f_res_127233;
            ((float *) mem_127140)[i_127210] = tmp4_127232;
            
            float redout_tmp_127261 = defunc_1_op_res_127235;
            float redout_tmp_127262 = defunc_1_op_res_127236;
            float redout_tmp_127263 = defunc_1_op_res_127237;
            
            redout_127211 = redout_tmp_127261;
            redout_127212 = redout_tmp_127262;
            redout_127213 = redout_tmp_127263;
        }
        defunc_2_reduce_res_127142 = redout_127211;
        defunc_2_reduce_res_127143 = redout_127212;
        defunc_2_reduce_res_127144 = redout_127213;
        
        float x_127177 = defunc_2_reduce_res_127142 *
              defunc_2_reduce_res_127144;
        float y_127178 = defunc_2_reduce_res_127143 *
              defunc_2_reduce_res_127143;
        float y_127179 = x_127177 - y_127178;
        float det1_127180 = 1.0F / y_127179;
        float a11_127181 = defunc_2_reduce_res_127144 * det1_127180;
        float negate_arg_127182 = defunc_2_reduce_res_127143 * det1_127180;
        float b11_127183 = 0.0F - negate_arg_127182;
        float c11_127184 = defunc_2_reduce_res_127142 * det1_127180;
        float defunc_2_reduce_res_127185;
        float defunc_2_reduce_res_127186;
        float redout_127241;
        float redout_127242;
        
        redout_127241 = 0.0F;
        redout_127242 = 0.0F;
        for (int64_t i_127240 = 0; i_127240 < l_window_114538; i_127240++) {
            float x_127243 = ((float *) mem_127140)[i_127240];
            float x_127244 = ((float *) mem_127138)[i_127240];
            bool cond_127245 = sle64(x_118791, i_127240);
            float defunc_0_f_res_127246;
            
            if (cond_127245) {
                defunc_0_f_res_127246 = 0.0F;
            } else {
                int64_t i_127247 = add64(x_127133, i_127240);
                float x_127248 = ((float *) mem_122426.mem)[gtid_118706 *
                                                            n_114534 +
                                                            i_127247];
                
                defunc_0_f_res_127246 = x_127248;
            }
            
            float x_127249 = a11_127181 * x_127243;
            float y_127250 = b11_127183 * x_127244;
            float x_127251 = x_127249 + y_127250;
            float defunc_9_fit_fun_res_127252 = defunc_0_f_res_127246 *
                  x_127251;
            float x_127253 = b11_127183 * x_127243;
            float y_127254 = c11_127184 * x_127244;
            float x_127255 = x_127253 + y_127254;
            float defunc_9_slope_fun_res_127256 = defunc_0_f_res_127246 *
                  x_127255;
            float defunc_1_op_res_127257 = defunc_9_fit_fun_res_127252 +
                  redout_127241;
            float defunc_1_op_res_127258 = defunc_9_slope_fun_res_127256 +
                  redout_127242;
            float redout_tmp_127266 = defunc_1_op_res_127257;
            float redout_tmp_127267 = defunc_1_op_res_127258;
            
            redout_127241 = redout_tmp_127266;
            redout_127242 = redout_tmp_127267;
        }
        defunc_2_reduce_res_127185 = redout_127241;
        defunc_2_reduce_res_127186 = redout_127242;
        ((float *) mem_122646.mem)[gtid_118708] = defunc_2_reduce_res_127185;
        ((float *) mem_122649.mem)[gtid_118708] = defunc_2_reduce_res_127186;
    }
    
  cleanup:
    { }
    free(mem_127138);
    free(mem_127140);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131503_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131503_end -
                 futhark_mc_segmap_parloop_131503_start;
        
        ctx->futhark_mc_segmap_parloop_131503_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131503_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131503_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131501(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118707 = tid;
    int num_tasks_127208 = info.nsubtasks;
    struct futhark_mc_task_131500 *futhark_mc_task_131500 =
                                  (struct futhark_mc_task_131500 *) args;
    struct futhark_context *ctx = futhark_mc_task_131500->ctx;
    uint64_t futhark_mc_segmap_task_131501_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131501_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131500->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131500->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131500->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131500->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131500->free_i_114610;
    int64_t gtid_118706 = futhark_mc_task_131500->free_gtid_118706;
    int64_t x_118791 = futhark_mc_task_131500->free_x_118791;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131500->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131500->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131500->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131500->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131500->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122608 = futhark_mc_task_131500->free_bytes_122608;
    struct memblock mem_122646 = {.desc ="mem_122646", .mem =
                                  futhark_mc_task_131500->free_mem_122646,
                                  .size =0, .references =NULL};
    struct memblock mem_122649 = {.desc ="mem_122649", .mem =
                                  futhark_mc_task_131500->free_mem_122649,
                                  .size =0, .references =NULL};
    int64_t iter_127209;
    struct futhark_mc_segmap_parloop_struct_131502
    futhark_mc_segmap_parloop_struct_131502;
    
    futhark_mc_segmap_parloop_struct_131502.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131502.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131502.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131502.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131502.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131502.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131502.free_gtid_118706 = gtid_118706;
    futhark_mc_segmap_parloop_struct_131502.free_x_118791 = x_118791;
    futhark_mc_segmap_parloop_struct_131502.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131502.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131502.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131502.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131502.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131502.free_bytes_122608 = bytes_122608;
    futhark_mc_segmap_parloop_struct_131502.free_mem_122646 = mem_122646.mem;
    futhark_mc_segmap_parloop_struct_131502.free_mem_122649 = mem_122649.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131503_task;
    
    futhark_mc_segmap_parloop_131503_task.name =
        "futhark_mc_segmap_parloop_131503";
    futhark_mc_segmap_parloop_131503_task.fn = futhark_mc_segmap_parloop_131503;
    futhark_mc_segmap_parloop_131503_task.args =
        &futhark_mc_segmap_parloop_struct_131502;
    futhark_mc_segmap_parloop_131503_task.iterations = iterations;
    futhark_mc_segmap_parloop_131503_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131503_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131503_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131503_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131503_task);
    
    if (futhark_mc_segmap_parloop_131503_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131503_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131503_total_end -
                 futhark_mc_segmap_parloop_131503_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131503_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131503_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131503_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131501_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131501_end -
                 futhark_mc_segmap_task_131501_start;
        
        ctx->futhark_mc_segmap_task_131501_runs[tid]++;
        ctx->futhark_mc_segmap_task_131501_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131501_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131507 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_118706;
    int64_t free_x_118791;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122608;
    char *free_mem_122646;
    char *free_mem_122649;
};
struct futhark_mc_task_131511 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118706;
    int64_t free_x_118791;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_127063;
    float free_x_127064;
    float free_defunc_0_f_res_127067;
    float *retval_defunc_2_reduce_res_127070;
    float *retval_defunc_2_reduce_res_127071;
    float *retval_defunc_2_reduce_res_127072;
    char *retval_mem_127068;
    char *retval_mem_127069;
};
struct futhark_mc_segred_stage_1_parloop_struct_131516 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118706;
    int64_t free_x_118791;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_127063;
    float free_x_127064;
    float free_defunc_0_f_res_127067;
    char *free_mem_127068;
    char *free_mem_127069;
    char *free_reduce_stage_1_tid_res_arr_mem_127320;
    char *free_reduce_stage_1_tid_res_arr_mem_127322;
    char *free_reduce_stage_1_tid_res_arr_mem_127324;
};
static int futhark_mc_segred_stage_1_parloop_131517(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_118711,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131516
    *futhark_mc_segred_stage_1_parloop_struct_131516 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131516 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131516->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131517_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131517_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131516->free_n_114534;
    int64_t gtid_118706 =
            futhark_mc_segred_stage_1_parloop_struct_131516->free_gtid_118706;
    int64_t x_118791 =
            futhark_mc_segred_stage_1_parloop_struct_131516->free_x_118791;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131516->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131516->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_127063 =
            futhark_mc_segred_stage_1_parloop_struct_131516->free_x_127063;
    float x_127064 =
          futhark_mc_segred_stage_1_parloop_struct_131516->free_x_127064;
    float defunc_0_f_res_127067 =
          futhark_mc_segred_stage_1_parloop_struct_131516->free_defunc_0_f_res_127067;
    struct memblock mem_127068 = {.desc ="mem_127068", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131516->free_mem_127068,
                                  .size =0, .references =NULL};
    struct memblock mem_127069 = {.desc ="mem_127069", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131516->free_mem_127069,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_127320 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_127320",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131516->free_reduce_stage_1_tid_res_arr_mem_127320,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_127322 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_127322",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131516->free_reduce_stage_1_tid_res_arr_mem_127322,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_127324 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_127324",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131516->free_reduce_stage_1_tid_res_arr_mem_127324,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_127326 = start;
    float x_127269;
    float x_127270;
    float x_127272;
    float x_127273;
    float x_127275;
    float x_127276;
    float local_acc_127327 = 0.0F;
    float local_acc_127328 = 0.0F;
    float local_acc_127329 = 0.0F;
    
    for (; iter_127326 < end; iter_127326++) {
        int64_t gtid_118712 = iter_127326;
        bool cond_127278 = sle64(x_118791, gtid_118712);
        float defunc_0_f_res_127279;
        
        if (cond_127278) {
            defunc_0_f_res_127279 = 0.0F;
        } else {
            int64_t i_127280 = add64(gtid_118712, x_127063);
            float x_127281 = ((float *) mem_122004.mem)[gtid_118706 * n_114534 +
                                                        i_127280];
            float defunc_0_f_res_f_res_127282 = 1.0F + x_127281;
            
            defunc_0_f_res_127279 = defunc_0_f_res_f_res_127282;
        }
        
        float defunc_0_f_res_127283;
        
        if (cond_127278) {
            defunc_0_f_res_127283 = 0.0F;
        } else {
            int64_t i_127284 = add64(gtid_118712, x_127063);
            float x_127285 = ((float *) mem_122430.mem)[gtid_118706 * n_114534 +
                                                        i_127284];
            
            defunc_0_f_res_127283 = x_127285;
        }
        
        float x_j_127286 = defunc_0_f_res_127279 - defunc_0_f_res_127067;
        float abs_res_127287 = (float) fabs(x_j_127286);
        float tmp1_127288 = abs_res_127287 / x_127064;
        float x_127289 = tmp1_127288 * tmp1_127288;
        float y_127290 = tmp1_127288 * x_127289;
        float tmp2_127291 = 1.0F - y_127290;
        float x_127292 = tmp2_127291 * tmp2_127291;
        float tmp3_127293 = tmp2_127291 * x_127292;
        float tmp4_127294 = defunc_0_f_res_127283 * tmp3_127293;
        float defunc_1_f_res_127295 = x_j_127286 * tmp4_127294;
        float defunc_1_f_res_127296 = x_j_127286 * defunc_1_f_res_127295;
        
        // save map-out results
        {
            ((float *) mem_127068.mem)[gtid_118712] = defunc_1_f_res_127295;
            ((float *) mem_127069.mem)[gtid_118712] = tmp4_127294;
        }
        // Load accum params
        {
            x_127269 = local_acc_127327;
        }
        // Load next params
        {
            x_127270 = tmp4_127294;
        }
        // Red body
        {
            float defunc_1_op_res_127271 = x_127269 + x_127270;
            
            local_acc_127327 = defunc_1_op_res_127271;
        }
        // Load accum params
        {
            x_127272 = local_acc_127328;
        }
        // Load next params
        {
            x_127273 = defunc_1_f_res_127295;
        }
        // Red body
        {
            float defunc_1_op_res_127274 = x_127272 + x_127273;
            
            local_acc_127328 = defunc_1_op_res_127274;
        }
        // Load accum params
        {
            x_127275 = local_acc_127329;
        }
        // Load next params
        {
            x_127276 = defunc_1_f_res_127296;
        }
        // Red body
        {
            float defunc_1_op_res_127277 = x_127275 + x_127276;
            
            local_acc_127329 = defunc_1_op_res_127277;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_127320.mem)[flat_tid_118711] =
        local_acc_127327;
    ((float *) reduce_stage_1_tid_res_arr_mem_127322.mem)[flat_tid_118711] =
        local_acc_127328;
    ((float *) reduce_stage_1_tid_res_arr_mem_127324.mem)[flat_tid_118711] =
        local_acc_127329;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131517_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131517_end -
                 futhark_mc_segred_stage_1_parloop_131517_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131517_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131517_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131517_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131512(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118711 = tid;
    int num_tasks_127319 = info.nsubtasks;
    struct futhark_mc_task_131511 *futhark_mc_task_131511 =
                                  (struct futhark_mc_task_131511 *) args;
    struct futhark_context *ctx = futhark_mc_task_131511->ctx;
    uint64_t futhark_mc_segred_task_131512_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131512_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131511->free_n_114534;
    int64_t gtid_118706 = futhark_mc_task_131511->free_gtid_118706;
    int64_t x_118791 = futhark_mc_task_131511->free_x_118791;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131511->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131511->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_127063 = futhark_mc_task_131511->free_x_127063;
    float x_127064 = futhark_mc_task_131511->free_x_127064;
    float defunc_0_f_res_127067 =
          futhark_mc_task_131511->free_defunc_0_f_res_127067;
    float defunc_2_reduce_res_127070 =
          *futhark_mc_task_131511->retval_defunc_2_reduce_res_127070;
    float defunc_2_reduce_res_127071 =
          *futhark_mc_task_131511->retval_defunc_2_reduce_res_127071;
    float defunc_2_reduce_res_127072 =
          *futhark_mc_task_131511->retval_defunc_2_reduce_res_127072;
    struct memblock mem_127068 = {.desc ="mem_127068", .mem =
                                  futhark_mc_task_131511->retval_mem_127068,
                                  .size =0, .references =NULL};
    struct memblock mem_127069 = {.desc ="mem_127069", .mem =
                                  futhark_mc_task_131511->retval_mem_127069,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_127320_cached_sizze_131513 = 0;
    char *reduce_stage_1_tid_res_arr_mem_127320 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_127322_cached_sizze_131514 = 0;
    char *reduce_stage_1_tid_res_arr_mem_127322 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_127324_cached_sizze_131515 = 0;
    char *reduce_stage_1_tid_res_arr_mem_127324 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_127320_cached_sizze_131513 <
        (size_t) ((int64_t) 4 * num_tasks_127319)) {
        reduce_stage_1_tid_res_arr_mem_127320 =
            realloc(reduce_stage_1_tid_res_arr_mem_127320, (int64_t) 4 *
                    num_tasks_127319);
        reduce_stage_1_tid_res_arr_mem_127320_cached_sizze_131513 =
            (int64_t) 4 * num_tasks_127319;
    }
    if (reduce_stage_1_tid_res_arr_mem_127322_cached_sizze_131514 <
        (size_t) ((int64_t) 4 * num_tasks_127319)) {
        reduce_stage_1_tid_res_arr_mem_127322 =
            realloc(reduce_stage_1_tid_res_arr_mem_127322, (int64_t) 4 *
                    num_tasks_127319);
        reduce_stage_1_tid_res_arr_mem_127322_cached_sizze_131514 =
            (int64_t) 4 * num_tasks_127319;
    }
    if (reduce_stage_1_tid_res_arr_mem_127324_cached_sizze_131515 <
        (size_t) ((int64_t) 4 * num_tasks_127319)) {
        reduce_stage_1_tid_res_arr_mem_127324 =
            realloc(reduce_stage_1_tid_res_arr_mem_127324, (int64_t) 4 *
                    num_tasks_127319);
        reduce_stage_1_tid_res_arr_mem_127324_cached_sizze_131515 =
            (int64_t) 4 * num_tasks_127319;
    }
    
    int64_t iter_127326;
    struct futhark_mc_segred_stage_1_parloop_struct_131516
    futhark_mc_segred_stage_1_parloop_struct_131516;
    
    futhark_mc_segred_stage_1_parloop_struct_131516.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131516.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131516.free_gtid_118706 =
        gtid_118706;
    futhark_mc_segred_stage_1_parloop_struct_131516.free_x_118791 = x_118791;
    futhark_mc_segred_stage_1_parloop_struct_131516.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131516.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131516.free_x_127063 = x_127063;
    futhark_mc_segred_stage_1_parloop_struct_131516.free_x_127064 = x_127064;
    futhark_mc_segred_stage_1_parloop_struct_131516.free_defunc_0_f_res_127067 =
        defunc_0_f_res_127067;
    futhark_mc_segred_stage_1_parloop_struct_131516.free_mem_127068 =
        mem_127068.mem;
    futhark_mc_segred_stage_1_parloop_struct_131516.free_mem_127069 =
        mem_127069.mem;
    futhark_mc_segred_stage_1_parloop_struct_131516.free_reduce_stage_1_tid_res_arr_mem_127320 =
        reduce_stage_1_tid_res_arr_mem_127320;
    futhark_mc_segred_stage_1_parloop_struct_131516.free_reduce_stage_1_tid_res_arr_mem_127322 =
        reduce_stage_1_tid_res_arr_mem_127322;
    futhark_mc_segred_stage_1_parloop_struct_131516.free_reduce_stage_1_tid_res_arr_mem_127324 =
        reduce_stage_1_tid_res_arr_mem_127324;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131517_task;
    
    futhark_mc_segred_stage_1_parloop_131517_task.name =
        "futhark_mc_segred_stage_1_parloop_131517";
    futhark_mc_segred_stage_1_parloop_131517_task.fn =
        futhark_mc_segred_stage_1_parloop_131517;
    futhark_mc_segred_stage_1_parloop_131517_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131516;
    futhark_mc_segred_stage_1_parloop_131517_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131517_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131517_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131517_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131517_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131517_task);
    
    if (futhark_mc_segred_stage_1_parloop_131517_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131517_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131517_total_end -
                 futhark_mc_segred_stage_1_parloop_131517_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131517_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131517_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131517_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_127070 = 0.0F;
        defunc_2_reduce_res_127071 = 0.0F;
        defunc_2_reduce_res_127072 = 0.0F;
    }
    
    float x_127330;
    float x_127331;
    float x_127333;
    float x_127334;
    float x_127336;
    float x_127337;
    
    for (int32_t i_127339 = 0; i_127339 < num_tasks_127319; i_127339++) {
        flat_tid_118711 = i_127339;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_127330 = defunc_2_reduce_res_127070;
            }
            // load next params
            {
                x_127331 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_127320)[flat_tid_118711];
            }
            // red body
            {
                float defunc_1_op_res_127332 = x_127330 + x_127331;
                
                defunc_2_reduce_res_127070 = defunc_1_op_res_127332;
            }
            // load acc params
            {
                x_127333 = defunc_2_reduce_res_127071;
            }
            // load next params
            {
                x_127334 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_127322)[flat_tid_118711];
            }
            // red body
            {
                float defunc_1_op_res_127335 = x_127333 + x_127334;
                
                defunc_2_reduce_res_127071 = defunc_1_op_res_127335;
            }
            // load acc params
            {
                x_127336 = defunc_2_reduce_res_127072;
            }
            // load next params
            {
                x_127337 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_127324)[flat_tid_118711];
            }
            // red body
            {
                float defunc_1_op_res_127338 = x_127336 + x_127337;
                
                defunc_2_reduce_res_127072 = defunc_1_op_res_127338;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_127320);
    free(reduce_stage_1_tid_res_arr_mem_127322);
    free(reduce_stage_1_tid_res_arr_mem_127324);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131512_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131512_end -
                 futhark_mc_segred_task_131512_start;
        
        ctx->futhark_mc_segred_task_131512_runs[tid]++;
        ctx->futhark_mc_segred_task_131512_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131512_iter[tid] += iterations;
    }
    *futhark_mc_task_131511->retval_defunc_2_reduce_res_127070 =
        defunc_2_reduce_res_127070;
    *futhark_mc_task_131511->retval_defunc_2_reduce_res_127071 =
        defunc_2_reduce_res_127071;
    *futhark_mc_task_131511->retval_defunc_2_reduce_res_127072 =
        defunc_2_reduce_res_127072;
    futhark_mc_task_131511->retval_mem_127068 = mem_127068.mem;
    futhark_mc_task_131511->retval_mem_127069 = mem_127069.mem;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131518 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118706;
    int64_t free_x_118791;
    char *free_mem_122426;
    int64_t free_x_127063;
    char *free_mem_127068;
    char *free_mem_127069;
    float free_a11_127107;
    float free_b11_127109;
    float free_c11_127110;
    float *retval_defunc_2_reduce_res_127111;
    float *retval_defunc_2_reduce_res_127112;
};
struct futhark_mc_segred_stage_1_parloop_struct_131522 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118706;
    int64_t free_x_118791;
    char *free_mem_122426;
    int64_t free_x_127063;
    char *free_mem_127068;
    char *free_mem_127069;
    float free_a11_127107;
    float free_b11_127109;
    float free_c11_127110;
    char *free_reduce_stage_1_tid_res_arr_mem_127341;
    char *free_reduce_stage_1_tid_res_arr_mem_127343;
};
static int futhark_mc_segred_stage_1_parloop_131523(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_118713,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131522
    *futhark_mc_segred_stage_1_parloop_struct_131522 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131522 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131522->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131523_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131523_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131522->free_n_114534;
    int64_t gtid_118706 =
            futhark_mc_segred_stage_1_parloop_struct_131522->free_gtid_118706;
    int64_t x_118791 =
            futhark_mc_segred_stage_1_parloop_struct_131522->free_x_118791;
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131522->free_mem_122426,
                                  .size =0, .references =NULL};
    int64_t x_127063 =
            futhark_mc_segred_stage_1_parloop_struct_131522->free_x_127063;
    struct memblock mem_127068 = {.desc ="mem_127068", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131522->free_mem_127068,
                                  .size =0, .references =NULL};
    struct memblock mem_127069 = {.desc ="mem_127069", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131522->free_mem_127069,
                                  .size =0, .references =NULL};
    float a11_127107 =
          futhark_mc_segred_stage_1_parloop_struct_131522->free_a11_127107;
    float b11_127109 =
          futhark_mc_segred_stage_1_parloop_struct_131522->free_b11_127109;
    float c11_127110 =
          futhark_mc_segred_stage_1_parloop_struct_131522->free_c11_127110;
    struct memblock reduce_stage_1_tid_res_arr_mem_127341 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_127341",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131522->free_reduce_stage_1_tid_res_arr_mem_127341,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_127343 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_127343",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131522->free_reduce_stage_1_tid_res_arr_mem_127343,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_127345 = start;
    float x_127297;
    float x_127298;
    float x_127300;
    float x_127301;
    float local_acc_127346 = 0.0F;
    float local_acc_127347 = 0.0F;
    
    for (; iter_127345 < end; iter_127345++) {
        int64_t gtid_118714 = iter_127345;
        float x_127303 = ((float *) mem_127069.mem)[gtid_118714];
        float x_127304 = ((float *) mem_127068.mem)[gtid_118714];
        bool cond_127305 = sle64(x_118791, gtid_118714);
        float defunc_0_f_res_127306;
        
        if (cond_127305) {
            defunc_0_f_res_127306 = 0.0F;
        } else {
            int64_t i_127307 = add64(gtid_118714, x_127063);
            float x_127308 = ((float *) mem_122426.mem)[gtid_118706 * n_114534 +
                                                        i_127307];
            
            defunc_0_f_res_127306 = x_127308;
        }
        
        float x_127309 = a11_127107 * x_127303;
        float y_127310 = b11_127109 * x_127304;
        float x_127311 = x_127309 + y_127310;
        float defunc_9_fit_fun_res_127312 = defunc_0_f_res_127306 * x_127311;
        float x_127313 = b11_127109 * x_127303;
        float y_127314 = c11_127110 * x_127304;
        float x_127315 = x_127313 + y_127314;
        float defunc_9_slope_fun_res_127316 = defunc_0_f_res_127306 * x_127315;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_127297 = local_acc_127346;
        }
        // Load next params
        {
            x_127298 = defunc_9_fit_fun_res_127312;
        }
        // Red body
        {
            float defunc_1_op_res_127299 = x_127297 + x_127298;
            
            local_acc_127346 = defunc_1_op_res_127299;
        }
        // Load accum params
        {
            x_127300 = local_acc_127347;
        }
        // Load next params
        {
            x_127301 = defunc_9_slope_fun_res_127316;
        }
        // Red body
        {
            float defunc_1_op_res_127302 = x_127300 + x_127301;
            
            local_acc_127347 = defunc_1_op_res_127302;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_127341.mem)[flat_tid_118713] =
        local_acc_127346;
    ((float *) reduce_stage_1_tid_res_arr_mem_127343.mem)[flat_tid_118713] =
        local_acc_127347;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131523_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131523_end -
                 futhark_mc_segred_stage_1_parloop_131523_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131523_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131523_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131523_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131519(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118713 = tid;
    int num_tasks_127340 = info.nsubtasks;
    struct futhark_mc_task_131518 *futhark_mc_task_131518 =
                                  (struct futhark_mc_task_131518 *) args;
    struct futhark_context *ctx = futhark_mc_task_131518->ctx;
    uint64_t futhark_mc_segred_task_131519_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131519_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131518->free_n_114534;
    int64_t gtid_118706 = futhark_mc_task_131518->free_gtid_118706;
    int64_t x_118791 = futhark_mc_task_131518->free_x_118791;
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131518->free_mem_122426,
                                  .size =0, .references =NULL};
    int64_t x_127063 = futhark_mc_task_131518->free_x_127063;
    struct memblock mem_127068 = {.desc ="mem_127068", .mem =
                                  futhark_mc_task_131518->free_mem_127068,
                                  .size =0, .references =NULL};
    struct memblock mem_127069 = {.desc ="mem_127069", .mem =
                                  futhark_mc_task_131518->free_mem_127069,
                                  .size =0, .references =NULL};
    float a11_127107 = futhark_mc_task_131518->free_a11_127107;
    float b11_127109 = futhark_mc_task_131518->free_b11_127109;
    float c11_127110 = futhark_mc_task_131518->free_c11_127110;
    float defunc_2_reduce_res_127111 =
          *futhark_mc_task_131518->retval_defunc_2_reduce_res_127111;
    float defunc_2_reduce_res_127112 =
          *futhark_mc_task_131518->retval_defunc_2_reduce_res_127112;
    size_t reduce_stage_1_tid_res_arr_mem_127341_cached_sizze_131520 = 0;
    char *reduce_stage_1_tid_res_arr_mem_127341 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_127343_cached_sizze_131521 = 0;
    char *reduce_stage_1_tid_res_arr_mem_127343 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_127341_cached_sizze_131520 <
        (size_t) ((int64_t) 4 * num_tasks_127340)) {
        reduce_stage_1_tid_res_arr_mem_127341 =
            realloc(reduce_stage_1_tid_res_arr_mem_127341, (int64_t) 4 *
                    num_tasks_127340);
        reduce_stage_1_tid_res_arr_mem_127341_cached_sizze_131520 =
            (int64_t) 4 * num_tasks_127340;
    }
    if (reduce_stage_1_tid_res_arr_mem_127343_cached_sizze_131521 <
        (size_t) ((int64_t) 4 * num_tasks_127340)) {
        reduce_stage_1_tid_res_arr_mem_127343 =
            realloc(reduce_stage_1_tid_res_arr_mem_127343, (int64_t) 4 *
                    num_tasks_127340);
        reduce_stage_1_tid_res_arr_mem_127343_cached_sizze_131521 =
            (int64_t) 4 * num_tasks_127340;
    }
    
    int64_t iter_127345;
    struct futhark_mc_segred_stage_1_parloop_struct_131522
    futhark_mc_segred_stage_1_parloop_struct_131522;
    
    futhark_mc_segred_stage_1_parloop_struct_131522.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131522.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131522.free_gtid_118706 =
        gtid_118706;
    futhark_mc_segred_stage_1_parloop_struct_131522.free_x_118791 = x_118791;
    futhark_mc_segred_stage_1_parloop_struct_131522.free_mem_122426 =
        mem_122426.mem;
    futhark_mc_segred_stage_1_parloop_struct_131522.free_x_127063 = x_127063;
    futhark_mc_segred_stage_1_parloop_struct_131522.free_mem_127068 =
        mem_127068.mem;
    futhark_mc_segred_stage_1_parloop_struct_131522.free_mem_127069 =
        mem_127069.mem;
    futhark_mc_segred_stage_1_parloop_struct_131522.free_a11_127107 =
        a11_127107;
    futhark_mc_segred_stage_1_parloop_struct_131522.free_b11_127109 =
        b11_127109;
    futhark_mc_segred_stage_1_parloop_struct_131522.free_c11_127110 =
        c11_127110;
    futhark_mc_segred_stage_1_parloop_struct_131522.free_reduce_stage_1_tid_res_arr_mem_127341 =
        reduce_stage_1_tid_res_arr_mem_127341;
    futhark_mc_segred_stage_1_parloop_struct_131522.free_reduce_stage_1_tid_res_arr_mem_127343 =
        reduce_stage_1_tid_res_arr_mem_127343;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131523_task;
    
    futhark_mc_segred_stage_1_parloop_131523_task.name =
        "futhark_mc_segred_stage_1_parloop_131523";
    futhark_mc_segred_stage_1_parloop_131523_task.fn =
        futhark_mc_segred_stage_1_parloop_131523;
    futhark_mc_segred_stage_1_parloop_131523_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131522;
    futhark_mc_segred_stage_1_parloop_131523_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131523_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131523_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131523_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131523_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131523_task);
    
    if (futhark_mc_segred_stage_1_parloop_131523_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131523_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131523_total_end -
                 futhark_mc_segred_stage_1_parloop_131523_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131523_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131523_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131523_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_127111 = 0.0F;
        defunc_2_reduce_res_127112 = 0.0F;
    }
    
    float x_127348;
    float x_127349;
    float x_127351;
    float x_127352;
    
    for (int32_t i_127354 = 0; i_127354 < num_tasks_127340; i_127354++) {
        flat_tid_118713 = i_127354;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_127348 = defunc_2_reduce_res_127111;
            }
            // load next params
            {
                x_127349 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_127341)[flat_tid_118713];
            }
            // red body
            {
                float defunc_1_op_res_127350 = x_127348 + x_127349;
                
                defunc_2_reduce_res_127111 = defunc_1_op_res_127350;
            }
            // load acc params
            {
                x_127351 = defunc_2_reduce_res_127112;
            }
            // load next params
            {
                x_127352 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_127343)[flat_tid_118713];
            }
            // red body
            {
                float defunc_1_op_res_127353 = x_127351 + x_127352;
                
                defunc_2_reduce_res_127112 = defunc_1_op_res_127353;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_127341);
    free(reduce_stage_1_tid_res_arr_mem_127343);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131519_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131519_end -
                 futhark_mc_segred_task_131519_start;
        
        ctx->futhark_mc_segred_task_131519_runs[tid]++;
        ctx->futhark_mc_segred_task_131519_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131519_iter[tid] += iterations;
    }
    *futhark_mc_task_131518->retval_defunc_2_reduce_res_127111 =
        defunc_2_reduce_res_127111;
    *futhark_mc_task_131518->retval_defunc_2_reduce_res_127112 =
        defunc_2_reduce_res_127112;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131508(void *args, int64_t start,
                                            int64_t end, int flat_tid_118709,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131507
    *futhark_mc_segmap_parloop_struct_131507 =
    (struct futhark_mc_segmap_parloop_struct_131507 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131507->ctx;
    uint64_t futhark_mc_segmap_parloop_131508_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131508_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131507->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131507->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131507->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131507->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131507->free_i_114610;
    int64_t gtid_118706 =
            futhark_mc_segmap_parloop_struct_131507->free_gtid_118706;
    int64_t x_118791 = futhark_mc_segmap_parloop_struct_131507->free_x_118791;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131507->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131507->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131507->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131507->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131507->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122608 =
            futhark_mc_segmap_parloop_struct_131507->free_bytes_122608;
    struct memblock mem_122646 = {.desc ="mem_122646", .mem =
                                  futhark_mc_segmap_parloop_struct_131507->free_mem_122646,
                                  .size =0, .references =NULL};
    struct memblock mem_122649 = {.desc ="mem_122649", .mem =
                                  futhark_mc_segmap_parloop_struct_131507->free_mem_122649,
                                  .size =0, .references =NULL};
    size_t mem_127068_cached_sizze_131509 = 0;
    char *mem_127068 = NULL;
    size_t mem_127069_cached_sizze_131510 = 0;
    char *mem_127069 = NULL;
    int64_t iterations = end - start;
    int64_t iter_127268 = start;
    
    if (mem_127068_cached_sizze_131509 < (size_t) bytes_122608) {
        mem_127068 = realloc(mem_127068, bytes_122608);
        mem_127068_cached_sizze_131509 = bytes_122608;
    }
    if (mem_127069_cached_sizze_131510 < (size_t) bytes_122608) {
        mem_127069 = realloc(mem_127069, bytes_122608);
        mem_127069_cached_sizze_131510 = bytes_122608;
    }
    for (; iter_127268 < end; iter_127268++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_127317 = l_n_m_114584;
        int64_t gtid_118710 = iter_127268;
        int64_t remnant_127318 = iter_127268 - gtid_118710;
        int64_t x_127063 = ((int64_t *) mem_122124.mem)[gtid_118706 *
                                                        l_n_m_114584 +
                                                        gtid_118710];
        float x_127064 = ((float *) mem_122128.mem)[gtid_118706 * l_n_m_114584 +
                                                    gtid_118710];
        int64_t min_arg_127065 = mul64(t_jump_114541, gtid_118710);
        int64_t min_res_127066 = smin64(i_114610, min_arg_127065);
        float defunc_0_f_res_127067 = sitofp_i64_f32(min_res_127066);
        float defunc_2_reduce_res_127070;
        float defunc_2_reduce_res_127071;
        float defunc_2_reduce_res_127072;
        int64_t flat_tid_118711 = (int64_t) 0;
        int32_t num_tasks_127319;
        struct futhark_mc_task_131511 futhark_mc_task_131511;
        
        futhark_mc_task_131511.ctx = ctx;
        futhark_mc_task_131511.free_n_114534 = n_114534;
        futhark_mc_task_131511.free_gtid_118706 = gtid_118706;
        futhark_mc_task_131511.free_x_118791 = x_118791;
        futhark_mc_task_131511.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131511.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131511.free_x_127063 = x_127063;
        futhark_mc_task_131511.free_x_127064 = x_127064;
        futhark_mc_task_131511.free_defunc_0_f_res_127067 =
            defunc_0_f_res_127067;
        futhark_mc_task_131511.retval_defunc_2_reduce_res_127070 =
            &defunc_2_reduce_res_127070;
        futhark_mc_task_131511.retval_defunc_2_reduce_res_127071 =
            &defunc_2_reduce_res_127071;
        futhark_mc_task_131511.retval_defunc_2_reduce_res_127072 =
            &defunc_2_reduce_res_127072;
        futhark_mc_task_131511.retval_mem_127068 = mem_127068;
        futhark_mc_task_131511.retval_mem_127069 = mem_127069;
        
        struct scheduler_segop futhark_mc_task_131511_task;
        
        futhark_mc_task_131511_task.args = &futhark_mc_task_131511;
        futhark_mc_task_131511_task.top_level_fn =
            futhark_mc_segred_task_131512;
        futhark_mc_task_131511_task.name = "futhark_mc_segred_task_131512";
        futhark_mc_task_131511_task.iterations = l_window_114538;
        futhark_mc_task_131511_task.task_time =
            &ctx->futhark_mc_segred_task_131512_total_time;
        futhark_mc_task_131511_task.task_iter =
            &ctx->futhark_mc_segred_task_131512_total_iter;
        futhark_mc_task_131511_task.sched = STATIC;
        futhark_mc_task_131511_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131512_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131511_task);
        
        if (futhark_mc_segred_task_131512_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float x_127103 = defunc_2_reduce_res_127070 *
              defunc_2_reduce_res_127072;
        float y_127104 = defunc_2_reduce_res_127071 *
              defunc_2_reduce_res_127071;
        float y_127105 = x_127103 - y_127104;
        float det1_127106 = 1.0F / y_127105;
        float a11_127107 = defunc_2_reduce_res_127072 * det1_127106;
        float negate_arg_127108 = defunc_2_reduce_res_127071 * det1_127106;
        float b11_127109 = 0.0F - negate_arg_127108;
        float c11_127110 = defunc_2_reduce_res_127070 * det1_127106;
        float defunc_2_reduce_res_127111;
        float defunc_2_reduce_res_127112;
        int64_t flat_tid_118713 = (int64_t) 0;
        int32_t num_tasks_127340;
        struct futhark_mc_task_131518 futhark_mc_task_131518;
        
        futhark_mc_task_131518.ctx = ctx;
        futhark_mc_task_131518.free_n_114534 = n_114534;
        futhark_mc_task_131518.free_gtid_118706 = gtid_118706;
        futhark_mc_task_131518.free_x_118791 = x_118791;
        futhark_mc_task_131518.free_mem_122426 = mem_122426.mem;
        futhark_mc_task_131518.free_x_127063 = x_127063;
        futhark_mc_task_131518.free_mem_127068 = mem_127068;
        futhark_mc_task_131518.free_mem_127069 = mem_127069;
        futhark_mc_task_131518.free_a11_127107 = a11_127107;
        futhark_mc_task_131518.free_b11_127109 = b11_127109;
        futhark_mc_task_131518.free_c11_127110 = c11_127110;
        futhark_mc_task_131518.retval_defunc_2_reduce_res_127111 =
            &defunc_2_reduce_res_127111;
        futhark_mc_task_131518.retval_defunc_2_reduce_res_127112 =
            &defunc_2_reduce_res_127112;
        
        struct scheduler_segop futhark_mc_task_131518_task;
        
        futhark_mc_task_131518_task.args = &futhark_mc_task_131518;
        futhark_mc_task_131518_task.top_level_fn =
            futhark_mc_segred_task_131519;
        futhark_mc_task_131518_task.name = "futhark_mc_segred_task_131519";
        futhark_mc_task_131518_task.iterations = l_window_114538;
        futhark_mc_task_131518_task.task_time =
            &ctx->futhark_mc_segred_task_131519_total_time;
        futhark_mc_task_131518_task.task_iter =
            &ctx->futhark_mc_segred_task_131519_total_iter;
        futhark_mc_task_131518_task.sched = STATIC;
        futhark_mc_task_131518_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131519_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131518_task);
        
        if (futhark_mc_segred_task_131519_err != 0) {
            err = 1;
            goto cleanup;
        }
        ((float *) mem_122646.mem)[gtid_118710] = defunc_2_reduce_res_127111;
        ((float *) mem_122649.mem)[gtid_118710] = defunc_2_reduce_res_127112;
    }
    
  cleanup:
    { }
    free(mem_127068);
    free(mem_127069);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131508_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131508_end -
                 futhark_mc_segmap_parloop_131508_start;
        
        ctx->futhark_mc_segmap_parloop_131508_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131508_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131508_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131506(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118709 = tid;
    int num_tasks_127208 = info.nsubtasks;
    struct futhark_mc_task_131500 *futhark_mc_task_131500 =
                                  (struct futhark_mc_task_131500 *) args;
    struct futhark_context *ctx = futhark_mc_task_131500->ctx;
    uint64_t futhark_mc_segmap_nested_task_131506_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131506_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131500->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131500->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131500->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131500->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131500->free_i_114610;
    int64_t gtid_118706 = futhark_mc_task_131500->free_gtid_118706;
    int64_t x_118791 = futhark_mc_task_131500->free_x_118791;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131500->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131500->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131500->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131500->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131500->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122608 = futhark_mc_task_131500->free_bytes_122608;
    struct memblock mem_122646 = {.desc ="mem_122646", .mem =
                                  futhark_mc_task_131500->free_mem_122646,
                                  .size =0, .references =NULL};
    struct memblock mem_122649 = {.desc ="mem_122649", .mem =
                                  futhark_mc_task_131500->free_mem_122649,
                                  .size =0, .references =NULL};
    int64_t iter_127268;
    struct futhark_mc_segmap_parloop_struct_131507
    futhark_mc_segmap_parloop_struct_131507;
    
    futhark_mc_segmap_parloop_struct_131507.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131507.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131507.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131507.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131507.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131507.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131507.free_gtid_118706 = gtid_118706;
    futhark_mc_segmap_parloop_struct_131507.free_x_118791 = x_118791;
    futhark_mc_segmap_parloop_struct_131507.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131507.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131507.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131507.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131507.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131507.free_bytes_122608 = bytes_122608;
    futhark_mc_segmap_parloop_struct_131507.free_mem_122646 = mem_122646.mem;
    futhark_mc_segmap_parloop_struct_131507.free_mem_122649 = mem_122649.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131508_task;
    
    futhark_mc_segmap_parloop_131508_task.name =
        "futhark_mc_segmap_parloop_131508";
    futhark_mc_segmap_parloop_131508_task.fn = futhark_mc_segmap_parloop_131508;
    futhark_mc_segmap_parloop_131508_task.args =
        &futhark_mc_segmap_parloop_struct_131507;
    futhark_mc_segmap_parloop_131508_task.iterations = iterations;
    futhark_mc_segmap_parloop_131508_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131508_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131508_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131508_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131508_task);
    
    if (futhark_mc_segmap_parloop_131508_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131508_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131508_total_end -
                 futhark_mc_segmap_parloop_131508_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131508_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131508_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131508_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131506_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131506_end -
                 futhark_mc_segmap_nested_task_131506_start;
        
        ctx->futhark_mc_segmap_nested_task_131506_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131506_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131506_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131497(void *args, int64_t start,
                                            int64_t end, int flat_tid_118705,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131496
    *futhark_mc_segmap_parloop_struct_131496 =
    (struct futhark_mc_segmap_parloop_struct_131496 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131496->ctx;
    uint64_t futhark_mc_segmap_parloop_131497_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131497_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131496->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131496->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131496->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131496->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131496->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131496->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131496->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131496->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131496->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131496->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131496->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131496->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131496->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122608 =
            futhark_mc_segmap_parloop_struct_131496->free_bytes_122608;
    struct memblock mem_122713 = {.desc ="mem_122713", .mem =
                                  futhark_mc_segmap_parloop_struct_131496->free_mem_122713,
                                  .size =0, .references =NULL};
    struct memblock mem_122717 = {.desc ="mem_122717", .mem =
                                  futhark_mc_segmap_parloop_struct_131496->free_mem_122717,
                                  .size =0, .references =NULL};
    size_t mem_122646_cached_sizze_131498 = 0;
    char *mem_122646 = NULL;
    size_t mem_122649_cached_sizze_131499 = 0;
    char *mem_122649 = NULL;
    int64_t iterations = end - start;
    int64_t iter_127062 = start;
    
    if (mem_122646_cached_sizze_131498 < (size_t) bytes_122055) {
        mem_122646 = realloc(mem_122646, bytes_122055);
        mem_122646_cached_sizze_131498 = bytes_122055;
    }
    if (mem_122649_cached_sizze_131499 < (size_t) bytes_122055) {
        mem_122649 = realloc(mem_122649, bytes_122055);
        mem_122649_cached_sizze_131499 = bytes_122055;
    }
    for (; iter_127062 < end; iter_127062++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_127206 = m_114533;
        int64_t gtid_118706 = iter_127062;
        int64_t remnant_127207 = iter_127062 - gtid_118706;
        int64_t x_118791 = ((int64_t *) mem_121982.mem)[gtid_118706];
        int64_t flat_tid_118707 = (int64_t) 0;
        int32_t num_tasks_127208;
        int64_t flat_tid_118709 = (int64_t) 0;
        struct futhark_mc_task_131500 futhark_mc_task_131500;
        
        futhark_mc_task_131500.ctx = ctx;
        futhark_mc_task_131500.free_n_114534 = n_114534;
        futhark_mc_task_131500.free_l_window_114538 = l_window_114538;
        futhark_mc_task_131500.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131500.free_l_n_m_114584 = l_n_m_114584;
        futhark_mc_task_131500.free_i_114610 = i_114610;
        futhark_mc_task_131500.free_gtid_118706 = gtid_118706;
        futhark_mc_task_131500.free_x_118791 = x_118791;
        futhark_mc_task_131500.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131500.free_mem_122124 = mem_122124.mem;
        futhark_mc_task_131500.free_mem_122128 = mem_122128.mem;
        futhark_mc_task_131500.free_mem_122426 = mem_122426.mem;
        futhark_mc_task_131500.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131500.free_bytes_122608 = bytes_122608;
        futhark_mc_task_131500.free_mem_122646 = mem_122646;
        futhark_mc_task_131500.free_mem_122649 = mem_122649;
        
        struct scheduler_segop futhark_mc_task_131500_task;
        
        futhark_mc_task_131500_task.args = &futhark_mc_task_131500;
        futhark_mc_task_131500_task.top_level_fn =
            futhark_mc_segmap_task_131501;
        futhark_mc_task_131500_task.name = "futhark_mc_segmap_task_131501";
        futhark_mc_task_131500_task.iterations = l_n_m_114584;
        futhark_mc_task_131500_task.task_time =
            &ctx->futhark_mc_segmap_task_131501_total_time;
        futhark_mc_task_131500_task.task_iter =
            &ctx->futhark_mc_segmap_task_131501_total_iter;
        futhark_mc_task_131500_task.sched = STATIC;
        futhark_mc_task_131500_task.nested_fn =
            futhark_mc_segmap_nested_task_131506;
        
        int futhark_mc_segmap_task_131501_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131500_task);
        
        if (futhark_mc_segmap_task_131501_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122713.mem + gtid_118706 * l_n_m_114584 * (int64_t) 4,
                mem_122646 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
        memmove(mem_122717.mem + gtid_118706 * l_n_m_114584 * (int64_t) 4,
                mem_122649 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122646);
    free(mem_122649);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131497_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131497_end -
                 futhark_mc_segmap_parloop_131497_start;
        
        ctx->futhark_mc_segmap_parloop_131497_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131497_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131497_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131495(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118705 = tid;
    int num_tasks_126973 = info.nsubtasks;
    struct futhark_mc_task_131487 *futhark_mc_task_131487 =
                                  (struct futhark_mc_task_131487 *) args;
    struct futhark_context *ctx = futhark_mc_task_131487->ctx;
    uint64_t futhark_mc_segmap_nested_task_131495_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131495_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131487->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131487->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131487->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131487->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131487->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131487->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131487->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131487->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131487->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131487->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131487->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131487->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131487->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122608 = futhark_mc_task_131487->free_bytes_122608;
    struct memblock mem_122713 = {.desc ="mem_122713", .mem =
                                  futhark_mc_task_131487->free_mem_122713,
                                  .size =0, .references =NULL};
    struct memblock mem_122717 = {.desc ="mem_122717", .mem =
                                  futhark_mc_task_131487->free_mem_122717,
                                  .size =0, .references =NULL};
    int64_t iter_127062;
    struct futhark_mc_segmap_parloop_struct_131496
    futhark_mc_segmap_parloop_struct_131496;
    
    futhark_mc_segmap_parloop_struct_131496.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131496.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131496.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131496.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131496.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131496.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131496.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131496.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131496.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131496.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131496.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131496.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131496.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131496.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131496.free_bytes_122608 = bytes_122608;
    futhark_mc_segmap_parloop_struct_131496.free_mem_122713 = mem_122713.mem;
    futhark_mc_segmap_parloop_struct_131496.free_mem_122717 = mem_122717.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131497_task;
    
    futhark_mc_segmap_parloop_131497_task.name =
        "futhark_mc_segmap_parloop_131497";
    futhark_mc_segmap_parloop_131497_task.fn = futhark_mc_segmap_parloop_131497;
    futhark_mc_segmap_parloop_131497_task.args =
        &futhark_mc_segmap_parloop_struct_131496;
    futhark_mc_segmap_parloop_131497_task.iterations = iterations;
    futhark_mc_segmap_parloop_131497_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131497_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131497_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131497_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131497_task);
    
    if (futhark_mc_segmap_parloop_131497_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131497_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131497_total_end -
                 futhark_mc_segmap_parloop_131497_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131497_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131497_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131497_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131495_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131495_end -
                 futhark_mc_segmap_nested_task_131495_start;
        
        ctx->futhark_mc_segmap_nested_task_131495_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131495_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131495_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131524 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122718;
    char *free_mem_122889;
    char *free_mem_122893;
};
struct futhark_mc_segmap_parloop_struct_131526 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122718;
    char *free_mem_122889;
    char *free_mem_122893;
};
static int futhark_mc_segmap_parloop_131527(void *args, int64_t start,
                                            int64_t end, int flat_tid_118936,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131526
    *futhark_mc_segmap_parloop_struct_131526 =
    (struct futhark_mc_segmap_parloop_struct_131526 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131526->ctx;
    uint64_t futhark_mc_segmap_parloop_131527_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131527_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131526->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131526->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131526->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131526->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131526->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131526->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131526->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131526->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131526->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131526->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131526->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131526->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131526->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122718 =
            futhark_mc_segmap_parloop_struct_131526->free_bytes_122718;
    struct memblock mem_122889 = {.desc ="mem_122889", .mem =
                                  futhark_mc_segmap_parloop_struct_131526->free_mem_122889,
                                  .size =0, .references =NULL};
    struct memblock mem_122893 = {.desc ="mem_122893", .mem =
                                  futhark_mc_segmap_parloop_struct_131526->free_mem_122893,
                                  .size =0, .references =NULL};
    size_t mem_122798_cached_sizze_131528 = 0;
    char *mem_122798 = NULL;
    size_t mem_122801_cached_sizze_131529 = 0;
    char *mem_122801 = NULL;
    size_t mem_122818_cached_sizze_131530 = 0;
    char *mem_122818 = NULL;
    size_t mem_122821_cached_sizze_131531 = 0;
    char *mem_122821 = NULL;
    size_t mem_122848_cached_sizze_131532 = 0;
    char *mem_122848 = NULL;
    size_t mem_122851_cached_sizze_131533 = 0;
    char *mem_122851 = NULL;
    int64_t iterations = end - start;
    int64_t iter_127356 = start;
    
    if (mem_122798_cached_sizze_131528 < (size_t) bytes_122055) {
        mem_122798 = realloc(mem_122798, bytes_122055);
        mem_122798_cached_sizze_131528 = bytes_122055;
    }
    if (mem_122801_cached_sizze_131529 < (size_t) bytes_122055) {
        mem_122801 = realloc(mem_122801, bytes_122055);
        mem_122801_cached_sizze_131529 = bytes_122055;
    }
    if (mem_122818_cached_sizze_131530 < (size_t) bytes_122718) {
        mem_122818 = realloc(mem_122818, bytes_122718);
        mem_122818_cached_sizze_131530 = bytes_122718;
    }
    if (mem_122821_cached_sizze_131531 < (size_t) bytes_122718) {
        mem_122821 = realloc(mem_122821, bytes_122718);
        mem_122821_cached_sizze_131531 = bytes_122718;
    }
    if (mem_122848_cached_sizze_131532 < (size_t) bytes_122718) {
        mem_122848 = realloc(mem_122848, bytes_122718);
        mem_122848_cached_sizze_131532 = bytes_122718;
    }
    if (mem_122851_cached_sizze_131533 < (size_t) bytes_122718) {
        mem_122851 = realloc(mem_122851, bytes_122718);
        mem_122851_cached_sizze_131533 = bytes_122718;
    }
    for (; iter_127356 < end; iter_127356++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_127474 = m_114533;
        int64_t gtid_118937 = iter_127356;
        int64_t remnant_127475 = iter_127356 - gtid_118937;
        int64_t x_115665 = ((int64_t *) mem_121982.mem)[gtid_118937];
        
        for (int64_t i_127357 = 0; i_127357 < l_n_m_114584; i_127357++) {
            int64_t x_127360 = ((int64_t *) mem_122124.mem)[gtid_118937 *
                                                            l_n_m_114584 +
                                                            i_127357];
            float x_127361 = ((float *) mem_122128.mem)[gtid_118937 *
                                                        l_n_m_114584 +
                                                        i_127357];
            int64_t min_arg_127362 = mul64(t_jump_114541, i_127357);
            int64_t min_res_127363 = smin64(i_114610, min_arg_127362);
            float defunc_0_f_res_127364 = sitofp_i64_f32(min_res_127363);
            
            for (int64_t i_127369 = 0; i_127369 < l_window_114538; i_127369++) {
                bool cond_127372 = sle64(x_115665, i_127369);
                float defunc_0_f_res_127373;
                
                if (cond_127372) {
                    defunc_0_f_res_127373 = 0.0F;
                } else {
                    int64_t i_127374 = add64(x_127360, i_127369);
                    float x_127375 = ((float *) mem_122004.mem)[gtid_118937 *
                                                                n_114534 +
                                                                i_127374];
                    float defunc_0_f_res_f_res_127376 = 1.0F + x_127375;
                    
                    defunc_0_f_res_127373 = defunc_0_f_res_f_res_127376;
                }
                
                float defunc_0_f_res_127377;
                
                if (cond_127372) {
                    defunc_0_f_res_127377 = 0.0F;
                } else {
                    int64_t i_127378 = add64(x_127360, i_127369);
                    float x_127379 = ((float *) mem_122430.mem)[gtid_118937 *
                                                                n_114534 +
                                                                i_127378];
                    
                    defunc_0_f_res_127377 = x_127379;
                }
                
                float x_j_127380 = defunc_0_f_res_127373 -
                      defunc_0_f_res_127364;
                float abs_res_127381 = (float) fabs(x_j_127380);
                float tmp1_127382 = abs_res_127381 / x_127361;
                float x_127383 = tmp1_127382 * tmp1_127382;
                float y_127384 = tmp1_127382 * x_127383;
                float tmp2_127385 = 1.0F - y_127384;
                float x_127386 = tmp2_127385 * tmp2_127385;
                float tmp3_127387 = tmp2_127385 * x_127386;
                float tmp4_127388 = defunc_0_f_res_127377 * tmp3_127387;
                
                ((float *) mem_122818)[i_127369] = x_j_127380;
                ((float *) mem_122821)[i_127369] = tmp4_127388;
            }
            
            float defunc_2_reduce_res_127393;
            float defunc_2_reduce_res_127394;
            float defunc_2_reduce_res_127395;
            float defunc_2_reduce_res_127396;
            float defunc_2_reduce_res_127397;
            float redout_127401;
            float redout_127402;
            float redout_127403;
            float redout_127404;
            float redout_127405;
            
            redout_127401 = 0.0F;
            redout_127402 = 0.0F;
            redout_127403 = 0.0F;
            redout_127404 = 0.0F;
            redout_127405 = 0.0F;
            for (int64_t i_127400 = 0; i_127400 < l_window_114538; i_127400++) {
                float x_127408 = ((float *) mem_122818)[i_127400];
                float x_127409 = ((float *) mem_122821)[i_127400];
                float defunc_1_f_res_127410 = x_127408 * x_127409;
                float defunc_1_f_res_127411 = x_127408 * defunc_1_f_res_127410;
                float defunc_1_f_res_127412 = x_127408 * defunc_1_f_res_127411;
                float defunc_1_f_res_127413 = x_127408 * defunc_1_f_res_127412;
                float defunc_1_op_res_127414 = x_127409 + redout_127401;
                float defunc_1_op_res_127415 = defunc_1_f_res_127410 +
                      redout_127402;
                float defunc_1_op_res_127416 = defunc_1_f_res_127411 +
                      redout_127403;
                float defunc_1_op_res_127417 = defunc_1_f_res_127412 +
                      redout_127404;
                float defunc_1_op_res_127418 = defunc_1_f_res_127413 +
                      redout_127405;
                
                ((float *) mem_122848)[i_127400] = defunc_1_f_res_127411;
                ((float *) mem_122851)[i_127400] = defunc_1_f_res_127410;
                
                float redout_tmp_127480 = defunc_1_op_res_127414;
                float redout_tmp_127481 = defunc_1_op_res_127415;
                float redout_tmp_127482 = defunc_1_op_res_127416;
                float redout_tmp_127483 = defunc_1_op_res_127417;
                float redout_tmp_127484 = defunc_1_op_res_127418;
                
                redout_127401 = redout_tmp_127480;
                redout_127402 = redout_tmp_127481;
                redout_127403 = redout_tmp_127482;
                redout_127404 = redout_tmp_127483;
                redout_127405 = redout_tmp_127484;
            }
            defunc_2_reduce_res_127393 = redout_127401;
            defunc_2_reduce_res_127394 = redout_127402;
            defunc_2_reduce_res_127395 = redout_127403;
            defunc_2_reduce_res_127396 = redout_127404;
            defunc_2_reduce_res_127397 = redout_127405;
            
            float x_127421 = defunc_2_reduce_res_127395 *
                  defunc_2_reduce_res_127397;
            float y_127422 = defunc_2_reduce_res_127396 *
                  defunc_2_reduce_res_127396;
            float a12_127423 = x_127421 - y_127422;
            float x_127424 = defunc_2_reduce_res_127395 *
                  defunc_2_reduce_res_127396;
            float y_127425 = defunc_2_reduce_res_127394 *
                  defunc_2_reduce_res_127397;
            float b12_127426 = x_127424 - y_127425;
            float x_127427 = defunc_2_reduce_res_127394 *
                  defunc_2_reduce_res_127396;
            float y_127428 = defunc_2_reduce_res_127395 *
                  defunc_2_reduce_res_127395;
            float c12_127429 = x_127427 - y_127428;
            float x_127430 = defunc_2_reduce_res_127393 *
                  defunc_2_reduce_res_127397;
            float b2_127431 = x_127430 - y_127428;
            float x_127432 = defunc_2_reduce_res_127394 *
                  defunc_2_reduce_res_127395;
            float y_127433 = defunc_2_reduce_res_127393 *
                  defunc_2_reduce_res_127396;
            float c2_127434 = x_127432 - y_127433;
            float x_127435 = defunc_2_reduce_res_127393 * a12_127423;
            float y_127436 = defunc_2_reduce_res_127394 * b12_127426;
            float x_127437 = x_127435 + y_127436;
            float y_127438 = defunc_2_reduce_res_127395 * c12_127429;
            float y_127439 = x_127437 + y_127438;
            float det_127440 = 1.0F / y_127439;
            float a12_127441 = a12_127423 * det_127440;
            float b12_127442 = b12_127426 * det_127440;
            float c12_127443 = c12_127429 * det_127440;
            float b2_127444 = b2_127431 * det_127440;
            float c2_127445 = c2_127434 * det_127440;
            float defunc_2_reduce_res_127446;
            float defunc_2_reduce_res_127447;
            float redout_127449;
            float redout_127450;
            
            redout_127449 = 0.0F;
            redout_127450 = 0.0F;
            for (int64_t i_127448 = 0; i_127448 < l_window_114538; i_127448++) {
                float x_127451 = ((float *) mem_122821)[i_127448];
                float x_127452 = ((float *) mem_122851)[i_127448];
                float x_127453 = ((float *) mem_122848)[i_127448];
                bool cond_127454 = sle64(x_115665, i_127448);
                float defunc_0_f_res_127455;
                
                if (cond_127454) {
                    defunc_0_f_res_127455 = 0.0F;
                } else {
                    int64_t i_127456 = add64(x_127360, i_127448);
                    float x_127457 = ((float *) mem_122426.mem)[gtid_118937 *
                                                                n_114534 +
                                                                i_127456];
                    
                    defunc_0_f_res_127455 = x_127457;
                }
                
                float x_127458 = a12_127441 * x_127451;
                float y_127459 = b12_127442 * x_127452;
                float x_127460 = x_127458 + y_127459;
                float y_127461 = c12_127443 * x_127453;
                float x_127462 = x_127460 + y_127461;
                float defunc_9_fit_fun_res_127463 = defunc_0_f_res_127455 *
                      x_127462;
                float x_127464 = b12_127442 * x_127451;
                float y_127465 = b2_127444 * x_127452;
                float x_127466 = x_127464 + y_127465;
                float y_127467 = c2_127445 * x_127453;
                float x_127468 = x_127466 + y_127467;
                float defunc_9_slope_fun_res_127469 = defunc_0_f_res_127455 *
                      x_127468;
                float defunc_1_op_res_127470 = defunc_9_fit_fun_res_127463 +
                      redout_127449;
                float defunc_1_op_res_127471 = defunc_9_slope_fun_res_127469 +
                      redout_127450;
                float redout_tmp_127487 = defunc_1_op_res_127470;
                float redout_tmp_127488 = defunc_1_op_res_127471;
                
                redout_127449 = redout_tmp_127487;
                redout_127450 = redout_tmp_127488;
            }
            defunc_2_reduce_res_127446 = redout_127449;
            defunc_2_reduce_res_127447 = redout_127450;
            ((float *) mem_122798)[i_127357] = defunc_2_reduce_res_127446;
            ((float *) mem_122801)[i_127357] = defunc_2_reduce_res_127447;
        }
        memmove(mem_122889.mem + gtid_118937 * l_n_m_114584 * (int64_t) 4,
                mem_122798 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
        memmove(mem_122893.mem + gtid_118937 * l_n_m_114584 * (int64_t) 4,
                mem_122801 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122798);
    free(mem_122801);
    free(mem_122818);
    free(mem_122821);
    free(mem_122848);
    free(mem_122851);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131527_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131527_end -
                 futhark_mc_segmap_parloop_131527_start;
        
        ctx->futhark_mc_segmap_parloop_131527_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131527_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131527_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131525(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118936 = tid;
    int num_tasks_127355 = info.nsubtasks;
    struct futhark_mc_task_131524 *futhark_mc_task_131524 =
                                  (struct futhark_mc_task_131524 *) args;
    struct futhark_context *ctx = futhark_mc_task_131524->ctx;
    uint64_t futhark_mc_segmap_task_131525_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131525_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131524->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131524->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131524->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131524->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131524->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131524->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131524->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131524->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131524->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131524->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131524->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131524->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131524->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122718 = futhark_mc_task_131524->free_bytes_122718;
    struct memblock mem_122889 = {.desc ="mem_122889", .mem =
                                  futhark_mc_task_131524->free_mem_122889,
                                  .size =0, .references =NULL};
    struct memblock mem_122893 = {.desc ="mem_122893", .mem =
                                  futhark_mc_task_131524->free_mem_122893,
                                  .size =0, .references =NULL};
    int64_t iter_127356;
    struct futhark_mc_segmap_parloop_struct_131526
    futhark_mc_segmap_parloop_struct_131526;
    
    futhark_mc_segmap_parloop_struct_131526.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131526.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131526.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131526.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131526.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131526.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131526.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131526.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131526.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131526.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131526.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131526.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131526.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131526.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131526.free_bytes_122718 = bytes_122718;
    futhark_mc_segmap_parloop_struct_131526.free_mem_122889 = mem_122889.mem;
    futhark_mc_segmap_parloop_struct_131526.free_mem_122893 = mem_122893.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131527_task;
    
    futhark_mc_segmap_parloop_131527_task.name =
        "futhark_mc_segmap_parloop_131527";
    futhark_mc_segmap_parloop_131527_task.fn = futhark_mc_segmap_parloop_131527;
    futhark_mc_segmap_parloop_131527_task.args =
        &futhark_mc_segmap_parloop_struct_131526;
    futhark_mc_segmap_parloop_131527_task.iterations = iterations;
    futhark_mc_segmap_parloop_131527_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131527_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131527_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131527_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131527_task);
    
    if (futhark_mc_segmap_parloop_131527_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131527_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131527_total_end -
                 futhark_mc_segmap_parloop_131527_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131527_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131527_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131527_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131525_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131525_end -
                 futhark_mc_segmap_task_131525_start;
        
        ctx->futhark_mc_segmap_task_131525_runs[tid]++;
        ctx->futhark_mc_segmap_task_131525_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131525_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131535 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122055;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122718;
    char *free_mem_122889;
    char *free_mem_122893;
};
struct futhark_mc_task_131539 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_118939;
    int64_t free_x_119062;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122718;
    char *free_mem_122792;
    char *free_mem_122795;
};
struct futhark_mc_segmap_parloop_struct_131541 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_118939;
    int64_t free_x_119062;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122718;
    char *free_mem_122792;
    char *free_mem_122795;
};
static int futhark_mc_segmap_parloop_131542(void *args, int64_t start,
                                            int64_t end, int flat_tid_118940,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131541
    *futhark_mc_segmap_parloop_struct_131541 =
    (struct futhark_mc_segmap_parloop_struct_131541 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131541->ctx;
    uint64_t futhark_mc_segmap_parloop_131542_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131542_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131541->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131541->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131541->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131541->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131541->free_i_114610;
    int64_t gtid_118939 =
            futhark_mc_segmap_parloop_struct_131541->free_gtid_118939;
    int64_t x_119062 = futhark_mc_segmap_parloop_struct_131541->free_x_119062;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131541->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131541->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131541->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131541->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131541->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122718 =
            futhark_mc_segmap_parloop_struct_131541->free_bytes_122718;
    struct memblock mem_122792 = {.desc ="mem_122792", .mem =
                                  futhark_mc_segmap_parloop_struct_131541->free_mem_122792,
                                  .size =0, .references =NULL};
    struct memblock mem_122795 = {.desc ="mem_122795", .mem =
                                  futhark_mc_segmap_parloop_struct_131541->free_mem_122795,
                                  .size =0, .references =NULL};
    size_t mem_127603_cached_sizze_131543 = 0;
    char *mem_127603 = NULL;
    size_t mem_127605_cached_sizze_131544 = 0;
    char *mem_127605 = NULL;
    size_t mem_127631_cached_sizze_131545 = 0;
    char *mem_127631 = NULL;
    size_t mem_127633_cached_sizze_131546 = 0;
    char *mem_127633 = NULL;
    int64_t iterations = end - start;
    int64_t iter_127717 = start;
    
    if (mem_127603_cached_sizze_131543 < (size_t) bytes_122718) {
        mem_127603 = realloc(mem_127603, bytes_122718);
        mem_127603_cached_sizze_131543 = bytes_122718;
    }
    if (mem_127605_cached_sizze_131544 < (size_t) bytes_122718) {
        mem_127605 = realloc(mem_127605, bytes_122718);
        mem_127605_cached_sizze_131544 = bytes_122718;
    }
    if (mem_127631_cached_sizze_131545 < (size_t) bytes_122718) {
        mem_127631 = realloc(mem_127631, bytes_122718);
        mem_127631_cached_sizze_131545 = bytes_122718;
    }
    if (mem_127633_cached_sizze_131546 < (size_t) bytes_122718) {
        mem_127633 = realloc(mem_127633, bytes_122718);
        mem_127633_cached_sizze_131546 = bytes_122718;
    }
    for (; iter_127717 < end; iter_127717++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_127785 = l_n_m_114584;
        int64_t gtid_118941 = iter_127717;
        int64_t remnant_127786 = iter_127717 - gtid_118941;
        int64_t x_127598 = ((int64_t *) mem_122124.mem)[gtid_118939 *
                                                        l_n_m_114584 +
                                                        gtid_118941];
        float x_127599 = ((float *) mem_122128.mem)[gtid_118939 * l_n_m_114584 +
                                                    gtid_118941];
        int64_t min_arg_127600 = mul64(t_jump_114541, gtid_118941);
        int64_t min_res_127601 = smin64(i_114610, min_arg_127600);
        float defunc_0_f_res_127602 = sitofp_i64_f32(min_res_127601);
        
        for (int64_t i_127718 = 0; i_127718 < l_window_114538; i_127718++) {
            bool cond_127721 = sle64(x_119062, i_127718);
            float defunc_0_f_res_127722;
            
            if (cond_127721) {
                defunc_0_f_res_127722 = 0.0F;
            } else {
                int64_t i_127723 = add64(x_127598, i_127718);
                float x_127724 = ((float *) mem_122004.mem)[gtid_118939 *
                                                            n_114534 +
                                                            i_127723];
                float defunc_0_f_res_f_res_127725 = 1.0F + x_127724;
                
                defunc_0_f_res_127722 = defunc_0_f_res_f_res_127725;
            }
            
            float defunc_0_f_res_127726;
            
            if (cond_127721) {
                defunc_0_f_res_127726 = 0.0F;
            } else {
                int64_t i_127727 = add64(x_127598, i_127718);
                float x_127728 = ((float *) mem_122430.mem)[gtid_118939 *
                                                            n_114534 +
                                                            i_127727];
                
                defunc_0_f_res_127726 = x_127728;
            }
            
            float x_j_127729 = defunc_0_f_res_127722 - defunc_0_f_res_127602;
            float abs_res_127730 = (float) fabs(x_j_127729);
            float tmp1_127731 = abs_res_127730 / x_127599;
            float x_127732 = tmp1_127731 * tmp1_127731;
            float y_127733 = tmp1_127731 * x_127732;
            float tmp2_127734 = 1.0F - y_127733;
            float x_127735 = tmp2_127734 * tmp2_127734;
            float tmp3_127736 = tmp2_127734 * x_127735;
            float tmp4_127737 = defunc_0_f_res_127726 * tmp3_127736;
            
            ((float *) mem_127603)[i_127718] = x_j_127729;
            ((float *) mem_127605)[i_127718] = tmp4_127737;
        }
        
        float defunc_2_reduce_res_127635;
        float defunc_2_reduce_res_127636;
        float defunc_2_reduce_res_127637;
        float defunc_2_reduce_res_127638;
        float defunc_2_reduce_res_127639;
        float redout_127741;
        float redout_127742;
        float redout_127743;
        float redout_127744;
        float redout_127745;
        
        redout_127741 = 0.0F;
        redout_127742 = 0.0F;
        redout_127743 = 0.0F;
        redout_127744 = 0.0F;
        redout_127745 = 0.0F;
        for (int64_t i_127740 = 0; i_127740 < l_window_114538; i_127740++) {
            float x_127748 = ((float *) mem_127603)[i_127740];
            float x_127749 = ((float *) mem_127605)[i_127740];
            float defunc_1_f_res_127750 = x_127748 * x_127749;
            float defunc_1_f_res_127751 = x_127748 * defunc_1_f_res_127750;
            float defunc_1_f_res_127752 = x_127748 * defunc_1_f_res_127751;
            float defunc_1_f_res_127753 = x_127748 * defunc_1_f_res_127752;
            float defunc_1_op_res_127754 = x_127749 + redout_127741;
            float defunc_1_op_res_127755 = defunc_1_f_res_127750 +
                  redout_127742;
            float defunc_1_op_res_127756 = defunc_1_f_res_127751 +
                  redout_127743;
            float defunc_1_op_res_127757 = defunc_1_f_res_127752 +
                  redout_127744;
            float defunc_1_op_res_127758 = defunc_1_f_res_127753 +
                  redout_127745;
            
            ((float *) mem_127631)[i_127740] = defunc_1_f_res_127751;
            ((float *) mem_127633)[i_127740] = defunc_1_f_res_127750;
            
            float redout_tmp_127789 = defunc_1_op_res_127754;
            float redout_tmp_127790 = defunc_1_op_res_127755;
            float redout_tmp_127791 = defunc_1_op_res_127756;
            float redout_tmp_127792 = defunc_1_op_res_127757;
            float redout_tmp_127793 = defunc_1_op_res_127758;
            
            redout_127741 = redout_tmp_127789;
            redout_127742 = redout_tmp_127790;
            redout_127743 = redout_tmp_127791;
            redout_127744 = redout_tmp_127792;
            redout_127745 = redout_tmp_127793;
        }
        defunc_2_reduce_res_127635 = redout_127741;
        defunc_2_reduce_res_127636 = redout_127742;
        defunc_2_reduce_res_127637 = redout_127743;
        defunc_2_reduce_res_127638 = redout_127744;
        defunc_2_reduce_res_127639 = redout_127745;
        
        float x_127663 = defunc_2_reduce_res_127637 *
              defunc_2_reduce_res_127639;
        float y_127664 = defunc_2_reduce_res_127638 *
              defunc_2_reduce_res_127638;
        float a12_127665 = x_127663 - y_127664;
        float x_127666 = defunc_2_reduce_res_127637 *
              defunc_2_reduce_res_127638;
        float y_127667 = defunc_2_reduce_res_127636 *
              defunc_2_reduce_res_127639;
        float b12_127668 = x_127666 - y_127667;
        float x_127669 = defunc_2_reduce_res_127636 *
              defunc_2_reduce_res_127638;
        float y_127670 = defunc_2_reduce_res_127637 *
              defunc_2_reduce_res_127637;
        float c12_127671 = x_127669 - y_127670;
        float x_127672 = defunc_2_reduce_res_127635 *
              defunc_2_reduce_res_127639;
        float b2_127673 = x_127672 - y_127670;
        float x_127674 = defunc_2_reduce_res_127636 *
              defunc_2_reduce_res_127637;
        float y_127675 = defunc_2_reduce_res_127635 *
              defunc_2_reduce_res_127638;
        float c2_127676 = x_127674 - y_127675;
        float x_127677 = defunc_2_reduce_res_127635 * a12_127665;
        float y_127678 = defunc_2_reduce_res_127636 * b12_127668;
        float x_127679 = x_127677 + y_127678;
        float y_127680 = defunc_2_reduce_res_127637 * c12_127671;
        float y_127681 = x_127679 + y_127680;
        float det_127682 = 1.0F / y_127681;
        float a12_127683 = a12_127665 * det_127682;
        float b12_127684 = b12_127668 * det_127682;
        float c12_127685 = c12_127671 * det_127682;
        float b2_127686 = b2_127673 * det_127682;
        float c2_127687 = c2_127676 * det_127682;
        float defunc_2_reduce_res_127688;
        float defunc_2_reduce_res_127689;
        float redout_127762;
        float redout_127763;
        
        redout_127762 = 0.0F;
        redout_127763 = 0.0F;
        for (int64_t i_127761 = 0; i_127761 < l_window_114538; i_127761++) {
            float x_127764 = ((float *) mem_127605)[i_127761];
            float x_127765 = ((float *) mem_127633)[i_127761];
            float x_127766 = ((float *) mem_127631)[i_127761];
            bool cond_127767 = sle64(x_119062, i_127761);
            float defunc_0_f_res_127768;
            
            if (cond_127767) {
                defunc_0_f_res_127768 = 0.0F;
            } else {
                int64_t i_127769 = add64(x_127598, i_127761);
                float x_127770 = ((float *) mem_122426.mem)[gtid_118939 *
                                                            n_114534 +
                                                            i_127769];
                
                defunc_0_f_res_127768 = x_127770;
            }
            
            float x_127771 = a12_127683 * x_127764;
            float y_127772 = b12_127684 * x_127765;
            float x_127773 = x_127771 + y_127772;
            float y_127774 = c12_127685 * x_127766;
            float x_127775 = x_127773 + y_127774;
            float defunc_9_fit_fun_res_127776 = defunc_0_f_res_127768 *
                  x_127775;
            float x_127777 = b12_127684 * x_127764;
            float y_127778 = b2_127686 * x_127765;
            float x_127779 = x_127777 + y_127778;
            float y_127780 = c2_127687 * x_127766;
            float x_127781 = x_127779 + y_127780;
            float defunc_9_slope_fun_res_127782 = defunc_0_f_res_127768 *
                  x_127781;
            float defunc_1_op_res_127783 = defunc_9_fit_fun_res_127776 +
                  redout_127762;
            float defunc_1_op_res_127784 = defunc_9_slope_fun_res_127782 +
                  redout_127763;
            float redout_tmp_127796 = defunc_1_op_res_127783;
            float redout_tmp_127797 = defunc_1_op_res_127784;
            
            redout_127762 = redout_tmp_127796;
            redout_127763 = redout_tmp_127797;
        }
        defunc_2_reduce_res_127688 = redout_127762;
        defunc_2_reduce_res_127689 = redout_127763;
        ((float *) mem_122792.mem)[gtid_118941] = defunc_2_reduce_res_127688;
        ((float *) mem_122795.mem)[gtid_118941] = defunc_2_reduce_res_127689;
    }
    
  cleanup:
    { }
    free(mem_127603);
    free(mem_127605);
    free(mem_127631);
    free(mem_127633);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131542_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131542_end -
                 futhark_mc_segmap_parloop_131542_start;
        
        ctx->futhark_mc_segmap_parloop_131542_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131542_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131542_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131540(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118940 = tid;
    int num_tasks_127716 = info.nsubtasks;
    struct futhark_mc_task_131539 *futhark_mc_task_131539 =
                                  (struct futhark_mc_task_131539 *) args;
    struct futhark_context *ctx = futhark_mc_task_131539->ctx;
    uint64_t futhark_mc_segmap_task_131540_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131540_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131539->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131539->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131539->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131539->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131539->free_i_114610;
    int64_t gtid_118939 = futhark_mc_task_131539->free_gtid_118939;
    int64_t x_119062 = futhark_mc_task_131539->free_x_119062;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131539->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131539->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131539->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131539->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131539->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122718 = futhark_mc_task_131539->free_bytes_122718;
    struct memblock mem_122792 = {.desc ="mem_122792", .mem =
                                  futhark_mc_task_131539->free_mem_122792,
                                  .size =0, .references =NULL};
    struct memblock mem_122795 = {.desc ="mem_122795", .mem =
                                  futhark_mc_task_131539->free_mem_122795,
                                  .size =0, .references =NULL};
    int64_t iter_127717;
    struct futhark_mc_segmap_parloop_struct_131541
    futhark_mc_segmap_parloop_struct_131541;
    
    futhark_mc_segmap_parloop_struct_131541.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131541.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131541.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131541.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131541.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131541.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131541.free_gtid_118939 = gtid_118939;
    futhark_mc_segmap_parloop_struct_131541.free_x_119062 = x_119062;
    futhark_mc_segmap_parloop_struct_131541.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131541.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131541.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131541.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131541.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131541.free_bytes_122718 = bytes_122718;
    futhark_mc_segmap_parloop_struct_131541.free_mem_122792 = mem_122792.mem;
    futhark_mc_segmap_parloop_struct_131541.free_mem_122795 = mem_122795.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131542_task;
    
    futhark_mc_segmap_parloop_131542_task.name =
        "futhark_mc_segmap_parloop_131542";
    futhark_mc_segmap_parloop_131542_task.fn = futhark_mc_segmap_parloop_131542;
    futhark_mc_segmap_parloop_131542_task.args =
        &futhark_mc_segmap_parloop_struct_131541;
    futhark_mc_segmap_parloop_131542_task.iterations = iterations;
    futhark_mc_segmap_parloop_131542_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131542_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131542_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131542_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131542_task);
    
    if (futhark_mc_segmap_parloop_131542_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131542_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131542_total_end -
                 futhark_mc_segmap_parloop_131542_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131542_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131542_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131542_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131540_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131540_end -
                 futhark_mc_segmap_task_131540_start;
        
        ctx->futhark_mc_segmap_task_131540_runs[tid]++;
        ctx->futhark_mc_segmap_task_131540_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131540_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131548 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_t_jump_114541;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_gtid_118939;
    int64_t free_x_119062;
    char *free_mem_122004;
    char *free_mem_122124;
    char *free_mem_122128;
    char *free_mem_122426;
    char *free_mem_122430;
    int64_t free_bytes_122718;
    char *free_mem_122792;
    char *free_mem_122795;
};
struct futhark_mc_task_131554 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_gtid_118939;
    int64_t free_x_119062;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_127490;
    float free_x_127491;
    float free_defunc_0_f_res_127494;
    char *free_mem_127495;
    char *free_mem_127496;
};
struct futhark_mc_segmap_parloop_struct_131556 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_window_114538;
    int64_t free_gtid_118939;
    int64_t free_x_119062;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_127490;
    float free_x_127491;
    float free_defunc_0_f_res_127494;
    char *free_mem_127495;
    char *free_mem_127496;
};
static int futhark_mc_segmap_parloop_131557(void *args, int64_t start,
                                            int64_t end, int flat_tid_118944,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131556
    *futhark_mc_segmap_parloop_struct_131556 =
    (struct futhark_mc_segmap_parloop_struct_131556 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131556->ctx;
    uint64_t futhark_mc_segmap_parloop_131557_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131557_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131556->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131556->free_l_window_114538;
    int64_t gtid_118939 =
            futhark_mc_segmap_parloop_struct_131556->free_gtid_118939;
    int64_t x_119062 = futhark_mc_segmap_parloop_struct_131556->free_x_119062;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131556->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131556->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_127490 = futhark_mc_segmap_parloop_struct_131556->free_x_127490;
    float x_127491 = futhark_mc_segmap_parloop_struct_131556->free_x_127491;
    float defunc_0_f_res_127494 =
          futhark_mc_segmap_parloop_struct_131556->free_defunc_0_f_res_127494;
    struct memblock mem_127495 = {.desc ="mem_127495", .mem =
                                  futhark_mc_segmap_parloop_struct_131556->free_mem_127495,
                                  .size =0, .references =NULL};
    struct memblock mem_127496 = {.desc ="mem_127496", .mem =
                                  futhark_mc_segmap_parloop_struct_131556->free_mem_127496,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_127865 = start;
    
    for (; iter_127865 < end; iter_127865++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_127871 = l_window_114538;
        int64_t gtid_118945 = iter_127865;
        int64_t remnant_127872 = iter_127865 - gtid_118945;
        bool cond_127799 = sle64(x_119062, gtid_118945);
        float defunc_0_f_res_127800;
        
        if (cond_127799) {
            defunc_0_f_res_127800 = 0.0F;
        } else {
            int64_t i_127866 = add64(gtid_118945, x_127490);
            float x_127867 = ((float *) mem_122004.mem)[gtid_118939 * n_114534 +
                                                        i_127866];
            float defunc_0_f_res_f_res_127868 = 1.0F + x_127867;
            
            defunc_0_f_res_127800 = defunc_0_f_res_f_res_127868;
        }
        
        float defunc_0_f_res_127804;
        
        if (cond_127799) {
            defunc_0_f_res_127804 = 0.0F;
        } else {
            int64_t i_127869 = add64(gtid_118945, x_127490);
            float x_127870 = ((float *) mem_122430.mem)[gtid_118939 * n_114534 +
                                                        i_127869];
            
            defunc_0_f_res_127804 = x_127870;
        }
        
        float x_j_127807 = defunc_0_f_res_127800 - defunc_0_f_res_127494;
        float abs_res_127808 = (float) fabs(x_j_127807);
        float tmp1_127809 = abs_res_127808 / x_127491;
        float x_127810 = tmp1_127809 * tmp1_127809;
        float y_127811 = tmp1_127809 * x_127810;
        float tmp2_127812 = 1.0F - y_127811;
        float x_127813 = tmp2_127812 * tmp2_127812;
        float tmp3_127814 = tmp2_127812 * x_127813;
        float tmp4_127815 = defunc_0_f_res_127804 * tmp3_127814;
        
        ((float *) mem_127495.mem)[gtid_118945] = x_j_127807;
        ((float *) mem_127496.mem)[gtid_118945] = tmp4_127815;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131557_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131557_end -
                 futhark_mc_segmap_parloop_131557_start;
        
        ctx->futhark_mc_segmap_parloop_131557_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131557_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131557_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131555(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118944 = tid;
    int num_tasks_127864 = info.nsubtasks;
    struct futhark_mc_task_131554 *futhark_mc_task_131554 =
                                  (struct futhark_mc_task_131554 *) args;
    struct futhark_context *ctx = futhark_mc_task_131554->ctx;
    uint64_t futhark_mc_segmap_task_131555_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131555_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131554->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131554->free_l_window_114538;
    int64_t gtid_118939 = futhark_mc_task_131554->free_gtid_118939;
    int64_t x_119062 = futhark_mc_task_131554->free_x_119062;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131554->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131554->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_127490 = futhark_mc_task_131554->free_x_127490;
    float x_127491 = futhark_mc_task_131554->free_x_127491;
    float defunc_0_f_res_127494 =
          futhark_mc_task_131554->free_defunc_0_f_res_127494;
    struct memblock mem_127495 = {.desc ="mem_127495", .mem =
                                  futhark_mc_task_131554->free_mem_127495,
                                  .size =0, .references =NULL};
    struct memblock mem_127496 = {.desc ="mem_127496", .mem =
                                  futhark_mc_task_131554->free_mem_127496,
                                  .size =0, .references =NULL};
    int64_t iter_127865;
    struct futhark_mc_segmap_parloop_struct_131556
    futhark_mc_segmap_parloop_struct_131556;
    
    futhark_mc_segmap_parloop_struct_131556.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131556.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131556.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131556.free_gtid_118939 = gtid_118939;
    futhark_mc_segmap_parloop_struct_131556.free_x_119062 = x_119062;
    futhark_mc_segmap_parloop_struct_131556.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131556.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131556.free_x_127490 = x_127490;
    futhark_mc_segmap_parloop_struct_131556.free_x_127491 = x_127491;
    futhark_mc_segmap_parloop_struct_131556.free_defunc_0_f_res_127494 =
        defunc_0_f_res_127494;
    futhark_mc_segmap_parloop_struct_131556.free_mem_127495 = mem_127495.mem;
    futhark_mc_segmap_parloop_struct_131556.free_mem_127496 = mem_127496.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131557_task;
    
    futhark_mc_segmap_parloop_131557_task.name =
        "futhark_mc_segmap_parloop_131557";
    futhark_mc_segmap_parloop_131557_task.fn = futhark_mc_segmap_parloop_131557;
    futhark_mc_segmap_parloop_131557_task.args =
        &futhark_mc_segmap_parloop_struct_131556;
    futhark_mc_segmap_parloop_131557_task.iterations = iterations;
    futhark_mc_segmap_parloop_131557_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131557_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131557_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131557_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131557_task);
    
    if (futhark_mc_segmap_parloop_131557_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131557_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131557_total_end -
                 futhark_mc_segmap_parloop_131557_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131557_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131557_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131557_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131555_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131555_end -
                 futhark_mc_segmap_task_131555_start;
        
        ctx->futhark_mc_segmap_task_131555_runs[tid]++;
        ctx->futhark_mc_segmap_task_131555_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131555_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131558 {
    struct futhark_context *ctx;
    char *free_mem_127495;
    char *free_mem_127496;
    float *retval_defunc_2_reduce_res_127518;
    float *retval_defunc_2_reduce_res_127519;
    float *retval_defunc_2_reduce_res_127520;
    float *retval_defunc_2_reduce_res_127521;
    float *retval_defunc_2_reduce_res_127522;
    char *retval_mem_127516;
    char *retval_mem_127517;
};
struct futhark_mc_segred_stage_1_parloop_struct_131565 {
    struct futhark_context *ctx;
    char *free_mem_127495;
    char *free_mem_127496;
    char *free_mem_127516;
    char *free_mem_127517;
    char *free_reduce_stage_1_tid_res_arr_mem_127874;
    char *free_reduce_stage_1_tid_res_arr_mem_127876;
    char *free_reduce_stage_1_tid_res_arr_mem_127878;
    char *free_reduce_stage_1_tid_res_arr_mem_127880;
    char *free_reduce_stage_1_tid_res_arr_mem_127882;
};
static int futhark_mc_segred_stage_1_parloop_131566(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_118946,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131565
    *futhark_mc_segred_stage_1_parloop_struct_131565 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131565 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131565->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131566_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131566_start = get_wall_time();
    
    struct memblock mem_127495 = {.desc ="mem_127495", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131565->free_mem_127495,
                                  .size =0, .references =NULL};
    struct memblock mem_127496 = {.desc ="mem_127496", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131565->free_mem_127496,
                                  .size =0, .references =NULL};
    struct memblock mem_127516 = {.desc ="mem_127516", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131565->free_mem_127516,
                                  .size =0, .references =NULL};
    struct memblock mem_127517 = {.desc ="mem_127517", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131565->free_mem_127517,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_127874 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_127874",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131565->free_reduce_stage_1_tid_res_arr_mem_127874,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_127876 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_127876",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131565->free_reduce_stage_1_tid_res_arr_mem_127876,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_127878 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_127878",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131565->free_reduce_stage_1_tid_res_arr_mem_127878,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_127880 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_127880",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131565->free_reduce_stage_1_tid_res_arr_mem_127880,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_127882 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_127882",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131565->free_reduce_stage_1_tid_res_arr_mem_127882,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_127884 = start;
    float x_127816;
    float x_127817;
    float x_127819;
    float x_127820;
    float x_127822;
    float x_127823;
    float x_127825;
    float x_127826;
    float x_127828;
    float x_127829;
    float local_acc_127885 = 0.0F;
    float local_acc_127886 = 0.0F;
    float local_acc_127887 = 0.0F;
    float local_acc_127888 = 0.0F;
    float local_acc_127889 = 0.0F;
    
    for (; iter_127884 < end; iter_127884++) {
        int64_t gtid_118947 = iter_127884;
        float x_127831 = ((float *) mem_127495.mem)[gtid_118947];
        float x_127832 = ((float *) mem_127496.mem)[gtid_118947];
        float defunc_1_f_res_127833 = x_127831 * x_127832;
        float defunc_1_f_res_127834 = x_127831 * defunc_1_f_res_127833;
        float defunc_1_f_res_127835 = x_127831 * defunc_1_f_res_127834;
        float defunc_1_f_res_127836 = x_127831 * defunc_1_f_res_127835;
        
        // save map-out results
        {
            ((float *) mem_127516.mem)[gtid_118947] = defunc_1_f_res_127834;
            ((float *) mem_127517.mem)[gtid_118947] = defunc_1_f_res_127833;
        }
        // Load accum params
        {
            x_127816 = local_acc_127885;
        }
        // Load next params
        {
            x_127817 = x_127832;
        }
        // Red body
        {
            float defunc_1_op_res_127818 = x_127816 + x_127817;
            
            local_acc_127885 = defunc_1_op_res_127818;
        }
        // Load accum params
        {
            x_127819 = local_acc_127886;
        }
        // Load next params
        {
            x_127820 = defunc_1_f_res_127833;
        }
        // Red body
        {
            float defunc_1_op_res_127821 = x_127819 + x_127820;
            
            local_acc_127886 = defunc_1_op_res_127821;
        }
        // Load accum params
        {
            x_127822 = local_acc_127887;
        }
        // Load next params
        {
            x_127823 = defunc_1_f_res_127834;
        }
        // Red body
        {
            float defunc_1_op_res_127824 = x_127822 + x_127823;
            
            local_acc_127887 = defunc_1_op_res_127824;
        }
        // Load accum params
        {
            x_127825 = local_acc_127888;
        }
        // Load next params
        {
            x_127826 = defunc_1_f_res_127835;
        }
        // Red body
        {
            float defunc_1_op_res_127827 = x_127825 + x_127826;
            
            local_acc_127888 = defunc_1_op_res_127827;
        }
        // Load accum params
        {
            x_127828 = local_acc_127889;
        }
        // Load next params
        {
            x_127829 = defunc_1_f_res_127836;
        }
        // Red body
        {
            float defunc_1_op_res_127830 = x_127828 + x_127829;
            
            local_acc_127889 = defunc_1_op_res_127830;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_127874.mem)[flat_tid_118946] =
        local_acc_127885;
    ((float *) reduce_stage_1_tid_res_arr_mem_127876.mem)[flat_tid_118946] =
        local_acc_127886;
    ((float *) reduce_stage_1_tid_res_arr_mem_127878.mem)[flat_tid_118946] =
        local_acc_127887;
    ((float *) reduce_stage_1_tid_res_arr_mem_127880.mem)[flat_tid_118946] =
        local_acc_127888;
    ((float *) reduce_stage_1_tid_res_arr_mem_127882.mem)[flat_tid_118946] =
        local_acc_127889;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131566_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131566_end -
                 futhark_mc_segred_stage_1_parloop_131566_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131566_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131566_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131566_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131559(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118946 = tid;
    int num_tasks_127873 = info.nsubtasks;
    struct futhark_mc_task_131558 *futhark_mc_task_131558 =
                                  (struct futhark_mc_task_131558 *) args;
    struct futhark_context *ctx = futhark_mc_task_131558->ctx;
    uint64_t futhark_mc_segred_task_131559_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131559_start = get_wall_time();
    
    struct memblock mem_127495 = {.desc ="mem_127495", .mem =
                                  futhark_mc_task_131558->free_mem_127495,
                                  .size =0, .references =NULL};
    struct memblock mem_127496 = {.desc ="mem_127496", .mem =
                                  futhark_mc_task_131558->free_mem_127496,
                                  .size =0, .references =NULL};
    float defunc_2_reduce_res_127518 =
          *futhark_mc_task_131558->retval_defunc_2_reduce_res_127518;
    float defunc_2_reduce_res_127519 =
          *futhark_mc_task_131558->retval_defunc_2_reduce_res_127519;
    float defunc_2_reduce_res_127520 =
          *futhark_mc_task_131558->retval_defunc_2_reduce_res_127520;
    float defunc_2_reduce_res_127521 =
          *futhark_mc_task_131558->retval_defunc_2_reduce_res_127521;
    float defunc_2_reduce_res_127522 =
          *futhark_mc_task_131558->retval_defunc_2_reduce_res_127522;
    struct memblock mem_127516 = {.desc ="mem_127516", .mem =
                                  futhark_mc_task_131558->retval_mem_127516,
                                  .size =0, .references =NULL};
    struct memblock mem_127517 = {.desc ="mem_127517", .mem =
                                  futhark_mc_task_131558->retval_mem_127517,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_127874_cached_sizze_131560 = 0;
    char *reduce_stage_1_tid_res_arr_mem_127874 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_127876_cached_sizze_131561 = 0;
    char *reduce_stage_1_tid_res_arr_mem_127876 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_127878_cached_sizze_131562 = 0;
    char *reduce_stage_1_tid_res_arr_mem_127878 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_127880_cached_sizze_131563 = 0;
    char *reduce_stage_1_tid_res_arr_mem_127880 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_127882_cached_sizze_131564 = 0;
    char *reduce_stage_1_tid_res_arr_mem_127882 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_127874_cached_sizze_131560 <
        (size_t) ((int64_t) 4 * num_tasks_127873)) {
        reduce_stage_1_tid_res_arr_mem_127874 =
            realloc(reduce_stage_1_tid_res_arr_mem_127874, (int64_t) 4 *
                    num_tasks_127873);
        reduce_stage_1_tid_res_arr_mem_127874_cached_sizze_131560 =
            (int64_t) 4 * num_tasks_127873;
    }
    if (reduce_stage_1_tid_res_arr_mem_127876_cached_sizze_131561 <
        (size_t) ((int64_t) 4 * num_tasks_127873)) {
        reduce_stage_1_tid_res_arr_mem_127876 =
            realloc(reduce_stage_1_tid_res_arr_mem_127876, (int64_t) 4 *
                    num_tasks_127873);
        reduce_stage_1_tid_res_arr_mem_127876_cached_sizze_131561 =
            (int64_t) 4 * num_tasks_127873;
    }
    if (reduce_stage_1_tid_res_arr_mem_127878_cached_sizze_131562 <
        (size_t) ((int64_t) 4 * num_tasks_127873)) {
        reduce_stage_1_tid_res_arr_mem_127878 =
            realloc(reduce_stage_1_tid_res_arr_mem_127878, (int64_t) 4 *
                    num_tasks_127873);
        reduce_stage_1_tid_res_arr_mem_127878_cached_sizze_131562 =
            (int64_t) 4 * num_tasks_127873;
    }
    if (reduce_stage_1_tid_res_arr_mem_127880_cached_sizze_131563 <
        (size_t) ((int64_t) 4 * num_tasks_127873)) {
        reduce_stage_1_tid_res_arr_mem_127880 =
            realloc(reduce_stage_1_tid_res_arr_mem_127880, (int64_t) 4 *
                    num_tasks_127873);
        reduce_stage_1_tid_res_arr_mem_127880_cached_sizze_131563 =
            (int64_t) 4 * num_tasks_127873;
    }
    if (reduce_stage_1_tid_res_arr_mem_127882_cached_sizze_131564 <
        (size_t) ((int64_t) 4 * num_tasks_127873)) {
        reduce_stage_1_tid_res_arr_mem_127882 =
            realloc(reduce_stage_1_tid_res_arr_mem_127882, (int64_t) 4 *
                    num_tasks_127873);
        reduce_stage_1_tid_res_arr_mem_127882_cached_sizze_131564 =
            (int64_t) 4 * num_tasks_127873;
    }
    
    int64_t iter_127884;
    struct futhark_mc_segred_stage_1_parloop_struct_131565
    futhark_mc_segred_stage_1_parloop_struct_131565;
    
    futhark_mc_segred_stage_1_parloop_struct_131565.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131565.free_mem_127495 =
        mem_127495.mem;
    futhark_mc_segred_stage_1_parloop_struct_131565.free_mem_127496 =
        mem_127496.mem;
    futhark_mc_segred_stage_1_parloop_struct_131565.free_mem_127516 =
        mem_127516.mem;
    futhark_mc_segred_stage_1_parloop_struct_131565.free_mem_127517 =
        mem_127517.mem;
    futhark_mc_segred_stage_1_parloop_struct_131565.free_reduce_stage_1_tid_res_arr_mem_127874 =
        reduce_stage_1_tid_res_arr_mem_127874;
    futhark_mc_segred_stage_1_parloop_struct_131565.free_reduce_stage_1_tid_res_arr_mem_127876 =
        reduce_stage_1_tid_res_arr_mem_127876;
    futhark_mc_segred_stage_1_parloop_struct_131565.free_reduce_stage_1_tid_res_arr_mem_127878 =
        reduce_stage_1_tid_res_arr_mem_127878;
    futhark_mc_segred_stage_1_parloop_struct_131565.free_reduce_stage_1_tid_res_arr_mem_127880 =
        reduce_stage_1_tid_res_arr_mem_127880;
    futhark_mc_segred_stage_1_parloop_struct_131565.free_reduce_stage_1_tid_res_arr_mem_127882 =
        reduce_stage_1_tid_res_arr_mem_127882;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131566_task;
    
    futhark_mc_segred_stage_1_parloop_131566_task.name =
        "futhark_mc_segred_stage_1_parloop_131566";
    futhark_mc_segred_stage_1_parloop_131566_task.fn =
        futhark_mc_segred_stage_1_parloop_131566;
    futhark_mc_segred_stage_1_parloop_131566_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131565;
    futhark_mc_segred_stage_1_parloop_131566_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131566_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131566_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131566_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131566_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131566_task);
    
    if (futhark_mc_segred_stage_1_parloop_131566_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131566_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131566_total_end -
                 futhark_mc_segred_stage_1_parloop_131566_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131566_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131566_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131566_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_127518 = 0.0F;
        defunc_2_reduce_res_127519 = 0.0F;
        defunc_2_reduce_res_127520 = 0.0F;
        defunc_2_reduce_res_127521 = 0.0F;
        defunc_2_reduce_res_127522 = 0.0F;
    }
    
    float x_127890;
    float x_127891;
    float x_127893;
    float x_127894;
    float x_127896;
    float x_127897;
    float x_127899;
    float x_127900;
    float x_127902;
    float x_127903;
    
    for (int32_t i_127905 = 0; i_127905 < num_tasks_127873; i_127905++) {
        flat_tid_118946 = i_127905;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_127890 = defunc_2_reduce_res_127518;
            }
            // load next params
            {
                x_127891 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_127874)[flat_tid_118946];
            }
            // red body
            {
                float defunc_1_op_res_127892 = x_127890 + x_127891;
                
                defunc_2_reduce_res_127518 = defunc_1_op_res_127892;
            }
            // load acc params
            {
                x_127893 = defunc_2_reduce_res_127519;
            }
            // load next params
            {
                x_127894 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_127876)[flat_tid_118946];
            }
            // red body
            {
                float defunc_1_op_res_127895 = x_127893 + x_127894;
                
                defunc_2_reduce_res_127519 = defunc_1_op_res_127895;
            }
            // load acc params
            {
                x_127896 = defunc_2_reduce_res_127520;
            }
            // load next params
            {
                x_127897 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_127878)[flat_tid_118946];
            }
            // red body
            {
                float defunc_1_op_res_127898 = x_127896 + x_127897;
                
                defunc_2_reduce_res_127520 = defunc_1_op_res_127898;
            }
            // load acc params
            {
                x_127899 = defunc_2_reduce_res_127521;
            }
            // load next params
            {
                x_127900 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_127880)[flat_tid_118946];
            }
            // red body
            {
                float defunc_1_op_res_127901 = x_127899 + x_127900;
                
                defunc_2_reduce_res_127521 = defunc_1_op_res_127901;
            }
            // load acc params
            {
                x_127902 = defunc_2_reduce_res_127522;
            }
            // load next params
            {
                x_127903 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_127882)[flat_tid_118946];
            }
            // red body
            {
                float defunc_1_op_res_127904 = x_127902 + x_127903;
                
                defunc_2_reduce_res_127522 = defunc_1_op_res_127904;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_127874);
    free(reduce_stage_1_tid_res_arr_mem_127876);
    free(reduce_stage_1_tid_res_arr_mem_127878);
    free(reduce_stage_1_tid_res_arr_mem_127880);
    free(reduce_stage_1_tid_res_arr_mem_127882);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131559_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131559_end -
                 futhark_mc_segred_task_131559_start;
        
        ctx->futhark_mc_segred_task_131559_runs[tid]++;
        ctx->futhark_mc_segred_task_131559_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131559_iter[tid] += iterations;
    }
    *futhark_mc_task_131558->retval_defunc_2_reduce_res_127518 =
        defunc_2_reduce_res_127518;
    *futhark_mc_task_131558->retval_defunc_2_reduce_res_127519 =
        defunc_2_reduce_res_127519;
    *futhark_mc_task_131558->retval_defunc_2_reduce_res_127520 =
        defunc_2_reduce_res_127520;
    *futhark_mc_task_131558->retval_defunc_2_reduce_res_127521 =
        defunc_2_reduce_res_127521;
    *futhark_mc_task_131558->retval_defunc_2_reduce_res_127522 =
        defunc_2_reduce_res_127522;
    futhark_mc_task_131558->retval_mem_127516 = mem_127516.mem;
    futhark_mc_task_131558->retval_mem_127517 = mem_127517.mem;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131567 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118939;
    int64_t free_x_119062;
    char *free_mem_122426;
    int64_t free_x_127490;
    char *free_mem_127496;
    char *free_mem_127516;
    char *free_mem_127517;
    float free_a12_127566;
    float free_b12_127567;
    float free_c12_127568;
    float free_b2_127569;
    float free_c2_127570;
    float *retval_defunc_2_reduce_res_127571;
    float *retval_defunc_2_reduce_res_127572;
};
struct futhark_mc_segred_stage_1_parloop_struct_131571 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_118939;
    int64_t free_x_119062;
    char *free_mem_122426;
    int64_t free_x_127490;
    char *free_mem_127496;
    char *free_mem_127516;
    char *free_mem_127517;
    float free_a12_127566;
    float free_b12_127567;
    float free_c12_127568;
    float free_b2_127569;
    float free_c2_127570;
    char *free_reduce_stage_1_tid_res_arr_mem_127907;
    char *free_reduce_stage_1_tid_res_arr_mem_127909;
};
static int futhark_mc_segred_stage_1_parloop_131572(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_118948,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131571
    *futhark_mc_segred_stage_1_parloop_struct_131571 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131571 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131571->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131572_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131572_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131571->free_n_114534;
    int64_t gtid_118939 =
            futhark_mc_segred_stage_1_parloop_struct_131571->free_gtid_118939;
    int64_t x_119062 =
            futhark_mc_segred_stage_1_parloop_struct_131571->free_x_119062;
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131571->free_mem_122426,
                                  .size =0, .references =NULL};
    int64_t x_127490 =
            futhark_mc_segred_stage_1_parloop_struct_131571->free_x_127490;
    struct memblock mem_127496 = {.desc ="mem_127496", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131571->free_mem_127496,
                                  .size =0, .references =NULL};
    struct memblock mem_127516 = {.desc ="mem_127516", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131571->free_mem_127516,
                                  .size =0, .references =NULL};
    struct memblock mem_127517 = {.desc ="mem_127517", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131571->free_mem_127517,
                                  .size =0, .references =NULL};
    float a12_127566 =
          futhark_mc_segred_stage_1_parloop_struct_131571->free_a12_127566;
    float b12_127567 =
          futhark_mc_segred_stage_1_parloop_struct_131571->free_b12_127567;
    float c12_127568 =
          futhark_mc_segred_stage_1_parloop_struct_131571->free_c12_127568;
    float b2_127569 =
          futhark_mc_segred_stage_1_parloop_struct_131571->free_b2_127569;
    float c2_127570 =
          futhark_mc_segred_stage_1_parloop_struct_131571->free_c2_127570;
    struct memblock reduce_stage_1_tid_res_arr_mem_127907 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_127907",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131571->free_reduce_stage_1_tid_res_arr_mem_127907,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_127909 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_127909",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131571->free_reduce_stage_1_tid_res_arr_mem_127909,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_127911 = start;
    float x_127837;
    float x_127838;
    float x_127840;
    float x_127841;
    float local_acc_127912 = 0.0F;
    float local_acc_127913 = 0.0F;
    
    for (; iter_127911 < end; iter_127911++) {
        int64_t gtid_118949 = iter_127911;
        float x_127843 = ((float *) mem_127496.mem)[gtid_118949];
        float x_127844 = ((float *) mem_127517.mem)[gtid_118949];
        float x_127845 = ((float *) mem_127516.mem)[gtid_118949];
        bool cond_127846 = sle64(x_119062, gtid_118949);
        float defunc_0_f_res_127847;
        
        if (cond_127846) {
            defunc_0_f_res_127847 = 0.0F;
        } else {
            int64_t i_127848 = add64(gtid_118949, x_127490);
            float x_127849 = ((float *) mem_122426.mem)[gtid_118939 * n_114534 +
                                                        i_127848];
            
            defunc_0_f_res_127847 = x_127849;
        }
        
        float x_127850 = a12_127566 * x_127843;
        float y_127851 = b12_127567 * x_127844;
        float x_127852 = x_127850 + y_127851;
        float y_127853 = c12_127568 * x_127845;
        float x_127854 = x_127852 + y_127853;
        float defunc_9_fit_fun_res_127855 = defunc_0_f_res_127847 * x_127854;
        float x_127856 = b12_127567 * x_127843;
        float y_127857 = b2_127569 * x_127844;
        float x_127858 = x_127856 + y_127857;
        float y_127859 = c2_127570 * x_127845;
        float x_127860 = x_127858 + y_127859;
        float defunc_9_slope_fun_res_127861 = defunc_0_f_res_127847 * x_127860;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_127837 = local_acc_127912;
        }
        // Load next params
        {
            x_127838 = defunc_9_fit_fun_res_127855;
        }
        // Red body
        {
            float defunc_1_op_res_127839 = x_127837 + x_127838;
            
            local_acc_127912 = defunc_1_op_res_127839;
        }
        // Load accum params
        {
            x_127840 = local_acc_127913;
        }
        // Load next params
        {
            x_127841 = defunc_9_slope_fun_res_127861;
        }
        // Red body
        {
            float defunc_1_op_res_127842 = x_127840 + x_127841;
            
            local_acc_127913 = defunc_1_op_res_127842;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_127907.mem)[flat_tid_118948] =
        local_acc_127912;
    ((float *) reduce_stage_1_tid_res_arr_mem_127909.mem)[flat_tid_118948] =
        local_acc_127913;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131572_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131572_end -
                 futhark_mc_segred_stage_1_parloop_131572_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131572_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131572_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131572_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131568(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118948 = tid;
    int num_tasks_127906 = info.nsubtasks;
    struct futhark_mc_task_131567 *futhark_mc_task_131567 =
                                  (struct futhark_mc_task_131567 *) args;
    struct futhark_context *ctx = futhark_mc_task_131567->ctx;
    uint64_t futhark_mc_segred_task_131568_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131568_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131567->free_n_114534;
    int64_t gtid_118939 = futhark_mc_task_131567->free_gtid_118939;
    int64_t x_119062 = futhark_mc_task_131567->free_x_119062;
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131567->free_mem_122426,
                                  .size =0, .references =NULL};
    int64_t x_127490 = futhark_mc_task_131567->free_x_127490;
    struct memblock mem_127496 = {.desc ="mem_127496", .mem =
                                  futhark_mc_task_131567->free_mem_127496,
                                  .size =0, .references =NULL};
    struct memblock mem_127516 = {.desc ="mem_127516", .mem =
                                  futhark_mc_task_131567->free_mem_127516,
                                  .size =0, .references =NULL};
    struct memblock mem_127517 = {.desc ="mem_127517", .mem =
                                  futhark_mc_task_131567->free_mem_127517,
                                  .size =0, .references =NULL};
    float a12_127566 = futhark_mc_task_131567->free_a12_127566;
    float b12_127567 = futhark_mc_task_131567->free_b12_127567;
    float c12_127568 = futhark_mc_task_131567->free_c12_127568;
    float b2_127569 = futhark_mc_task_131567->free_b2_127569;
    float c2_127570 = futhark_mc_task_131567->free_c2_127570;
    float defunc_2_reduce_res_127571 =
          *futhark_mc_task_131567->retval_defunc_2_reduce_res_127571;
    float defunc_2_reduce_res_127572 =
          *futhark_mc_task_131567->retval_defunc_2_reduce_res_127572;
    size_t reduce_stage_1_tid_res_arr_mem_127907_cached_sizze_131569 = 0;
    char *reduce_stage_1_tid_res_arr_mem_127907 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_127909_cached_sizze_131570 = 0;
    char *reduce_stage_1_tid_res_arr_mem_127909 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_127907_cached_sizze_131569 <
        (size_t) ((int64_t) 4 * num_tasks_127906)) {
        reduce_stage_1_tid_res_arr_mem_127907 =
            realloc(reduce_stage_1_tid_res_arr_mem_127907, (int64_t) 4 *
                    num_tasks_127906);
        reduce_stage_1_tid_res_arr_mem_127907_cached_sizze_131569 =
            (int64_t) 4 * num_tasks_127906;
    }
    if (reduce_stage_1_tid_res_arr_mem_127909_cached_sizze_131570 <
        (size_t) ((int64_t) 4 * num_tasks_127906)) {
        reduce_stage_1_tid_res_arr_mem_127909 =
            realloc(reduce_stage_1_tid_res_arr_mem_127909, (int64_t) 4 *
                    num_tasks_127906);
        reduce_stage_1_tid_res_arr_mem_127909_cached_sizze_131570 =
            (int64_t) 4 * num_tasks_127906;
    }
    
    int64_t iter_127911;
    struct futhark_mc_segred_stage_1_parloop_struct_131571
    futhark_mc_segred_stage_1_parloop_struct_131571;
    
    futhark_mc_segred_stage_1_parloop_struct_131571.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_gtid_118939 =
        gtid_118939;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_x_119062 = x_119062;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_mem_122426 =
        mem_122426.mem;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_x_127490 = x_127490;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_mem_127496 =
        mem_127496.mem;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_mem_127516 =
        mem_127516.mem;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_mem_127517 =
        mem_127517.mem;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_a12_127566 =
        a12_127566;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_b12_127567 =
        b12_127567;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_c12_127568 =
        c12_127568;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_b2_127569 = b2_127569;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_c2_127570 = c2_127570;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_reduce_stage_1_tid_res_arr_mem_127907 =
        reduce_stage_1_tid_res_arr_mem_127907;
    futhark_mc_segred_stage_1_parloop_struct_131571.free_reduce_stage_1_tid_res_arr_mem_127909 =
        reduce_stage_1_tid_res_arr_mem_127909;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131572_task;
    
    futhark_mc_segred_stage_1_parloop_131572_task.name =
        "futhark_mc_segred_stage_1_parloop_131572";
    futhark_mc_segred_stage_1_parloop_131572_task.fn =
        futhark_mc_segred_stage_1_parloop_131572;
    futhark_mc_segred_stage_1_parloop_131572_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131571;
    futhark_mc_segred_stage_1_parloop_131572_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131572_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131572_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131572_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131572_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131572_task);
    
    if (futhark_mc_segred_stage_1_parloop_131572_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131572_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131572_total_end -
                 futhark_mc_segred_stage_1_parloop_131572_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131572_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131572_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131572_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_127571 = 0.0F;
        defunc_2_reduce_res_127572 = 0.0F;
    }
    
    float x_127914;
    float x_127915;
    float x_127917;
    float x_127918;
    
    for (int32_t i_127920 = 0; i_127920 < num_tasks_127906; i_127920++) {
        flat_tid_118948 = i_127920;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_127914 = defunc_2_reduce_res_127571;
            }
            // load next params
            {
                x_127915 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_127907)[flat_tid_118948];
            }
            // red body
            {
                float defunc_1_op_res_127916 = x_127914 + x_127915;
                
                defunc_2_reduce_res_127571 = defunc_1_op_res_127916;
            }
            // load acc params
            {
                x_127917 = defunc_2_reduce_res_127572;
            }
            // load next params
            {
                x_127918 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_127909)[flat_tid_118948];
            }
            // red body
            {
                float defunc_1_op_res_127919 = x_127917 + x_127918;
                
                defunc_2_reduce_res_127572 = defunc_1_op_res_127919;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_127907);
    free(reduce_stage_1_tid_res_arr_mem_127909);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131568_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131568_end -
                 futhark_mc_segred_task_131568_start;
        
        ctx->futhark_mc_segred_task_131568_runs[tid]++;
        ctx->futhark_mc_segred_task_131568_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131568_iter[tid] += iterations;
    }
    *futhark_mc_task_131567->retval_defunc_2_reduce_res_127571 =
        defunc_2_reduce_res_127571;
    *futhark_mc_task_131567->retval_defunc_2_reduce_res_127572 =
        defunc_2_reduce_res_127572;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131549(void *args, int64_t start,
                                            int64_t end, int flat_tid_118942,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131548
    *futhark_mc_segmap_parloop_struct_131548 =
    (struct futhark_mc_segmap_parloop_struct_131548 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131548->ctx;
    uint64_t futhark_mc_segmap_parloop_131549_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131549_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131548->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131548->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131548->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131548->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131548->free_i_114610;
    int64_t gtid_118939 =
            futhark_mc_segmap_parloop_struct_131548->free_gtid_118939;
    int64_t x_119062 = futhark_mc_segmap_parloop_struct_131548->free_x_119062;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131548->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131548->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131548->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131548->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131548->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122718 =
            futhark_mc_segmap_parloop_struct_131548->free_bytes_122718;
    struct memblock mem_122792 = {.desc ="mem_122792", .mem =
                                  futhark_mc_segmap_parloop_struct_131548->free_mem_122792,
                                  .size =0, .references =NULL};
    struct memblock mem_122795 = {.desc ="mem_122795", .mem =
                                  futhark_mc_segmap_parloop_struct_131548->free_mem_122795,
                                  .size =0, .references =NULL};
    size_t mem_127495_cached_sizze_131550 = 0;
    char *mem_127495 = NULL;
    size_t mem_127496_cached_sizze_131551 = 0;
    char *mem_127496 = NULL;
    size_t mem_127516_cached_sizze_131552 = 0;
    char *mem_127516 = NULL;
    size_t mem_127517_cached_sizze_131553 = 0;
    char *mem_127517 = NULL;
    int64_t iterations = end - start;
    int64_t iter_127798 = start;
    
    if (mem_127495_cached_sizze_131550 < (size_t) bytes_122718) {
        mem_127495 = realloc(mem_127495, bytes_122718);
        mem_127495_cached_sizze_131550 = bytes_122718;
    }
    if (mem_127496_cached_sizze_131551 < (size_t) bytes_122718) {
        mem_127496 = realloc(mem_127496, bytes_122718);
        mem_127496_cached_sizze_131551 = bytes_122718;
    }
    if (mem_127516_cached_sizze_131552 < (size_t) bytes_122718) {
        mem_127516 = realloc(mem_127516, bytes_122718);
        mem_127516_cached_sizze_131552 = bytes_122718;
    }
    if (mem_127517_cached_sizze_131553 < (size_t) bytes_122718) {
        mem_127517 = realloc(mem_127517, bytes_122718);
        mem_127517_cached_sizze_131553 = bytes_122718;
    }
    for (; iter_127798 < end; iter_127798++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_127862 = l_n_m_114584;
        int64_t gtid_118943 = iter_127798;
        int64_t remnant_127863 = iter_127798 - gtid_118943;
        int64_t x_127490 = ((int64_t *) mem_122124.mem)[gtid_118939 *
                                                        l_n_m_114584 +
                                                        gtid_118943];
        float x_127491 = ((float *) mem_122128.mem)[gtid_118939 * l_n_m_114584 +
                                                    gtid_118943];
        int64_t min_arg_127492 = mul64(t_jump_114541, gtid_118943);
        int64_t min_res_127493 = smin64(i_114610, min_arg_127492);
        float defunc_0_f_res_127494 = sitofp_i64_f32(min_res_127493);
        int64_t flat_tid_118944 = (int64_t) 0;
        int32_t num_tasks_127864;
        struct futhark_mc_task_131554 futhark_mc_task_131554;
        
        futhark_mc_task_131554.ctx = ctx;
        futhark_mc_task_131554.free_n_114534 = n_114534;
        futhark_mc_task_131554.free_l_window_114538 = l_window_114538;
        futhark_mc_task_131554.free_gtid_118939 = gtid_118939;
        futhark_mc_task_131554.free_x_119062 = x_119062;
        futhark_mc_task_131554.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131554.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131554.free_x_127490 = x_127490;
        futhark_mc_task_131554.free_x_127491 = x_127491;
        futhark_mc_task_131554.free_defunc_0_f_res_127494 =
            defunc_0_f_res_127494;
        futhark_mc_task_131554.free_mem_127495 = mem_127495;
        futhark_mc_task_131554.free_mem_127496 = mem_127496;
        
        struct scheduler_segop futhark_mc_task_131554_task;
        
        futhark_mc_task_131554_task.args = &futhark_mc_task_131554;
        futhark_mc_task_131554_task.top_level_fn =
            futhark_mc_segmap_task_131555;
        futhark_mc_task_131554_task.name = "futhark_mc_segmap_task_131555";
        futhark_mc_task_131554_task.iterations = l_window_114538;
        futhark_mc_task_131554_task.task_time =
            &ctx->futhark_mc_segmap_task_131555_total_time;
        futhark_mc_task_131554_task.task_iter =
            &ctx->futhark_mc_segmap_task_131555_total_iter;
        futhark_mc_task_131554_task.sched = STATIC;
        futhark_mc_task_131554_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131555_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131554_task);
        
        if (futhark_mc_segmap_task_131555_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float defunc_2_reduce_res_127518;
        float defunc_2_reduce_res_127519;
        float defunc_2_reduce_res_127520;
        float defunc_2_reduce_res_127521;
        float defunc_2_reduce_res_127522;
        int64_t flat_tid_118946 = (int64_t) 0;
        int32_t num_tasks_127873;
        struct futhark_mc_task_131558 futhark_mc_task_131558;
        
        futhark_mc_task_131558.ctx = ctx;
        futhark_mc_task_131558.free_mem_127495 = mem_127495;
        futhark_mc_task_131558.free_mem_127496 = mem_127496;
        futhark_mc_task_131558.retval_defunc_2_reduce_res_127518 =
            &defunc_2_reduce_res_127518;
        futhark_mc_task_131558.retval_defunc_2_reduce_res_127519 =
            &defunc_2_reduce_res_127519;
        futhark_mc_task_131558.retval_defunc_2_reduce_res_127520 =
            &defunc_2_reduce_res_127520;
        futhark_mc_task_131558.retval_defunc_2_reduce_res_127521 =
            &defunc_2_reduce_res_127521;
        futhark_mc_task_131558.retval_defunc_2_reduce_res_127522 =
            &defunc_2_reduce_res_127522;
        futhark_mc_task_131558.retval_mem_127516 = mem_127516;
        futhark_mc_task_131558.retval_mem_127517 = mem_127517;
        
        struct scheduler_segop futhark_mc_task_131558_task;
        
        futhark_mc_task_131558_task.args = &futhark_mc_task_131558;
        futhark_mc_task_131558_task.top_level_fn =
            futhark_mc_segred_task_131559;
        futhark_mc_task_131558_task.name = "futhark_mc_segred_task_131559";
        futhark_mc_task_131558_task.iterations = l_window_114538;
        futhark_mc_task_131558_task.task_time =
            &ctx->futhark_mc_segred_task_131559_total_time;
        futhark_mc_task_131558_task.task_iter =
            &ctx->futhark_mc_segred_task_131559_total_iter;
        futhark_mc_task_131558_task.sched = STATIC;
        futhark_mc_task_131558_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131559_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131558_task);
        
        if (futhark_mc_segred_task_131559_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float x_127546 = defunc_2_reduce_res_127520 *
              defunc_2_reduce_res_127522;
        float y_127547 = defunc_2_reduce_res_127521 *
              defunc_2_reduce_res_127521;
        float a12_127548 = x_127546 - y_127547;
        float x_127549 = defunc_2_reduce_res_127520 *
              defunc_2_reduce_res_127521;
        float y_127550 = defunc_2_reduce_res_127519 *
              defunc_2_reduce_res_127522;
        float b12_127551 = x_127549 - y_127550;
        float x_127552 = defunc_2_reduce_res_127519 *
              defunc_2_reduce_res_127521;
        float y_127553 = defunc_2_reduce_res_127520 *
              defunc_2_reduce_res_127520;
        float c12_127554 = x_127552 - y_127553;
        float x_127555 = defunc_2_reduce_res_127518 *
              defunc_2_reduce_res_127522;
        float b2_127556 = x_127555 - y_127553;
        float x_127557 = defunc_2_reduce_res_127519 *
              defunc_2_reduce_res_127520;
        float y_127558 = defunc_2_reduce_res_127518 *
              defunc_2_reduce_res_127521;
        float c2_127559 = x_127557 - y_127558;
        float x_127560 = defunc_2_reduce_res_127518 * a12_127548;
        float y_127561 = defunc_2_reduce_res_127519 * b12_127551;
        float x_127562 = x_127560 + y_127561;
        float y_127563 = defunc_2_reduce_res_127520 * c12_127554;
        float y_127564 = x_127562 + y_127563;
        float det_127565 = 1.0F / y_127564;
        float a12_127566 = a12_127548 * det_127565;
        float b12_127567 = b12_127551 * det_127565;
        float c12_127568 = c12_127554 * det_127565;
        float b2_127569 = b2_127556 * det_127565;
        float c2_127570 = c2_127559 * det_127565;
        float defunc_2_reduce_res_127571;
        float defunc_2_reduce_res_127572;
        int64_t flat_tid_118948 = (int64_t) 0;
        int32_t num_tasks_127906;
        struct futhark_mc_task_131567 futhark_mc_task_131567;
        
        futhark_mc_task_131567.ctx = ctx;
        futhark_mc_task_131567.free_n_114534 = n_114534;
        futhark_mc_task_131567.free_gtid_118939 = gtid_118939;
        futhark_mc_task_131567.free_x_119062 = x_119062;
        futhark_mc_task_131567.free_mem_122426 = mem_122426.mem;
        futhark_mc_task_131567.free_x_127490 = x_127490;
        futhark_mc_task_131567.free_mem_127496 = mem_127496;
        futhark_mc_task_131567.free_mem_127516 = mem_127516;
        futhark_mc_task_131567.free_mem_127517 = mem_127517;
        futhark_mc_task_131567.free_a12_127566 = a12_127566;
        futhark_mc_task_131567.free_b12_127567 = b12_127567;
        futhark_mc_task_131567.free_c12_127568 = c12_127568;
        futhark_mc_task_131567.free_b2_127569 = b2_127569;
        futhark_mc_task_131567.free_c2_127570 = c2_127570;
        futhark_mc_task_131567.retval_defunc_2_reduce_res_127571 =
            &defunc_2_reduce_res_127571;
        futhark_mc_task_131567.retval_defunc_2_reduce_res_127572 =
            &defunc_2_reduce_res_127572;
        
        struct scheduler_segop futhark_mc_task_131567_task;
        
        futhark_mc_task_131567_task.args = &futhark_mc_task_131567;
        futhark_mc_task_131567_task.top_level_fn =
            futhark_mc_segred_task_131568;
        futhark_mc_task_131567_task.name = "futhark_mc_segred_task_131568";
        futhark_mc_task_131567_task.iterations = l_window_114538;
        futhark_mc_task_131567_task.task_time =
            &ctx->futhark_mc_segred_task_131568_total_time;
        futhark_mc_task_131567_task.task_iter =
            &ctx->futhark_mc_segred_task_131568_total_iter;
        futhark_mc_task_131567_task.sched = STATIC;
        futhark_mc_task_131567_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131568_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131567_task);
        
        if (futhark_mc_segred_task_131568_err != 0) {
            err = 1;
            goto cleanup;
        }
        ((float *) mem_122792.mem)[gtid_118943] = defunc_2_reduce_res_127571;
        ((float *) mem_122795.mem)[gtid_118943] = defunc_2_reduce_res_127572;
    }
    
  cleanup:
    { }
    free(mem_127495);
    free(mem_127496);
    free(mem_127516);
    free(mem_127517);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131549_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131549_end -
                 futhark_mc_segmap_parloop_131549_start;
        
        ctx->futhark_mc_segmap_parloop_131549_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131549_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131549_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131547(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118942 = tid;
    int num_tasks_127716 = info.nsubtasks;
    struct futhark_mc_task_131539 *futhark_mc_task_131539 =
                                  (struct futhark_mc_task_131539 *) args;
    struct futhark_context *ctx = futhark_mc_task_131539->ctx;
    uint64_t futhark_mc_segmap_nested_task_131547_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131547_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131539->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131539->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131539->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131539->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131539->free_i_114610;
    int64_t gtid_118939 = futhark_mc_task_131539->free_gtid_118939;
    int64_t x_119062 = futhark_mc_task_131539->free_x_119062;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131539->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131539->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131539->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131539->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131539->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122718 = futhark_mc_task_131539->free_bytes_122718;
    struct memblock mem_122792 = {.desc ="mem_122792", .mem =
                                  futhark_mc_task_131539->free_mem_122792,
                                  .size =0, .references =NULL};
    struct memblock mem_122795 = {.desc ="mem_122795", .mem =
                                  futhark_mc_task_131539->free_mem_122795,
                                  .size =0, .references =NULL};
    int64_t iter_127798;
    struct futhark_mc_segmap_parloop_struct_131548
    futhark_mc_segmap_parloop_struct_131548;
    
    futhark_mc_segmap_parloop_struct_131548.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131548.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131548.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131548.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131548.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131548.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131548.free_gtid_118939 = gtid_118939;
    futhark_mc_segmap_parloop_struct_131548.free_x_119062 = x_119062;
    futhark_mc_segmap_parloop_struct_131548.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131548.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131548.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131548.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131548.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131548.free_bytes_122718 = bytes_122718;
    futhark_mc_segmap_parloop_struct_131548.free_mem_122792 = mem_122792.mem;
    futhark_mc_segmap_parloop_struct_131548.free_mem_122795 = mem_122795.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131549_task;
    
    futhark_mc_segmap_parloop_131549_task.name =
        "futhark_mc_segmap_parloop_131549";
    futhark_mc_segmap_parloop_131549_task.fn = futhark_mc_segmap_parloop_131549;
    futhark_mc_segmap_parloop_131549_task.args =
        &futhark_mc_segmap_parloop_struct_131548;
    futhark_mc_segmap_parloop_131549_task.iterations = iterations;
    futhark_mc_segmap_parloop_131549_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131549_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131549_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131549_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131549_task);
    
    if (futhark_mc_segmap_parloop_131549_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131549_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131549_total_end -
                 futhark_mc_segmap_parloop_131549_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131549_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131549_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131549_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131547_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131547_end -
                 futhark_mc_segmap_nested_task_131547_start;
        
        ctx->futhark_mc_segmap_nested_task_131547_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131547_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131547_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131536(void *args, int64_t start,
                                            int64_t end, int flat_tid_118938,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131535
    *futhark_mc_segmap_parloop_struct_131535 =
    (struct futhark_mc_segmap_parloop_struct_131535 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131535->ctx;
    uint64_t futhark_mc_segmap_parloop_131536_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131536_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131535->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131535->free_n_114534;
    int64_t l_window_114538 =
            futhark_mc_segmap_parloop_struct_131535->free_l_window_114538;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131535->free_t_jump_114541;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131535->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131535->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131535->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131535->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 =
            futhark_mc_segmap_parloop_struct_131535->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_segmap_parloop_struct_131535->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_segmap_parloop_struct_131535->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_segmap_parloop_struct_131535->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131535->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122718 =
            futhark_mc_segmap_parloop_struct_131535->free_bytes_122718;
    struct memblock mem_122889 = {.desc ="mem_122889", .mem =
                                  futhark_mc_segmap_parloop_struct_131535->free_mem_122889,
                                  .size =0, .references =NULL};
    struct memblock mem_122893 = {.desc ="mem_122893", .mem =
                                  futhark_mc_segmap_parloop_struct_131535->free_mem_122893,
                                  .size =0, .references =NULL};
    size_t mem_122792_cached_sizze_131537 = 0;
    char *mem_122792 = NULL;
    size_t mem_122795_cached_sizze_131538 = 0;
    char *mem_122795 = NULL;
    int64_t iterations = end - start;
    int64_t iter_127489 = start;
    
    if (mem_122792_cached_sizze_131537 < (size_t) bytes_122055) {
        mem_122792 = realloc(mem_122792, bytes_122055);
        mem_122792_cached_sizze_131537 = bytes_122055;
    }
    if (mem_122795_cached_sizze_131538 < (size_t) bytes_122055) {
        mem_122795 = realloc(mem_122795, bytes_122055);
        mem_122795_cached_sizze_131538 = bytes_122055;
    }
    for (; iter_127489 < end; iter_127489++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_127714 = m_114533;
        int64_t gtid_118939 = iter_127489;
        int64_t remnant_127715 = iter_127489 - gtid_118939;
        int64_t x_119062 = ((int64_t *) mem_121982.mem)[gtid_118939];
        int64_t flat_tid_118940 = (int64_t) 0;
        int32_t num_tasks_127716;
        int64_t flat_tid_118942 = (int64_t) 0;
        struct futhark_mc_task_131539 futhark_mc_task_131539;
        
        futhark_mc_task_131539.ctx = ctx;
        futhark_mc_task_131539.free_n_114534 = n_114534;
        futhark_mc_task_131539.free_l_window_114538 = l_window_114538;
        futhark_mc_task_131539.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131539.free_l_n_m_114584 = l_n_m_114584;
        futhark_mc_task_131539.free_i_114610 = i_114610;
        futhark_mc_task_131539.free_gtid_118939 = gtid_118939;
        futhark_mc_task_131539.free_x_119062 = x_119062;
        futhark_mc_task_131539.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131539.free_mem_122124 = mem_122124.mem;
        futhark_mc_task_131539.free_mem_122128 = mem_122128.mem;
        futhark_mc_task_131539.free_mem_122426 = mem_122426.mem;
        futhark_mc_task_131539.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131539.free_bytes_122718 = bytes_122718;
        futhark_mc_task_131539.free_mem_122792 = mem_122792;
        futhark_mc_task_131539.free_mem_122795 = mem_122795;
        
        struct scheduler_segop futhark_mc_task_131539_task;
        
        futhark_mc_task_131539_task.args = &futhark_mc_task_131539;
        futhark_mc_task_131539_task.top_level_fn =
            futhark_mc_segmap_task_131540;
        futhark_mc_task_131539_task.name = "futhark_mc_segmap_task_131540";
        futhark_mc_task_131539_task.iterations = l_n_m_114584;
        futhark_mc_task_131539_task.task_time =
            &ctx->futhark_mc_segmap_task_131540_total_time;
        futhark_mc_task_131539_task.task_iter =
            &ctx->futhark_mc_segmap_task_131540_total_iter;
        futhark_mc_task_131539_task.sched = STATIC;
        futhark_mc_task_131539_task.nested_fn =
            futhark_mc_segmap_nested_task_131547;
        
        int futhark_mc_segmap_task_131540_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131539_task);
        
        if (futhark_mc_segmap_task_131540_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122889.mem + gtid_118939 * l_n_m_114584 * (int64_t) 4,
                mem_122792 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
        memmove(mem_122893.mem + gtid_118939 * l_n_m_114584 * (int64_t) 4,
                mem_122795 + (int64_t) 0, l_n_m_114584 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122792);
    free(mem_122795);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131536_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131536_end -
                 futhark_mc_segmap_parloop_131536_start;
        
        ctx->futhark_mc_segmap_parloop_131536_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131536_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131536_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131534(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_118938 = tid;
    int num_tasks_127355 = info.nsubtasks;
    struct futhark_mc_task_131524 *futhark_mc_task_131524 =
                                  (struct futhark_mc_task_131524 *) args;
    struct futhark_context *ctx = futhark_mc_task_131524->ctx;
    uint64_t futhark_mc_segmap_nested_task_131534_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131534_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131524->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131524->free_n_114534;
    int64_t l_window_114538 = futhark_mc_task_131524->free_l_window_114538;
    int64_t t_jump_114541 = futhark_mc_task_131524->free_t_jump_114541;
    int64_t l_n_m_114584 = futhark_mc_task_131524->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131524->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131524->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131524->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122055 = futhark_mc_task_131524->free_bytes_122055;
    struct memblock mem_122124 = {.desc ="mem_122124", .mem =
                                  futhark_mc_task_131524->free_mem_122124,
                                  .size =0, .references =NULL};
    struct memblock mem_122128 = {.desc ="mem_122128", .mem =
                                  futhark_mc_task_131524->free_mem_122128,
                                  .size =0, .references =NULL};
    struct memblock mem_122426 = {.desc ="mem_122426", .mem =
                                  futhark_mc_task_131524->free_mem_122426,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131524->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t bytes_122718 = futhark_mc_task_131524->free_bytes_122718;
    struct memblock mem_122889 = {.desc ="mem_122889", .mem =
                                  futhark_mc_task_131524->free_mem_122889,
                                  .size =0, .references =NULL};
    struct memblock mem_122893 = {.desc ="mem_122893", .mem =
                                  futhark_mc_task_131524->free_mem_122893,
                                  .size =0, .references =NULL};
    int64_t iter_127489;
    struct futhark_mc_segmap_parloop_struct_131535
    futhark_mc_segmap_parloop_struct_131535;
    
    futhark_mc_segmap_parloop_struct_131535.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131535.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131535.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131535.free_l_window_114538 =
        l_window_114538;
    futhark_mc_segmap_parloop_struct_131535.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131535.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131535.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131535.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131535.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131535.free_bytes_122055 = bytes_122055;
    futhark_mc_segmap_parloop_struct_131535.free_mem_122124 = mem_122124.mem;
    futhark_mc_segmap_parloop_struct_131535.free_mem_122128 = mem_122128.mem;
    futhark_mc_segmap_parloop_struct_131535.free_mem_122426 = mem_122426.mem;
    futhark_mc_segmap_parloop_struct_131535.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131535.free_bytes_122718 = bytes_122718;
    futhark_mc_segmap_parloop_struct_131535.free_mem_122889 = mem_122889.mem;
    futhark_mc_segmap_parloop_struct_131535.free_mem_122893 = mem_122893.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131536_task;
    
    futhark_mc_segmap_parloop_131536_task.name =
        "futhark_mc_segmap_parloop_131536";
    futhark_mc_segmap_parloop_131536_task.fn = futhark_mc_segmap_parloop_131536;
    futhark_mc_segmap_parloop_131536_task.args =
        &futhark_mc_segmap_parloop_struct_131535;
    futhark_mc_segmap_parloop_131536_task.iterations = iterations;
    futhark_mc_segmap_parloop_131536_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131536_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131536_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131536_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131536_task);
    
    if (futhark_mc_segmap_parloop_131536_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131536_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131536_total_end -
                 futhark_mc_segmap_parloop_131536_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131536_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131536_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131536_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131534_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131534_end -
                 futhark_mc_segmap_nested_task_131534_start;
        
        ctx->futhark_mc_segmap_nested_task_131534_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131534_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131534_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131573 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_jump_114542;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_y_115794;
    int64_t free_bytes_121983;
    char *free_defunc_11_loess_l_res_mem_122898;
    char *free_defunc_11_loess_l_res_mem_122899;
    char *free_mem_122921;
};
struct futhark_mc_segmap_parloop_struct_131575 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_jump_114542;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_y_115794;
    int64_t free_bytes_121983;
    char *free_defunc_11_loess_l_res_mem_122898;
    char *free_defunc_11_loess_l_res_mem_122899;
    char *free_mem_122921;
};
static int futhark_mc_segmap_parloop_131576(void *args, int64_t start,
                                            int64_t end, int flat_tid_119279,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131575
    *futhark_mc_segmap_parloop_struct_131575 =
    (struct futhark_mc_segmap_parloop_struct_131575 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131575->ctx;
    uint64_t futhark_mc_segmap_parloop_131576_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131576_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131575->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131575->free_n_114534;
    int64_t l_jump_114542 =
            futhark_mc_segmap_parloop_struct_131575->free_l_jump_114542;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131575->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131575->free_i_114610;
    int64_t y_115794 = futhark_mc_segmap_parloop_struct_131575->free_y_115794;
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131575->free_bytes_121983;
    struct memblock defunc_11_loess_l_res_mem_122898 = {.desc =
                                                        "defunc_11_loess_l_res_mem_122898",
                                                        .mem =
                                                        futhark_mc_segmap_parloop_struct_131575->free_defunc_11_loess_l_res_mem_122898,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock defunc_11_loess_l_res_mem_122899 = {.desc =
                                                        "defunc_11_loess_l_res_mem_122899",
                                                        .mem =
                                                        futhark_mc_segmap_parloop_struct_131575->free_defunc_11_loess_l_res_mem_122899,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock mem_122921 = {.desc ="mem_122921", .mem =
                                  futhark_mc_segmap_parloop_struct_131575->free_mem_122921,
                                  .size =0, .references =NULL};
    size_t mem_122905_cached_sizze_131577 = 0;
    char *mem_122905 = NULL;
    int64_t iterations = end - start;
    int64_t iter_127922 = start;
    
    if (mem_122905_cached_sizze_131577 < (size_t) bytes_121983) {
        mem_122905 = realloc(mem_122905, bytes_121983);
        mem_122905_cached_sizze_131577 = bytes_121983;
    }
    for (; iter_127922 < end; iter_127922++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_127972 = m_114533;
        int64_t gtid_119280 = iter_127922;
        int64_t remnant_127973 = iter_127922 - gtid_119280;
        
        for (int64_t i_127923 = 0; i_127923 < n_114534; i_127923++) {
            int64_t m_v_127925 = sdiv64(i_127923, l_jump_114542);
            bool cond_127926 = m_v_127925 == y_115794;
            int64_t j_127927;
            
            if (cond_127926) {
                int64_t j_t_res_127928 = sub64(m_v_127925, (int64_t) 1);
                
                j_127927 = j_t_res_127928;
            } else {
                j_127927 = m_v_127925;
            }
            
            int64_t min_arg_127929 = mul64(l_jump_114542, j_127927);
            int64_t min_res_127930 = smin64(i_114610, min_arg_127929);
            int64_t defunc_0_m_fun_arg_127931 = add64((int64_t) 1, j_127927);
            int64_t min_arg_127932 = mul64(l_jump_114542,
                                           defunc_0_m_fun_arg_127931);
            int64_t min_res_127933 = smin64(i_114610, min_arg_127932);
            int64_t i64_arg_127934 = sub64(min_res_127933, min_res_127930);
            float i64_res_127935 = sitofp_i64_f32(i64_arg_127934);
            int64_t i64_arg_127936 = sub64(i_127923, min_res_127930);
            float i64_res_127937 = sitofp_i64_f32(i64_arg_127936);
            float u_127938 = i64_res_127937 / i64_res_127935;
            float u2_127939 = u_127938 * u_127938;
            float u3_127940 = u_127938 * u2_127939;
            float x_127941 = 2.0F * u3_127940;
            float y_127942 = 3.0F * u2_127939;
            float x_127943 = x_127941 - y_127942;
            float x_127944 = 1.0F + x_127943;
            bool x_127945 = sle64((int64_t) 0, j_127927);
            bool y_127946 = slt64(j_127927, l_n_m_114584);
            bool bounds_check_127947 = x_127945 && y_127946;
            bool index_certs_127948;
            
            if (!bounds_check_127947) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", j_127927,
                              "] out of bounds for array of shape [",
                              l_n_m_114584, "].",
                              "-> #0  stl.fut:63:41-47\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:54:3-67:14\n   #4  stl.fut:252:21-67\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:250:15-253:43\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                return 1;
            }
            
            float y_127949 =
                  ((float *) defunc_11_loess_l_res_mem_122898.mem)[gtid_119280 *
                                                                   l_n_m_114584 +
                                                                   j_127927];
            float x_127950 = x_127944 * y_127949;
            float x_127951 = y_127942 - x_127941;
            bool x_127952 = sle64((int64_t) 0, defunc_0_m_fun_arg_127931);
            bool y_127953 = slt64(defunc_0_m_fun_arg_127931, l_n_m_114584);
            bool bounds_check_127954 = x_127952 && y_127953;
            bool index_certs_127955;
            
            if (!bounds_check_127954) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", defunc_0_m_fun_arg_127931,
                              "] out of bounds for array of shape [",
                              l_n_m_114584, "].",
                              "-> #0  stl.fut:64:41-51\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:54:3-67:14\n   #4  stl.fut:252:21-67\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:250:15-253:43\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                return 1;
            }
            
            float y_127956 =
                  ((float *) defunc_11_loess_l_res_mem_122898.mem)[gtid_119280 *
                                                                   l_n_m_114584 +
                                                                   defunc_0_m_fun_arg_127931];
            float y_127957 = x_127951 * y_127956;
            float x_127958 = x_127950 + y_127957;
            float y_127959 = 2.0F * u2_127939;
            float x_127960 = u3_127940 - y_127959;
            float x_127961 = u_127938 + x_127960;
            float y_127962 =
                  ((float *) defunc_11_loess_l_res_mem_122899.mem)[gtid_119280 *
                                                                   l_n_m_114584 +
                                                                   j_127927];
            float x_127963 = x_127961 * y_127962;
            float y_127964 = i64_res_127935 * x_127963;
            float x_127965 = x_127958 + y_127964;
            float x_127966 = u3_127940 - u2_127939;
            float y_127967 =
                  ((float *) defunc_11_loess_l_res_mem_122899.mem)[gtid_119280 *
                                                                   l_n_m_114584 +
                                                                   defunc_0_m_fun_arg_127931];
            float x_127968 = x_127966 * y_127967;
            float y_127969 = i64_res_127935 * x_127968;
            float defunc_0_f_res_127970 = x_127965 + y_127969;
            
            ((float *) mem_122905)[i_127923] = defunc_0_f_res_127970;
        }
        memmove(mem_122921.mem + gtid_119280 * n_114534 * (int64_t) 4,
                mem_122905 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122905);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131576_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131576_end -
                 futhark_mc_segmap_parloop_131576_start;
        
        ctx->futhark_mc_segmap_parloop_131576_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131576_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131576_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131574(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119279 = tid;
    int num_tasks_127921 = info.nsubtasks;
    struct futhark_mc_task_131573 *futhark_mc_task_131573 =
                                  (struct futhark_mc_task_131573 *) args;
    struct futhark_context *ctx = futhark_mc_task_131573->ctx;
    uint64_t futhark_mc_segmap_task_131574_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131574_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131573->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131573->free_n_114534;
    int64_t l_jump_114542 = futhark_mc_task_131573->free_l_jump_114542;
    int64_t l_n_m_114584 = futhark_mc_task_131573->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131573->free_i_114610;
    int64_t y_115794 = futhark_mc_task_131573->free_y_115794;
    int64_t bytes_121983 = futhark_mc_task_131573->free_bytes_121983;
    struct memblock defunc_11_loess_l_res_mem_122898 = {.desc =
                                                        "defunc_11_loess_l_res_mem_122898",
                                                        .mem =
                                                        futhark_mc_task_131573->free_defunc_11_loess_l_res_mem_122898,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock defunc_11_loess_l_res_mem_122899 = {.desc =
                                                        "defunc_11_loess_l_res_mem_122899",
                                                        .mem =
                                                        futhark_mc_task_131573->free_defunc_11_loess_l_res_mem_122899,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock mem_122921 = {.desc ="mem_122921", .mem =
                                  futhark_mc_task_131573->free_mem_122921,
                                  .size =0, .references =NULL};
    int64_t iter_127922;
    struct futhark_mc_segmap_parloop_struct_131575
    futhark_mc_segmap_parloop_struct_131575;
    
    futhark_mc_segmap_parloop_struct_131575.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131575.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131575.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131575.free_l_jump_114542 = l_jump_114542;
    futhark_mc_segmap_parloop_struct_131575.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131575.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131575.free_y_115794 = y_115794;
    futhark_mc_segmap_parloop_struct_131575.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131575.free_defunc_11_loess_l_res_mem_122898 =
        defunc_11_loess_l_res_mem_122898.mem;
    futhark_mc_segmap_parloop_struct_131575.free_defunc_11_loess_l_res_mem_122899 =
        defunc_11_loess_l_res_mem_122899.mem;
    futhark_mc_segmap_parloop_struct_131575.free_mem_122921 = mem_122921.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131576_task;
    
    futhark_mc_segmap_parloop_131576_task.name =
        "futhark_mc_segmap_parloop_131576";
    futhark_mc_segmap_parloop_131576_task.fn = futhark_mc_segmap_parloop_131576;
    futhark_mc_segmap_parloop_131576_task.args =
        &futhark_mc_segmap_parloop_struct_131575;
    futhark_mc_segmap_parloop_131576_task.iterations = iterations;
    futhark_mc_segmap_parloop_131576_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131576_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131576_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131576_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131576_task);
    
    if (futhark_mc_segmap_parloop_131576_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131576_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131576_total_end -
                 futhark_mc_segmap_parloop_131576_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131576_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131576_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131576_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131574_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131574_end -
                 futhark_mc_segmap_task_131574_start;
        
        ctx->futhark_mc_segmap_task_131574_runs[tid]++;
        ctx->futhark_mc_segmap_task_131574_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131574_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131579 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_l_jump_114542;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_y_115794;
    int64_t free_bytes_121983;
    char *free_defunc_11_loess_l_res_mem_122898;
    char *free_defunc_11_loess_l_res_mem_122899;
    char *free_mem_122921;
};
struct futhark_mc_task_131582 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_jump_114542;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_y_115794;
    int64_t free_gtid_119282;
    char *free_defunc_11_loess_l_res_mem_122898;
    char *free_defunc_11_loess_l_res_mem_122899;
    char *free_mem_122902;
};
struct futhark_mc_segmap_parloop_struct_131584 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_l_jump_114542;
    int64_t free_l_n_m_114584;
    int64_t free_i_114610;
    int64_t free_y_115794;
    int64_t free_gtid_119282;
    char *free_defunc_11_loess_l_res_mem_122898;
    char *free_defunc_11_loess_l_res_mem_122899;
    char *free_mem_122902;
};
static int futhark_mc_segmap_parloop_131585(void *args, int64_t start,
                                            int64_t end, int flat_tid_119283,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131584
    *futhark_mc_segmap_parloop_struct_131584 =
    (struct futhark_mc_segmap_parloop_struct_131584 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131584->ctx;
    uint64_t futhark_mc_segmap_parloop_131585_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131585_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131584->free_n_114534;
    int64_t l_jump_114542 =
            futhark_mc_segmap_parloop_struct_131584->free_l_jump_114542;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131584->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131584->free_i_114610;
    int64_t y_115794 = futhark_mc_segmap_parloop_struct_131584->free_y_115794;
    int64_t gtid_119282 =
            futhark_mc_segmap_parloop_struct_131584->free_gtid_119282;
    struct memblock defunc_11_loess_l_res_mem_122898 = {.desc =
                                                        "defunc_11_loess_l_res_mem_122898",
                                                        .mem =
                                                        futhark_mc_segmap_parloop_struct_131584->free_defunc_11_loess_l_res_mem_122898,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock defunc_11_loess_l_res_mem_122899 = {.desc =
                                                        "defunc_11_loess_l_res_mem_122899",
                                                        .mem =
                                                        futhark_mc_segmap_parloop_struct_131584->free_defunc_11_loess_l_res_mem_122899,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock mem_122902 = {.desc ="mem_122902", .mem =
                                  futhark_mc_segmap_parloop_struct_131584->free_mem_122902,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_128025 = start;
    
    for (; iter_128025 < end; iter_128025++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128027 = n_114534;
        int64_t gtid_119284 = iter_128025;
        int64_t remnant_128028 = iter_128025 - gtid_119284;
        int64_t m_v_127976 = sdiv64(gtid_119284, l_jump_114542);
        bool cond_127977 = m_v_127976 == y_115794;
        int64_t j_127978;
        
        if (cond_127977) {
            int64_t j_t_res_128026 = sub64(m_v_127976, (int64_t) 1);
            
            j_127978 = j_t_res_128026;
        } else {
            j_127978 = m_v_127976;
        }
        
        int64_t min_arg_127980 = mul64(l_jump_114542, j_127978);
        int64_t min_res_127981 = smin64(i_114610, min_arg_127980);
        int64_t defunc_0_m_fun_arg_127982 = add64((int64_t) 1, j_127978);
        int64_t min_arg_127983 = mul64(l_jump_114542,
                                       defunc_0_m_fun_arg_127982);
        int64_t min_res_127984 = smin64(i_114610, min_arg_127983);
        int64_t i64_arg_127985 = sub64(min_res_127984, min_res_127981);
        float i64_res_127986 = sitofp_i64_f32(i64_arg_127985);
        int64_t i64_arg_127987 = sub64(gtid_119284, min_res_127981);
        float i64_res_127988 = sitofp_i64_f32(i64_arg_127987);
        float u_127989 = i64_res_127988 / i64_res_127986;
        float u2_127990 = u_127989 * u_127989;
        float u3_127991 = u_127989 * u2_127990;
        float x_127992 = 2.0F * u3_127991;
        float y_127993 = 3.0F * u2_127990;
        float x_127994 = x_127992 - y_127993;
        float x_127995 = 1.0F + x_127994;
        bool x_127996 = sle64((int64_t) 0, j_127978);
        bool y_127997 = slt64(j_127978, l_n_m_114584);
        bool bounds_check_127998 = x_127996 && y_127997;
        bool index_certs_127999;
        
        if (!bounds_check_127998) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", j_127978,
                                   "] out of bounds for array of shape [",
                                   l_n_m_114584, "].",
                                   "-> #0  stl.fut:63:41-47\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:54:3-67:14\n   #4  stl.fut:252:21-67\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:250:15-253:43\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
            return 1;
        }
        
        float y_128000 =
              ((float *) defunc_11_loess_l_res_mem_122898.mem)[gtid_119282 *
                                                               l_n_m_114584 +
                                                               j_127978];
        float x_128001 = x_127995 * y_128000;
        float x_128002 = y_127993 - x_127992;
        bool x_128003 = sle64((int64_t) 0, defunc_0_m_fun_arg_127982);
        bool y_128004 = slt64(defunc_0_m_fun_arg_127982, l_n_m_114584);
        bool bounds_check_128005 = x_128003 && y_128004;
        bool index_certs_128006;
        
        if (!bounds_check_128005) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", defunc_0_m_fun_arg_127982,
                                   "] out of bounds for array of shape [",
                                   l_n_m_114584, "].",
                                   "-> #0  stl.fut:64:41-51\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:54:3-67:14\n   #4  stl.fut:252:21-67\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:250:15-253:43\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
            return 1;
        }
        
        float y_128007 =
              ((float *) defunc_11_loess_l_res_mem_122898.mem)[gtid_119282 *
                                                               l_n_m_114584 +
                                                               defunc_0_m_fun_arg_127982];
        float y_128008 = x_128002 * y_128007;
        float x_128009 = x_128001 + y_128008;
        float y_128010 = 2.0F * u2_127990;
        float x_128011 = u3_127991 - y_128010;
        float x_128012 = u_127989 + x_128011;
        float y_128013 =
              ((float *) defunc_11_loess_l_res_mem_122899.mem)[gtid_119282 *
                                                               l_n_m_114584 +
                                                               j_127978];
        float x_128014 = x_128012 * y_128013;
        float y_128015 = i64_res_127986 * x_128014;
        float x_128016 = x_128009 + y_128015;
        float x_128017 = u3_127991 - u2_127990;
        float y_128018 =
              ((float *) defunc_11_loess_l_res_mem_122899.mem)[gtid_119282 *
                                                               l_n_m_114584 +
                                                               defunc_0_m_fun_arg_127982];
        float x_128019 = x_128017 * y_128018;
        float y_128020 = i64_res_127986 * x_128019;
        float defunc_0_f_res_128021 = x_128016 + y_128020;
        
        ((float *) mem_122902.mem)[gtid_119284] = defunc_0_f_res_128021;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131585_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131585_end -
                 futhark_mc_segmap_parloop_131585_start;
        
        ctx->futhark_mc_segmap_parloop_131585_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131585_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131585_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131583(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119283 = tid;
    int num_tasks_128024 = info.nsubtasks;
    struct futhark_mc_task_131582 *futhark_mc_task_131582 =
                                  (struct futhark_mc_task_131582 *) args;
    struct futhark_context *ctx = futhark_mc_task_131582->ctx;
    uint64_t futhark_mc_segmap_task_131583_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131583_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131582->free_n_114534;
    int64_t l_jump_114542 = futhark_mc_task_131582->free_l_jump_114542;
    int64_t l_n_m_114584 = futhark_mc_task_131582->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131582->free_i_114610;
    int64_t y_115794 = futhark_mc_task_131582->free_y_115794;
    int64_t gtid_119282 = futhark_mc_task_131582->free_gtid_119282;
    struct memblock defunc_11_loess_l_res_mem_122898 = {.desc =
                                                        "defunc_11_loess_l_res_mem_122898",
                                                        .mem =
                                                        futhark_mc_task_131582->free_defunc_11_loess_l_res_mem_122898,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock defunc_11_loess_l_res_mem_122899 = {.desc =
                                                        "defunc_11_loess_l_res_mem_122899",
                                                        .mem =
                                                        futhark_mc_task_131582->free_defunc_11_loess_l_res_mem_122899,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock mem_122902 = {.desc ="mem_122902", .mem =
                                  futhark_mc_task_131582->free_mem_122902,
                                  .size =0, .references =NULL};
    int64_t iter_128025;
    struct futhark_mc_segmap_parloop_struct_131584
    futhark_mc_segmap_parloop_struct_131584;
    
    futhark_mc_segmap_parloop_struct_131584.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131584.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131584.free_l_jump_114542 = l_jump_114542;
    futhark_mc_segmap_parloop_struct_131584.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131584.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131584.free_y_115794 = y_115794;
    futhark_mc_segmap_parloop_struct_131584.free_gtid_119282 = gtid_119282;
    futhark_mc_segmap_parloop_struct_131584.free_defunc_11_loess_l_res_mem_122898 =
        defunc_11_loess_l_res_mem_122898.mem;
    futhark_mc_segmap_parloop_struct_131584.free_defunc_11_loess_l_res_mem_122899 =
        defunc_11_loess_l_res_mem_122899.mem;
    futhark_mc_segmap_parloop_struct_131584.free_mem_122902 = mem_122902.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131585_task;
    
    futhark_mc_segmap_parloop_131585_task.name =
        "futhark_mc_segmap_parloop_131585";
    futhark_mc_segmap_parloop_131585_task.fn = futhark_mc_segmap_parloop_131585;
    futhark_mc_segmap_parloop_131585_task.args =
        &futhark_mc_segmap_parloop_struct_131584;
    futhark_mc_segmap_parloop_131585_task.iterations = iterations;
    futhark_mc_segmap_parloop_131585_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131585_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131585_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131585_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131585_task);
    
    if (futhark_mc_segmap_parloop_131585_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131585_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131585_total_end -
                 futhark_mc_segmap_parloop_131585_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131585_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131585_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131585_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131583_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131583_end -
                 futhark_mc_segmap_task_131583_start;
        
        ctx->futhark_mc_segmap_task_131583_runs[tid]++;
        ctx->futhark_mc_segmap_task_131583_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131583_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131580(void *args, int64_t start,
                                            int64_t end, int flat_tid_119281,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131579
    *futhark_mc_segmap_parloop_struct_131579 =
    (struct futhark_mc_segmap_parloop_struct_131579 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131579->ctx;
    uint64_t futhark_mc_segmap_parloop_131580_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131580_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131579->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131579->free_n_114534;
    int64_t l_jump_114542 =
            futhark_mc_segmap_parloop_struct_131579->free_l_jump_114542;
    int64_t l_n_m_114584 =
            futhark_mc_segmap_parloop_struct_131579->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131579->free_i_114610;
    int64_t y_115794 = futhark_mc_segmap_parloop_struct_131579->free_y_115794;
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131579->free_bytes_121983;
    struct memblock defunc_11_loess_l_res_mem_122898 = {.desc =
                                                        "defunc_11_loess_l_res_mem_122898",
                                                        .mem =
                                                        futhark_mc_segmap_parloop_struct_131579->free_defunc_11_loess_l_res_mem_122898,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock defunc_11_loess_l_res_mem_122899 = {.desc =
                                                        "defunc_11_loess_l_res_mem_122899",
                                                        .mem =
                                                        futhark_mc_segmap_parloop_struct_131579->free_defunc_11_loess_l_res_mem_122899,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock mem_122921 = {.desc ="mem_122921", .mem =
                                  futhark_mc_segmap_parloop_struct_131579->free_mem_122921,
                                  .size =0, .references =NULL};
    size_t mem_122902_cached_sizze_131581 = 0;
    char *mem_122902 = NULL;
    int64_t iterations = end - start;
    int64_t iter_127975 = start;
    
    if (mem_122902_cached_sizze_131581 < (size_t) bytes_121983) {
        mem_122902 = realloc(mem_122902, bytes_121983);
        mem_122902_cached_sizze_131581 = bytes_121983;
    }
    for (; iter_127975 < end; iter_127975++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128022 = m_114533;
        int64_t gtid_119282 = iter_127975;
        int64_t remnant_128023 = iter_127975 - gtid_119282;
        int64_t flat_tid_119283 = (int64_t) 0;
        int32_t num_tasks_128024;
        struct futhark_mc_task_131582 futhark_mc_task_131582;
        
        futhark_mc_task_131582.ctx = ctx;
        futhark_mc_task_131582.free_n_114534 = n_114534;
        futhark_mc_task_131582.free_l_jump_114542 = l_jump_114542;
        futhark_mc_task_131582.free_l_n_m_114584 = l_n_m_114584;
        futhark_mc_task_131582.free_i_114610 = i_114610;
        futhark_mc_task_131582.free_y_115794 = y_115794;
        futhark_mc_task_131582.free_gtid_119282 = gtid_119282;
        futhark_mc_task_131582.free_defunc_11_loess_l_res_mem_122898 =
            defunc_11_loess_l_res_mem_122898.mem;
        futhark_mc_task_131582.free_defunc_11_loess_l_res_mem_122899 =
            defunc_11_loess_l_res_mem_122899.mem;
        futhark_mc_task_131582.free_mem_122902 = mem_122902;
        
        struct scheduler_segop futhark_mc_task_131582_task;
        
        futhark_mc_task_131582_task.args = &futhark_mc_task_131582;
        futhark_mc_task_131582_task.top_level_fn =
            futhark_mc_segmap_task_131583;
        futhark_mc_task_131582_task.name = "futhark_mc_segmap_task_131583";
        futhark_mc_task_131582_task.iterations = n_114534;
        futhark_mc_task_131582_task.task_time =
            &ctx->futhark_mc_segmap_task_131583_total_time;
        futhark_mc_task_131582_task.task_iter =
            &ctx->futhark_mc_segmap_task_131583_total_iter;
        futhark_mc_task_131582_task.sched = STATIC;
        futhark_mc_task_131582_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131583_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131582_task);
        
        if (futhark_mc_segmap_task_131583_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122921.mem + gtid_119282 * n_114534 * (int64_t) 4,
                mem_122902 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122902);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131580_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131580_end -
                 futhark_mc_segmap_parloop_131580_start;
        
        ctx->futhark_mc_segmap_parloop_131580_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131580_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131580_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131578(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119281 = tid;
    int num_tasks_127921 = info.nsubtasks;
    struct futhark_mc_task_131573 *futhark_mc_task_131573 =
                                  (struct futhark_mc_task_131573 *) args;
    struct futhark_context *ctx = futhark_mc_task_131573->ctx;
    uint64_t futhark_mc_segmap_nested_task_131578_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131578_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131573->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131573->free_n_114534;
    int64_t l_jump_114542 = futhark_mc_task_131573->free_l_jump_114542;
    int64_t l_n_m_114584 = futhark_mc_task_131573->free_l_n_m_114584;
    int64_t i_114610 = futhark_mc_task_131573->free_i_114610;
    int64_t y_115794 = futhark_mc_task_131573->free_y_115794;
    int64_t bytes_121983 = futhark_mc_task_131573->free_bytes_121983;
    struct memblock defunc_11_loess_l_res_mem_122898 = {.desc =
                                                        "defunc_11_loess_l_res_mem_122898",
                                                        .mem =
                                                        futhark_mc_task_131573->free_defunc_11_loess_l_res_mem_122898,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock defunc_11_loess_l_res_mem_122899 = {.desc =
                                                        "defunc_11_loess_l_res_mem_122899",
                                                        .mem =
                                                        futhark_mc_task_131573->free_defunc_11_loess_l_res_mem_122899,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock mem_122921 = {.desc ="mem_122921", .mem =
                                  futhark_mc_task_131573->free_mem_122921,
                                  .size =0, .references =NULL};
    int64_t iter_127975;
    struct futhark_mc_segmap_parloop_struct_131579
    futhark_mc_segmap_parloop_struct_131579;
    
    futhark_mc_segmap_parloop_struct_131579.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131579.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131579.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131579.free_l_jump_114542 = l_jump_114542;
    futhark_mc_segmap_parloop_struct_131579.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_segmap_parloop_struct_131579.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131579.free_y_115794 = y_115794;
    futhark_mc_segmap_parloop_struct_131579.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131579.free_defunc_11_loess_l_res_mem_122898 =
        defunc_11_loess_l_res_mem_122898.mem;
    futhark_mc_segmap_parloop_struct_131579.free_defunc_11_loess_l_res_mem_122899 =
        defunc_11_loess_l_res_mem_122899.mem;
    futhark_mc_segmap_parloop_struct_131579.free_mem_122921 = mem_122921.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131580_task;
    
    futhark_mc_segmap_parloop_131580_task.name =
        "futhark_mc_segmap_parloop_131580";
    futhark_mc_segmap_parloop_131580_task.fn = futhark_mc_segmap_parloop_131580;
    futhark_mc_segmap_parloop_131580_task.args =
        &futhark_mc_segmap_parloop_struct_131579;
    futhark_mc_segmap_parloop_131580_task.iterations = iterations;
    futhark_mc_segmap_parloop_131580_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131580_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131580_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131580_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131580_task);
    
    if (futhark_mc_segmap_parloop_131580_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131580_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131580_total_end -
                 futhark_mc_segmap_parloop_131580_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131580_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131580_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131580_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131578_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131578_end -
                 futhark_mc_segmap_nested_task_131578_start;
        
        ctx->futhark_mc_segmap_nested_task_131578_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131578_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131578_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131586 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_C_len_114582;
    int64_t free_bytes_121983;
    char *free_mem_122328;
    int64_t free_L_l_ixfn_122922;
    char *free_L_l_mem_122923;
    char *free_mem_122945;
};
struct futhark_mc_segmap_parloop_struct_131588 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_C_len_114582;
    int64_t free_bytes_121983;
    char *free_mem_122328;
    int64_t free_L_l_ixfn_122922;
    char *free_L_l_mem_122923;
    char *free_mem_122945;
};
static int futhark_mc_segmap_parloop_131589(void *args, int64_t start,
                                            int64_t end, int flat_tid_119335,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131588
    *futhark_mc_segmap_parloop_struct_131588 =
    (struct futhark_mc_segmap_parloop_struct_131588 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131588->ctx;
    uint64_t futhark_mc_segmap_parloop_131589_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131589_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131588->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131588->free_n_114534;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131588->free_n_p_114536;
    int64_t C_len_114582 =
            futhark_mc_segmap_parloop_struct_131588->free_C_len_114582;
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131588->free_bytes_121983;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_segmap_parloop_struct_131588->free_mem_122328,
                                  .size =0, .references =NULL};
    int64_t L_l_ixfn_122922 =
            futhark_mc_segmap_parloop_struct_131588->free_L_l_ixfn_122922;
    struct memblock L_l_mem_122923 = {.desc ="L_l_mem_122923", .mem =
                                      futhark_mc_segmap_parloop_struct_131588->free_L_l_mem_122923,
                                      .size =0, .references =NULL};
    struct memblock mem_122945 = {.desc ="mem_122945", .mem =
                                  futhark_mc_segmap_parloop_struct_131588->free_mem_122945,
                                  .size =0, .references =NULL};
    size_t mem_122929_cached_sizze_131590 = 0;
    char *mem_122929 = NULL;
    int64_t iterations = end - start;
    int64_t iter_128030 = start;
    
    if (mem_122929_cached_sizze_131590 < (size_t) bytes_121983) {
        mem_122929 = realloc(mem_122929, bytes_121983);
        mem_122929_cached_sizze_131590 = bytes_121983;
    }
    for (; iter_128030 < end; iter_128030++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128038 = m_114533;
        int64_t gtid_119336 = iter_128030;
        int64_t remnant_128039 = iter_128030 - gtid_119336;
        
        for (int64_t i_128031 = 0; i_128031 < n_114534; i_128031++) {
            int64_t slice_128033 = n_p_114536 + i_128031;
            float x_128034 = ((float *) mem_122328.mem)[gtid_119336 *
                                                        C_len_114582 +
                                                        slice_128033];
            float x_128035 = ((float *) L_l_mem_122923.mem)[gtid_119336 *
                                                            L_l_ixfn_122922 +
                                                            i_128031];
            float defunc_1_f_res_128036 = x_128034 - x_128035;
            
            ((float *) mem_122929)[i_128031] = defunc_1_f_res_128036;
        }
        memmove(mem_122945.mem + gtid_119336 * n_114534 * (int64_t) 4,
                mem_122929 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122929);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131589_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131589_end -
                 futhark_mc_segmap_parloop_131589_start;
        
        ctx->futhark_mc_segmap_parloop_131589_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131589_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131589_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131587(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119335 = tid;
    int num_tasks_128029 = info.nsubtasks;
    struct futhark_mc_task_131586 *futhark_mc_task_131586 =
                                  (struct futhark_mc_task_131586 *) args;
    struct futhark_context *ctx = futhark_mc_task_131586->ctx;
    uint64_t futhark_mc_segmap_task_131587_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131587_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131586->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131586->free_n_114534;
    int64_t n_p_114536 = futhark_mc_task_131586->free_n_p_114536;
    int64_t C_len_114582 = futhark_mc_task_131586->free_C_len_114582;
    int64_t bytes_121983 = futhark_mc_task_131586->free_bytes_121983;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_task_131586->free_mem_122328,
                                  .size =0, .references =NULL};
    int64_t L_l_ixfn_122922 = futhark_mc_task_131586->free_L_l_ixfn_122922;
    struct memblock L_l_mem_122923 = {.desc ="L_l_mem_122923", .mem =
                                      futhark_mc_task_131586->free_L_l_mem_122923,
                                      .size =0, .references =NULL};
    struct memblock mem_122945 = {.desc ="mem_122945", .mem =
                                  futhark_mc_task_131586->free_mem_122945,
                                  .size =0, .references =NULL};
    int64_t iter_128030;
    struct futhark_mc_segmap_parloop_struct_131588
    futhark_mc_segmap_parloop_struct_131588;
    
    futhark_mc_segmap_parloop_struct_131588.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131588.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131588.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131588.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131588.free_C_len_114582 = C_len_114582;
    futhark_mc_segmap_parloop_struct_131588.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131588.free_mem_122328 = mem_122328.mem;
    futhark_mc_segmap_parloop_struct_131588.free_L_l_ixfn_122922 =
        L_l_ixfn_122922;
    futhark_mc_segmap_parloop_struct_131588.free_L_l_mem_122923 =
        L_l_mem_122923.mem;
    futhark_mc_segmap_parloop_struct_131588.free_mem_122945 = mem_122945.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131589_task;
    
    futhark_mc_segmap_parloop_131589_task.name =
        "futhark_mc_segmap_parloop_131589";
    futhark_mc_segmap_parloop_131589_task.fn = futhark_mc_segmap_parloop_131589;
    futhark_mc_segmap_parloop_131589_task.args =
        &futhark_mc_segmap_parloop_struct_131588;
    futhark_mc_segmap_parloop_131589_task.iterations = iterations;
    futhark_mc_segmap_parloop_131589_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131589_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131589_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131589_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131589_task);
    
    if (futhark_mc_segmap_parloop_131589_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131589_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131589_total_end -
                 futhark_mc_segmap_parloop_131589_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131589_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131589_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131589_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131587_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131587_end -
                 futhark_mc_segmap_task_131587_start;
        
        ctx->futhark_mc_segmap_task_131587_runs[tid]++;
        ctx->futhark_mc_segmap_task_131587_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131587_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131592 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_C_len_114582;
    int64_t free_bytes_121983;
    char *free_mem_122328;
    int64_t free_L_l_ixfn_122922;
    char *free_L_l_mem_122923;
    char *free_mem_122945;
};
struct futhark_mc_task_131595 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_C_len_114582;
    int64_t free_gtid_119338;
    char *free_mem_122328;
    int64_t free_L_l_ixfn_122922;
    char *free_L_l_mem_122923;
    char *free_mem_122926;
};
struct futhark_mc_segmap_parloop_struct_131597 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_n_p_114536;
    int64_t free_C_len_114582;
    int64_t free_gtid_119338;
    char *free_mem_122328;
    int64_t free_L_l_ixfn_122922;
    char *free_L_l_mem_122923;
    char *free_mem_122926;
};
static int futhark_mc_segmap_parloop_131598(void *args, int64_t start,
                                            int64_t end, int flat_tid_119339,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131597
    *futhark_mc_segmap_parloop_struct_131597 =
    (struct futhark_mc_segmap_parloop_struct_131597 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131597->ctx;
    uint64_t futhark_mc_segmap_parloop_131598_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131598_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131597->free_n_114534;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131597->free_n_p_114536;
    int64_t C_len_114582 =
            futhark_mc_segmap_parloop_struct_131597->free_C_len_114582;
    int64_t gtid_119338 =
            futhark_mc_segmap_parloop_struct_131597->free_gtid_119338;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_segmap_parloop_struct_131597->free_mem_122328,
                                  .size =0, .references =NULL};
    int64_t L_l_ixfn_122922 =
            futhark_mc_segmap_parloop_struct_131597->free_L_l_ixfn_122922;
    struct memblock L_l_mem_122923 = {.desc ="L_l_mem_122923", .mem =
                                      futhark_mc_segmap_parloop_struct_131597->free_L_l_mem_122923,
                                      .size =0, .references =NULL};
    struct memblock mem_122926 = {.desc ="mem_122926", .mem =
                                  futhark_mc_segmap_parloop_struct_131597->free_mem_122926,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_128049 = start;
    
    for (; iter_128049 < end; iter_128049++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128050 = n_114534;
        int64_t gtid_119340 = iter_128049;
        int64_t remnant_128051 = iter_128049 - gtid_119340;
        int64_t slice_128042 = n_p_114536 + gtid_119340;
        float x_128043 = ((float *) mem_122328.mem)[gtid_119338 * C_len_114582 +
                                                    slice_128042];
        float x_128044 = ((float *) L_l_mem_122923.mem)[gtid_119338 *
                                                        L_l_ixfn_122922 +
                                                        gtid_119340];
        float defunc_1_f_res_128045 = x_128043 - x_128044;
        
        ((float *) mem_122926.mem)[gtid_119340] = defunc_1_f_res_128045;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131598_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131598_end -
                 futhark_mc_segmap_parloop_131598_start;
        
        ctx->futhark_mc_segmap_parloop_131598_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131598_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131598_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131596(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119339 = tid;
    int num_tasks_128048 = info.nsubtasks;
    struct futhark_mc_task_131595 *futhark_mc_task_131595 =
                                  (struct futhark_mc_task_131595 *) args;
    struct futhark_context *ctx = futhark_mc_task_131595->ctx;
    uint64_t futhark_mc_segmap_task_131596_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131596_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131595->free_n_114534;
    int64_t n_p_114536 = futhark_mc_task_131595->free_n_p_114536;
    int64_t C_len_114582 = futhark_mc_task_131595->free_C_len_114582;
    int64_t gtid_119338 = futhark_mc_task_131595->free_gtid_119338;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_task_131595->free_mem_122328,
                                  .size =0, .references =NULL};
    int64_t L_l_ixfn_122922 = futhark_mc_task_131595->free_L_l_ixfn_122922;
    struct memblock L_l_mem_122923 = {.desc ="L_l_mem_122923", .mem =
                                      futhark_mc_task_131595->free_L_l_mem_122923,
                                      .size =0, .references =NULL};
    struct memblock mem_122926 = {.desc ="mem_122926", .mem =
                                  futhark_mc_task_131595->free_mem_122926,
                                  .size =0, .references =NULL};
    int64_t iter_128049;
    struct futhark_mc_segmap_parloop_struct_131597
    futhark_mc_segmap_parloop_struct_131597;
    
    futhark_mc_segmap_parloop_struct_131597.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131597.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131597.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131597.free_C_len_114582 = C_len_114582;
    futhark_mc_segmap_parloop_struct_131597.free_gtid_119338 = gtid_119338;
    futhark_mc_segmap_parloop_struct_131597.free_mem_122328 = mem_122328.mem;
    futhark_mc_segmap_parloop_struct_131597.free_L_l_ixfn_122922 =
        L_l_ixfn_122922;
    futhark_mc_segmap_parloop_struct_131597.free_L_l_mem_122923 =
        L_l_mem_122923.mem;
    futhark_mc_segmap_parloop_struct_131597.free_mem_122926 = mem_122926.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131598_task;
    
    futhark_mc_segmap_parloop_131598_task.name =
        "futhark_mc_segmap_parloop_131598";
    futhark_mc_segmap_parloop_131598_task.fn = futhark_mc_segmap_parloop_131598;
    futhark_mc_segmap_parloop_131598_task.args =
        &futhark_mc_segmap_parloop_struct_131597;
    futhark_mc_segmap_parloop_131598_task.iterations = iterations;
    futhark_mc_segmap_parloop_131598_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131598_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131598_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131598_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131598_task);
    
    if (futhark_mc_segmap_parloop_131598_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131598_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131598_total_end -
                 futhark_mc_segmap_parloop_131598_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131598_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131598_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131598_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131596_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131596_end -
                 futhark_mc_segmap_task_131596_start;
        
        ctx->futhark_mc_segmap_task_131596_runs[tid]++;
        ctx->futhark_mc_segmap_task_131596_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131596_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131593(void *args, int64_t start,
                                            int64_t end, int flat_tid_119337,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131592
    *futhark_mc_segmap_parloop_struct_131592 =
    (struct futhark_mc_segmap_parloop_struct_131592 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131592->ctx;
    uint64_t futhark_mc_segmap_parloop_131593_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131593_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131592->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131592->free_n_114534;
    int64_t n_p_114536 =
            futhark_mc_segmap_parloop_struct_131592->free_n_p_114536;
    int64_t C_len_114582 =
            futhark_mc_segmap_parloop_struct_131592->free_C_len_114582;
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131592->free_bytes_121983;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_segmap_parloop_struct_131592->free_mem_122328,
                                  .size =0, .references =NULL};
    int64_t L_l_ixfn_122922 =
            futhark_mc_segmap_parloop_struct_131592->free_L_l_ixfn_122922;
    struct memblock L_l_mem_122923 = {.desc ="L_l_mem_122923", .mem =
                                      futhark_mc_segmap_parloop_struct_131592->free_L_l_mem_122923,
                                      .size =0, .references =NULL};
    struct memblock mem_122945 = {.desc ="mem_122945", .mem =
                                  futhark_mc_segmap_parloop_struct_131592->free_mem_122945,
                                  .size =0, .references =NULL};
    size_t mem_122926_cached_sizze_131594 = 0;
    char *mem_122926 = NULL;
    int64_t iterations = end - start;
    int64_t iter_128041 = start;
    
    if (mem_122926_cached_sizze_131594 < (size_t) bytes_121983) {
        mem_122926 = realloc(mem_122926, bytes_121983);
        mem_122926_cached_sizze_131594 = bytes_121983;
    }
    for (; iter_128041 < end; iter_128041++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128046 = m_114533;
        int64_t gtid_119338 = iter_128041;
        int64_t remnant_128047 = iter_128041 - gtid_119338;
        int64_t flat_tid_119339 = (int64_t) 0;
        int32_t num_tasks_128048;
        struct futhark_mc_task_131595 futhark_mc_task_131595;
        
        futhark_mc_task_131595.ctx = ctx;
        futhark_mc_task_131595.free_n_114534 = n_114534;
        futhark_mc_task_131595.free_n_p_114536 = n_p_114536;
        futhark_mc_task_131595.free_C_len_114582 = C_len_114582;
        futhark_mc_task_131595.free_gtid_119338 = gtid_119338;
        futhark_mc_task_131595.free_mem_122328 = mem_122328.mem;
        futhark_mc_task_131595.free_L_l_ixfn_122922 = L_l_ixfn_122922;
        futhark_mc_task_131595.free_L_l_mem_122923 = L_l_mem_122923.mem;
        futhark_mc_task_131595.free_mem_122926 = mem_122926;
        
        struct scheduler_segop futhark_mc_task_131595_task;
        
        futhark_mc_task_131595_task.args = &futhark_mc_task_131595;
        futhark_mc_task_131595_task.top_level_fn =
            futhark_mc_segmap_task_131596;
        futhark_mc_task_131595_task.name = "futhark_mc_segmap_task_131596";
        futhark_mc_task_131595_task.iterations = n_114534;
        futhark_mc_task_131595_task.task_time =
            &ctx->futhark_mc_segmap_task_131596_total_time;
        futhark_mc_task_131595_task.task_iter =
            &ctx->futhark_mc_segmap_task_131596_total_iter;
        futhark_mc_task_131595_task.sched = STATIC;
        futhark_mc_task_131595_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131596_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131595_task);
        
        if (futhark_mc_segmap_task_131596_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122945.mem + gtid_119338 * n_114534 * (int64_t) 4,
                mem_122926 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122926);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131593_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131593_end -
                 futhark_mc_segmap_parloop_131593_start;
        
        ctx->futhark_mc_segmap_parloop_131593_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131593_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131593_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131591(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119337 = tid;
    int num_tasks_128029 = info.nsubtasks;
    struct futhark_mc_task_131586 *futhark_mc_task_131586 =
                                  (struct futhark_mc_task_131586 *) args;
    struct futhark_context *ctx = futhark_mc_task_131586->ctx;
    uint64_t futhark_mc_segmap_nested_task_131591_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131591_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131586->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131586->free_n_114534;
    int64_t n_p_114536 = futhark_mc_task_131586->free_n_p_114536;
    int64_t C_len_114582 = futhark_mc_task_131586->free_C_len_114582;
    int64_t bytes_121983 = futhark_mc_task_131586->free_bytes_121983;
    struct memblock mem_122328 = {.desc ="mem_122328", .mem =
                                  futhark_mc_task_131586->free_mem_122328,
                                  .size =0, .references =NULL};
    int64_t L_l_ixfn_122922 = futhark_mc_task_131586->free_L_l_ixfn_122922;
    struct memblock L_l_mem_122923 = {.desc ="L_l_mem_122923", .mem =
                                      futhark_mc_task_131586->free_L_l_mem_122923,
                                      .size =0, .references =NULL};
    struct memblock mem_122945 = {.desc ="mem_122945", .mem =
                                  futhark_mc_task_131586->free_mem_122945,
                                  .size =0, .references =NULL};
    int64_t iter_128041;
    struct futhark_mc_segmap_parloop_struct_131592
    futhark_mc_segmap_parloop_struct_131592;
    
    futhark_mc_segmap_parloop_struct_131592.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131592.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131592.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131592.free_n_p_114536 = n_p_114536;
    futhark_mc_segmap_parloop_struct_131592.free_C_len_114582 = C_len_114582;
    futhark_mc_segmap_parloop_struct_131592.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131592.free_mem_122328 = mem_122328.mem;
    futhark_mc_segmap_parloop_struct_131592.free_L_l_ixfn_122922 =
        L_l_ixfn_122922;
    futhark_mc_segmap_parloop_struct_131592.free_L_l_mem_122923 =
        L_l_mem_122923.mem;
    futhark_mc_segmap_parloop_struct_131592.free_mem_122945 = mem_122945.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131593_task;
    
    futhark_mc_segmap_parloop_131593_task.name =
        "futhark_mc_segmap_parloop_131593";
    futhark_mc_segmap_parloop_131593_task.fn = futhark_mc_segmap_parloop_131593;
    futhark_mc_segmap_parloop_131593_task.args =
        &futhark_mc_segmap_parloop_struct_131592;
    futhark_mc_segmap_parloop_131593_task.iterations = iterations;
    futhark_mc_segmap_parloop_131593_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131593_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131593_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131593_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131593_task);
    
    if (futhark_mc_segmap_parloop_131593_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131593_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131593_total_end -
                 futhark_mc_segmap_parloop_131593_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131593_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131593_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131593_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131591_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131591_end -
                 futhark_mc_segmap_nested_task_131591_start;
        
        ctx->futhark_mc_segmap_nested_task_131591_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131591_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131591_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131599 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_Y_mem_121939;
    char *free_mem_121979;
    int64_t free_bytes_121983;
    char *free_mem_122945;
    char *free_mem_122985;
};
struct futhark_mc_segmap_parloop_struct_131601 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_Y_mem_121939;
    char *free_mem_121979;
    int64_t free_bytes_121983;
    char *free_mem_122945;
    char *free_mem_122985;
};
static int futhark_mc_segmap_parloop_131602(void *args, int64_t start,
                                            int64_t end, int flat_tid_119347,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131601
    *futhark_mc_segmap_parloop_struct_131601 =
    (struct futhark_mc_segmap_parloop_struct_131601 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131601->ctx;
    uint64_t futhark_mc_segmap_parloop_131602_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131602_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131601->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131601->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131601->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131601->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131601->free_bytes_121983;
    struct memblock mem_122945 = {.desc ="mem_122945", .mem =
                                  futhark_mc_segmap_parloop_struct_131601->free_mem_122945,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131601->free_mem_122985,
                                  .size =0, .references =NULL};
    size_t mem_122954_cached_sizze_131603 = 0;
    char *mem_122954 = NULL;
    size_t mem_122969_cached_sizze_131604 = 0;
    char *mem_122969 = NULL;
    int64_t iterations = end - start;
    int64_t iter_128053 = start;
    
    if (mem_122954_cached_sizze_131603 < (size_t) bytes_121983) {
        mem_122954 = realloc(mem_122954, bytes_121983);
        mem_122954_cached_sizze_131603 = bytes_121983;
    }
    if (mem_122969_cached_sizze_131604 < (size_t) bytes_121983) {
        mem_122969 = realloc(mem_122969, bytes_121983);
        mem_122969_cached_sizze_131604 = bytes_121983;
    }
    for (; iter_128053 < end; iter_128053++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128070 = m_114533;
        int64_t gtid_119348 = iter_128053;
        int64_t remnant_128071 = iter_128053 - gtid_119348;
        
        for (int64_t i_128054 = 0; i_128054 < n_114534; i_128054++) {
            float x_128056 = ((float *) Y_mem_121939.mem)[gtid_119348 *
                                                          n_114534 + i_128054];
            float x_128057 = ((float *) mem_122945.mem)[gtid_119348 * n_114534 +
                                                        i_128054];
            float defunc_1_f_res_128058 = x_128056 - x_128057;
            
            ((float *) mem_122954)[i_128054] = defunc_1_f_res_128058;
        }
        for (int64_t i_128060 = 0; i_128060 < n_114534; i_128060++) {
            int64_t x_128062 = ((int64_t *) mem_121979.mem)[gtid_119348 *
                                                            n_114534 +
                                                            i_128060];
            bool cond_128063 = sle64((int64_t) 0, x_128062);
            float defunc_0_f_res_128064;
            
            if (cond_128063) {
                bool y_128065 = slt64(x_128062, n_114534);
                bool bounds_check_128066 = cond_128063 && y_128065;
                bool index_certs_128067;
                
                if (!bounds_check_128066) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", x_128062,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:279:21-41\n   #3  /prelude/soacs.fut:67:19-23\n   #4  /prelude/soacs.fut:67:3-37\n   #5  stl.fut:277:13-280:31\n   #6  stl.fut:394:3-405:33\n   #7  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float defunc_0_f_res_t_res_128068 =
                      ((float *) mem_122954)[x_128062];
                
                defunc_0_f_res_128064 = defunc_0_f_res_t_res_128068;
            } else {
                defunc_0_f_res_128064 = 0.0F;
            }
            ((float *) mem_122969)[i_128060] = defunc_0_f_res_128064;
        }
        memmove(mem_122985.mem + gtid_119348 * n_114534 * (int64_t) 4,
                mem_122969 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122954);
    free(mem_122969);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131602_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131602_end -
                 futhark_mc_segmap_parloop_131602_start;
        
        ctx->futhark_mc_segmap_parloop_131602_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131602_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131602_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131600(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119347 = tid;
    int num_tasks_128052 = info.nsubtasks;
    struct futhark_mc_task_131599 *futhark_mc_task_131599 =
                                  (struct futhark_mc_task_131599 *) args;
    struct futhark_context *ctx = futhark_mc_task_131599->ctx;
    uint64_t futhark_mc_segmap_task_131600_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131600_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131599->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131599->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131599->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131599->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131599->free_bytes_121983;
    struct memblock mem_122945 = {.desc ="mem_122945", .mem =
                                  futhark_mc_task_131599->free_mem_122945,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131599->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t iter_128053;
    struct futhark_mc_segmap_parloop_struct_131601
    futhark_mc_segmap_parloop_struct_131601;
    
    futhark_mc_segmap_parloop_struct_131601.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131601.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131601.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131601.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131601.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131601.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131601.free_mem_122945 = mem_122945.mem;
    futhark_mc_segmap_parloop_struct_131601.free_mem_122985 = mem_122985.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131602_task;
    
    futhark_mc_segmap_parloop_131602_task.name =
        "futhark_mc_segmap_parloop_131602";
    futhark_mc_segmap_parloop_131602_task.fn = futhark_mc_segmap_parloop_131602;
    futhark_mc_segmap_parloop_131602_task.args =
        &futhark_mc_segmap_parloop_struct_131601;
    futhark_mc_segmap_parloop_131602_task.iterations = iterations;
    futhark_mc_segmap_parloop_131602_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131602_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131602_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131602_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131602_task);
    
    if (futhark_mc_segmap_parloop_131602_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131602_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131602_total_end -
                 futhark_mc_segmap_parloop_131602_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131602_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131602_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131602_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131600_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131600_end -
                 futhark_mc_segmap_task_131600_start;
        
        ctx->futhark_mc_segmap_task_131600_runs[tid]++;
        ctx->futhark_mc_segmap_task_131600_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131600_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131606 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_Y_mem_121939;
    char *free_mem_121979;
    int64_t free_bytes_121983;
    char *free_mem_122945;
    char *free_mem_122985;
};
struct futhark_mc_task_131610 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119350;
    char *free_Y_mem_121939;
    char *free_mem_122945;
    char *free_mem_122948;
};
struct futhark_mc_segmap_parloop_struct_131612 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119350;
    char *free_Y_mem_121939;
    char *free_mem_122945;
    char *free_mem_122948;
};
static int futhark_mc_segmap_parloop_131613(void *args, int64_t start,
                                            int64_t end, int flat_tid_119351,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131612
    *futhark_mc_segmap_parloop_struct_131612 =
    (struct futhark_mc_segmap_parloop_struct_131612 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131612->ctx;
    uint64_t futhark_mc_segmap_parloop_131613_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131613_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131612->free_n_114534;
    int64_t gtid_119350 =
            futhark_mc_segmap_parloop_struct_131612->free_gtid_119350;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131612->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_122945 = {.desc ="mem_122945", .mem =
                                  futhark_mc_segmap_parloop_struct_131612->free_mem_122945,
                                  .size =0, .references =NULL};
    struct memblock mem_122948 = {.desc ="mem_122948", .mem =
                                  futhark_mc_segmap_parloop_struct_131612->free_mem_122948,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_128088 = start;
    
    for (; iter_128088 < end; iter_128088++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128089 = n_114534;
        int64_t gtid_119352 = iter_128088;
        int64_t remnant_128090 = iter_128088 - gtid_119352;
        float x_128075 = ((float *) Y_mem_121939.mem)[gtid_119350 * n_114534 +
                                                      gtid_119352];
        float x_128076 = ((float *) mem_122945.mem)[gtid_119350 * n_114534 +
                                                    gtid_119352];
        float defunc_1_f_res_128077 = x_128075 - x_128076;
        
        ((float *) mem_122948.mem)[gtid_119352] = defunc_1_f_res_128077;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131613_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131613_end -
                 futhark_mc_segmap_parloop_131613_start;
        
        ctx->futhark_mc_segmap_parloop_131613_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131613_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131613_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131611(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119351 = tid;
    int num_tasks_128087 = info.nsubtasks;
    struct futhark_mc_task_131610 *futhark_mc_task_131610 =
                                  (struct futhark_mc_task_131610 *) args;
    struct futhark_context *ctx = futhark_mc_task_131610->ctx;
    uint64_t futhark_mc_segmap_task_131611_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131611_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131610->free_n_114534;
    int64_t gtid_119350 = futhark_mc_task_131610->free_gtid_119350;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131610->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_122945 = {.desc ="mem_122945", .mem =
                                  futhark_mc_task_131610->free_mem_122945,
                                  .size =0, .references =NULL};
    struct memblock mem_122948 = {.desc ="mem_122948", .mem =
                                  futhark_mc_task_131610->free_mem_122948,
                                  .size =0, .references =NULL};
    int64_t iter_128088;
    struct futhark_mc_segmap_parloop_struct_131612
    futhark_mc_segmap_parloop_struct_131612;
    
    futhark_mc_segmap_parloop_struct_131612.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131612.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131612.free_gtid_119350 = gtid_119350;
    futhark_mc_segmap_parloop_struct_131612.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131612.free_mem_122945 = mem_122945.mem;
    futhark_mc_segmap_parloop_struct_131612.free_mem_122948 = mem_122948.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131613_task;
    
    futhark_mc_segmap_parloop_131613_task.name =
        "futhark_mc_segmap_parloop_131613";
    futhark_mc_segmap_parloop_131613_task.fn = futhark_mc_segmap_parloop_131613;
    futhark_mc_segmap_parloop_131613_task.args =
        &futhark_mc_segmap_parloop_struct_131612;
    futhark_mc_segmap_parloop_131613_task.iterations = iterations;
    futhark_mc_segmap_parloop_131613_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131613_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131613_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131613_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131613_task);
    
    if (futhark_mc_segmap_parloop_131613_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131613_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131613_total_end -
                 futhark_mc_segmap_parloop_131613_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131613_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131613_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131613_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131611_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131611_end -
                 futhark_mc_segmap_task_131611_start;
        
        ctx->futhark_mc_segmap_task_131611_runs[tid]++;
        ctx->futhark_mc_segmap_task_131611_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131611_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131614 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119350;
    char *free_mem_121979;
    char *free_mem_122948;
    char *free_mem_122951;
};
struct futhark_mc_segmap_parloop_struct_131616 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119350;
    char *free_mem_121979;
    char *free_mem_122948;
    char *free_mem_122951;
};
static int futhark_mc_segmap_parloop_131617(void *args, int64_t start,
                                            int64_t end, int flat_tid_119353,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131616
    *futhark_mc_segmap_parloop_struct_131616 =
    (struct futhark_mc_segmap_parloop_struct_131616 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131616->ctx;
    uint64_t futhark_mc_segmap_parloop_131617_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131617_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131616->free_n_114534;
    int64_t gtid_119350 =
            futhark_mc_segmap_parloop_struct_131616->free_gtid_119350;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131616->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122948 = {.desc ="mem_122948", .mem =
                                  futhark_mc_segmap_parloop_struct_131616->free_mem_122948,
                                  .size =0, .references =NULL};
    struct memblock mem_122951 = {.desc ="mem_122951", .mem =
                                  futhark_mc_segmap_parloop_struct_131616->free_mem_122951,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_128092 = start;
    
    for (; iter_128092 < end; iter_128092++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128097 = n_114534;
        int64_t gtid_119354 = iter_128092;
        int64_t remnant_128098 = iter_128092 - gtid_119354;
        int64_t x_128078 = ((int64_t *) mem_121979.mem)[gtid_119350 * n_114534 +
                                                        gtid_119354];
        bool cond_128079 = sle64((int64_t) 0, x_128078);
        float defunc_0_f_res_128080;
        
        if (cond_128079) {
            bool y_128093 = slt64(x_128078, n_114534);
            bool bounds_check_128094 = cond_128079 && y_128093;
            bool index_certs_128095;
            
            if (!bounds_check_128094) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", x_128078,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:279:21-41\n   #3  /prelude/soacs.fut:67:19-23\n   #4  /prelude/soacs.fut:67:3-37\n   #5  stl.fut:277:13-280:31\n   #6  stl.fut:394:3-405:33\n   #7  stl.fut:381:1-405:33\n");
                return 1;
            }
            
            float defunc_0_f_res_t_res_128096 =
                  ((float *) mem_122948.mem)[x_128078];
            
            defunc_0_f_res_128080 = defunc_0_f_res_t_res_128096;
        } else {
            defunc_0_f_res_128080 = 0.0F;
        }
        ((float *) mem_122951.mem)[gtid_119354] = defunc_0_f_res_128080;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131617_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131617_end -
                 futhark_mc_segmap_parloop_131617_start;
        
        ctx->futhark_mc_segmap_parloop_131617_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131617_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131617_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131615(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119353 = tid;
    int num_tasks_128091 = info.nsubtasks;
    struct futhark_mc_task_131614 *futhark_mc_task_131614 =
                                  (struct futhark_mc_task_131614 *) args;
    struct futhark_context *ctx = futhark_mc_task_131614->ctx;
    uint64_t futhark_mc_segmap_task_131615_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131615_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131614->free_n_114534;
    int64_t gtid_119350 = futhark_mc_task_131614->free_gtid_119350;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131614->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_122948 = {.desc ="mem_122948", .mem =
                                  futhark_mc_task_131614->free_mem_122948,
                                  .size =0, .references =NULL};
    struct memblock mem_122951 = {.desc ="mem_122951", .mem =
                                  futhark_mc_task_131614->free_mem_122951,
                                  .size =0, .references =NULL};
    int64_t iter_128092;
    struct futhark_mc_segmap_parloop_struct_131616
    futhark_mc_segmap_parloop_struct_131616;
    
    futhark_mc_segmap_parloop_struct_131616.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131616.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131616.free_gtid_119350 = gtid_119350;
    futhark_mc_segmap_parloop_struct_131616.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131616.free_mem_122948 = mem_122948.mem;
    futhark_mc_segmap_parloop_struct_131616.free_mem_122951 = mem_122951.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131617_task;
    
    futhark_mc_segmap_parloop_131617_task.name =
        "futhark_mc_segmap_parloop_131617";
    futhark_mc_segmap_parloop_131617_task.fn = futhark_mc_segmap_parloop_131617;
    futhark_mc_segmap_parloop_131617_task.args =
        &futhark_mc_segmap_parloop_struct_131616;
    futhark_mc_segmap_parloop_131617_task.iterations = iterations;
    futhark_mc_segmap_parloop_131617_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131617_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131617_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131617_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131617_task);
    
    if (futhark_mc_segmap_parloop_131617_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131617_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131617_total_end -
                 futhark_mc_segmap_parloop_131617_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131617_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131617_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131617_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131615_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131615_end -
                 futhark_mc_segmap_task_131615_start;
        
        ctx->futhark_mc_segmap_task_131615_runs[tid]++;
        ctx->futhark_mc_segmap_task_131615_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131615_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131607(void *args, int64_t start,
                                            int64_t end, int flat_tid_119349,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131606
    *futhark_mc_segmap_parloop_struct_131606 =
    (struct futhark_mc_segmap_parloop_struct_131606 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131606->ctx;
    uint64_t futhark_mc_segmap_parloop_131607_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131607_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131606->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131606->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131606->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131606->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131606->free_bytes_121983;
    struct memblock mem_122945 = {.desc ="mem_122945", .mem =
                                  futhark_mc_segmap_parloop_struct_131606->free_mem_122945,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131606->free_mem_122985,
                                  .size =0, .references =NULL};
    size_t mem_122948_cached_sizze_131608 = 0;
    char *mem_122948 = NULL;
    size_t mem_122951_cached_sizze_131609 = 0;
    char *mem_122951 = NULL;
    int64_t iterations = end - start;
    int64_t iter_128074 = start;
    
    if (mem_122948_cached_sizze_131608 < (size_t) bytes_121983) {
        mem_122948 = realloc(mem_122948, bytes_121983);
        mem_122948_cached_sizze_131608 = bytes_121983;
    }
    if (mem_122951_cached_sizze_131609 < (size_t) bytes_121983) {
        mem_122951 = realloc(mem_122951, bytes_121983);
        mem_122951_cached_sizze_131609 = bytes_121983;
    }
    for (; iter_128074 < end; iter_128074++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128085 = m_114533;
        int64_t gtid_119350 = iter_128074;
        int64_t remnant_128086 = iter_128074 - gtid_119350;
        int64_t flat_tid_119351 = (int64_t) 0;
        int32_t num_tasks_128087;
        struct futhark_mc_task_131610 futhark_mc_task_131610;
        
        futhark_mc_task_131610.ctx = ctx;
        futhark_mc_task_131610.free_n_114534 = n_114534;
        futhark_mc_task_131610.free_gtid_119350 = gtid_119350;
        futhark_mc_task_131610.free_Y_mem_121939 = Y_mem_121939.mem;
        futhark_mc_task_131610.free_mem_122945 = mem_122945.mem;
        futhark_mc_task_131610.free_mem_122948 = mem_122948;
        
        struct scheduler_segop futhark_mc_task_131610_task;
        
        futhark_mc_task_131610_task.args = &futhark_mc_task_131610;
        futhark_mc_task_131610_task.top_level_fn =
            futhark_mc_segmap_task_131611;
        futhark_mc_task_131610_task.name = "futhark_mc_segmap_task_131611";
        futhark_mc_task_131610_task.iterations = n_114534;
        futhark_mc_task_131610_task.task_time =
            &ctx->futhark_mc_segmap_task_131611_total_time;
        futhark_mc_task_131610_task.task_iter =
            &ctx->futhark_mc_segmap_task_131611_total_iter;
        futhark_mc_task_131610_task.sched = STATIC;
        futhark_mc_task_131610_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131611_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131610_task);
        
        if (futhark_mc_segmap_task_131611_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        int64_t flat_tid_119353 = (int64_t) 0;
        int32_t num_tasks_128091;
        struct futhark_mc_task_131614 futhark_mc_task_131614;
        
        futhark_mc_task_131614.ctx = ctx;
        futhark_mc_task_131614.free_n_114534 = n_114534;
        futhark_mc_task_131614.free_gtid_119350 = gtid_119350;
        futhark_mc_task_131614.free_mem_121979 = mem_121979.mem;
        futhark_mc_task_131614.free_mem_122948 = mem_122948;
        futhark_mc_task_131614.free_mem_122951 = mem_122951;
        
        struct scheduler_segop futhark_mc_task_131614_task;
        
        futhark_mc_task_131614_task.args = &futhark_mc_task_131614;
        futhark_mc_task_131614_task.top_level_fn =
            futhark_mc_segmap_task_131615;
        futhark_mc_task_131614_task.name = "futhark_mc_segmap_task_131615";
        futhark_mc_task_131614_task.iterations = n_114534;
        futhark_mc_task_131614_task.task_time =
            &ctx->futhark_mc_segmap_task_131615_total_time;
        futhark_mc_task_131614_task.task_iter =
            &ctx->futhark_mc_segmap_task_131615_total_iter;
        futhark_mc_task_131614_task.sched = STATIC;
        futhark_mc_task_131614_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131615_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131614_task);
        
        if (futhark_mc_segmap_task_131615_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_122985.mem + gtid_119350 * n_114534 * (int64_t) 4,
                mem_122951 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122948);
    free(mem_122951);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131607_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131607_end -
                 futhark_mc_segmap_parloop_131607_start;
        
        ctx->futhark_mc_segmap_parloop_131607_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131607_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131607_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131605(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119349 = tid;
    int num_tasks_128052 = info.nsubtasks;
    struct futhark_mc_task_131599 *futhark_mc_task_131599 =
                                  (struct futhark_mc_task_131599 *) args;
    struct futhark_context *ctx = futhark_mc_task_131599->ctx;
    uint64_t futhark_mc_segmap_nested_task_131605_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131605_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131599->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131599->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131599->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131599->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131599->free_bytes_121983;
    struct memblock mem_122945 = {.desc ="mem_122945", .mem =
                                  futhark_mc_task_131599->free_mem_122945,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131599->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t iter_128074;
    struct futhark_mc_segmap_parloop_struct_131606
    futhark_mc_segmap_parloop_struct_131606;
    
    futhark_mc_segmap_parloop_struct_131606.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131606.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131606.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131606.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131606.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131606.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131606.free_mem_122945 = mem_122945.mem;
    futhark_mc_segmap_parloop_struct_131606.free_mem_122985 = mem_122985.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131607_task;
    
    futhark_mc_segmap_parloop_131607_task.name =
        "futhark_mc_segmap_parloop_131607";
    futhark_mc_segmap_parloop_131607_task.fn = futhark_mc_segmap_parloop_131607;
    futhark_mc_segmap_parloop_131607_task.args =
        &futhark_mc_segmap_parloop_struct_131606;
    futhark_mc_segmap_parloop_131607_task.iterations = iterations;
    futhark_mc_segmap_parloop_131607_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131607_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131607_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131607_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131607_task);
    
    if (futhark_mc_segmap_parloop_131607_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131607_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131607_total_end -
                 futhark_mc_segmap_parloop_131607_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131607_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131607_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131607_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131605_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131605_end -
                 futhark_mc_segmap_nested_task_131605_start;
        
        ctx->futhark_mc_segmap_nested_task_131605_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131605_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131605_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131618 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123011;
};
struct futhark_mc_segmap_parloop_struct_131620 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123011;
};
static int futhark_mc_segmap_parloop_131621(void *args, int64_t start,
                                            int64_t end, int flat_tid_119370,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131620
    *futhark_mc_segmap_parloop_struct_131620 =
    (struct futhark_mc_segmap_parloop_struct_131620 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131620->ctx;
    uint64_t futhark_mc_segmap_parloop_131621_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131621_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131620->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131620->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131620->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131620->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131620->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131620->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131620->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131620->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131620->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131620->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131620->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131620->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131620->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123011 = {.desc ="mem_123011", .mem =
                                  futhark_mc_segmap_parloop_struct_131620->free_mem_123011,
                                  .size =0, .references =NULL};
    size_t mem_122995_cached_sizze_131622 = 0;
    char *mem_122995 = NULL;
    int64_t iterations = end - start;
    int64_t iter_128102 = start;
    
    if (mem_122995_cached_sizze_131622 < (size_t) bytes_122135) {
        mem_122995 = realloc(mem_122995, bytes_122135);
        mem_122995_cached_sizze_131622 = bytes_122135;
    }
    for (; iter_128102 < end; iter_128102++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128159 = m_114533;
        int64_t gtid_119371 = iter_128102;
        int64_t remnant_128160 = iter_128102 - gtid_119371;
        int64_t x_115889 = ((int64_t *) mem_121982.mem)[gtid_119371];
        
        for (int64_t i_128103 = 0; i_128103 < t_n_m_114591; i_128103++) {
            int64_t x_128105 = ((int64_t *) mem_122204.mem)[gtid_119371 *
                                                            t_n_m_114591 +
                                                            i_128103];
            float x_128106 = ((float *) mem_122208.mem)[gtid_119371 *
                                                        t_n_m_114591 +
                                                        i_128103];
            int64_t min_arg_128107 = mul64(t_jump_114541, i_128103);
            int64_t min_res_128108 = smin64(i_114610, min_arg_128107);
            float defunc_0_f_res_128109 = sitofp_i64_f32(min_res_128108);
            float defunc_2_reduce_res_128110;
            float redout_128112 = 0.0F;
            
            for (int64_t i_128111 = 0; i_128111 < t_window_114537; i_128111++) {
                bool cond_128113 = sle64(x_115889, i_128111);
                float defunc_0_f_res_128114;
                
                if (cond_128113) {
                    defunc_0_f_res_128114 = 0.0F;
                } else {
                    int64_t i_128115 = add64(x_128105, i_128111);
                    float x_128116 = ((float *) mem_122004.mem)[gtid_119371 *
                                                                n_114534 +
                                                                i_128115];
                    float defunc_0_f_res_f_res_128117 = 1.0F + x_128116;
                    
                    defunc_0_f_res_128114 = defunc_0_f_res_f_res_128117;
                }
                
                float defunc_0_f_res_128118;
                
                if (cond_128113) {
                    defunc_0_f_res_128118 = 0.0F;
                } else {
                    int64_t i_128119 = add64(x_128105, i_128111);
                    float x_128120 = ((float *) mem_122430.mem)[gtid_119371 *
                                                                n_114534 +
                                                                i_128119];
                    
                    defunc_0_f_res_128118 = x_128120;
                }
                
                float x_j_128121 = defunc_0_f_res_128114 -
                      defunc_0_f_res_128109;
                float abs_res_128122 = (float) fabs(x_j_128121);
                float tmp1_128123 = abs_res_128122 / x_128106;
                float x_128124 = tmp1_128123 * tmp1_128123;
                float y_128125 = tmp1_128123 * x_128124;
                float tmp2_128126 = 1.0F - y_128125;
                float x_128127 = tmp2_128126 * tmp2_128126;
                float tmp3_128128 = tmp2_128126 * x_128127;
                float w_j_128129 = defunc_0_f_res_128118 * tmp3_128128;
                float defunc_1_op_res_128130 = w_j_128129 + redout_128112;
                float redout_tmp_128162 = defunc_1_op_res_128130;
                
                redout_128112 = redout_tmp_128162;
            }
            defunc_2_reduce_res_128110 = redout_128112;
            
            float a0_128131 = 1.0F / defunc_2_reduce_res_128110;
            float defunc_2_reduce_res_128132;
            float redout_128134 = 0.0F;
            
            for (int64_t i_128133 = 0; i_128133 < t_window_114537; i_128133++) {
                bool cond_128135 = sle64(x_115889, i_128133);
                float defunc_0_f_res_128136;
                
                if (cond_128135) {
                    defunc_0_f_res_128136 = 0.0F;
                } else {
                    int64_t i_128137 = add64(x_128105, i_128133);
                    float x_128138 = ((float *) mem_122004.mem)[gtid_119371 *
                                                                n_114534 +
                                                                i_128137];
                    float defunc_0_f_res_f_res_128139 = 1.0F + x_128138;
                    
                    defunc_0_f_res_128136 = defunc_0_f_res_f_res_128139;
                }
                
                float defunc_0_f_res_128140;
                
                if (cond_128135) {
                    defunc_0_f_res_128140 = 0.0F;
                } else {
                    int64_t i_128141 = add64(x_128105, i_128133);
                    float x_128142 = ((float *) mem_122430.mem)[gtid_119371 *
                                                                n_114534 +
                                                                i_128141];
                    
                    defunc_0_f_res_128140 = x_128142;
                }
                
                float x_j_128143 = defunc_0_f_res_128136 -
                      defunc_0_f_res_128109;
                float abs_res_128144 = (float) fabs(x_j_128143);
                float tmp1_128145 = abs_res_128144 / x_128106;
                float x_128146 = tmp1_128145 * tmp1_128145;
                float y_128147 = tmp1_128145 * x_128146;
                float tmp2_128148 = 1.0F - y_128147;
                float x_128149 = tmp2_128148 * tmp2_128148;
                float tmp3_128150 = tmp2_128148 * x_128149;
                float tmp4_128151 = defunc_0_f_res_128140 * tmp3_128150;
                float defunc_0_f_res_128152;
                
                if (cond_128135) {
                    defunc_0_f_res_128152 = 0.0F;
                } else {
                    int64_t i_128153 = add64(x_128105, i_128133);
                    float x_128154 = ((float *) mem_122985.mem)[gtid_119371 *
                                                                n_114534 +
                                                                i_128153];
                    
                    defunc_0_f_res_128152 = x_128154;
                }
                
                float x_128155 = a0_128131 * tmp4_128151;
                float defunc_9_fit_fun_res_128156 = defunc_0_f_res_128152 *
                      x_128155;
                float defunc_1_op_res_128157 = defunc_9_fit_fun_res_128156 +
                      redout_128134;
                float redout_tmp_128163 = defunc_1_op_res_128157;
                
                redout_128134 = redout_tmp_128163;
            }
            defunc_2_reduce_res_128132 = redout_128134;
            ((float *) mem_122995)[i_128103] = defunc_2_reduce_res_128132;
        }
        memmove(mem_123011.mem + gtid_119371 * t_n_m_114591 * (int64_t) 4,
                mem_122995 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122995);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131621_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131621_end -
                 futhark_mc_segmap_parloop_131621_start;
        
        ctx->futhark_mc_segmap_parloop_131621_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131621_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131621_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131619(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119370 = tid;
    int num_tasks_128101 = info.nsubtasks;
    struct futhark_mc_task_131618 *futhark_mc_task_131618 =
                                  (struct futhark_mc_task_131618 *) args;
    struct futhark_context *ctx = futhark_mc_task_131618->ctx;
    uint64_t futhark_mc_segmap_task_131619_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131619_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131618->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131618->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131618->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131618->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131618->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131618->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131618->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131618->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131618->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131618->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131618->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131618->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131618->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123011 = {.desc ="mem_123011", .mem =
                                  futhark_mc_task_131618->free_mem_123011,
                                  .size =0, .references =NULL};
    int64_t iter_128102;
    struct futhark_mc_segmap_parloop_struct_131620
    futhark_mc_segmap_parloop_struct_131620;
    
    futhark_mc_segmap_parloop_struct_131620.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131620.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131620.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131620.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131620.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131620.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131620.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131620.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131620.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131620.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131620.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131620.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131620.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131620.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131620.free_mem_123011 = mem_123011.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131621_task;
    
    futhark_mc_segmap_parloop_131621_task.name =
        "futhark_mc_segmap_parloop_131621";
    futhark_mc_segmap_parloop_131621_task.fn = futhark_mc_segmap_parloop_131621;
    futhark_mc_segmap_parloop_131621_task.args =
        &futhark_mc_segmap_parloop_struct_131620;
    futhark_mc_segmap_parloop_131621_task.iterations = iterations;
    futhark_mc_segmap_parloop_131621_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131621_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131621_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131621_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131621_task);
    
    if (futhark_mc_segmap_parloop_131621_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131621_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131621_total_end -
                 futhark_mc_segmap_parloop_131621_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131621_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131621_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131621_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131619_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131619_end -
                 futhark_mc_segmap_task_131619_start;
        
        ctx->futhark_mc_segmap_task_131619_runs[tid]++;
        ctx->futhark_mc_segmap_task_131619_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131619_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131624 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123011;
};
struct futhark_mc_task_131627 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_119373;
    int64_t free_x_119443;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_122992;
};
struct futhark_mc_segmap_parloop_struct_131629 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_119373;
    int64_t free_x_119443;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_122992;
};
static int futhark_mc_segmap_parloop_131630(void *args, int64_t start,
                                            int64_t end, int flat_tid_119374,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131629
    *futhark_mc_segmap_parloop_struct_131629 =
    (struct futhark_mc_segmap_parloop_struct_131629 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131629->ctx;
    uint64_t futhark_mc_segmap_parloop_131630_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131630_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131629->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131629->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131629->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131629->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131629->free_i_114610;
    int64_t gtid_119373 =
            futhark_mc_segmap_parloop_struct_131629->free_gtid_119373;
    int64_t x_119443 = futhark_mc_segmap_parloop_struct_131629->free_x_119443;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131629->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131629->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131629->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131629->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131629->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_122992 = {.desc ="mem_122992", .mem =
                                  futhark_mc_segmap_parloop_struct_131629->free_mem_122992,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_128274 = start;
    
    for (; iter_128274 < end; iter_128274++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128320 = t_n_m_114591;
        int64_t gtid_119375 = iter_128274;
        int64_t remnant_128321 = iter_128274 - gtid_119375;
        int64_t x_128218 = ((int64_t *) mem_122204.mem)[gtid_119373 *
                                                        t_n_m_114591 +
                                                        gtid_119375];
        float x_128219 = ((float *) mem_122208.mem)[gtid_119373 * t_n_m_114591 +
                                                    gtid_119375];
        int64_t min_arg_128220 = mul64(t_jump_114541, gtid_119375);
        int64_t min_res_128221 = smin64(i_114610, min_arg_128220);
        float defunc_0_f_res_128222 = sitofp_i64_f32(min_res_128221);
        float defunc_2_reduce_res_128223;
        float redout_128276 = 0.0F;
        
        for (int64_t i_128275 = 0; i_128275 < t_window_114537; i_128275++) {
            bool cond_128277 = sle64(x_119443, i_128275);
            float defunc_0_f_res_128278;
            
            if (cond_128277) {
                defunc_0_f_res_128278 = 0.0F;
            } else {
                int64_t i_128279 = add64(x_128218, i_128275);
                float x_128280 = ((float *) mem_122004.mem)[gtid_119373 *
                                                            n_114534 +
                                                            i_128279];
                float defunc_0_f_res_f_res_128281 = 1.0F + x_128280;
                
                defunc_0_f_res_128278 = defunc_0_f_res_f_res_128281;
            }
            
            float defunc_0_f_res_128282;
            
            if (cond_128277) {
                defunc_0_f_res_128282 = 0.0F;
            } else {
                int64_t i_128283 = add64(x_128218, i_128275);
                float x_128284 = ((float *) mem_122430.mem)[gtid_119373 *
                                                            n_114534 +
                                                            i_128283];
                
                defunc_0_f_res_128282 = x_128284;
            }
            
            float x_j_128285 = defunc_0_f_res_128278 - defunc_0_f_res_128222;
            float abs_res_128286 = (float) fabs(x_j_128285);
            float tmp1_128287 = abs_res_128286 / x_128219;
            float x_128288 = tmp1_128287 * tmp1_128287;
            float y_128289 = tmp1_128287 * x_128288;
            float tmp2_128290 = 1.0F - y_128289;
            float x_128291 = tmp2_128290 * tmp2_128290;
            float tmp3_128292 = tmp2_128290 * x_128291;
            float w_j_128293 = defunc_0_f_res_128282 * tmp3_128292;
            float defunc_1_op_res_128294 = w_j_128293 + redout_128276;
            float redout_tmp_128322 = defunc_1_op_res_128294;
            
            redout_128276 = redout_tmp_128322;
        }
        defunc_2_reduce_res_128223 = redout_128276;
        
        float a0_128244 = 1.0F / defunc_2_reduce_res_128223;
        float defunc_2_reduce_res_128245;
        float redout_128296 = 0.0F;
        
        for (int64_t i_128295 = 0; i_128295 < t_window_114537; i_128295++) {
            bool cond_128297 = sle64(x_119443, i_128295);
            float defunc_0_f_res_128298;
            
            if (cond_128297) {
                defunc_0_f_res_128298 = 0.0F;
            } else {
                int64_t i_128299 = add64(x_128218, i_128295);
                float x_128300 = ((float *) mem_122004.mem)[gtid_119373 *
                                                            n_114534 +
                                                            i_128299];
                float defunc_0_f_res_f_res_128301 = 1.0F + x_128300;
                
                defunc_0_f_res_128298 = defunc_0_f_res_f_res_128301;
            }
            
            float defunc_0_f_res_128302;
            
            if (cond_128297) {
                defunc_0_f_res_128302 = 0.0F;
            } else {
                int64_t i_128303 = add64(x_128218, i_128295);
                float x_128304 = ((float *) mem_122430.mem)[gtid_119373 *
                                                            n_114534 +
                                                            i_128303];
                
                defunc_0_f_res_128302 = x_128304;
            }
            
            float x_j_128305 = defunc_0_f_res_128298 - defunc_0_f_res_128222;
            float abs_res_128306 = (float) fabs(x_j_128305);
            float tmp1_128307 = abs_res_128306 / x_128219;
            float x_128308 = tmp1_128307 * tmp1_128307;
            float y_128309 = tmp1_128307 * x_128308;
            float tmp2_128310 = 1.0F - y_128309;
            float x_128311 = tmp2_128310 * tmp2_128310;
            float tmp3_128312 = tmp2_128310 * x_128311;
            float tmp4_128313 = defunc_0_f_res_128302 * tmp3_128312;
            float defunc_0_f_res_128314;
            
            if (cond_128297) {
                defunc_0_f_res_128314 = 0.0F;
            } else {
                int64_t i_128315 = add64(x_128218, i_128295);
                float x_128316 = ((float *) mem_122985.mem)[gtid_119373 *
                                                            n_114534 +
                                                            i_128315];
                
                defunc_0_f_res_128314 = x_128316;
            }
            
            float x_128317 = a0_128244 * tmp4_128313;
            float defunc_9_fit_fun_res_128318 = defunc_0_f_res_128314 *
                  x_128317;
            float defunc_1_op_res_128319 = defunc_9_fit_fun_res_128318 +
                  redout_128296;
            float redout_tmp_128323 = defunc_1_op_res_128319;
            
            redout_128296 = redout_tmp_128323;
        }
        defunc_2_reduce_res_128245 = redout_128296;
        ((float *) mem_122992.mem)[gtid_119375] = defunc_2_reduce_res_128245;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131630_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131630_end -
                 futhark_mc_segmap_parloop_131630_start;
        
        ctx->futhark_mc_segmap_parloop_131630_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131630_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131630_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131628(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119374 = tid;
    int num_tasks_128273 = info.nsubtasks;
    struct futhark_mc_task_131627 *futhark_mc_task_131627 =
                                  (struct futhark_mc_task_131627 *) args;
    struct futhark_context *ctx = futhark_mc_task_131627->ctx;
    uint64_t futhark_mc_segmap_task_131628_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131628_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131627->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131627->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131627->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131627->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131627->free_i_114610;
    int64_t gtid_119373 = futhark_mc_task_131627->free_gtid_119373;
    int64_t x_119443 = futhark_mc_task_131627->free_x_119443;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131627->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131627->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131627->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131627->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131627->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_122992 = {.desc ="mem_122992", .mem =
                                  futhark_mc_task_131627->free_mem_122992,
                                  .size =0, .references =NULL};
    int64_t iter_128274;
    struct futhark_mc_segmap_parloop_struct_131629
    futhark_mc_segmap_parloop_struct_131629;
    
    futhark_mc_segmap_parloop_struct_131629.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131629.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131629.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131629.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131629.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131629.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131629.free_gtid_119373 = gtid_119373;
    futhark_mc_segmap_parloop_struct_131629.free_x_119443 = x_119443;
    futhark_mc_segmap_parloop_struct_131629.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131629.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131629.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131629.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131629.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131629.free_mem_122992 = mem_122992.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131630_task;
    
    futhark_mc_segmap_parloop_131630_task.name =
        "futhark_mc_segmap_parloop_131630";
    futhark_mc_segmap_parloop_131630_task.fn = futhark_mc_segmap_parloop_131630;
    futhark_mc_segmap_parloop_131630_task.args =
        &futhark_mc_segmap_parloop_struct_131629;
    futhark_mc_segmap_parloop_131630_task.iterations = iterations;
    futhark_mc_segmap_parloop_131630_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131630_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131630_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131630_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131630_task);
    
    if (futhark_mc_segmap_parloop_131630_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131630_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131630_total_end -
                 futhark_mc_segmap_parloop_131630_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131630_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131630_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131630_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131628_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131628_end -
                 futhark_mc_segmap_task_131628_start;
        
        ctx->futhark_mc_segmap_task_131628_runs[tid]++;
        ctx->futhark_mc_segmap_task_131628_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131628_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131632 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_119373;
    int64_t free_x_119443;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_122992;
};
struct futhark_mc_task_131634 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119373;
    int64_t free_x_119443;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_128165;
    float free_x_128166;
    float free_defunc_0_f_res_128169;
    float *retval_defunc_2_reduce_res_128170;
};
struct futhark_mc_segred_stage_1_parloop_struct_131637 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119373;
    int64_t free_x_119443;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_128165;
    float free_x_128166;
    float free_defunc_0_f_res_128169;
    char *free_reduce_stage_1_tid_res_arr_mem_128373;
};
static int futhark_mc_segred_stage_1_parloop_131638(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_119378,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131637
    *futhark_mc_segred_stage_1_parloop_struct_131637 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131637 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131637->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131638_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131638_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131637->free_n_114534;
    int64_t gtid_119373 =
            futhark_mc_segred_stage_1_parloop_struct_131637->free_gtid_119373;
    int64_t x_119443 =
            futhark_mc_segred_stage_1_parloop_struct_131637->free_x_119443;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131637->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131637->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_128165 =
            futhark_mc_segred_stage_1_parloop_struct_131637->free_x_128165;
    float x_128166 =
          futhark_mc_segred_stage_1_parloop_struct_131637->free_x_128166;
    float defunc_0_f_res_128169 =
          futhark_mc_segred_stage_1_parloop_struct_131637->free_defunc_0_f_res_128169;
    struct memblock reduce_stage_1_tid_res_arr_mem_128373 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_128373",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131637->free_reduce_stage_1_tid_res_arr_mem_128373,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_128375 = start;
    float x_128325;
    float x_128326;
    float local_acc_128376 = 0.0F;
    
    for (; iter_128375 < end; iter_128375++) {
        int64_t gtid_119379 = iter_128375;
        bool cond_128328 = sle64(x_119443, gtid_119379);
        float defunc_0_f_res_128329;
        
        if (cond_128328) {
            defunc_0_f_res_128329 = 0.0F;
        } else {
            int64_t i_128330 = add64(gtid_119379, x_128165);
            float x_128331 = ((float *) mem_122004.mem)[gtid_119373 * n_114534 +
                                                        i_128330];
            float defunc_0_f_res_f_res_128332 = 1.0F + x_128331;
            
            defunc_0_f_res_128329 = defunc_0_f_res_f_res_128332;
        }
        
        float defunc_0_f_res_128333;
        
        if (cond_128328) {
            defunc_0_f_res_128333 = 0.0F;
        } else {
            int64_t i_128334 = add64(gtid_119379, x_128165);
            float x_128335 = ((float *) mem_122430.mem)[gtid_119373 * n_114534 +
                                                        i_128334];
            
            defunc_0_f_res_128333 = x_128335;
        }
        
        float x_j_128336 = defunc_0_f_res_128329 - defunc_0_f_res_128169;
        float abs_res_128337 = (float) fabs(x_j_128336);
        float tmp1_128338 = abs_res_128337 / x_128166;
        float x_128339 = tmp1_128338 * tmp1_128338;
        float y_128340 = tmp1_128338 * x_128339;
        float tmp2_128341 = 1.0F - y_128340;
        float x_128342 = tmp2_128341 * tmp2_128341;
        float tmp3_128343 = tmp2_128341 * x_128342;
        float w_j_128344 = defunc_0_f_res_128333 * tmp3_128343;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_128325 = local_acc_128376;
        }
        // Load next params
        {
            x_128326 = w_j_128344;
        }
        // Red body
        {
            float defunc_1_op_res_128327 = x_128325 + x_128326;
            
            local_acc_128376 = defunc_1_op_res_128327;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_128373.mem)[flat_tid_119378] =
        local_acc_128376;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131638_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131638_end -
                 futhark_mc_segred_stage_1_parloop_131638_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131638_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131638_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131638_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131635(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119378 = tid;
    int num_tasks_128372 = info.nsubtasks;
    struct futhark_mc_task_131634 *futhark_mc_task_131634 =
                                  (struct futhark_mc_task_131634 *) args;
    struct futhark_context *ctx = futhark_mc_task_131634->ctx;
    uint64_t futhark_mc_segred_task_131635_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131635_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131634->free_n_114534;
    int64_t gtid_119373 = futhark_mc_task_131634->free_gtid_119373;
    int64_t x_119443 = futhark_mc_task_131634->free_x_119443;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131634->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131634->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_128165 = futhark_mc_task_131634->free_x_128165;
    float x_128166 = futhark_mc_task_131634->free_x_128166;
    float defunc_0_f_res_128169 =
          futhark_mc_task_131634->free_defunc_0_f_res_128169;
    float defunc_2_reduce_res_128170 =
          *futhark_mc_task_131634->retval_defunc_2_reduce_res_128170;
    size_t reduce_stage_1_tid_res_arr_mem_128373_cached_sizze_131636 = 0;
    char *reduce_stage_1_tid_res_arr_mem_128373 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_128373_cached_sizze_131636 <
        (size_t) ((int64_t) 4 * num_tasks_128372)) {
        reduce_stage_1_tid_res_arr_mem_128373 =
            realloc(reduce_stage_1_tid_res_arr_mem_128373, (int64_t) 4 *
                    num_tasks_128372);
        reduce_stage_1_tid_res_arr_mem_128373_cached_sizze_131636 =
            (int64_t) 4 * num_tasks_128372;
    }
    
    int64_t iter_128375;
    struct futhark_mc_segred_stage_1_parloop_struct_131637
    futhark_mc_segred_stage_1_parloop_struct_131637;
    
    futhark_mc_segred_stage_1_parloop_struct_131637.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131637.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131637.free_gtid_119373 =
        gtid_119373;
    futhark_mc_segred_stage_1_parloop_struct_131637.free_x_119443 = x_119443;
    futhark_mc_segred_stage_1_parloop_struct_131637.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131637.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131637.free_x_128165 = x_128165;
    futhark_mc_segred_stage_1_parloop_struct_131637.free_x_128166 = x_128166;
    futhark_mc_segred_stage_1_parloop_struct_131637.free_defunc_0_f_res_128169 =
        defunc_0_f_res_128169;
    futhark_mc_segred_stage_1_parloop_struct_131637.free_reduce_stage_1_tid_res_arr_mem_128373 =
        reduce_stage_1_tid_res_arr_mem_128373;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131638_task;
    
    futhark_mc_segred_stage_1_parloop_131638_task.name =
        "futhark_mc_segred_stage_1_parloop_131638";
    futhark_mc_segred_stage_1_parloop_131638_task.fn =
        futhark_mc_segred_stage_1_parloop_131638;
    futhark_mc_segred_stage_1_parloop_131638_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131637;
    futhark_mc_segred_stage_1_parloop_131638_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131638_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131638_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131638_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131638_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131638_task);
    
    if (futhark_mc_segred_stage_1_parloop_131638_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131638_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131638_total_end -
                 futhark_mc_segred_stage_1_parloop_131638_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131638_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131638_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131638_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_128170 = 0.0F;
    }
    
    float x_128377;
    float x_128378;
    
    for (int32_t i_128380 = 0; i_128380 < num_tasks_128372; i_128380++) {
        flat_tid_119378 = i_128380;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_128377 = defunc_2_reduce_res_128170;
            }
            // load next params
            {
                x_128378 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_128373)[flat_tid_119378];
            }
            // red body
            {
                float defunc_1_op_res_128379 = x_128377 + x_128378;
                
                defunc_2_reduce_res_128170 = defunc_1_op_res_128379;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_128373);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131635_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131635_end -
                 futhark_mc_segred_task_131635_start;
        
        ctx->futhark_mc_segred_task_131635_runs[tid]++;
        ctx->futhark_mc_segred_task_131635_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131635_iter[tid] += iterations;
    }
    *futhark_mc_task_131634->retval_defunc_2_reduce_res_128170 =
        defunc_2_reduce_res_128170;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131639 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119373;
    int64_t free_x_119443;
    char *free_mem_122004;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_x_128165;
    float free_x_128166;
    float free_defunc_0_f_res_128169;
    float free_a0_128191;
    float *retval_defunc_2_reduce_res_128192;
};
struct futhark_mc_segred_stage_1_parloop_struct_131642 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119373;
    int64_t free_x_119443;
    char *free_mem_122004;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_x_128165;
    float free_x_128166;
    float free_defunc_0_f_res_128169;
    float free_a0_128191;
    char *free_reduce_stage_1_tid_res_arr_mem_128382;
};
static int futhark_mc_segred_stage_1_parloop_131643(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_119380,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131642
    *futhark_mc_segred_stage_1_parloop_struct_131642 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131642 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131642->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131643_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131643_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131642->free_n_114534;
    int64_t gtid_119373 =
            futhark_mc_segred_stage_1_parloop_struct_131642->free_gtid_119373;
    int64_t x_119443 =
            futhark_mc_segred_stage_1_parloop_struct_131642->free_x_119443;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131642->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131642->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131642->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t x_128165 =
            futhark_mc_segred_stage_1_parloop_struct_131642->free_x_128165;
    float x_128166 =
          futhark_mc_segred_stage_1_parloop_struct_131642->free_x_128166;
    float defunc_0_f_res_128169 =
          futhark_mc_segred_stage_1_parloop_struct_131642->free_defunc_0_f_res_128169;
    float a0_128191 =
          futhark_mc_segred_stage_1_parloop_struct_131642->free_a0_128191;
    struct memblock reduce_stage_1_tid_res_arr_mem_128382 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_128382",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131642->free_reduce_stage_1_tid_res_arr_mem_128382,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_128384 = start;
    float x_128345;
    float x_128346;
    float local_acc_128385 = 0.0F;
    
    for (; iter_128384 < end; iter_128384++) {
        int64_t gtid_119381 = iter_128384;
        bool cond_128348 = sle64(x_119443, gtid_119381);
        float defunc_0_f_res_128349;
        
        if (cond_128348) {
            defunc_0_f_res_128349 = 0.0F;
        } else {
            int64_t i_128350 = add64(gtid_119381, x_128165);
            float x_128351 = ((float *) mem_122004.mem)[gtid_119373 * n_114534 +
                                                        i_128350];
            float defunc_0_f_res_f_res_128352 = 1.0F + x_128351;
            
            defunc_0_f_res_128349 = defunc_0_f_res_f_res_128352;
        }
        
        float defunc_0_f_res_128353;
        
        if (cond_128348) {
            defunc_0_f_res_128353 = 0.0F;
        } else {
            int64_t i_128354 = add64(gtid_119381, x_128165);
            float x_128355 = ((float *) mem_122430.mem)[gtid_119373 * n_114534 +
                                                        i_128354];
            
            defunc_0_f_res_128353 = x_128355;
        }
        
        float x_j_128356 = defunc_0_f_res_128349 - defunc_0_f_res_128169;
        float abs_res_128357 = (float) fabs(x_j_128356);
        float tmp1_128358 = abs_res_128357 / x_128166;
        float x_128359 = tmp1_128358 * tmp1_128358;
        float y_128360 = tmp1_128358 * x_128359;
        float tmp2_128361 = 1.0F - y_128360;
        float x_128362 = tmp2_128361 * tmp2_128361;
        float tmp3_128363 = tmp2_128361 * x_128362;
        float tmp4_128364 = defunc_0_f_res_128353 * tmp3_128363;
        float defunc_0_f_res_128365;
        
        if (cond_128348) {
            defunc_0_f_res_128365 = 0.0F;
        } else {
            int64_t i_128366 = add64(gtid_119381, x_128165);
            float x_128367 = ((float *) mem_122985.mem)[gtid_119373 * n_114534 +
                                                        i_128366];
            
            defunc_0_f_res_128365 = x_128367;
        }
        
        float x_128368 = a0_128191 * tmp4_128364;
        float defunc_9_fit_fun_res_128369 = defunc_0_f_res_128365 * x_128368;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_128345 = local_acc_128385;
        }
        // Load next params
        {
            x_128346 = defunc_9_fit_fun_res_128369;
        }
        // Red body
        {
            float defunc_1_op_res_128347 = x_128345 + x_128346;
            
            local_acc_128385 = defunc_1_op_res_128347;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_128382.mem)[flat_tid_119380] =
        local_acc_128385;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131643_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131643_end -
                 futhark_mc_segred_stage_1_parloop_131643_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131643_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131643_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131643_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131640(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119380 = tid;
    int num_tasks_128381 = info.nsubtasks;
    struct futhark_mc_task_131639 *futhark_mc_task_131639 =
                                  (struct futhark_mc_task_131639 *) args;
    struct futhark_context *ctx = futhark_mc_task_131639->ctx;
    uint64_t futhark_mc_segred_task_131640_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131640_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131639->free_n_114534;
    int64_t gtid_119373 = futhark_mc_task_131639->free_gtid_119373;
    int64_t x_119443 = futhark_mc_task_131639->free_x_119443;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131639->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131639->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131639->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t x_128165 = futhark_mc_task_131639->free_x_128165;
    float x_128166 = futhark_mc_task_131639->free_x_128166;
    float defunc_0_f_res_128169 =
          futhark_mc_task_131639->free_defunc_0_f_res_128169;
    float a0_128191 = futhark_mc_task_131639->free_a0_128191;
    float defunc_2_reduce_res_128192 =
          *futhark_mc_task_131639->retval_defunc_2_reduce_res_128192;
    size_t reduce_stage_1_tid_res_arr_mem_128382_cached_sizze_131641 = 0;
    char *reduce_stage_1_tid_res_arr_mem_128382 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_128382_cached_sizze_131641 <
        (size_t) ((int64_t) 4 * num_tasks_128381)) {
        reduce_stage_1_tid_res_arr_mem_128382 =
            realloc(reduce_stage_1_tid_res_arr_mem_128382, (int64_t) 4 *
                    num_tasks_128381);
        reduce_stage_1_tid_res_arr_mem_128382_cached_sizze_131641 =
            (int64_t) 4 * num_tasks_128381;
    }
    
    int64_t iter_128384;
    struct futhark_mc_segred_stage_1_parloop_struct_131642
    futhark_mc_segred_stage_1_parloop_struct_131642;
    
    futhark_mc_segred_stage_1_parloop_struct_131642.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131642.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131642.free_gtid_119373 =
        gtid_119373;
    futhark_mc_segred_stage_1_parloop_struct_131642.free_x_119443 = x_119443;
    futhark_mc_segred_stage_1_parloop_struct_131642.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131642.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131642.free_mem_122985 =
        mem_122985.mem;
    futhark_mc_segred_stage_1_parloop_struct_131642.free_x_128165 = x_128165;
    futhark_mc_segred_stage_1_parloop_struct_131642.free_x_128166 = x_128166;
    futhark_mc_segred_stage_1_parloop_struct_131642.free_defunc_0_f_res_128169 =
        defunc_0_f_res_128169;
    futhark_mc_segred_stage_1_parloop_struct_131642.free_a0_128191 = a0_128191;
    futhark_mc_segred_stage_1_parloop_struct_131642.free_reduce_stage_1_tid_res_arr_mem_128382 =
        reduce_stage_1_tid_res_arr_mem_128382;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131643_task;
    
    futhark_mc_segred_stage_1_parloop_131643_task.name =
        "futhark_mc_segred_stage_1_parloop_131643";
    futhark_mc_segred_stage_1_parloop_131643_task.fn =
        futhark_mc_segred_stage_1_parloop_131643;
    futhark_mc_segred_stage_1_parloop_131643_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131642;
    futhark_mc_segred_stage_1_parloop_131643_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131643_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131643_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131643_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131643_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131643_task);
    
    if (futhark_mc_segred_stage_1_parloop_131643_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131643_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131643_total_end -
                 futhark_mc_segred_stage_1_parloop_131643_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131643_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131643_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131643_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_128192 = 0.0F;
    }
    
    float x_128386;
    float x_128387;
    
    for (int32_t i_128389 = 0; i_128389 < num_tasks_128381; i_128389++) {
        flat_tid_119380 = i_128389;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_128386 = defunc_2_reduce_res_128192;
            }
            // load next params
            {
                x_128387 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_128382)[flat_tid_119380];
            }
            // red body
            {
                float defunc_1_op_res_128388 = x_128386 + x_128387;
                
                defunc_2_reduce_res_128192 = defunc_1_op_res_128388;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_128382);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131640_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131640_end -
                 futhark_mc_segred_task_131640_start;
        
        ctx->futhark_mc_segred_task_131640_runs[tid]++;
        ctx->futhark_mc_segred_task_131640_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131640_iter[tid] += iterations;
    }
    *futhark_mc_task_131639->retval_defunc_2_reduce_res_128192 =
        defunc_2_reduce_res_128192;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131633(void *args, int64_t start,
                                            int64_t end, int flat_tid_119376,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131632
    *futhark_mc_segmap_parloop_struct_131632 =
    (struct futhark_mc_segmap_parloop_struct_131632 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131632->ctx;
    uint64_t futhark_mc_segmap_parloop_131633_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131633_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131632->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131632->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131632->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131632->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131632->free_i_114610;
    int64_t gtid_119373 =
            futhark_mc_segmap_parloop_struct_131632->free_gtid_119373;
    int64_t x_119443 = futhark_mc_segmap_parloop_struct_131632->free_x_119443;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131632->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131632->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131632->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131632->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131632->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_122992 = {.desc ="mem_122992", .mem =
                                  futhark_mc_segmap_parloop_struct_131632->free_mem_122992,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_128324 = start;
    
    for (; iter_128324 < end; iter_128324++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128370 = t_n_m_114591;
        int64_t gtid_119377 = iter_128324;
        int64_t remnant_128371 = iter_128324 - gtid_119377;
        int64_t x_128165 = ((int64_t *) mem_122204.mem)[gtid_119373 *
                                                        t_n_m_114591 +
                                                        gtid_119377];
        float x_128166 = ((float *) mem_122208.mem)[gtid_119373 * t_n_m_114591 +
                                                    gtid_119377];
        int64_t min_arg_128167 = mul64(t_jump_114541, gtid_119377);
        int64_t min_res_128168 = smin64(i_114610, min_arg_128167);
        float defunc_0_f_res_128169 = sitofp_i64_f32(min_res_128168);
        float defunc_2_reduce_res_128170;
        int64_t flat_tid_119378 = (int64_t) 0;
        int32_t num_tasks_128372;
        struct futhark_mc_task_131634 futhark_mc_task_131634;
        
        futhark_mc_task_131634.ctx = ctx;
        futhark_mc_task_131634.free_n_114534 = n_114534;
        futhark_mc_task_131634.free_gtid_119373 = gtid_119373;
        futhark_mc_task_131634.free_x_119443 = x_119443;
        futhark_mc_task_131634.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131634.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131634.free_x_128165 = x_128165;
        futhark_mc_task_131634.free_x_128166 = x_128166;
        futhark_mc_task_131634.free_defunc_0_f_res_128169 =
            defunc_0_f_res_128169;
        futhark_mc_task_131634.retval_defunc_2_reduce_res_128170 =
            &defunc_2_reduce_res_128170;
        
        struct scheduler_segop futhark_mc_task_131634_task;
        
        futhark_mc_task_131634_task.args = &futhark_mc_task_131634;
        futhark_mc_task_131634_task.top_level_fn =
            futhark_mc_segred_task_131635;
        futhark_mc_task_131634_task.name = "futhark_mc_segred_task_131635";
        futhark_mc_task_131634_task.iterations = t_window_114537;
        futhark_mc_task_131634_task.task_time =
            &ctx->futhark_mc_segred_task_131635_total_time;
        futhark_mc_task_131634_task.task_iter =
            &ctx->futhark_mc_segred_task_131635_total_iter;
        futhark_mc_task_131634_task.sched = STATIC;
        futhark_mc_task_131634_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131635_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131634_task);
        
        if (futhark_mc_segred_task_131635_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float a0_128191 = 1.0F / defunc_2_reduce_res_128170;
        float defunc_2_reduce_res_128192;
        int64_t flat_tid_119380 = (int64_t) 0;
        int32_t num_tasks_128381;
        struct futhark_mc_task_131639 futhark_mc_task_131639;
        
        futhark_mc_task_131639.ctx = ctx;
        futhark_mc_task_131639.free_n_114534 = n_114534;
        futhark_mc_task_131639.free_gtid_119373 = gtid_119373;
        futhark_mc_task_131639.free_x_119443 = x_119443;
        futhark_mc_task_131639.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131639.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131639.free_mem_122985 = mem_122985.mem;
        futhark_mc_task_131639.free_x_128165 = x_128165;
        futhark_mc_task_131639.free_x_128166 = x_128166;
        futhark_mc_task_131639.free_defunc_0_f_res_128169 =
            defunc_0_f_res_128169;
        futhark_mc_task_131639.free_a0_128191 = a0_128191;
        futhark_mc_task_131639.retval_defunc_2_reduce_res_128192 =
            &defunc_2_reduce_res_128192;
        
        struct scheduler_segop futhark_mc_task_131639_task;
        
        futhark_mc_task_131639_task.args = &futhark_mc_task_131639;
        futhark_mc_task_131639_task.top_level_fn =
            futhark_mc_segred_task_131640;
        futhark_mc_task_131639_task.name = "futhark_mc_segred_task_131640";
        futhark_mc_task_131639_task.iterations = t_window_114537;
        futhark_mc_task_131639_task.task_time =
            &ctx->futhark_mc_segred_task_131640_total_time;
        futhark_mc_task_131639_task.task_iter =
            &ctx->futhark_mc_segred_task_131640_total_iter;
        futhark_mc_task_131639_task.sched = STATIC;
        futhark_mc_task_131639_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131640_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131639_task);
        
        if (futhark_mc_segred_task_131640_err != 0) {
            err = 1;
            goto cleanup;
        }
        ((float *) mem_122992.mem)[gtid_119377] = defunc_2_reduce_res_128192;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131633_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131633_end -
                 futhark_mc_segmap_parloop_131633_start;
        
        ctx->futhark_mc_segmap_parloop_131633_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131633_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131633_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131631(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119376 = tid;
    int num_tasks_128273 = info.nsubtasks;
    struct futhark_mc_task_131627 *futhark_mc_task_131627 =
                                  (struct futhark_mc_task_131627 *) args;
    struct futhark_context *ctx = futhark_mc_task_131627->ctx;
    uint64_t futhark_mc_segmap_nested_task_131631_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131631_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131627->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131627->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131627->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131627->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131627->free_i_114610;
    int64_t gtid_119373 = futhark_mc_task_131627->free_gtid_119373;
    int64_t x_119443 = futhark_mc_task_131627->free_x_119443;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131627->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131627->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131627->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131627->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131627->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_122992 = {.desc ="mem_122992", .mem =
                                  futhark_mc_task_131627->free_mem_122992,
                                  .size =0, .references =NULL};
    int64_t iter_128324;
    struct futhark_mc_segmap_parloop_struct_131632
    futhark_mc_segmap_parloop_struct_131632;
    
    futhark_mc_segmap_parloop_struct_131632.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131632.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131632.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131632.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131632.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131632.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131632.free_gtid_119373 = gtid_119373;
    futhark_mc_segmap_parloop_struct_131632.free_x_119443 = x_119443;
    futhark_mc_segmap_parloop_struct_131632.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131632.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131632.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131632.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131632.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131632.free_mem_122992 = mem_122992.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131633_task;
    
    futhark_mc_segmap_parloop_131633_task.name =
        "futhark_mc_segmap_parloop_131633";
    futhark_mc_segmap_parloop_131633_task.fn = futhark_mc_segmap_parloop_131633;
    futhark_mc_segmap_parloop_131633_task.args =
        &futhark_mc_segmap_parloop_struct_131632;
    futhark_mc_segmap_parloop_131633_task.iterations = iterations;
    futhark_mc_segmap_parloop_131633_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131633_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131633_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131633_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131633_task);
    
    if (futhark_mc_segmap_parloop_131633_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131633_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131633_total_end -
                 futhark_mc_segmap_parloop_131633_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131633_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131633_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131633_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131631_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131631_end -
                 futhark_mc_segmap_nested_task_131631_start;
        
        ctx->futhark_mc_segmap_nested_task_131631_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131631_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131631_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131625(void *args, int64_t start,
                                            int64_t end, int flat_tid_119372,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131624
    *futhark_mc_segmap_parloop_struct_131624 =
    (struct futhark_mc_segmap_parloop_struct_131624 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131624->ctx;
    uint64_t futhark_mc_segmap_parloop_131625_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131625_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131624->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131624->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131624->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131624->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131624->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131624->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131624->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131624->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131624->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131624->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131624->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131624->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131624->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123011 = {.desc ="mem_123011", .mem =
                                  futhark_mc_segmap_parloop_struct_131624->free_mem_123011,
                                  .size =0, .references =NULL};
    size_t mem_122992_cached_sizze_131626 = 0;
    char *mem_122992 = NULL;
    int64_t iterations = end - start;
    int64_t iter_128164 = start;
    
    if (mem_122992_cached_sizze_131626 < (size_t) bytes_122135) {
        mem_122992 = realloc(mem_122992, bytes_122135);
        mem_122992_cached_sizze_131626 = bytes_122135;
    }
    for (; iter_128164 < end; iter_128164++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128271 = m_114533;
        int64_t gtid_119373 = iter_128164;
        int64_t remnant_128272 = iter_128164 - gtid_119373;
        int64_t x_119443 = ((int64_t *) mem_121982.mem)[gtid_119373];
        int64_t flat_tid_119374 = (int64_t) 0;
        int32_t num_tasks_128273;
        int64_t flat_tid_119376 = (int64_t) 0;
        struct futhark_mc_task_131627 futhark_mc_task_131627;
        
        futhark_mc_task_131627.ctx = ctx;
        futhark_mc_task_131627.free_n_114534 = n_114534;
        futhark_mc_task_131627.free_t_window_114537 = t_window_114537;
        futhark_mc_task_131627.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131627.free_t_n_m_114591 = t_n_m_114591;
        futhark_mc_task_131627.free_i_114610 = i_114610;
        futhark_mc_task_131627.free_gtid_119373 = gtid_119373;
        futhark_mc_task_131627.free_x_119443 = x_119443;
        futhark_mc_task_131627.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131627.free_mem_122204 = mem_122204.mem;
        futhark_mc_task_131627.free_mem_122208 = mem_122208.mem;
        futhark_mc_task_131627.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131627.free_mem_122985 = mem_122985.mem;
        futhark_mc_task_131627.free_mem_122992 = mem_122992;
        
        struct scheduler_segop futhark_mc_task_131627_task;
        
        futhark_mc_task_131627_task.args = &futhark_mc_task_131627;
        futhark_mc_task_131627_task.top_level_fn =
            futhark_mc_segmap_task_131628;
        futhark_mc_task_131627_task.name = "futhark_mc_segmap_task_131628";
        futhark_mc_task_131627_task.iterations = t_n_m_114591;
        futhark_mc_task_131627_task.task_time =
            &ctx->futhark_mc_segmap_task_131628_total_time;
        futhark_mc_task_131627_task.task_iter =
            &ctx->futhark_mc_segmap_task_131628_total_iter;
        futhark_mc_task_131627_task.sched = STATIC;
        futhark_mc_task_131627_task.nested_fn =
            futhark_mc_segmap_nested_task_131631;
        
        int futhark_mc_segmap_task_131628_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131627_task);
        
        if (futhark_mc_segmap_task_131628_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_123011.mem + gtid_119373 * t_n_m_114591 * (int64_t) 4,
                mem_122992 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_122992);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131625_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131625_end -
                 futhark_mc_segmap_parloop_131625_start;
        
        ctx->futhark_mc_segmap_parloop_131625_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131625_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131625_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131623(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119372 = tid;
    int num_tasks_128101 = info.nsubtasks;
    struct futhark_mc_task_131618 *futhark_mc_task_131618 =
                                  (struct futhark_mc_task_131618 *) args;
    struct futhark_context *ctx = futhark_mc_task_131618->ctx;
    uint64_t futhark_mc_segmap_nested_task_131623_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131623_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131618->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131618->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131618->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131618->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131618->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131618->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131618->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131618->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131618->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131618->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131618->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131618->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131618->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123011 = {.desc ="mem_123011", .mem =
                                  futhark_mc_task_131618->free_mem_123011,
                                  .size =0, .references =NULL};
    int64_t iter_128164;
    struct futhark_mc_segmap_parloop_struct_131624
    futhark_mc_segmap_parloop_struct_131624;
    
    futhark_mc_segmap_parloop_struct_131624.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131624.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131624.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131624.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131624.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131624.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131624.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131624.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131624.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131624.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131624.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131624.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131624.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131624.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131624.free_mem_123011 = mem_123011.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131625_task;
    
    futhark_mc_segmap_parloop_131625_task.name =
        "futhark_mc_segmap_parloop_131625";
    futhark_mc_segmap_parloop_131625_task.fn = futhark_mc_segmap_parloop_131625;
    futhark_mc_segmap_parloop_131625_task.args =
        &futhark_mc_segmap_parloop_struct_131624;
    futhark_mc_segmap_parloop_131625_task.iterations = iterations;
    futhark_mc_segmap_parloop_131625_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131625_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131625_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131625_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131625_task);
    
    if (futhark_mc_segmap_parloop_131625_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131625_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131625_total_end -
                 futhark_mc_segmap_parloop_131625_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131625_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131625_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131625_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131623_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131623_end -
                 futhark_mc_segmap_nested_task_131623_start;
        
        ctx->futhark_mc_segmap_nested_task_131623_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131623_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131623_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131644 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123051;
    char *free_mem_123055;
};
struct futhark_mc_segmap_parloop_struct_131646 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123051;
    char *free_mem_123055;
};
static int futhark_mc_segmap_parloop_131647(void *args, int64_t start,
                                            int64_t end, int flat_tid_119557,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131646
    *futhark_mc_segmap_parloop_struct_131646 =
    (struct futhark_mc_segmap_parloop_struct_131646 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131646->ctx;
    uint64_t futhark_mc_segmap_parloop_131647_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131647_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131646->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131646->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131646->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131646->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131646->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131646->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131646->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131646->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131646->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131646->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131646->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131646->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131646->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123051 = {.desc ="mem_123051", .mem =
                                  futhark_mc_segmap_parloop_struct_131646->free_mem_123051,
                                  .size =0, .references =NULL};
    struct memblock mem_123055 = {.desc ="mem_123055", .mem =
                                  futhark_mc_segmap_parloop_struct_131646->free_mem_123055,
                                  .size =0, .references =NULL};
    size_t mem_123020_cached_sizze_131648 = 0;
    char *mem_123020 = NULL;
    size_t mem_123023_cached_sizze_131649 = 0;
    char *mem_123023 = NULL;
    int64_t iterations = end - start;
    int64_t iter_128391 = start;
    
    if (mem_123020_cached_sizze_131648 < (size_t) bytes_122135) {
        mem_123020 = realloc(mem_123020, bytes_122135);
        mem_123020_cached_sizze_131648 = bytes_122135;
    }
    if (mem_123023_cached_sizze_131649 < (size_t) bytes_122135) {
        mem_123023 = realloc(mem_123023, bytes_122135);
        mem_123023_cached_sizze_131649 = bytes_122135;
    }
    for (; iter_128391 < end; iter_128391++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128475 = m_114533;
        int64_t gtid_119558 = iter_128391;
        int64_t remnant_128476 = iter_128391 - gtid_119558;
        int64_t x_115960 = ((int64_t *) mem_121982.mem)[gtid_119558];
        
        for (int64_t i_128392 = 0; i_128392 < t_n_m_114591; i_128392++) {
            int64_t x_128395 = ((int64_t *) mem_122204.mem)[gtid_119558 *
                                                            t_n_m_114591 +
                                                            i_128392];
            float x_128396 = ((float *) mem_122208.mem)[gtid_119558 *
                                                        t_n_m_114591 +
                                                        i_128392];
            int64_t min_arg_128397 = mul64(t_jump_114541, i_128392);
            int64_t min_res_128398 = smin64(i_114610, min_arg_128397);
            float defunc_0_f_res_128399 = sitofp_i64_f32(min_res_128398);
            float defunc_2_reduce_res_128400;
            float defunc_2_reduce_res_128401;
            float defunc_2_reduce_res_128402;
            float redout_128404;
            float redout_128405;
            float redout_128406;
            
            redout_128404 = 0.0F;
            redout_128405 = 0.0F;
            redout_128406 = 0.0F;
            for (int64_t i_128403 = 0; i_128403 < t_window_114537; i_128403++) {
                bool cond_128407 = sle64(x_115960, i_128403);
                float defunc_0_f_res_128408;
                
                if (cond_128407) {
                    defunc_0_f_res_128408 = 0.0F;
                } else {
                    int64_t i_128409 = add64(x_128395, i_128403);
                    float x_128410 = ((float *) mem_122004.mem)[gtid_119558 *
                                                                n_114534 +
                                                                i_128409];
                    float defunc_0_f_res_f_res_128411 = 1.0F + x_128410;
                    
                    defunc_0_f_res_128408 = defunc_0_f_res_f_res_128411;
                }
                
                float defunc_0_f_res_128412;
                
                if (cond_128407) {
                    defunc_0_f_res_128412 = 0.0F;
                } else {
                    int64_t i_128413 = add64(x_128395, i_128403);
                    float x_128414 = ((float *) mem_122430.mem)[gtid_119558 *
                                                                n_114534 +
                                                                i_128413];
                    
                    defunc_0_f_res_128412 = x_128414;
                }
                
                float x_j_128415 = defunc_0_f_res_128408 -
                      defunc_0_f_res_128399;
                float abs_res_128416 = (float) fabs(x_j_128415);
                float tmp1_128417 = abs_res_128416 / x_128396;
                float x_128418 = tmp1_128417 * tmp1_128417;
                float y_128419 = tmp1_128417 * x_128418;
                float tmp2_128420 = 1.0F - y_128419;
                float x_128421 = tmp2_128420 * tmp2_128420;
                float tmp3_128422 = tmp2_128420 * x_128421;
                float w_j_128423 = defunc_0_f_res_128412 * tmp3_128422;
                float xw_j_128424 = x_j_128415 * w_j_128423;
                float x2w_j_128425 = x_j_128415 * xw_j_128424;
                float defunc_1_op_res_128426 = w_j_128423 + redout_128404;
                float defunc_1_op_res_128427 = xw_j_128424 + redout_128405;
                float defunc_1_op_res_128428 = x2w_j_128425 + redout_128406;
                float redout_tmp_128479 = defunc_1_op_res_128426;
                float redout_tmp_128480 = defunc_1_op_res_128427;
                float redout_tmp_128481 = defunc_1_op_res_128428;
                
                redout_128404 = redout_tmp_128479;
                redout_128405 = redout_tmp_128480;
                redout_128406 = redout_tmp_128481;
            }
            defunc_2_reduce_res_128400 = redout_128404;
            defunc_2_reduce_res_128401 = redout_128405;
            defunc_2_reduce_res_128402 = redout_128406;
            
            float x_128429 = defunc_2_reduce_res_128400 *
                  defunc_2_reduce_res_128402;
            float y_128430 = defunc_2_reduce_res_128401 *
                  defunc_2_reduce_res_128401;
            float y_128431 = x_128429 - y_128430;
            float det1_128432 = 1.0F / y_128431;
            float a11_128433 = defunc_2_reduce_res_128402 * det1_128432;
            float negate_arg_128434 = defunc_2_reduce_res_128401 * det1_128432;
            float b11_128435 = 0.0F - negate_arg_128434;
            float c11_128436 = defunc_2_reduce_res_128400 * det1_128432;
            float defunc_2_reduce_res_128437;
            float defunc_2_reduce_res_128438;
            float redout_128440;
            float redout_128441;
            
            redout_128440 = 0.0F;
            redout_128441 = 0.0F;
            for (int64_t i_128439 = 0; i_128439 < t_window_114537; i_128439++) {
                bool cond_128442 = sle64(x_115960, i_128439);
                float defunc_0_f_res_128443;
                
                if (cond_128442) {
                    defunc_0_f_res_128443 = 0.0F;
                } else {
                    int64_t i_128444 = add64(x_128395, i_128439);
                    float x_128445 = ((float *) mem_122004.mem)[gtid_119558 *
                                                                n_114534 +
                                                                i_128444];
                    float defunc_0_f_res_f_res_128446 = 1.0F + x_128445;
                    
                    defunc_0_f_res_128443 = defunc_0_f_res_f_res_128446;
                }
                
                float defunc_0_f_res_128447;
                
                if (cond_128442) {
                    defunc_0_f_res_128447 = 0.0F;
                } else {
                    int64_t i_128448 = add64(x_128395, i_128439);
                    float x_128449 = ((float *) mem_122430.mem)[gtid_119558 *
                                                                n_114534 +
                                                                i_128448];
                    
                    defunc_0_f_res_128447 = x_128449;
                }
                
                float x_j_128450 = defunc_0_f_res_128443 -
                      defunc_0_f_res_128399;
                float abs_res_128451 = (float) fabs(x_j_128450);
                float tmp1_128452 = abs_res_128451 / x_128396;
                float x_128453 = tmp1_128452 * tmp1_128452;
                float y_128454 = tmp1_128452 * x_128453;
                float tmp2_128455 = 1.0F - y_128454;
                float x_128456 = tmp2_128455 * tmp2_128455;
                float tmp3_128457 = tmp2_128455 * x_128456;
                float tmp4_128458 = defunc_0_f_res_128447 * tmp3_128457;
                float defunc_1_f_res_128459 = x_j_128450 * tmp4_128458;
                float defunc_0_f_res_128460;
                
                if (cond_128442) {
                    defunc_0_f_res_128460 = 0.0F;
                } else {
                    int64_t i_128461 = add64(x_128395, i_128439);
                    float x_128462 = ((float *) mem_122985.mem)[gtid_119558 *
                                                                n_114534 +
                                                                i_128461];
                    
                    defunc_0_f_res_128460 = x_128462;
                }
                
                float x_128463 = a11_128433 * tmp4_128458;
                float y_128464 = b11_128435 * defunc_1_f_res_128459;
                float x_128465 = x_128463 + y_128464;
                float defunc_9_fit_fun_res_128466 = defunc_0_f_res_128460 *
                      x_128465;
                float x_128467 = b11_128435 * tmp4_128458;
                float y_128468 = c11_128436 * defunc_1_f_res_128459;
                float x_128469 = x_128467 + y_128468;
                float defunc_9_slope_fun_res_128470 = defunc_0_f_res_128460 *
                      x_128469;
                float defunc_1_op_res_128471 = defunc_9_fit_fun_res_128466 +
                      redout_128440;
                float defunc_1_op_res_128472 = defunc_9_slope_fun_res_128470 +
                      redout_128441;
                float redout_tmp_128482 = defunc_1_op_res_128471;
                float redout_tmp_128483 = defunc_1_op_res_128472;
                
                redout_128440 = redout_tmp_128482;
                redout_128441 = redout_tmp_128483;
            }
            defunc_2_reduce_res_128437 = redout_128440;
            defunc_2_reduce_res_128438 = redout_128441;
            ((float *) mem_123020)[i_128392] = defunc_2_reduce_res_128437;
            ((float *) mem_123023)[i_128392] = defunc_2_reduce_res_128438;
        }
        memmove(mem_123051.mem + gtid_119558 * t_n_m_114591 * (int64_t) 4,
                mem_123020 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
        memmove(mem_123055.mem + gtid_119558 * t_n_m_114591 * (int64_t) 4,
                mem_123023 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123020);
    free(mem_123023);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131647_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131647_end -
                 futhark_mc_segmap_parloop_131647_start;
        
        ctx->futhark_mc_segmap_parloop_131647_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131647_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131647_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131645(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119557 = tid;
    int num_tasks_128390 = info.nsubtasks;
    struct futhark_mc_task_131644 *futhark_mc_task_131644 =
                                  (struct futhark_mc_task_131644 *) args;
    struct futhark_context *ctx = futhark_mc_task_131644->ctx;
    uint64_t futhark_mc_segmap_task_131645_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131645_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131644->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131644->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131644->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131644->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131644->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131644->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131644->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131644->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131644->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131644->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131644->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131644->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131644->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123051 = {.desc ="mem_123051", .mem =
                                  futhark_mc_task_131644->free_mem_123051,
                                  .size =0, .references =NULL};
    struct memblock mem_123055 = {.desc ="mem_123055", .mem =
                                  futhark_mc_task_131644->free_mem_123055,
                                  .size =0, .references =NULL};
    int64_t iter_128391;
    struct futhark_mc_segmap_parloop_struct_131646
    futhark_mc_segmap_parloop_struct_131646;
    
    futhark_mc_segmap_parloop_struct_131646.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131646.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131646.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131646.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131646.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131646.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131646.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131646.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131646.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131646.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131646.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131646.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131646.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131646.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131646.free_mem_123051 = mem_123051.mem;
    futhark_mc_segmap_parloop_struct_131646.free_mem_123055 = mem_123055.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131647_task;
    
    futhark_mc_segmap_parloop_131647_task.name =
        "futhark_mc_segmap_parloop_131647";
    futhark_mc_segmap_parloop_131647_task.fn = futhark_mc_segmap_parloop_131647;
    futhark_mc_segmap_parloop_131647_task.args =
        &futhark_mc_segmap_parloop_struct_131646;
    futhark_mc_segmap_parloop_131647_task.iterations = iterations;
    futhark_mc_segmap_parloop_131647_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131647_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131647_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131647_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131647_task);
    
    if (futhark_mc_segmap_parloop_131647_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131647_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131647_total_end -
                 futhark_mc_segmap_parloop_131647_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131647_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131647_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131647_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131645_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131645_end -
                 futhark_mc_segmap_task_131645_start;
        
        ctx->futhark_mc_segmap_task_131645_runs[tid]++;
        ctx->futhark_mc_segmap_task_131645_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131645_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131651 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123051;
    char *free_mem_123055;
};
struct futhark_mc_task_131655 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_119560;
    int64_t free_x_119658;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123014;
    char *free_mem_123017;
};
struct futhark_mc_segmap_parloop_struct_131657 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_119560;
    int64_t free_x_119658;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123014;
    char *free_mem_123017;
};
static int futhark_mc_segmap_parloop_131658(void *args, int64_t start,
                                            int64_t end, int flat_tid_119561,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131657
    *futhark_mc_segmap_parloop_struct_131657 =
    (struct futhark_mc_segmap_parloop_struct_131657 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131657->ctx;
    uint64_t futhark_mc_segmap_parloop_131658_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131658_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131657->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131657->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131657->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131657->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131657->free_i_114610;
    int64_t gtid_119560 =
            futhark_mc_segmap_parloop_struct_131657->free_gtid_119560;
    int64_t x_119658 = futhark_mc_segmap_parloop_struct_131657->free_x_119658;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131657->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131657->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131657->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131657->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131657->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123014 = {.desc ="mem_123014", .mem =
                                  futhark_mc_segmap_parloop_struct_131657->free_mem_123014,
                                  .size =0, .references =NULL};
    struct memblock mem_123017 = {.desc ="mem_123017", .mem =
                                  futhark_mc_segmap_parloop_struct_131657->free_mem_123017,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_128647 = start;
    
    for (; iter_128647 < end; iter_128647++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128708 = t_n_m_114591;
        int64_t gtid_119562 = iter_128647;
        int64_t remnant_128709 = iter_128647 - gtid_119562;
        int64_t x_128566 = ((int64_t *) mem_122204.mem)[gtid_119560 *
                                                        t_n_m_114591 +
                                                        gtid_119562];
        float x_128567 = ((float *) mem_122208.mem)[gtid_119560 * t_n_m_114591 +
                                                    gtid_119562];
        int64_t min_arg_128568 = mul64(t_jump_114541, gtid_119562);
        int64_t min_res_128569 = smin64(i_114610, min_arg_128568);
        float defunc_0_f_res_128570 = sitofp_i64_f32(min_res_128569);
        float defunc_2_reduce_res_128571;
        float defunc_2_reduce_res_128572;
        float defunc_2_reduce_res_128573;
        float redout_128649;
        float redout_128650;
        float redout_128651;
        
        redout_128649 = 0.0F;
        redout_128650 = 0.0F;
        redout_128651 = 0.0F;
        for (int64_t i_128648 = 0; i_128648 < t_window_114537; i_128648++) {
            bool cond_128652 = sle64(x_119658, i_128648);
            float defunc_0_f_res_128653;
            
            if (cond_128652) {
                defunc_0_f_res_128653 = 0.0F;
            } else {
                int64_t i_128654 = add64(x_128566, i_128648);
                float x_128655 = ((float *) mem_122004.mem)[gtid_119560 *
                                                            n_114534 +
                                                            i_128654];
                float defunc_0_f_res_f_res_128656 = 1.0F + x_128655;
                
                defunc_0_f_res_128653 = defunc_0_f_res_f_res_128656;
            }
            
            float defunc_0_f_res_128657;
            
            if (cond_128652) {
                defunc_0_f_res_128657 = 0.0F;
            } else {
                int64_t i_128658 = add64(x_128566, i_128648);
                float x_128659 = ((float *) mem_122430.mem)[gtid_119560 *
                                                            n_114534 +
                                                            i_128658];
                
                defunc_0_f_res_128657 = x_128659;
            }
            
            float x_j_128660 = defunc_0_f_res_128653 - defunc_0_f_res_128570;
            float abs_res_128661 = (float) fabs(x_j_128660);
            float tmp1_128662 = abs_res_128661 / x_128567;
            float x_128663 = tmp1_128662 * tmp1_128662;
            float y_128664 = tmp1_128662 * x_128663;
            float tmp2_128665 = 1.0F - y_128664;
            float x_128666 = tmp2_128665 * tmp2_128665;
            float tmp3_128667 = tmp2_128665 * x_128666;
            float w_j_128668 = defunc_0_f_res_128657 * tmp3_128667;
            float xw_j_128669 = x_j_128660 * w_j_128668;
            float x2w_j_128670 = x_j_128660 * xw_j_128669;
            float defunc_1_op_res_128671 = w_j_128668 + redout_128649;
            float defunc_1_op_res_128672 = xw_j_128669 + redout_128650;
            float defunc_1_op_res_128673 = x2w_j_128670 + redout_128651;
            float redout_tmp_128710 = defunc_1_op_res_128671;
            float redout_tmp_128711 = defunc_1_op_res_128672;
            float redout_tmp_128712 = defunc_1_op_res_128673;
            
            redout_128649 = redout_tmp_128710;
            redout_128650 = redout_tmp_128711;
            redout_128651 = redout_tmp_128712;
        }
        defunc_2_reduce_res_128571 = redout_128649;
        defunc_2_reduce_res_128572 = redout_128650;
        defunc_2_reduce_res_128573 = redout_128651;
        
        float x_128600 = defunc_2_reduce_res_128571 *
              defunc_2_reduce_res_128573;
        float y_128601 = defunc_2_reduce_res_128572 *
              defunc_2_reduce_res_128572;
        float y_128602 = x_128600 - y_128601;
        float det1_128603 = 1.0F / y_128602;
        float a11_128604 = defunc_2_reduce_res_128573 * det1_128603;
        float negate_arg_128605 = defunc_2_reduce_res_128572 * det1_128603;
        float b11_128606 = 0.0F - negate_arg_128605;
        float c11_128607 = defunc_2_reduce_res_128571 * det1_128603;
        float defunc_2_reduce_res_128608;
        float defunc_2_reduce_res_128609;
        float redout_128675;
        float redout_128676;
        
        redout_128675 = 0.0F;
        redout_128676 = 0.0F;
        for (int64_t i_128674 = 0; i_128674 < t_window_114537; i_128674++) {
            bool cond_128677 = sle64(x_119658, i_128674);
            float defunc_0_f_res_128678;
            
            if (cond_128677) {
                defunc_0_f_res_128678 = 0.0F;
            } else {
                int64_t i_128679 = add64(x_128566, i_128674);
                float x_128680 = ((float *) mem_122004.mem)[gtid_119560 *
                                                            n_114534 +
                                                            i_128679];
                float defunc_0_f_res_f_res_128681 = 1.0F + x_128680;
                
                defunc_0_f_res_128678 = defunc_0_f_res_f_res_128681;
            }
            
            float defunc_0_f_res_128682;
            
            if (cond_128677) {
                defunc_0_f_res_128682 = 0.0F;
            } else {
                int64_t i_128683 = add64(x_128566, i_128674);
                float x_128684 = ((float *) mem_122430.mem)[gtid_119560 *
                                                            n_114534 +
                                                            i_128683];
                
                defunc_0_f_res_128682 = x_128684;
            }
            
            float x_j_128685 = defunc_0_f_res_128678 - defunc_0_f_res_128570;
            float abs_res_128686 = (float) fabs(x_j_128685);
            float tmp1_128687 = abs_res_128686 / x_128567;
            float x_128688 = tmp1_128687 * tmp1_128687;
            float y_128689 = tmp1_128687 * x_128688;
            float tmp2_128690 = 1.0F - y_128689;
            float x_128691 = tmp2_128690 * tmp2_128690;
            float tmp3_128692 = tmp2_128690 * x_128691;
            float tmp4_128693 = defunc_0_f_res_128682 * tmp3_128692;
            float defunc_1_f_res_128694 = x_j_128685 * tmp4_128693;
            float defunc_0_f_res_128695;
            
            if (cond_128677) {
                defunc_0_f_res_128695 = 0.0F;
            } else {
                int64_t i_128696 = add64(x_128566, i_128674);
                float x_128697 = ((float *) mem_122985.mem)[gtid_119560 *
                                                            n_114534 +
                                                            i_128696];
                
                defunc_0_f_res_128695 = x_128697;
            }
            
            float x_128698 = a11_128604 * tmp4_128693;
            float y_128699 = b11_128606 * defunc_1_f_res_128694;
            float x_128700 = x_128698 + y_128699;
            float defunc_9_fit_fun_res_128701 = defunc_0_f_res_128695 *
                  x_128700;
            float x_128702 = b11_128606 * tmp4_128693;
            float y_128703 = c11_128607 * defunc_1_f_res_128694;
            float x_128704 = x_128702 + y_128703;
            float defunc_9_slope_fun_res_128705 = defunc_0_f_res_128695 *
                  x_128704;
            float defunc_1_op_res_128706 = defunc_9_fit_fun_res_128701 +
                  redout_128675;
            float defunc_1_op_res_128707 = defunc_9_slope_fun_res_128705 +
                  redout_128676;
            float redout_tmp_128713 = defunc_1_op_res_128706;
            float redout_tmp_128714 = defunc_1_op_res_128707;
            
            redout_128675 = redout_tmp_128713;
            redout_128676 = redout_tmp_128714;
        }
        defunc_2_reduce_res_128608 = redout_128675;
        defunc_2_reduce_res_128609 = redout_128676;
        ((float *) mem_123014.mem)[gtid_119562] = defunc_2_reduce_res_128608;
        ((float *) mem_123017.mem)[gtid_119562] = defunc_2_reduce_res_128609;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131658_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131658_end -
                 futhark_mc_segmap_parloop_131658_start;
        
        ctx->futhark_mc_segmap_parloop_131658_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131658_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131658_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131656(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119561 = tid;
    int num_tasks_128646 = info.nsubtasks;
    struct futhark_mc_task_131655 *futhark_mc_task_131655 =
                                  (struct futhark_mc_task_131655 *) args;
    struct futhark_context *ctx = futhark_mc_task_131655->ctx;
    uint64_t futhark_mc_segmap_task_131656_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131656_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131655->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131655->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131655->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131655->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131655->free_i_114610;
    int64_t gtid_119560 = futhark_mc_task_131655->free_gtid_119560;
    int64_t x_119658 = futhark_mc_task_131655->free_x_119658;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131655->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131655->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131655->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131655->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131655->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123014 = {.desc ="mem_123014", .mem =
                                  futhark_mc_task_131655->free_mem_123014,
                                  .size =0, .references =NULL};
    struct memblock mem_123017 = {.desc ="mem_123017", .mem =
                                  futhark_mc_task_131655->free_mem_123017,
                                  .size =0, .references =NULL};
    int64_t iter_128647;
    struct futhark_mc_segmap_parloop_struct_131657
    futhark_mc_segmap_parloop_struct_131657;
    
    futhark_mc_segmap_parloop_struct_131657.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131657.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131657.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131657.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131657.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131657.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131657.free_gtid_119560 = gtid_119560;
    futhark_mc_segmap_parloop_struct_131657.free_x_119658 = x_119658;
    futhark_mc_segmap_parloop_struct_131657.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131657.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131657.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131657.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131657.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131657.free_mem_123014 = mem_123014.mem;
    futhark_mc_segmap_parloop_struct_131657.free_mem_123017 = mem_123017.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131658_task;
    
    futhark_mc_segmap_parloop_131658_task.name =
        "futhark_mc_segmap_parloop_131658";
    futhark_mc_segmap_parloop_131658_task.fn = futhark_mc_segmap_parloop_131658;
    futhark_mc_segmap_parloop_131658_task.args =
        &futhark_mc_segmap_parloop_struct_131657;
    futhark_mc_segmap_parloop_131658_task.iterations = iterations;
    futhark_mc_segmap_parloop_131658_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131658_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131658_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131658_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131658_task);
    
    if (futhark_mc_segmap_parloop_131658_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131658_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131658_total_end -
                 futhark_mc_segmap_parloop_131658_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131658_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131658_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131658_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131656_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131656_end -
                 futhark_mc_segmap_task_131656_start;
        
        ctx->futhark_mc_segmap_task_131656_runs[tid]++;
        ctx->futhark_mc_segmap_task_131656_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131656_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131660 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_119560;
    int64_t free_x_119658;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123014;
    char *free_mem_123017;
};
struct futhark_mc_task_131662 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119560;
    int64_t free_x_119658;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_128485;
    float free_x_128486;
    float free_defunc_0_f_res_128489;
    float *retval_defunc_2_reduce_res_128490;
    float *retval_defunc_2_reduce_res_128491;
    float *retval_defunc_2_reduce_res_128492;
};
struct futhark_mc_segred_stage_1_parloop_struct_131667 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119560;
    int64_t free_x_119658;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_128485;
    float free_x_128486;
    float free_defunc_0_f_res_128489;
    char *free_reduce_stage_1_tid_res_arr_mem_128782;
    char *free_reduce_stage_1_tid_res_arr_mem_128784;
    char *free_reduce_stage_1_tid_res_arr_mem_128786;
};
static int futhark_mc_segred_stage_1_parloop_131668(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_119565,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131667
    *futhark_mc_segred_stage_1_parloop_struct_131667 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131667 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131667->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131668_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131668_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131667->free_n_114534;
    int64_t gtid_119560 =
            futhark_mc_segred_stage_1_parloop_struct_131667->free_gtid_119560;
    int64_t x_119658 =
            futhark_mc_segred_stage_1_parloop_struct_131667->free_x_119658;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131667->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131667->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_128485 =
            futhark_mc_segred_stage_1_parloop_struct_131667->free_x_128485;
    float x_128486 =
          futhark_mc_segred_stage_1_parloop_struct_131667->free_x_128486;
    float defunc_0_f_res_128489 =
          futhark_mc_segred_stage_1_parloop_struct_131667->free_defunc_0_f_res_128489;
    struct memblock reduce_stage_1_tid_res_arr_mem_128782 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_128782",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131667->free_reduce_stage_1_tid_res_arr_mem_128782,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_128784 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_128784",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131667->free_reduce_stage_1_tid_res_arr_mem_128784,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_128786 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_128786",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131667->free_reduce_stage_1_tid_res_arr_mem_128786,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_128788 = start;
    float x_128716;
    float x_128717;
    float x_128719;
    float x_128720;
    float x_128722;
    float x_128723;
    float local_acc_128789 = 0.0F;
    float local_acc_128790 = 0.0F;
    float local_acc_128791 = 0.0F;
    
    for (; iter_128788 < end; iter_128788++) {
        int64_t gtid_119566 = iter_128788;
        bool cond_128725 = sle64(x_119658, gtid_119566);
        float defunc_0_f_res_128726;
        
        if (cond_128725) {
            defunc_0_f_res_128726 = 0.0F;
        } else {
            int64_t i_128727 = add64(gtid_119566, x_128485);
            float x_128728 = ((float *) mem_122004.mem)[gtid_119560 * n_114534 +
                                                        i_128727];
            float defunc_0_f_res_f_res_128729 = 1.0F + x_128728;
            
            defunc_0_f_res_128726 = defunc_0_f_res_f_res_128729;
        }
        
        float defunc_0_f_res_128730;
        
        if (cond_128725) {
            defunc_0_f_res_128730 = 0.0F;
        } else {
            int64_t i_128731 = add64(gtid_119566, x_128485);
            float x_128732 = ((float *) mem_122430.mem)[gtid_119560 * n_114534 +
                                                        i_128731];
            
            defunc_0_f_res_128730 = x_128732;
        }
        
        float x_j_128733 = defunc_0_f_res_128726 - defunc_0_f_res_128489;
        float abs_res_128734 = (float) fabs(x_j_128733);
        float tmp1_128735 = abs_res_128734 / x_128486;
        float x_128736 = tmp1_128735 * tmp1_128735;
        float y_128737 = tmp1_128735 * x_128736;
        float tmp2_128738 = 1.0F - y_128737;
        float x_128739 = tmp2_128738 * tmp2_128738;
        float tmp3_128740 = tmp2_128738 * x_128739;
        float w_j_128741 = defunc_0_f_res_128730 * tmp3_128740;
        float xw_j_128742 = x_j_128733 * w_j_128741;
        float x2w_j_128743 = x_j_128733 * xw_j_128742;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_128716 = local_acc_128789;
        }
        // Load next params
        {
            x_128717 = w_j_128741;
        }
        // Red body
        {
            float defunc_1_op_res_128718 = x_128716 + x_128717;
            
            local_acc_128789 = defunc_1_op_res_128718;
        }
        // Load accum params
        {
            x_128719 = local_acc_128790;
        }
        // Load next params
        {
            x_128720 = xw_j_128742;
        }
        // Red body
        {
            float defunc_1_op_res_128721 = x_128719 + x_128720;
            
            local_acc_128790 = defunc_1_op_res_128721;
        }
        // Load accum params
        {
            x_128722 = local_acc_128791;
        }
        // Load next params
        {
            x_128723 = x2w_j_128743;
        }
        // Red body
        {
            float defunc_1_op_res_128724 = x_128722 + x_128723;
            
            local_acc_128791 = defunc_1_op_res_128724;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_128782.mem)[flat_tid_119565] =
        local_acc_128789;
    ((float *) reduce_stage_1_tid_res_arr_mem_128784.mem)[flat_tid_119565] =
        local_acc_128790;
    ((float *) reduce_stage_1_tid_res_arr_mem_128786.mem)[flat_tid_119565] =
        local_acc_128791;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131668_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131668_end -
                 futhark_mc_segred_stage_1_parloop_131668_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131668_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131668_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131668_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131663(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119565 = tid;
    int num_tasks_128781 = info.nsubtasks;
    struct futhark_mc_task_131662 *futhark_mc_task_131662 =
                                  (struct futhark_mc_task_131662 *) args;
    struct futhark_context *ctx = futhark_mc_task_131662->ctx;
    uint64_t futhark_mc_segred_task_131663_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131663_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131662->free_n_114534;
    int64_t gtid_119560 = futhark_mc_task_131662->free_gtid_119560;
    int64_t x_119658 = futhark_mc_task_131662->free_x_119658;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131662->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131662->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_128485 = futhark_mc_task_131662->free_x_128485;
    float x_128486 = futhark_mc_task_131662->free_x_128486;
    float defunc_0_f_res_128489 =
          futhark_mc_task_131662->free_defunc_0_f_res_128489;
    float defunc_2_reduce_res_128490 =
          *futhark_mc_task_131662->retval_defunc_2_reduce_res_128490;
    float defunc_2_reduce_res_128491 =
          *futhark_mc_task_131662->retval_defunc_2_reduce_res_128491;
    float defunc_2_reduce_res_128492 =
          *futhark_mc_task_131662->retval_defunc_2_reduce_res_128492;
    size_t reduce_stage_1_tid_res_arr_mem_128782_cached_sizze_131664 = 0;
    char *reduce_stage_1_tid_res_arr_mem_128782 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_128784_cached_sizze_131665 = 0;
    char *reduce_stage_1_tid_res_arr_mem_128784 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_128786_cached_sizze_131666 = 0;
    char *reduce_stage_1_tid_res_arr_mem_128786 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_128782_cached_sizze_131664 <
        (size_t) ((int64_t) 4 * num_tasks_128781)) {
        reduce_stage_1_tid_res_arr_mem_128782 =
            realloc(reduce_stage_1_tid_res_arr_mem_128782, (int64_t) 4 *
                    num_tasks_128781);
        reduce_stage_1_tid_res_arr_mem_128782_cached_sizze_131664 =
            (int64_t) 4 * num_tasks_128781;
    }
    if (reduce_stage_1_tid_res_arr_mem_128784_cached_sizze_131665 <
        (size_t) ((int64_t) 4 * num_tasks_128781)) {
        reduce_stage_1_tid_res_arr_mem_128784 =
            realloc(reduce_stage_1_tid_res_arr_mem_128784, (int64_t) 4 *
                    num_tasks_128781);
        reduce_stage_1_tid_res_arr_mem_128784_cached_sizze_131665 =
            (int64_t) 4 * num_tasks_128781;
    }
    if (reduce_stage_1_tid_res_arr_mem_128786_cached_sizze_131666 <
        (size_t) ((int64_t) 4 * num_tasks_128781)) {
        reduce_stage_1_tid_res_arr_mem_128786 =
            realloc(reduce_stage_1_tid_res_arr_mem_128786, (int64_t) 4 *
                    num_tasks_128781);
        reduce_stage_1_tid_res_arr_mem_128786_cached_sizze_131666 =
            (int64_t) 4 * num_tasks_128781;
    }
    
    int64_t iter_128788;
    struct futhark_mc_segred_stage_1_parloop_struct_131667
    futhark_mc_segred_stage_1_parloop_struct_131667;
    
    futhark_mc_segred_stage_1_parloop_struct_131667.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131667.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131667.free_gtid_119560 =
        gtid_119560;
    futhark_mc_segred_stage_1_parloop_struct_131667.free_x_119658 = x_119658;
    futhark_mc_segred_stage_1_parloop_struct_131667.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131667.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131667.free_x_128485 = x_128485;
    futhark_mc_segred_stage_1_parloop_struct_131667.free_x_128486 = x_128486;
    futhark_mc_segred_stage_1_parloop_struct_131667.free_defunc_0_f_res_128489 =
        defunc_0_f_res_128489;
    futhark_mc_segred_stage_1_parloop_struct_131667.free_reduce_stage_1_tid_res_arr_mem_128782 =
        reduce_stage_1_tid_res_arr_mem_128782;
    futhark_mc_segred_stage_1_parloop_struct_131667.free_reduce_stage_1_tid_res_arr_mem_128784 =
        reduce_stage_1_tid_res_arr_mem_128784;
    futhark_mc_segred_stage_1_parloop_struct_131667.free_reduce_stage_1_tid_res_arr_mem_128786 =
        reduce_stage_1_tid_res_arr_mem_128786;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131668_task;
    
    futhark_mc_segred_stage_1_parloop_131668_task.name =
        "futhark_mc_segred_stage_1_parloop_131668";
    futhark_mc_segred_stage_1_parloop_131668_task.fn =
        futhark_mc_segred_stage_1_parloop_131668;
    futhark_mc_segred_stage_1_parloop_131668_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131667;
    futhark_mc_segred_stage_1_parloop_131668_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131668_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131668_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131668_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131668_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131668_task);
    
    if (futhark_mc_segred_stage_1_parloop_131668_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131668_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131668_total_end -
                 futhark_mc_segred_stage_1_parloop_131668_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131668_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131668_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131668_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_128490 = 0.0F;
        defunc_2_reduce_res_128491 = 0.0F;
        defunc_2_reduce_res_128492 = 0.0F;
    }
    
    float x_128792;
    float x_128793;
    float x_128795;
    float x_128796;
    float x_128798;
    float x_128799;
    
    for (int32_t i_128801 = 0; i_128801 < num_tasks_128781; i_128801++) {
        flat_tid_119565 = i_128801;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_128792 = defunc_2_reduce_res_128490;
            }
            // load next params
            {
                x_128793 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_128782)[flat_tid_119565];
            }
            // red body
            {
                float defunc_1_op_res_128794 = x_128792 + x_128793;
                
                defunc_2_reduce_res_128490 = defunc_1_op_res_128794;
            }
            // load acc params
            {
                x_128795 = defunc_2_reduce_res_128491;
            }
            // load next params
            {
                x_128796 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_128784)[flat_tid_119565];
            }
            // red body
            {
                float defunc_1_op_res_128797 = x_128795 + x_128796;
                
                defunc_2_reduce_res_128491 = defunc_1_op_res_128797;
            }
            // load acc params
            {
                x_128798 = defunc_2_reduce_res_128492;
            }
            // load next params
            {
                x_128799 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_128786)[flat_tid_119565];
            }
            // red body
            {
                float defunc_1_op_res_128800 = x_128798 + x_128799;
                
                defunc_2_reduce_res_128492 = defunc_1_op_res_128800;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_128782);
    free(reduce_stage_1_tid_res_arr_mem_128784);
    free(reduce_stage_1_tid_res_arr_mem_128786);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131663_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131663_end -
                 futhark_mc_segred_task_131663_start;
        
        ctx->futhark_mc_segred_task_131663_runs[tid]++;
        ctx->futhark_mc_segred_task_131663_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131663_iter[tid] += iterations;
    }
    *futhark_mc_task_131662->retval_defunc_2_reduce_res_128490 =
        defunc_2_reduce_res_128490;
    *futhark_mc_task_131662->retval_defunc_2_reduce_res_128491 =
        defunc_2_reduce_res_128491;
    *futhark_mc_task_131662->retval_defunc_2_reduce_res_128492 =
        defunc_2_reduce_res_128492;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131669 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119560;
    int64_t free_x_119658;
    char *free_mem_122004;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_x_128485;
    float free_x_128486;
    float free_defunc_0_f_res_128489;
    float free_a11_128525;
    float free_b11_128527;
    float free_c11_128528;
    float *retval_defunc_2_reduce_res_128529;
    float *retval_defunc_2_reduce_res_128530;
};
struct futhark_mc_segred_stage_1_parloop_struct_131673 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119560;
    int64_t free_x_119658;
    char *free_mem_122004;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_x_128485;
    float free_x_128486;
    float free_defunc_0_f_res_128489;
    float free_a11_128525;
    float free_b11_128527;
    float free_c11_128528;
    char *free_reduce_stage_1_tid_res_arr_mem_128803;
    char *free_reduce_stage_1_tid_res_arr_mem_128805;
};
static int futhark_mc_segred_stage_1_parloop_131674(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_119567,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131673
    *futhark_mc_segred_stage_1_parloop_struct_131673 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131673 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131673->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131674_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131674_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131673->free_n_114534;
    int64_t gtid_119560 =
            futhark_mc_segred_stage_1_parloop_struct_131673->free_gtid_119560;
    int64_t x_119658 =
            futhark_mc_segred_stage_1_parloop_struct_131673->free_x_119658;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131673->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131673->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131673->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t x_128485 =
            futhark_mc_segred_stage_1_parloop_struct_131673->free_x_128485;
    float x_128486 =
          futhark_mc_segred_stage_1_parloop_struct_131673->free_x_128486;
    float defunc_0_f_res_128489 =
          futhark_mc_segred_stage_1_parloop_struct_131673->free_defunc_0_f_res_128489;
    float a11_128525 =
          futhark_mc_segred_stage_1_parloop_struct_131673->free_a11_128525;
    float b11_128527 =
          futhark_mc_segred_stage_1_parloop_struct_131673->free_b11_128527;
    float c11_128528 =
          futhark_mc_segred_stage_1_parloop_struct_131673->free_c11_128528;
    struct memblock reduce_stage_1_tid_res_arr_mem_128803 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_128803",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131673->free_reduce_stage_1_tid_res_arr_mem_128803,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_128805 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_128805",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131673->free_reduce_stage_1_tid_res_arr_mem_128805,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_128807 = start;
    float x_128744;
    float x_128745;
    float x_128747;
    float x_128748;
    float local_acc_128808 = 0.0F;
    float local_acc_128809 = 0.0F;
    
    for (; iter_128807 < end; iter_128807++) {
        int64_t gtid_119568 = iter_128807;
        bool cond_128750 = sle64(x_119658, gtid_119568);
        float defunc_0_f_res_128751;
        
        if (cond_128750) {
            defunc_0_f_res_128751 = 0.0F;
        } else {
            int64_t i_128752 = add64(gtid_119568, x_128485);
            float x_128753 = ((float *) mem_122004.mem)[gtid_119560 * n_114534 +
                                                        i_128752];
            float defunc_0_f_res_f_res_128754 = 1.0F + x_128753;
            
            defunc_0_f_res_128751 = defunc_0_f_res_f_res_128754;
        }
        
        float defunc_0_f_res_128755;
        
        if (cond_128750) {
            defunc_0_f_res_128755 = 0.0F;
        } else {
            int64_t i_128756 = add64(gtid_119568, x_128485);
            float x_128757 = ((float *) mem_122430.mem)[gtid_119560 * n_114534 +
                                                        i_128756];
            
            defunc_0_f_res_128755 = x_128757;
        }
        
        float x_j_128758 = defunc_0_f_res_128751 - defunc_0_f_res_128489;
        float abs_res_128759 = (float) fabs(x_j_128758);
        float tmp1_128760 = abs_res_128759 / x_128486;
        float x_128761 = tmp1_128760 * tmp1_128760;
        float y_128762 = tmp1_128760 * x_128761;
        float tmp2_128763 = 1.0F - y_128762;
        float x_128764 = tmp2_128763 * tmp2_128763;
        float tmp3_128765 = tmp2_128763 * x_128764;
        float tmp4_128766 = defunc_0_f_res_128755 * tmp3_128765;
        float defunc_1_f_res_128767 = x_j_128758 * tmp4_128766;
        float defunc_0_f_res_128768;
        
        if (cond_128750) {
            defunc_0_f_res_128768 = 0.0F;
        } else {
            int64_t i_128769 = add64(gtid_119568, x_128485);
            float x_128770 = ((float *) mem_122985.mem)[gtid_119560 * n_114534 +
                                                        i_128769];
            
            defunc_0_f_res_128768 = x_128770;
        }
        
        float x_128771 = a11_128525 * tmp4_128766;
        float y_128772 = b11_128527 * defunc_1_f_res_128767;
        float x_128773 = x_128771 + y_128772;
        float defunc_9_fit_fun_res_128774 = defunc_0_f_res_128768 * x_128773;
        float x_128775 = b11_128527 * tmp4_128766;
        float y_128776 = c11_128528 * defunc_1_f_res_128767;
        float x_128777 = x_128775 + y_128776;
        float defunc_9_slope_fun_res_128778 = defunc_0_f_res_128768 * x_128777;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_128744 = local_acc_128808;
        }
        // Load next params
        {
            x_128745 = defunc_9_fit_fun_res_128774;
        }
        // Red body
        {
            float defunc_1_op_res_128746 = x_128744 + x_128745;
            
            local_acc_128808 = defunc_1_op_res_128746;
        }
        // Load accum params
        {
            x_128747 = local_acc_128809;
        }
        // Load next params
        {
            x_128748 = defunc_9_slope_fun_res_128778;
        }
        // Red body
        {
            float defunc_1_op_res_128749 = x_128747 + x_128748;
            
            local_acc_128809 = defunc_1_op_res_128749;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_128803.mem)[flat_tid_119567] =
        local_acc_128808;
    ((float *) reduce_stage_1_tid_res_arr_mem_128805.mem)[flat_tid_119567] =
        local_acc_128809;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131674_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131674_end -
                 futhark_mc_segred_stage_1_parloop_131674_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131674_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131674_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131674_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131670(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119567 = tid;
    int num_tasks_128802 = info.nsubtasks;
    struct futhark_mc_task_131669 *futhark_mc_task_131669 =
                                  (struct futhark_mc_task_131669 *) args;
    struct futhark_context *ctx = futhark_mc_task_131669->ctx;
    uint64_t futhark_mc_segred_task_131670_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131670_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131669->free_n_114534;
    int64_t gtid_119560 = futhark_mc_task_131669->free_gtid_119560;
    int64_t x_119658 = futhark_mc_task_131669->free_x_119658;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131669->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131669->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131669->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t x_128485 = futhark_mc_task_131669->free_x_128485;
    float x_128486 = futhark_mc_task_131669->free_x_128486;
    float defunc_0_f_res_128489 =
          futhark_mc_task_131669->free_defunc_0_f_res_128489;
    float a11_128525 = futhark_mc_task_131669->free_a11_128525;
    float b11_128527 = futhark_mc_task_131669->free_b11_128527;
    float c11_128528 = futhark_mc_task_131669->free_c11_128528;
    float defunc_2_reduce_res_128529 =
          *futhark_mc_task_131669->retval_defunc_2_reduce_res_128529;
    float defunc_2_reduce_res_128530 =
          *futhark_mc_task_131669->retval_defunc_2_reduce_res_128530;
    size_t reduce_stage_1_tid_res_arr_mem_128803_cached_sizze_131671 = 0;
    char *reduce_stage_1_tid_res_arr_mem_128803 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_128805_cached_sizze_131672 = 0;
    char *reduce_stage_1_tid_res_arr_mem_128805 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_128803_cached_sizze_131671 <
        (size_t) ((int64_t) 4 * num_tasks_128802)) {
        reduce_stage_1_tid_res_arr_mem_128803 =
            realloc(reduce_stage_1_tid_res_arr_mem_128803, (int64_t) 4 *
                    num_tasks_128802);
        reduce_stage_1_tid_res_arr_mem_128803_cached_sizze_131671 =
            (int64_t) 4 * num_tasks_128802;
    }
    if (reduce_stage_1_tid_res_arr_mem_128805_cached_sizze_131672 <
        (size_t) ((int64_t) 4 * num_tasks_128802)) {
        reduce_stage_1_tid_res_arr_mem_128805 =
            realloc(reduce_stage_1_tid_res_arr_mem_128805, (int64_t) 4 *
                    num_tasks_128802);
        reduce_stage_1_tid_res_arr_mem_128805_cached_sizze_131672 =
            (int64_t) 4 * num_tasks_128802;
    }
    
    int64_t iter_128807;
    struct futhark_mc_segred_stage_1_parloop_struct_131673
    futhark_mc_segred_stage_1_parloop_struct_131673;
    
    futhark_mc_segred_stage_1_parloop_struct_131673.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_gtid_119560 =
        gtid_119560;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_x_119658 = x_119658;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_mem_122985 =
        mem_122985.mem;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_x_128485 = x_128485;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_x_128486 = x_128486;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_defunc_0_f_res_128489 =
        defunc_0_f_res_128489;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_a11_128525 =
        a11_128525;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_b11_128527 =
        b11_128527;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_c11_128528 =
        c11_128528;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_reduce_stage_1_tid_res_arr_mem_128803 =
        reduce_stage_1_tid_res_arr_mem_128803;
    futhark_mc_segred_stage_1_parloop_struct_131673.free_reduce_stage_1_tid_res_arr_mem_128805 =
        reduce_stage_1_tid_res_arr_mem_128805;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131674_task;
    
    futhark_mc_segred_stage_1_parloop_131674_task.name =
        "futhark_mc_segred_stage_1_parloop_131674";
    futhark_mc_segred_stage_1_parloop_131674_task.fn =
        futhark_mc_segred_stage_1_parloop_131674;
    futhark_mc_segred_stage_1_parloop_131674_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131673;
    futhark_mc_segred_stage_1_parloop_131674_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131674_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131674_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131674_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131674_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131674_task);
    
    if (futhark_mc_segred_stage_1_parloop_131674_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131674_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131674_total_end -
                 futhark_mc_segred_stage_1_parloop_131674_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131674_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131674_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131674_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_128529 = 0.0F;
        defunc_2_reduce_res_128530 = 0.0F;
    }
    
    float x_128810;
    float x_128811;
    float x_128813;
    float x_128814;
    
    for (int32_t i_128816 = 0; i_128816 < num_tasks_128802; i_128816++) {
        flat_tid_119567 = i_128816;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_128810 = defunc_2_reduce_res_128529;
            }
            // load next params
            {
                x_128811 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_128803)[flat_tid_119567];
            }
            // red body
            {
                float defunc_1_op_res_128812 = x_128810 + x_128811;
                
                defunc_2_reduce_res_128529 = defunc_1_op_res_128812;
            }
            // load acc params
            {
                x_128813 = defunc_2_reduce_res_128530;
            }
            // load next params
            {
                x_128814 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_128805)[flat_tid_119567];
            }
            // red body
            {
                float defunc_1_op_res_128815 = x_128813 + x_128814;
                
                defunc_2_reduce_res_128530 = defunc_1_op_res_128815;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_128803);
    free(reduce_stage_1_tid_res_arr_mem_128805);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131670_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131670_end -
                 futhark_mc_segred_task_131670_start;
        
        ctx->futhark_mc_segred_task_131670_runs[tid]++;
        ctx->futhark_mc_segred_task_131670_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131670_iter[tid] += iterations;
    }
    *futhark_mc_task_131669->retval_defunc_2_reduce_res_128529 =
        defunc_2_reduce_res_128529;
    *futhark_mc_task_131669->retval_defunc_2_reduce_res_128530 =
        defunc_2_reduce_res_128530;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131661(void *args, int64_t start,
                                            int64_t end, int flat_tid_119563,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131660
    *futhark_mc_segmap_parloop_struct_131660 =
    (struct futhark_mc_segmap_parloop_struct_131660 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131660->ctx;
    uint64_t futhark_mc_segmap_parloop_131661_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131661_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131660->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131660->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131660->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131660->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131660->free_i_114610;
    int64_t gtid_119560 =
            futhark_mc_segmap_parloop_struct_131660->free_gtid_119560;
    int64_t x_119658 = futhark_mc_segmap_parloop_struct_131660->free_x_119658;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131660->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131660->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131660->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131660->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131660->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123014 = {.desc ="mem_123014", .mem =
                                  futhark_mc_segmap_parloop_struct_131660->free_mem_123014,
                                  .size =0, .references =NULL};
    struct memblock mem_123017 = {.desc ="mem_123017", .mem =
                                  futhark_mc_segmap_parloop_struct_131660->free_mem_123017,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_128715 = start;
    
    for (; iter_128715 < end; iter_128715++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128779 = t_n_m_114591;
        int64_t gtid_119564 = iter_128715;
        int64_t remnant_128780 = iter_128715 - gtid_119564;
        int64_t x_128485 = ((int64_t *) mem_122204.mem)[gtid_119560 *
                                                        t_n_m_114591 +
                                                        gtid_119564];
        float x_128486 = ((float *) mem_122208.mem)[gtid_119560 * t_n_m_114591 +
                                                    gtid_119564];
        int64_t min_arg_128487 = mul64(t_jump_114541, gtid_119564);
        int64_t min_res_128488 = smin64(i_114610, min_arg_128487);
        float defunc_0_f_res_128489 = sitofp_i64_f32(min_res_128488);
        float defunc_2_reduce_res_128490;
        float defunc_2_reduce_res_128491;
        float defunc_2_reduce_res_128492;
        int64_t flat_tid_119565 = (int64_t) 0;
        int32_t num_tasks_128781;
        struct futhark_mc_task_131662 futhark_mc_task_131662;
        
        futhark_mc_task_131662.ctx = ctx;
        futhark_mc_task_131662.free_n_114534 = n_114534;
        futhark_mc_task_131662.free_gtid_119560 = gtid_119560;
        futhark_mc_task_131662.free_x_119658 = x_119658;
        futhark_mc_task_131662.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131662.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131662.free_x_128485 = x_128485;
        futhark_mc_task_131662.free_x_128486 = x_128486;
        futhark_mc_task_131662.free_defunc_0_f_res_128489 =
            defunc_0_f_res_128489;
        futhark_mc_task_131662.retval_defunc_2_reduce_res_128490 =
            &defunc_2_reduce_res_128490;
        futhark_mc_task_131662.retval_defunc_2_reduce_res_128491 =
            &defunc_2_reduce_res_128491;
        futhark_mc_task_131662.retval_defunc_2_reduce_res_128492 =
            &defunc_2_reduce_res_128492;
        
        struct scheduler_segop futhark_mc_task_131662_task;
        
        futhark_mc_task_131662_task.args = &futhark_mc_task_131662;
        futhark_mc_task_131662_task.top_level_fn =
            futhark_mc_segred_task_131663;
        futhark_mc_task_131662_task.name = "futhark_mc_segred_task_131663";
        futhark_mc_task_131662_task.iterations = t_window_114537;
        futhark_mc_task_131662_task.task_time =
            &ctx->futhark_mc_segred_task_131663_total_time;
        futhark_mc_task_131662_task.task_iter =
            &ctx->futhark_mc_segred_task_131663_total_iter;
        futhark_mc_task_131662_task.sched = STATIC;
        futhark_mc_task_131662_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131663_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131662_task);
        
        if (futhark_mc_segred_task_131663_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float x_128521 = defunc_2_reduce_res_128490 *
              defunc_2_reduce_res_128492;
        float y_128522 = defunc_2_reduce_res_128491 *
              defunc_2_reduce_res_128491;
        float y_128523 = x_128521 - y_128522;
        float det1_128524 = 1.0F / y_128523;
        float a11_128525 = defunc_2_reduce_res_128492 * det1_128524;
        float negate_arg_128526 = defunc_2_reduce_res_128491 * det1_128524;
        float b11_128527 = 0.0F - negate_arg_128526;
        float c11_128528 = defunc_2_reduce_res_128490 * det1_128524;
        float defunc_2_reduce_res_128529;
        float defunc_2_reduce_res_128530;
        int64_t flat_tid_119567 = (int64_t) 0;
        int32_t num_tasks_128802;
        struct futhark_mc_task_131669 futhark_mc_task_131669;
        
        futhark_mc_task_131669.ctx = ctx;
        futhark_mc_task_131669.free_n_114534 = n_114534;
        futhark_mc_task_131669.free_gtid_119560 = gtid_119560;
        futhark_mc_task_131669.free_x_119658 = x_119658;
        futhark_mc_task_131669.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131669.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131669.free_mem_122985 = mem_122985.mem;
        futhark_mc_task_131669.free_x_128485 = x_128485;
        futhark_mc_task_131669.free_x_128486 = x_128486;
        futhark_mc_task_131669.free_defunc_0_f_res_128489 =
            defunc_0_f_res_128489;
        futhark_mc_task_131669.free_a11_128525 = a11_128525;
        futhark_mc_task_131669.free_b11_128527 = b11_128527;
        futhark_mc_task_131669.free_c11_128528 = c11_128528;
        futhark_mc_task_131669.retval_defunc_2_reduce_res_128529 =
            &defunc_2_reduce_res_128529;
        futhark_mc_task_131669.retval_defunc_2_reduce_res_128530 =
            &defunc_2_reduce_res_128530;
        
        struct scheduler_segop futhark_mc_task_131669_task;
        
        futhark_mc_task_131669_task.args = &futhark_mc_task_131669;
        futhark_mc_task_131669_task.top_level_fn =
            futhark_mc_segred_task_131670;
        futhark_mc_task_131669_task.name = "futhark_mc_segred_task_131670";
        futhark_mc_task_131669_task.iterations = t_window_114537;
        futhark_mc_task_131669_task.task_time =
            &ctx->futhark_mc_segred_task_131670_total_time;
        futhark_mc_task_131669_task.task_iter =
            &ctx->futhark_mc_segred_task_131670_total_iter;
        futhark_mc_task_131669_task.sched = STATIC;
        futhark_mc_task_131669_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131670_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131669_task);
        
        if (futhark_mc_segred_task_131670_err != 0) {
            err = 1;
            goto cleanup;
        }
        ((float *) mem_123014.mem)[gtid_119564] = defunc_2_reduce_res_128529;
        ((float *) mem_123017.mem)[gtid_119564] = defunc_2_reduce_res_128530;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131661_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131661_end -
                 futhark_mc_segmap_parloop_131661_start;
        
        ctx->futhark_mc_segmap_parloop_131661_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131661_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131661_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131659(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119563 = tid;
    int num_tasks_128646 = info.nsubtasks;
    struct futhark_mc_task_131655 *futhark_mc_task_131655 =
                                  (struct futhark_mc_task_131655 *) args;
    struct futhark_context *ctx = futhark_mc_task_131655->ctx;
    uint64_t futhark_mc_segmap_nested_task_131659_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131659_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131655->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131655->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131655->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131655->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131655->free_i_114610;
    int64_t gtid_119560 = futhark_mc_task_131655->free_gtid_119560;
    int64_t x_119658 = futhark_mc_task_131655->free_x_119658;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131655->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131655->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131655->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131655->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131655->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123014 = {.desc ="mem_123014", .mem =
                                  futhark_mc_task_131655->free_mem_123014,
                                  .size =0, .references =NULL};
    struct memblock mem_123017 = {.desc ="mem_123017", .mem =
                                  futhark_mc_task_131655->free_mem_123017,
                                  .size =0, .references =NULL};
    int64_t iter_128715;
    struct futhark_mc_segmap_parloop_struct_131660
    futhark_mc_segmap_parloop_struct_131660;
    
    futhark_mc_segmap_parloop_struct_131660.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131660.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131660.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131660.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131660.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131660.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131660.free_gtid_119560 = gtid_119560;
    futhark_mc_segmap_parloop_struct_131660.free_x_119658 = x_119658;
    futhark_mc_segmap_parloop_struct_131660.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131660.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131660.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131660.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131660.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131660.free_mem_123014 = mem_123014.mem;
    futhark_mc_segmap_parloop_struct_131660.free_mem_123017 = mem_123017.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131661_task;
    
    futhark_mc_segmap_parloop_131661_task.name =
        "futhark_mc_segmap_parloop_131661";
    futhark_mc_segmap_parloop_131661_task.fn = futhark_mc_segmap_parloop_131661;
    futhark_mc_segmap_parloop_131661_task.args =
        &futhark_mc_segmap_parloop_struct_131660;
    futhark_mc_segmap_parloop_131661_task.iterations = iterations;
    futhark_mc_segmap_parloop_131661_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131661_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131661_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131661_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131661_task);
    
    if (futhark_mc_segmap_parloop_131661_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131661_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131661_total_end -
                 futhark_mc_segmap_parloop_131661_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131661_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131661_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131661_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131659_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131659_end -
                 futhark_mc_segmap_nested_task_131659_start;
        
        ctx->futhark_mc_segmap_nested_task_131659_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131659_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131659_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131652(void *args, int64_t start,
                                            int64_t end, int flat_tid_119559,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131651
    *futhark_mc_segmap_parloop_struct_131651 =
    (struct futhark_mc_segmap_parloop_struct_131651 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131651->ctx;
    uint64_t futhark_mc_segmap_parloop_131652_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131652_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131651->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131651->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131651->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131651->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131651->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131651->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131651->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131651->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131651->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131651->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131651->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131651->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131651->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123051 = {.desc ="mem_123051", .mem =
                                  futhark_mc_segmap_parloop_struct_131651->free_mem_123051,
                                  .size =0, .references =NULL};
    struct memblock mem_123055 = {.desc ="mem_123055", .mem =
                                  futhark_mc_segmap_parloop_struct_131651->free_mem_123055,
                                  .size =0, .references =NULL};
    size_t mem_123014_cached_sizze_131653 = 0;
    char *mem_123014 = NULL;
    size_t mem_123017_cached_sizze_131654 = 0;
    char *mem_123017 = NULL;
    int64_t iterations = end - start;
    int64_t iter_128484 = start;
    
    if (mem_123014_cached_sizze_131653 < (size_t) bytes_122135) {
        mem_123014 = realloc(mem_123014, bytes_122135);
        mem_123014_cached_sizze_131653 = bytes_122135;
    }
    if (mem_123017_cached_sizze_131654 < (size_t) bytes_122135) {
        mem_123017 = realloc(mem_123017, bytes_122135);
        mem_123017_cached_sizze_131654 = bytes_122135;
    }
    for (; iter_128484 < end; iter_128484++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128644 = m_114533;
        int64_t gtid_119560 = iter_128484;
        int64_t remnant_128645 = iter_128484 - gtid_119560;
        int64_t x_119658 = ((int64_t *) mem_121982.mem)[gtid_119560];
        int64_t flat_tid_119561 = (int64_t) 0;
        int32_t num_tasks_128646;
        int64_t flat_tid_119563 = (int64_t) 0;
        struct futhark_mc_task_131655 futhark_mc_task_131655;
        
        futhark_mc_task_131655.ctx = ctx;
        futhark_mc_task_131655.free_n_114534 = n_114534;
        futhark_mc_task_131655.free_t_window_114537 = t_window_114537;
        futhark_mc_task_131655.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131655.free_t_n_m_114591 = t_n_m_114591;
        futhark_mc_task_131655.free_i_114610 = i_114610;
        futhark_mc_task_131655.free_gtid_119560 = gtid_119560;
        futhark_mc_task_131655.free_x_119658 = x_119658;
        futhark_mc_task_131655.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131655.free_mem_122204 = mem_122204.mem;
        futhark_mc_task_131655.free_mem_122208 = mem_122208.mem;
        futhark_mc_task_131655.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131655.free_mem_122985 = mem_122985.mem;
        futhark_mc_task_131655.free_mem_123014 = mem_123014;
        futhark_mc_task_131655.free_mem_123017 = mem_123017;
        
        struct scheduler_segop futhark_mc_task_131655_task;
        
        futhark_mc_task_131655_task.args = &futhark_mc_task_131655;
        futhark_mc_task_131655_task.top_level_fn =
            futhark_mc_segmap_task_131656;
        futhark_mc_task_131655_task.name = "futhark_mc_segmap_task_131656";
        futhark_mc_task_131655_task.iterations = t_n_m_114591;
        futhark_mc_task_131655_task.task_time =
            &ctx->futhark_mc_segmap_task_131656_total_time;
        futhark_mc_task_131655_task.task_iter =
            &ctx->futhark_mc_segmap_task_131656_total_iter;
        futhark_mc_task_131655_task.sched = STATIC;
        futhark_mc_task_131655_task.nested_fn =
            futhark_mc_segmap_nested_task_131659;
        
        int futhark_mc_segmap_task_131656_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131655_task);
        
        if (futhark_mc_segmap_task_131656_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_123051.mem + gtid_119560 * t_n_m_114591 * (int64_t) 4,
                mem_123014 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
        memmove(mem_123055.mem + gtid_119560 * t_n_m_114591 * (int64_t) 4,
                mem_123017 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123014);
    free(mem_123017);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131652_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131652_end -
                 futhark_mc_segmap_parloop_131652_start;
        
        ctx->futhark_mc_segmap_parloop_131652_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131652_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131652_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131650(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119559 = tid;
    int num_tasks_128390 = info.nsubtasks;
    struct futhark_mc_task_131644 *futhark_mc_task_131644 =
                                  (struct futhark_mc_task_131644 *) args;
    struct futhark_context *ctx = futhark_mc_task_131644->ctx;
    uint64_t futhark_mc_segmap_nested_task_131650_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131650_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131644->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131644->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131644->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131644->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131644->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131644->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131644->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131644->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131644->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131644->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131644->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131644->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131644->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123051 = {.desc ="mem_123051", .mem =
                                  futhark_mc_task_131644->free_mem_123051,
                                  .size =0, .references =NULL};
    struct memblock mem_123055 = {.desc ="mem_123055", .mem =
                                  futhark_mc_task_131644->free_mem_123055,
                                  .size =0, .references =NULL};
    int64_t iter_128484;
    struct futhark_mc_segmap_parloop_struct_131651
    futhark_mc_segmap_parloop_struct_131651;
    
    futhark_mc_segmap_parloop_struct_131651.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131651.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131651.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131651.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131651.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131651.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131651.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131651.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131651.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131651.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131651.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131651.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131651.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131651.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131651.free_mem_123051 = mem_123051.mem;
    futhark_mc_segmap_parloop_struct_131651.free_mem_123055 = mem_123055.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131652_task;
    
    futhark_mc_segmap_parloop_131652_task.name =
        "futhark_mc_segmap_parloop_131652";
    futhark_mc_segmap_parloop_131652_task.fn = futhark_mc_segmap_parloop_131652;
    futhark_mc_segmap_parloop_131652_task.args =
        &futhark_mc_segmap_parloop_struct_131651;
    futhark_mc_segmap_parloop_131652_task.iterations = iterations;
    futhark_mc_segmap_parloop_131652_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131652_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131652_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131652_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131652_task);
    
    if (futhark_mc_segmap_parloop_131652_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131652_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131652_total_end -
                 futhark_mc_segmap_parloop_131652_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131652_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131652_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131652_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131650_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131650_end -
                 futhark_mc_segmap_nested_task_131650_start;
        
        ctx->futhark_mc_segmap_nested_task_131650_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131650_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131650_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131675 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123095;
    char *free_mem_123099;
};
struct futhark_mc_segmap_parloop_struct_131677 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123095;
    char *free_mem_123099;
};
static int futhark_mc_segmap_parloop_131678(void *args, int64_t start,
                                            int64_t end, int flat_tid_119829,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131677
    *futhark_mc_segmap_parloop_struct_131677 =
    (struct futhark_mc_segmap_parloop_struct_131677 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131677->ctx;
    uint64_t futhark_mc_segmap_parloop_131678_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131678_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131677->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131677->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131677->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131677->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131677->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131677->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131677->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131677->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131677->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131677->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131677->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131677->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131677->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123095 = {.desc ="mem_123095", .mem =
                                  futhark_mc_segmap_parloop_struct_131677->free_mem_123095,
                                  .size =0, .references =NULL};
    struct memblock mem_123099 = {.desc ="mem_123099", .mem =
                                  futhark_mc_segmap_parloop_struct_131677->free_mem_123099,
                                  .size =0, .references =NULL};
    size_t mem_123064_cached_sizze_131679 = 0;
    char *mem_123064 = NULL;
    size_t mem_123067_cached_sizze_131680 = 0;
    char *mem_123067 = NULL;
    int64_t iterations = end - start;
    int64_t iter_128818 = start;
    
    if (mem_123064_cached_sizze_131679 < (size_t) bytes_122135) {
        mem_123064 = realloc(mem_123064, bytes_122135);
        mem_123064_cached_sizze_131679 = bytes_122135;
    }
    if (mem_123067_cached_sizze_131680 < (size_t) bytes_122135) {
        mem_123067 = realloc(mem_123067, bytes_122135);
        mem_123067_cached_sizze_131680 = bytes_122135;
    }
    for (; iter_128818 < end; iter_128818++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_128932 = m_114533;
        int64_t gtid_119830 = iter_128818;
        int64_t remnant_128933 = iter_128818 - gtid_119830;
        int64_t x_116057 = ((int64_t *) mem_121982.mem)[gtid_119830];
        
        for (int64_t i_128819 = 0; i_128819 < t_n_m_114591; i_128819++) {
            int64_t x_128822 = ((int64_t *) mem_122204.mem)[gtid_119830 *
                                                            t_n_m_114591 +
                                                            i_128819];
            float x_128823 = ((float *) mem_122208.mem)[gtid_119830 *
                                                        t_n_m_114591 +
                                                        i_128819];
            int64_t min_arg_128824 = mul64(t_jump_114541, i_128819);
            int64_t min_res_128825 = smin64(i_114610, min_arg_128824);
            float defunc_0_f_res_128826 = sitofp_i64_f32(min_res_128825);
            float defunc_2_reduce_res_128827;
            float defunc_2_reduce_res_128828;
            float defunc_2_reduce_res_128829;
            float defunc_2_reduce_res_128830;
            float defunc_2_reduce_res_128831;
            float redout_128833;
            float redout_128834;
            float redout_128835;
            float redout_128836;
            float redout_128837;
            
            redout_128833 = 0.0F;
            redout_128834 = 0.0F;
            redout_128835 = 0.0F;
            redout_128836 = 0.0F;
            redout_128837 = 0.0F;
            for (int64_t i_128832 = 0; i_128832 < t_window_114537; i_128832++) {
                bool cond_128838 = sle64(x_116057, i_128832);
                float defunc_0_f_res_128839;
                
                if (cond_128838) {
                    defunc_0_f_res_128839 = 0.0F;
                } else {
                    int64_t i_128840 = add64(x_128822, i_128832);
                    float x_128841 = ((float *) mem_122004.mem)[gtid_119830 *
                                                                n_114534 +
                                                                i_128840];
                    float defunc_0_f_res_f_res_128842 = 1.0F + x_128841;
                    
                    defunc_0_f_res_128839 = defunc_0_f_res_f_res_128842;
                }
                
                float defunc_0_f_res_128843;
                
                if (cond_128838) {
                    defunc_0_f_res_128843 = 0.0F;
                } else {
                    int64_t i_128844 = add64(x_128822, i_128832);
                    float x_128845 = ((float *) mem_122430.mem)[gtid_119830 *
                                                                n_114534 +
                                                                i_128844];
                    
                    defunc_0_f_res_128843 = x_128845;
                }
                
                float x_j_128846 = defunc_0_f_res_128839 -
                      defunc_0_f_res_128826;
                float abs_res_128847 = (float) fabs(x_j_128846);
                float tmp1_128848 = abs_res_128847 / x_128823;
                float x_128849 = tmp1_128848 * tmp1_128848;
                float y_128850 = tmp1_128848 * x_128849;
                float tmp2_128851 = 1.0F - y_128850;
                float x_128852 = tmp2_128851 * tmp2_128851;
                float tmp3_128853 = tmp2_128851 * x_128852;
                float w_j_128854 = defunc_0_f_res_128843 * tmp3_128853;
                float xw_j_128855 = x_j_128846 * w_j_128854;
                float x2w_j_128856 = x_j_128846 * xw_j_128855;
                float x3w_j_128857 = x_j_128846 * x2w_j_128856;
                float x4w_j_128858 = x_j_128846 * x3w_j_128857;
                float defunc_1_op_res_128859 = w_j_128854 + redout_128833;
                float defunc_1_op_res_128860 = xw_j_128855 + redout_128834;
                float defunc_1_op_res_128861 = x2w_j_128856 + redout_128835;
                float defunc_1_op_res_128862 = x3w_j_128857 + redout_128836;
                float defunc_1_op_res_128863 = x4w_j_128858 + redout_128837;
                float redout_tmp_128936 = defunc_1_op_res_128859;
                float redout_tmp_128937 = defunc_1_op_res_128860;
                float redout_tmp_128938 = defunc_1_op_res_128861;
                float redout_tmp_128939 = defunc_1_op_res_128862;
                float redout_tmp_128940 = defunc_1_op_res_128863;
                
                redout_128833 = redout_tmp_128936;
                redout_128834 = redout_tmp_128937;
                redout_128835 = redout_tmp_128938;
                redout_128836 = redout_tmp_128939;
                redout_128837 = redout_tmp_128940;
            }
            defunc_2_reduce_res_128827 = redout_128833;
            defunc_2_reduce_res_128828 = redout_128834;
            defunc_2_reduce_res_128829 = redout_128835;
            defunc_2_reduce_res_128830 = redout_128836;
            defunc_2_reduce_res_128831 = redout_128837;
            
            float x_128864 = defunc_2_reduce_res_128829 *
                  defunc_2_reduce_res_128831;
            float y_128865 = defunc_2_reduce_res_128830 *
                  defunc_2_reduce_res_128830;
            float a12_128866 = x_128864 - y_128865;
            float x_128867 = defunc_2_reduce_res_128829 *
                  defunc_2_reduce_res_128830;
            float y_128868 = defunc_2_reduce_res_128828 *
                  defunc_2_reduce_res_128831;
            float b12_128869 = x_128867 - y_128868;
            float x_128870 = defunc_2_reduce_res_128828 *
                  defunc_2_reduce_res_128830;
            float y_128871 = defunc_2_reduce_res_128829 *
                  defunc_2_reduce_res_128829;
            float c12_128872 = x_128870 - y_128871;
            float x_128873 = defunc_2_reduce_res_128827 *
                  defunc_2_reduce_res_128831;
            float b2_128874 = x_128873 - y_128871;
            float x_128875 = defunc_2_reduce_res_128828 *
                  defunc_2_reduce_res_128829;
            float y_128876 = defunc_2_reduce_res_128827 *
                  defunc_2_reduce_res_128830;
            float c2_128877 = x_128875 - y_128876;
            float x_128878 = defunc_2_reduce_res_128827 * a12_128866;
            float y_128879 = defunc_2_reduce_res_128828 * b12_128869;
            float x_128880 = x_128878 + y_128879;
            float y_128881 = defunc_2_reduce_res_128829 * c12_128872;
            float y_128882 = x_128880 + y_128881;
            float det_128883 = 1.0F / y_128882;
            float a12_128884 = a12_128866 * det_128883;
            float b12_128885 = b12_128869 * det_128883;
            float c12_128886 = c12_128872 * det_128883;
            float b2_128887 = b2_128874 * det_128883;
            float c2_128888 = c2_128877 * det_128883;
            float defunc_2_reduce_res_128889;
            float defunc_2_reduce_res_128890;
            float redout_128892;
            float redout_128893;
            
            redout_128892 = 0.0F;
            redout_128893 = 0.0F;
            for (int64_t i_128891 = 0; i_128891 < t_window_114537; i_128891++) {
                bool cond_128894 = sle64(x_116057, i_128891);
                float defunc_0_f_res_128895;
                
                if (cond_128894) {
                    defunc_0_f_res_128895 = 0.0F;
                } else {
                    int64_t i_128896 = add64(x_128822, i_128891);
                    float x_128897 = ((float *) mem_122004.mem)[gtid_119830 *
                                                                n_114534 +
                                                                i_128896];
                    float defunc_0_f_res_f_res_128898 = 1.0F + x_128897;
                    
                    defunc_0_f_res_128895 = defunc_0_f_res_f_res_128898;
                }
                
                float defunc_0_f_res_128899;
                
                if (cond_128894) {
                    defunc_0_f_res_128899 = 0.0F;
                } else {
                    int64_t i_128900 = add64(x_128822, i_128891);
                    float x_128901 = ((float *) mem_122430.mem)[gtid_119830 *
                                                                n_114534 +
                                                                i_128900];
                    
                    defunc_0_f_res_128899 = x_128901;
                }
                
                float x_j_128902 = defunc_0_f_res_128895 -
                      defunc_0_f_res_128826;
                float abs_res_128903 = (float) fabs(x_j_128902);
                float tmp1_128904 = abs_res_128903 / x_128823;
                float x_128905 = tmp1_128904 * tmp1_128904;
                float y_128906 = tmp1_128904 * x_128905;
                float tmp2_128907 = 1.0F - y_128906;
                float x_128908 = tmp2_128907 * tmp2_128907;
                float tmp3_128909 = tmp2_128907 * x_128908;
                float tmp4_128910 = defunc_0_f_res_128899 * tmp3_128909;
                float defunc_1_f_res_128911 = x_j_128902 * tmp4_128910;
                float defunc_1_f_res_128912 = x_j_128902 *
                      defunc_1_f_res_128911;
                float defunc_0_f_res_128913;
                
                if (cond_128894) {
                    defunc_0_f_res_128913 = 0.0F;
                } else {
                    int64_t i_128914 = add64(x_128822, i_128891);
                    float x_128915 = ((float *) mem_122985.mem)[gtid_119830 *
                                                                n_114534 +
                                                                i_128914];
                    
                    defunc_0_f_res_128913 = x_128915;
                }
                
                float x_128916 = a12_128884 * tmp4_128910;
                float y_128917 = b12_128885 * defunc_1_f_res_128911;
                float x_128918 = x_128916 + y_128917;
                float y_128919 = c12_128886 * defunc_1_f_res_128912;
                float x_128920 = x_128918 + y_128919;
                float defunc_9_fit_fun_res_128921 = defunc_0_f_res_128913 *
                      x_128920;
                float x_128922 = b12_128885 * tmp4_128910;
                float y_128923 = b2_128887 * defunc_1_f_res_128911;
                float x_128924 = x_128922 + y_128923;
                float y_128925 = c2_128888 * defunc_1_f_res_128912;
                float x_128926 = x_128924 + y_128925;
                float defunc_9_slope_fun_res_128927 = defunc_0_f_res_128913 *
                      x_128926;
                float defunc_1_op_res_128928 = defunc_9_fit_fun_res_128921 +
                      redout_128892;
                float defunc_1_op_res_128929 = defunc_9_slope_fun_res_128927 +
                      redout_128893;
                float redout_tmp_128941 = defunc_1_op_res_128928;
                float redout_tmp_128942 = defunc_1_op_res_128929;
                
                redout_128892 = redout_tmp_128941;
                redout_128893 = redout_tmp_128942;
            }
            defunc_2_reduce_res_128889 = redout_128892;
            defunc_2_reduce_res_128890 = redout_128893;
            ((float *) mem_123064)[i_128819] = defunc_2_reduce_res_128889;
            ((float *) mem_123067)[i_128819] = defunc_2_reduce_res_128890;
        }
        memmove(mem_123095.mem + gtid_119830 * t_n_m_114591 * (int64_t) 4,
                mem_123064 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
        memmove(mem_123099.mem + gtid_119830 * t_n_m_114591 * (int64_t) 4,
                mem_123067 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123064);
    free(mem_123067);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131678_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131678_end -
                 futhark_mc_segmap_parloop_131678_start;
        
        ctx->futhark_mc_segmap_parloop_131678_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131678_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131678_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131676(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119829 = tid;
    int num_tasks_128817 = info.nsubtasks;
    struct futhark_mc_task_131675 *futhark_mc_task_131675 =
                                  (struct futhark_mc_task_131675 *) args;
    struct futhark_context *ctx = futhark_mc_task_131675->ctx;
    uint64_t futhark_mc_segmap_task_131676_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131676_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131675->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131675->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131675->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131675->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131675->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131675->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131675->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131675->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131675->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131675->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131675->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131675->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131675->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123095 = {.desc ="mem_123095", .mem =
                                  futhark_mc_task_131675->free_mem_123095,
                                  .size =0, .references =NULL};
    struct memblock mem_123099 = {.desc ="mem_123099", .mem =
                                  futhark_mc_task_131675->free_mem_123099,
                                  .size =0, .references =NULL};
    int64_t iter_128818;
    struct futhark_mc_segmap_parloop_struct_131677
    futhark_mc_segmap_parloop_struct_131677;
    
    futhark_mc_segmap_parloop_struct_131677.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131677.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131677.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131677.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131677.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131677.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131677.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131677.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131677.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131677.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131677.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131677.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131677.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131677.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131677.free_mem_123095 = mem_123095.mem;
    futhark_mc_segmap_parloop_struct_131677.free_mem_123099 = mem_123099.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131678_task;
    
    futhark_mc_segmap_parloop_131678_task.name =
        "futhark_mc_segmap_parloop_131678";
    futhark_mc_segmap_parloop_131678_task.fn = futhark_mc_segmap_parloop_131678;
    futhark_mc_segmap_parloop_131678_task.args =
        &futhark_mc_segmap_parloop_struct_131677;
    futhark_mc_segmap_parloop_131678_task.iterations = iterations;
    futhark_mc_segmap_parloop_131678_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131678_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131678_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131678_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131678_task);
    
    if (futhark_mc_segmap_parloop_131678_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131678_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131678_total_end -
                 futhark_mc_segmap_parloop_131678_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131678_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131678_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131678_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131676_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131676_end -
                 futhark_mc_segmap_task_131676_start;
        
        ctx->futhark_mc_segmap_task_131676_runs[tid]++;
        ctx->futhark_mc_segmap_task_131676_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131676_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131682 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123095;
    char *free_mem_123099;
};
struct futhark_mc_task_131686 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_119832;
    int64_t free_x_119962;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123058;
    char *free_mem_123061;
};
struct futhark_mc_segmap_parloop_struct_131688 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_119832;
    int64_t free_x_119962;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123058;
    char *free_mem_123061;
};
static int futhark_mc_segmap_parloop_131689(void *args, int64_t start,
                                            int64_t end, int flat_tid_119833,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131688
    *futhark_mc_segmap_parloop_struct_131688 =
    (struct futhark_mc_segmap_parloop_struct_131688 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131688->ctx;
    uint64_t futhark_mc_segmap_parloop_131689_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131689_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131688->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131688->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131688->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131688->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131688->free_i_114610;
    int64_t gtid_119832 =
            futhark_mc_segmap_parloop_struct_131688->free_gtid_119832;
    int64_t x_119962 = futhark_mc_segmap_parloop_struct_131688->free_x_119962;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131688->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131688->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131688->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131688->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131688->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123058 = {.desc ="mem_123058", .mem =
                                  futhark_mc_segmap_parloop_struct_131688->free_mem_123058,
                                  .size =0, .references =NULL};
    struct memblock mem_123061 = {.desc ="mem_123061", .mem =
                                  futhark_mc_segmap_parloop_struct_131688->free_mem_123061,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_129168 = start;
    
    for (; iter_129168 < end; iter_129168++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_129240 = t_n_m_114591;
        int64_t gtid_119834 = iter_129168;
        int64_t remnant_129241 = iter_129168 - gtid_119834;
        int64_t x_129057 = ((int64_t *) mem_122204.mem)[gtid_119832 *
                                                        t_n_m_114591 +
                                                        gtid_119834];
        float x_129058 = ((float *) mem_122208.mem)[gtid_119832 * t_n_m_114591 +
                                                    gtid_119834];
        int64_t min_arg_129059 = mul64(t_jump_114541, gtid_119834);
        int64_t min_res_129060 = smin64(i_114610, min_arg_129059);
        float defunc_0_f_res_129061 = sitofp_i64_f32(min_res_129060);
        float defunc_2_reduce_res_129062;
        float defunc_2_reduce_res_129063;
        float defunc_2_reduce_res_129064;
        float defunc_2_reduce_res_129065;
        float defunc_2_reduce_res_129066;
        float redout_129170;
        float redout_129171;
        float redout_129172;
        float redout_129173;
        float redout_129174;
        
        redout_129170 = 0.0F;
        redout_129171 = 0.0F;
        redout_129172 = 0.0F;
        redout_129173 = 0.0F;
        redout_129174 = 0.0F;
        for (int64_t i_129169 = 0; i_129169 < t_window_114537; i_129169++) {
            bool cond_129175 = sle64(x_119962, i_129169);
            float defunc_0_f_res_129176;
            
            if (cond_129175) {
                defunc_0_f_res_129176 = 0.0F;
            } else {
                int64_t i_129177 = add64(x_129057, i_129169);
                float x_129178 = ((float *) mem_122004.mem)[gtid_119832 *
                                                            n_114534 +
                                                            i_129177];
                float defunc_0_f_res_f_res_129179 = 1.0F + x_129178;
                
                defunc_0_f_res_129176 = defunc_0_f_res_f_res_129179;
            }
            
            float defunc_0_f_res_129180;
            
            if (cond_129175) {
                defunc_0_f_res_129180 = 0.0F;
            } else {
                int64_t i_129181 = add64(x_129057, i_129169);
                float x_129182 = ((float *) mem_122430.mem)[gtid_119832 *
                                                            n_114534 +
                                                            i_129181];
                
                defunc_0_f_res_129180 = x_129182;
            }
            
            float x_j_129183 = defunc_0_f_res_129176 - defunc_0_f_res_129061;
            float abs_res_129184 = (float) fabs(x_j_129183);
            float tmp1_129185 = abs_res_129184 / x_129058;
            float x_129186 = tmp1_129185 * tmp1_129185;
            float y_129187 = tmp1_129185 * x_129186;
            float tmp2_129188 = 1.0F - y_129187;
            float x_129189 = tmp2_129188 * tmp2_129188;
            float tmp3_129190 = tmp2_129188 * x_129189;
            float w_j_129191 = defunc_0_f_res_129180 * tmp3_129190;
            float xw_j_129192 = x_j_129183 * w_j_129191;
            float x2w_j_129193 = x_j_129183 * xw_j_129192;
            float x3w_j_129194 = x_j_129183 * x2w_j_129193;
            float x4w_j_129195 = x_j_129183 * x3w_j_129194;
            float defunc_1_op_res_129196 = w_j_129191 + redout_129170;
            float defunc_1_op_res_129197 = xw_j_129192 + redout_129171;
            float defunc_1_op_res_129198 = x2w_j_129193 + redout_129172;
            float defunc_1_op_res_129199 = x3w_j_129194 + redout_129173;
            float defunc_1_op_res_129200 = x4w_j_129195 + redout_129174;
            float redout_tmp_129242 = defunc_1_op_res_129196;
            float redout_tmp_129243 = defunc_1_op_res_129197;
            float redout_tmp_129244 = defunc_1_op_res_129198;
            float redout_tmp_129245 = defunc_1_op_res_129199;
            float redout_tmp_129246 = defunc_1_op_res_129200;
            
            redout_129170 = redout_tmp_129242;
            redout_129171 = redout_tmp_129243;
            redout_129172 = redout_tmp_129244;
            redout_129173 = redout_tmp_129245;
            redout_129174 = redout_tmp_129246;
        }
        defunc_2_reduce_res_129062 = redout_129170;
        defunc_2_reduce_res_129063 = redout_129171;
        defunc_2_reduce_res_129064 = redout_129172;
        defunc_2_reduce_res_129065 = redout_129173;
        defunc_2_reduce_res_129066 = redout_129174;
        
        float x_129099 = defunc_2_reduce_res_129064 *
              defunc_2_reduce_res_129066;
        float y_129100 = defunc_2_reduce_res_129065 *
              defunc_2_reduce_res_129065;
        float a12_129101 = x_129099 - y_129100;
        float x_129102 = defunc_2_reduce_res_129064 *
              defunc_2_reduce_res_129065;
        float y_129103 = defunc_2_reduce_res_129063 *
              defunc_2_reduce_res_129066;
        float b12_129104 = x_129102 - y_129103;
        float x_129105 = defunc_2_reduce_res_129063 *
              defunc_2_reduce_res_129065;
        float y_129106 = defunc_2_reduce_res_129064 *
              defunc_2_reduce_res_129064;
        float c12_129107 = x_129105 - y_129106;
        float x_129108 = defunc_2_reduce_res_129062 *
              defunc_2_reduce_res_129066;
        float b2_129109 = x_129108 - y_129106;
        float x_129110 = defunc_2_reduce_res_129063 *
              defunc_2_reduce_res_129064;
        float y_129111 = defunc_2_reduce_res_129062 *
              defunc_2_reduce_res_129065;
        float c2_129112 = x_129110 - y_129111;
        float x_129113 = defunc_2_reduce_res_129062 * a12_129101;
        float y_129114 = defunc_2_reduce_res_129063 * b12_129104;
        float x_129115 = x_129113 + y_129114;
        float y_129116 = defunc_2_reduce_res_129064 * c12_129107;
        float y_129117 = x_129115 + y_129116;
        float det_129118 = 1.0F / y_129117;
        float a12_129119 = a12_129101 * det_129118;
        float b12_129120 = b12_129104 * det_129118;
        float c12_129121 = c12_129107 * det_129118;
        float b2_129122 = b2_129109 * det_129118;
        float c2_129123 = c2_129112 * det_129118;
        float defunc_2_reduce_res_129124;
        float defunc_2_reduce_res_129125;
        float redout_129202;
        float redout_129203;
        
        redout_129202 = 0.0F;
        redout_129203 = 0.0F;
        for (int64_t i_129201 = 0; i_129201 < t_window_114537; i_129201++) {
            bool cond_129204 = sle64(x_119962, i_129201);
            float defunc_0_f_res_129205;
            
            if (cond_129204) {
                defunc_0_f_res_129205 = 0.0F;
            } else {
                int64_t i_129206 = add64(x_129057, i_129201);
                float x_129207 = ((float *) mem_122004.mem)[gtid_119832 *
                                                            n_114534 +
                                                            i_129206];
                float defunc_0_f_res_f_res_129208 = 1.0F + x_129207;
                
                defunc_0_f_res_129205 = defunc_0_f_res_f_res_129208;
            }
            
            float defunc_0_f_res_129209;
            
            if (cond_129204) {
                defunc_0_f_res_129209 = 0.0F;
            } else {
                int64_t i_129210 = add64(x_129057, i_129201);
                float x_129211 = ((float *) mem_122430.mem)[gtid_119832 *
                                                            n_114534 +
                                                            i_129210];
                
                defunc_0_f_res_129209 = x_129211;
            }
            
            float x_j_129212 = defunc_0_f_res_129205 - defunc_0_f_res_129061;
            float abs_res_129213 = (float) fabs(x_j_129212);
            float tmp1_129214 = abs_res_129213 / x_129058;
            float x_129215 = tmp1_129214 * tmp1_129214;
            float y_129216 = tmp1_129214 * x_129215;
            float tmp2_129217 = 1.0F - y_129216;
            float x_129218 = tmp2_129217 * tmp2_129217;
            float tmp3_129219 = tmp2_129217 * x_129218;
            float tmp4_129220 = defunc_0_f_res_129209 * tmp3_129219;
            float defunc_1_f_res_129221 = x_j_129212 * tmp4_129220;
            float defunc_1_f_res_129222 = x_j_129212 * defunc_1_f_res_129221;
            float defunc_0_f_res_129223;
            
            if (cond_129204) {
                defunc_0_f_res_129223 = 0.0F;
            } else {
                int64_t i_129224 = add64(x_129057, i_129201);
                float x_129225 = ((float *) mem_122985.mem)[gtid_119832 *
                                                            n_114534 +
                                                            i_129224];
                
                defunc_0_f_res_129223 = x_129225;
            }
            
            float x_129226 = a12_129119 * tmp4_129220;
            float y_129227 = b12_129120 * defunc_1_f_res_129221;
            float x_129228 = x_129226 + y_129227;
            float y_129229 = c12_129121 * defunc_1_f_res_129222;
            float x_129230 = x_129228 + y_129229;
            float defunc_9_fit_fun_res_129231 = defunc_0_f_res_129223 *
                  x_129230;
            float x_129232 = b12_129120 * tmp4_129220;
            float y_129233 = b2_129122 * defunc_1_f_res_129221;
            float x_129234 = x_129232 + y_129233;
            float y_129235 = c2_129123 * defunc_1_f_res_129222;
            float x_129236 = x_129234 + y_129235;
            float defunc_9_slope_fun_res_129237 = defunc_0_f_res_129223 *
                  x_129236;
            float defunc_1_op_res_129238 = defunc_9_fit_fun_res_129231 +
                  redout_129202;
            float defunc_1_op_res_129239 = defunc_9_slope_fun_res_129237 +
                  redout_129203;
            float redout_tmp_129247 = defunc_1_op_res_129238;
            float redout_tmp_129248 = defunc_1_op_res_129239;
            
            redout_129202 = redout_tmp_129247;
            redout_129203 = redout_tmp_129248;
        }
        defunc_2_reduce_res_129124 = redout_129202;
        defunc_2_reduce_res_129125 = redout_129203;
        ((float *) mem_123058.mem)[gtid_119834] = defunc_2_reduce_res_129124;
        ((float *) mem_123061.mem)[gtid_119834] = defunc_2_reduce_res_129125;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131689_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131689_end -
                 futhark_mc_segmap_parloop_131689_start;
        
        ctx->futhark_mc_segmap_parloop_131689_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131689_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131689_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131687(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119833 = tid;
    int num_tasks_129167 = info.nsubtasks;
    struct futhark_mc_task_131686 *futhark_mc_task_131686 =
                                  (struct futhark_mc_task_131686 *) args;
    struct futhark_context *ctx = futhark_mc_task_131686->ctx;
    uint64_t futhark_mc_segmap_task_131687_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131687_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131686->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131686->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131686->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131686->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131686->free_i_114610;
    int64_t gtid_119832 = futhark_mc_task_131686->free_gtid_119832;
    int64_t x_119962 = futhark_mc_task_131686->free_x_119962;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131686->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131686->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131686->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131686->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131686->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123058 = {.desc ="mem_123058", .mem =
                                  futhark_mc_task_131686->free_mem_123058,
                                  .size =0, .references =NULL};
    struct memblock mem_123061 = {.desc ="mem_123061", .mem =
                                  futhark_mc_task_131686->free_mem_123061,
                                  .size =0, .references =NULL};
    int64_t iter_129168;
    struct futhark_mc_segmap_parloop_struct_131688
    futhark_mc_segmap_parloop_struct_131688;
    
    futhark_mc_segmap_parloop_struct_131688.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131688.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131688.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131688.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131688.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131688.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131688.free_gtid_119832 = gtid_119832;
    futhark_mc_segmap_parloop_struct_131688.free_x_119962 = x_119962;
    futhark_mc_segmap_parloop_struct_131688.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131688.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131688.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131688.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131688.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131688.free_mem_123058 = mem_123058.mem;
    futhark_mc_segmap_parloop_struct_131688.free_mem_123061 = mem_123061.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131689_task;
    
    futhark_mc_segmap_parloop_131689_task.name =
        "futhark_mc_segmap_parloop_131689";
    futhark_mc_segmap_parloop_131689_task.fn = futhark_mc_segmap_parloop_131689;
    futhark_mc_segmap_parloop_131689_task.args =
        &futhark_mc_segmap_parloop_struct_131688;
    futhark_mc_segmap_parloop_131689_task.iterations = iterations;
    futhark_mc_segmap_parloop_131689_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131689_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131689_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131689_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131689_task);
    
    if (futhark_mc_segmap_parloop_131689_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131689_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131689_total_end -
                 futhark_mc_segmap_parloop_131689_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131689_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131689_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131689_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131687_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131687_end -
                 futhark_mc_segmap_task_131687_start;
        
        ctx->futhark_mc_segmap_task_131687_runs[tid]++;
        ctx->futhark_mc_segmap_task_131687_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131687_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131691 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_119832;
    int64_t free_x_119962;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    char *free_mem_123058;
    char *free_mem_123061;
};
struct futhark_mc_task_131693 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119832;
    int64_t free_x_119962;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_128944;
    float free_x_128945;
    float free_defunc_0_f_res_128948;
    float *retval_defunc_2_reduce_res_128949;
    float *retval_defunc_2_reduce_res_128950;
    float *retval_defunc_2_reduce_res_128951;
    float *retval_defunc_2_reduce_res_128952;
    float *retval_defunc_2_reduce_res_128953;
};
struct futhark_mc_segred_stage_1_parloop_struct_131700 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119832;
    int64_t free_x_119962;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_128944;
    float free_x_128945;
    float free_defunc_0_f_res_128948;
    char *free_reduce_stage_1_tid_res_arr_mem_129329;
    char *free_reduce_stage_1_tid_res_arr_mem_129331;
    char *free_reduce_stage_1_tid_res_arr_mem_129333;
    char *free_reduce_stage_1_tid_res_arr_mem_129335;
    char *free_reduce_stage_1_tid_res_arr_mem_129337;
};
static int futhark_mc_segred_stage_1_parloop_131701(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_119837,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131700
    *futhark_mc_segred_stage_1_parloop_struct_131700 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131700 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131700->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131701_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131701_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131700->free_n_114534;
    int64_t gtid_119832 =
            futhark_mc_segred_stage_1_parloop_struct_131700->free_gtid_119832;
    int64_t x_119962 =
            futhark_mc_segred_stage_1_parloop_struct_131700->free_x_119962;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131700->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131700->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_128944 =
            futhark_mc_segred_stage_1_parloop_struct_131700->free_x_128944;
    float x_128945 =
          futhark_mc_segred_stage_1_parloop_struct_131700->free_x_128945;
    float defunc_0_f_res_128948 =
          futhark_mc_segred_stage_1_parloop_struct_131700->free_defunc_0_f_res_128948;
    struct memblock reduce_stage_1_tid_res_arr_mem_129329 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129329",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131700->free_reduce_stage_1_tid_res_arr_mem_129329,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_129331 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129331",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131700->free_reduce_stage_1_tid_res_arr_mem_129331,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_129333 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129333",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131700->free_reduce_stage_1_tid_res_arr_mem_129333,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_129335 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129335",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131700->free_reduce_stage_1_tid_res_arr_mem_129335,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_129337 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129337",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131700->free_reduce_stage_1_tid_res_arr_mem_129337,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_129339 = start;
    float x_129250;
    float x_129251;
    float x_129253;
    float x_129254;
    float x_129256;
    float x_129257;
    float x_129259;
    float x_129260;
    float x_129262;
    float x_129263;
    float local_acc_129340 = 0.0F;
    float local_acc_129341 = 0.0F;
    float local_acc_129342 = 0.0F;
    float local_acc_129343 = 0.0F;
    float local_acc_129344 = 0.0F;
    
    for (; iter_129339 < end; iter_129339++) {
        int64_t gtid_119838 = iter_129339;
        bool cond_129265 = sle64(x_119962, gtid_119838);
        float defunc_0_f_res_129266;
        
        if (cond_129265) {
            defunc_0_f_res_129266 = 0.0F;
        } else {
            int64_t i_129267 = add64(gtid_119838, x_128944);
            float x_129268 = ((float *) mem_122004.mem)[gtid_119832 * n_114534 +
                                                        i_129267];
            float defunc_0_f_res_f_res_129269 = 1.0F + x_129268;
            
            defunc_0_f_res_129266 = defunc_0_f_res_f_res_129269;
        }
        
        float defunc_0_f_res_129270;
        
        if (cond_129265) {
            defunc_0_f_res_129270 = 0.0F;
        } else {
            int64_t i_129271 = add64(gtid_119838, x_128944);
            float x_129272 = ((float *) mem_122430.mem)[gtid_119832 * n_114534 +
                                                        i_129271];
            
            defunc_0_f_res_129270 = x_129272;
        }
        
        float x_j_129273 = defunc_0_f_res_129266 - defunc_0_f_res_128948;
        float abs_res_129274 = (float) fabs(x_j_129273);
        float tmp1_129275 = abs_res_129274 / x_128945;
        float x_129276 = tmp1_129275 * tmp1_129275;
        float y_129277 = tmp1_129275 * x_129276;
        float tmp2_129278 = 1.0F - y_129277;
        float x_129279 = tmp2_129278 * tmp2_129278;
        float tmp3_129280 = tmp2_129278 * x_129279;
        float w_j_129281 = defunc_0_f_res_129270 * tmp3_129280;
        float xw_j_129282 = x_j_129273 * w_j_129281;
        float x2w_j_129283 = x_j_129273 * xw_j_129282;
        float x3w_j_129284 = x_j_129273 * x2w_j_129283;
        float x4w_j_129285 = x_j_129273 * x3w_j_129284;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_129250 = local_acc_129340;
        }
        // Load next params
        {
            x_129251 = w_j_129281;
        }
        // Red body
        {
            float defunc_1_op_res_129252 = x_129250 + x_129251;
            
            local_acc_129340 = defunc_1_op_res_129252;
        }
        // Load accum params
        {
            x_129253 = local_acc_129341;
        }
        // Load next params
        {
            x_129254 = xw_j_129282;
        }
        // Red body
        {
            float defunc_1_op_res_129255 = x_129253 + x_129254;
            
            local_acc_129341 = defunc_1_op_res_129255;
        }
        // Load accum params
        {
            x_129256 = local_acc_129342;
        }
        // Load next params
        {
            x_129257 = x2w_j_129283;
        }
        // Red body
        {
            float defunc_1_op_res_129258 = x_129256 + x_129257;
            
            local_acc_129342 = defunc_1_op_res_129258;
        }
        // Load accum params
        {
            x_129259 = local_acc_129343;
        }
        // Load next params
        {
            x_129260 = x3w_j_129284;
        }
        // Red body
        {
            float defunc_1_op_res_129261 = x_129259 + x_129260;
            
            local_acc_129343 = defunc_1_op_res_129261;
        }
        // Load accum params
        {
            x_129262 = local_acc_129344;
        }
        // Load next params
        {
            x_129263 = x4w_j_129285;
        }
        // Red body
        {
            float defunc_1_op_res_129264 = x_129262 + x_129263;
            
            local_acc_129344 = defunc_1_op_res_129264;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_129329.mem)[flat_tid_119837] =
        local_acc_129340;
    ((float *) reduce_stage_1_tid_res_arr_mem_129331.mem)[flat_tid_119837] =
        local_acc_129341;
    ((float *) reduce_stage_1_tid_res_arr_mem_129333.mem)[flat_tid_119837] =
        local_acc_129342;
    ((float *) reduce_stage_1_tid_res_arr_mem_129335.mem)[flat_tid_119837] =
        local_acc_129343;
    ((float *) reduce_stage_1_tid_res_arr_mem_129337.mem)[flat_tid_119837] =
        local_acc_129344;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131701_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131701_end -
                 futhark_mc_segred_stage_1_parloop_131701_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131701_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131701_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131701_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131694(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119837 = tid;
    int num_tasks_129328 = info.nsubtasks;
    struct futhark_mc_task_131693 *futhark_mc_task_131693 =
                                  (struct futhark_mc_task_131693 *) args;
    struct futhark_context *ctx = futhark_mc_task_131693->ctx;
    uint64_t futhark_mc_segred_task_131694_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131694_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131693->free_n_114534;
    int64_t gtid_119832 = futhark_mc_task_131693->free_gtid_119832;
    int64_t x_119962 = futhark_mc_task_131693->free_x_119962;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131693->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131693->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_128944 = futhark_mc_task_131693->free_x_128944;
    float x_128945 = futhark_mc_task_131693->free_x_128945;
    float defunc_0_f_res_128948 =
          futhark_mc_task_131693->free_defunc_0_f_res_128948;
    float defunc_2_reduce_res_128949 =
          *futhark_mc_task_131693->retval_defunc_2_reduce_res_128949;
    float defunc_2_reduce_res_128950 =
          *futhark_mc_task_131693->retval_defunc_2_reduce_res_128950;
    float defunc_2_reduce_res_128951 =
          *futhark_mc_task_131693->retval_defunc_2_reduce_res_128951;
    float defunc_2_reduce_res_128952 =
          *futhark_mc_task_131693->retval_defunc_2_reduce_res_128952;
    float defunc_2_reduce_res_128953 =
          *futhark_mc_task_131693->retval_defunc_2_reduce_res_128953;
    size_t reduce_stage_1_tid_res_arr_mem_129329_cached_sizze_131695 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129329 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_129331_cached_sizze_131696 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129331 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_129333_cached_sizze_131697 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129333 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_129335_cached_sizze_131698 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129335 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_129337_cached_sizze_131699 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129337 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_129329_cached_sizze_131695 <
        (size_t) ((int64_t) 4 * num_tasks_129328)) {
        reduce_stage_1_tid_res_arr_mem_129329 =
            realloc(reduce_stage_1_tid_res_arr_mem_129329, (int64_t) 4 *
                    num_tasks_129328);
        reduce_stage_1_tid_res_arr_mem_129329_cached_sizze_131695 =
            (int64_t) 4 * num_tasks_129328;
    }
    if (reduce_stage_1_tid_res_arr_mem_129331_cached_sizze_131696 <
        (size_t) ((int64_t) 4 * num_tasks_129328)) {
        reduce_stage_1_tid_res_arr_mem_129331 =
            realloc(reduce_stage_1_tid_res_arr_mem_129331, (int64_t) 4 *
                    num_tasks_129328);
        reduce_stage_1_tid_res_arr_mem_129331_cached_sizze_131696 =
            (int64_t) 4 * num_tasks_129328;
    }
    if (reduce_stage_1_tid_res_arr_mem_129333_cached_sizze_131697 <
        (size_t) ((int64_t) 4 * num_tasks_129328)) {
        reduce_stage_1_tid_res_arr_mem_129333 =
            realloc(reduce_stage_1_tid_res_arr_mem_129333, (int64_t) 4 *
                    num_tasks_129328);
        reduce_stage_1_tid_res_arr_mem_129333_cached_sizze_131697 =
            (int64_t) 4 * num_tasks_129328;
    }
    if (reduce_stage_1_tid_res_arr_mem_129335_cached_sizze_131698 <
        (size_t) ((int64_t) 4 * num_tasks_129328)) {
        reduce_stage_1_tid_res_arr_mem_129335 =
            realloc(reduce_stage_1_tid_res_arr_mem_129335, (int64_t) 4 *
                    num_tasks_129328);
        reduce_stage_1_tid_res_arr_mem_129335_cached_sizze_131698 =
            (int64_t) 4 * num_tasks_129328;
    }
    if (reduce_stage_1_tid_res_arr_mem_129337_cached_sizze_131699 <
        (size_t) ((int64_t) 4 * num_tasks_129328)) {
        reduce_stage_1_tid_res_arr_mem_129337 =
            realloc(reduce_stage_1_tid_res_arr_mem_129337, (int64_t) 4 *
                    num_tasks_129328);
        reduce_stage_1_tid_res_arr_mem_129337_cached_sizze_131699 =
            (int64_t) 4 * num_tasks_129328;
    }
    
    int64_t iter_129339;
    struct futhark_mc_segred_stage_1_parloop_struct_131700
    futhark_mc_segred_stage_1_parloop_struct_131700;
    
    futhark_mc_segred_stage_1_parloop_struct_131700.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131700.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131700.free_gtid_119832 =
        gtid_119832;
    futhark_mc_segred_stage_1_parloop_struct_131700.free_x_119962 = x_119962;
    futhark_mc_segred_stage_1_parloop_struct_131700.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131700.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131700.free_x_128944 = x_128944;
    futhark_mc_segred_stage_1_parloop_struct_131700.free_x_128945 = x_128945;
    futhark_mc_segred_stage_1_parloop_struct_131700.free_defunc_0_f_res_128948 =
        defunc_0_f_res_128948;
    futhark_mc_segred_stage_1_parloop_struct_131700.free_reduce_stage_1_tid_res_arr_mem_129329 =
        reduce_stage_1_tid_res_arr_mem_129329;
    futhark_mc_segred_stage_1_parloop_struct_131700.free_reduce_stage_1_tid_res_arr_mem_129331 =
        reduce_stage_1_tid_res_arr_mem_129331;
    futhark_mc_segred_stage_1_parloop_struct_131700.free_reduce_stage_1_tid_res_arr_mem_129333 =
        reduce_stage_1_tid_res_arr_mem_129333;
    futhark_mc_segred_stage_1_parloop_struct_131700.free_reduce_stage_1_tid_res_arr_mem_129335 =
        reduce_stage_1_tid_res_arr_mem_129335;
    futhark_mc_segred_stage_1_parloop_struct_131700.free_reduce_stage_1_tid_res_arr_mem_129337 =
        reduce_stage_1_tid_res_arr_mem_129337;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131701_task;
    
    futhark_mc_segred_stage_1_parloop_131701_task.name =
        "futhark_mc_segred_stage_1_parloop_131701";
    futhark_mc_segred_stage_1_parloop_131701_task.fn =
        futhark_mc_segred_stage_1_parloop_131701;
    futhark_mc_segred_stage_1_parloop_131701_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131700;
    futhark_mc_segred_stage_1_parloop_131701_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131701_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131701_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131701_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131701_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131701_task);
    
    if (futhark_mc_segred_stage_1_parloop_131701_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131701_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131701_total_end -
                 futhark_mc_segred_stage_1_parloop_131701_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131701_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131701_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131701_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_128949 = 0.0F;
        defunc_2_reduce_res_128950 = 0.0F;
        defunc_2_reduce_res_128951 = 0.0F;
        defunc_2_reduce_res_128952 = 0.0F;
        defunc_2_reduce_res_128953 = 0.0F;
    }
    
    float x_129345;
    float x_129346;
    float x_129348;
    float x_129349;
    float x_129351;
    float x_129352;
    float x_129354;
    float x_129355;
    float x_129357;
    float x_129358;
    
    for (int32_t i_129360 = 0; i_129360 < num_tasks_129328; i_129360++) {
        flat_tid_119837 = i_129360;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_129345 = defunc_2_reduce_res_128949;
            }
            // load next params
            {
                x_129346 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129329)[flat_tid_119837];
            }
            // red body
            {
                float defunc_1_op_res_129347 = x_129345 + x_129346;
                
                defunc_2_reduce_res_128949 = defunc_1_op_res_129347;
            }
            // load acc params
            {
                x_129348 = defunc_2_reduce_res_128950;
            }
            // load next params
            {
                x_129349 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129331)[flat_tid_119837];
            }
            // red body
            {
                float defunc_1_op_res_129350 = x_129348 + x_129349;
                
                defunc_2_reduce_res_128950 = defunc_1_op_res_129350;
            }
            // load acc params
            {
                x_129351 = defunc_2_reduce_res_128951;
            }
            // load next params
            {
                x_129352 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129333)[flat_tid_119837];
            }
            // red body
            {
                float defunc_1_op_res_129353 = x_129351 + x_129352;
                
                defunc_2_reduce_res_128951 = defunc_1_op_res_129353;
            }
            // load acc params
            {
                x_129354 = defunc_2_reduce_res_128952;
            }
            // load next params
            {
                x_129355 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129335)[flat_tid_119837];
            }
            // red body
            {
                float defunc_1_op_res_129356 = x_129354 + x_129355;
                
                defunc_2_reduce_res_128952 = defunc_1_op_res_129356;
            }
            // load acc params
            {
                x_129357 = defunc_2_reduce_res_128953;
            }
            // load next params
            {
                x_129358 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129337)[flat_tid_119837];
            }
            // red body
            {
                float defunc_1_op_res_129359 = x_129357 + x_129358;
                
                defunc_2_reduce_res_128953 = defunc_1_op_res_129359;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_129329);
    free(reduce_stage_1_tid_res_arr_mem_129331);
    free(reduce_stage_1_tid_res_arr_mem_129333);
    free(reduce_stage_1_tid_res_arr_mem_129335);
    free(reduce_stage_1_tid_res_arr_mem_129337);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131694_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131694_end -
                 futhark_mc_segred_task_131694_start;
        
        ctx->futhark_mc_segred_task_131694_runs[tid]++;
        ctx->futhark_mc_segred_task_131694_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131694_iter[tid] += iterations;
    }
    *futhark_mc_task_131693->retval_defunc_2_reduce_res_128949 =
        defunc_2_reduce_res_128949;
    *futhark_mc_task_131693->retval_defunc_2_reduce_res_128950 =
        defunc_2_reduce_res_128950;
    *futhark_mc_task_131693->retval_defunc_2_reduce_res_128951 =
        defunc_2_reduce_res_128951;
    *futhark_mc_task_131693->retval_defunc_2_reduce_res_128952 =
        defunc_2_reduce_res_128952;
    *futhark_mc_task_131693->retval_defunc_2_reduce_res_128953 =
        defunc_2_reduce_res_128953;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131702 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119832;
    int64_t free_x_119962;
    char *free_mem_122004;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_x_128944;
    float free_x_128945;
    float free_defunc_0_f_res_128948;
    float free_a12_129010;
    float free_b12_129011;
    float free_c12_129012;
    float free_b2_129013;
    float free_c2_129014;
    float *retval_defunc_2_reduce_res_129015;
    float *retval_defunc_2_reduce_res_129016;
};
struct futhark_mc_segred_stage_1_parloop_struct_131706 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_119832;
    int64_t free_x_119962;
    char *free_mem_122004;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_x_128944;
    float free_x_128945;
    float free_defunc_0_f_res_128948;
    float free_a12_129010;
    float free_b12_129011;
    float free_c12_129012;
    float free_b2_129013;
    float free_c2_129014;
    char *free_reduce_stage_1_tid_res_arr_mem_129362;
    char *free_reduce_stage_1_tid_res_arr_mem_129364;
};
static int futhark_mc_segred_stage_1_parloop_131707(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_119839,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131706
    *futhark_mc_segred_stage_1_parloop_struct_131706 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131706 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131706->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131707_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131707_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131706->free_n_114534;
    int64_t gtid_119832 =
            futhark_mc_segred_stage_1_parloop_struct_131706->free_gtid_119832;
    int64_t x_119962 =
            futhark_mc_segred_stage_1_parloop_struct_131706->free_x_119962;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131706->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131706->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131706->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t x_128944 =
            futhark_mc_segred_stage_1_parloop_struct_131706->free_x_128944;
    float x_128945 =
          futhark_mc_segred_stage_1_parloop_struct_131706->free_x_128945;
    float defunc_0_f_res_128948 =
          futhark_mc_segred_stage_1_parloop_struct_131706->free_defunc_0_f_res_128948;
    float a12_129010 =
          futhark_mc_segred_stage_1_parloop_struct_131706->free_a12_129010;
    float b12_129011 =
          futhark_mc_segred_stage_1_parloop_struct_131706->free_b12_129011;
    float c12_129012 =
          futhark_mc_segred_stage_1_parloop_struct_131706->free_c12_129012;
    float b2_129013 =
          futhark_mc_segred_stage_1_parloop_struct_131706->free_b2_129013;
    float c2_129014 =
          futhark_mc_segred_stage_1_parloop_struct_131706->free_c2_129014;
    struct memblock reduce_stage_1_tid_res_arr_mem_129362 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129362",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131706->free_reduce_stage_1_tid_res_arr_mem_129362,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_129364 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129364",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131706->free_reduce_stage_1_tid_res_arr_mem_129364,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_129366 = start;
    float x_129286;
    float x_129287;
    float x_129289;
    float x_129290;
    float local_acc_129367 = 0.0F;
    float local_acc_129368 = 0.0F;
    
    for (; iter_129366 < end; iter_129366++) {
        int64_t gtid_119840 = iter_129366;
        bool cond_129292 = sle64(x_119962, gtid_119840);
        float defunc_0_f_res_129293;
        
        if (cond_129292) {
            defunc_0_f_res_129293 = 0.0F;
        } else {
            int64_t i_129294 = add64(gtid_119840, x_128944);
            float x_129295 = ((float *) mem_122004.mem)[gtid_119832 * n_114534 +
                                                        i_129294];
            float defunc_0_f_res_f_res_129296 = 1.0F + x_129295;
            
            defunc_0_f_res_129293 = defunc_0_f_res_f_res_129296;
        }
        
        float defunc_0_f_res_129297;
        
        if (cond_129292) {
            defunc_0_f_res_129297 = 0.0F;
        } else {
            int64_t i_129298 = add64(gtid_119840, x_128944);
            float x_129299 = ((float *) mem_122430.mem)[gtid_119832 * n_114534 +
                                                        i_129298];
            
            defunc_0_f_res_129297 = x_129299;
        }
        
        float x_j_129300 = defunc_0_f_res_129293 - defunc_0_f_res_128948;
        float abs_res_129301 = (float) fabs(x_j_129300);
        float tmp1_129302 = abs_res_129301 / x_128945;
        float x_129303 = tmp1_129302 * tmp1_129302;
        float y_129304 = tmp1_129302 * x_129303;
        float tmp2_129305 = 1.0F - y_129304;
        float x_129306 = tmp2_129305 * tmp2_129305;
        float tmp3_129307 = tmp2_129305 * x_129306;
        float tmp4_129308 = defunc_0_f_res_129297 * tmp3_129307;
        float defunc_1_f_res_129309 = x_j_129300 * tmp4_129308;
        float defunc_1_f_res_129310 = x_j_129300 * defunc_1_f_res_129309;
        float defunc_0_f_res_129311;
        
        if (cond_129292) {
            defunc_0_f_res_129311 = 0.0F;
        } else {
            int64_t i_129312 = add64(gtid_119840, x_128944);
            float x_129313 = ((float *) mem_122985.mem)[gtid_119832 * n_114534 +
                                                        i_129312];
            
            defunc_0_f_res_129311 = x_129313;
        }
        
        float x_129314 = a12_129010 * tmp4_129308;
        float y_129315 = b12_129011 * defunc_1_f_res_129309;
        float x_129316 = x_129314 + y_129315;
        float y_129317 = c12_129012 * defunc_1_f_res_129310;
        float x_129318 = x_129316 + y_129317;
        float defunc_9_fit_fun_res_129319 = defunc_0_f_res_129311 * x_129318;
        float x_129320 = b12_129011 * tmp4_129308;
        float y_129321 = b2_129013 * defunc_1_f_res_129309;
        float x_129322 = x_129320 + y_129321;
        float y_129323 = c2_129014 * defunc_1_f_res_129310;
        float x_129324 = x_129322 + y_129323;
        float defunc_9_slope_fun_res_129325 = defunc_0_f_res_129311 * x_129324;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_129286 = local_acc_129367;
        }
        // Load next params
        {
            x_129287 = defunc_9_fit_fun_res_129319;
        }
        // Red body
        {
            float defunc_1_op_res_129288 = x_129286 + x_129287;
            
            local_acc_129367 = defunc_1_op_res_129288;
        }
        // Load accum params
        {
            x_129289 = local_acc_129368;
        }
        // Load next params
        {
            x_129290 = defunc_9_slope_fun_res_129325;
        }
        // Red body
        {
            float defunc_1_op_res_129291 = x_129289 + x_129290;
            
            local_acc_129368 = defunc_1_op_res_129291;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_129362.mem)[flat_tid_119839] =
        local_acc_129367;
    ((float *) reduce_stage_1_tid_res_arr_mem_129364.mem)[flat_tid_119839] =
        local_acc_129368;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131707_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131707_end -
                 futhark_mc_segred_stage_1_parloop_131707_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131707_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131707_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131707_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131703(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119839 = tid;
    int num_tasks_129361 = info.nsubtasks;
    struct futhark_mc_task_131702 *futhark_mc_task_131702 =
                                  (struct futhark_mc_task_131702 *) args;
    struct futhark_context *ctx = futhark_mc_task_131702->ctx;
    uint64_t futhark_mc_segred_task_131703_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131703_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131702->free_n_114534;
    int64_t gtid_119832 = futhark_mc_task_131702->free_gtid_119832;
    int64_t x_119962 = futhark_mc_task_131702->free_x_119962;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131702->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131702->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131702->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t x_128944 = futhark_mc_task_131702->free_x_128944;
    float x_128945 = futhark_mc_task_131702->free_x_128945;
    float defunc_0_f_res_128948 =
          futhark_mc_task_131702->free_defunc_0_f_res_128948;
    float a12_129010 = futhark_mc_task_131702->free_a12_129010;
    float b12_129011 = futhark_mc_task_131702->free_b12_129011;
    float c12_129012 = futhark_mc_task_131702->free_c12_129012;
    float b2_129013 = futhark_mc_task_131702->free_b2_129013;
    float c2_129014 = futhark_mc_task_131702->free_c2_129014;
    float defunc_2_reduce_res_129015 =
          *futhark_mc_task_131702->retval_defunc_2_reduce_res_129015;
    float defunc_2_reduce_res_129016 =
          *futhark_mc_task_131702->retval_defunc_2_reduce_res_129016;
    size_t reduce_stage_1_tid_res_arr_mem_129362_cached_sizze_131704 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129362 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_129364_cached_sizze_131705 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129364 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_129362_cached_sizze_131704 <
        (size_t) ((int64_t) 4 * num_tasks_129361)) {
        reduce_stage_1_tid_res_arr_mem_129362 =
            realloc(reduce_stage_1_tid_res_arr_mem_129362, (int64_t) 4 *
                    num_tasks_129361);
        reduce_stage_1_tid_res_arr_mem_129362_cached_sizze_131704 =
            (int64_t) 4 * num_tasks_129361;
    }
    if (reduce_stage_1_tid_res_arr_mem_129364_cached_sizze_131705 <
        (size_t) ((int64_t) 4 * num_tasks_129361)) {
        reduce_stage_1_tid_res_arr_mem_129364 =
            realloc(reduce_stage_1_tid_res_arr_mem_129364, (int64_t) 4 *
                    num_tasks_129361);
        reduce_stage_1_tid_res_arr_mem_129364_cached_sizze_131705 =
            (int64_t) 4 * num_tasks_129361;
    }
    
    int64_t iter_129366;
    struct futhark_mc_segred_stage_1_parloop_struct_131706
    futhark_mc_segred_stage_1_parloop_struct_131706;
    
    futhark_mc_segred_stage_1_parloop_struct_131706.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_gtid_119832 =
        gtid_119832;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_x_119962 = x_119962;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_mem_122985 =
        mem_122985.mem;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_x_128944 = x_128944;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_x_128945 = x_128945;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_defunc_0_f_res_128948 =
        defunc_0_f_res_128948;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_a12_129010 =
        a12_129010;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_b12_129011 =
        b12_129011;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_c12_129012 =
        c12_129012;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_b2_129013 = b2_129013;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_c2_129014 = c2_129014;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_reduce_stage_1_tid_res_arr_mem_129362 =
        reduce_stage_1_tid_res_arr_mem_129362;
    futhark_mc_segred_stage_1_parloop_struct_131706.free_reduce_stage_1_tid_res_arr_mem_129364 =
        reduce_stage_1_tid_res_arr_mem_129364;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131707_task;
    
    futhark_mc_segred_stage_1_parloop_131707_task.name =
        "futhark_mc_segred_stage_1_parloop_131707";
    futhark_mc_segred_stage_1_parloop_131707_task.fn =
        futhark_mc_segred_stage_1_parloop_131707;
    futhark_mc_segred_stage_1_parloop_131707_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131706;
    futhark_mc_segred_stage_1_parloop_131707_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131707_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131707_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131707_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131707_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131707_task);
    
    if (futhark_mc_segred_stage_1_parloop_131707_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131707_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131707_total_end -
                 futhark_mc_segred_stage_1_parloop_131707_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131707_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131707_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131707_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_129015 = 0.0F;
        defunc_2_reduce_res_129016 = 0.0F;
    }
    
    float x_129369;
    float x_129370;
    float x_129372;
    float x_129373;
    
    for (int32_t i_129375 = 0; i_129375 < num_tasks_129361; i_129375++) {
        flat_tid_119839 = i_129375;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_129369 = defunc_2_reduce_res_129015;
            }
            // load next params
            {
                x_129370 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129362)[flat_tid_119839];
            }
            // red body
            {
                float defunc_1_op_res_129371 = x_129369 + x_129370;
                
                defunc_2_reduce_res_129015 = defunc_1_op_res_129371;
            }
            // load acc params
            {
                x_129372 = defunc_2_reduce_res_129016;
            }
            // load next params
            {
                x_129373 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129364)[flat_tid_119839];
            }
            // red body
            {
                float defunc_1_op_res_129374 = x_129372 + x_129373;
                
                defunc_2_reduce_res_129016 = defunc_1_op_res_129374;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_129362);
    free(reduce_stage_1_tid_res_arr_mem_129364);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131703_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131703_end -
                 futhark_mc_segred_task_131703_start;
        
        ctx->futhark_mc_segred_task_131703_runs[tid]++;
        ctx->futhark_mc_segred_task_131703_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131703_iter[tid] += iterations;
    }
    *futhark_mc_task_131702->retval_defunc_2_reduce_res_129015 =
        defunc_2_reduce_res_129015;
    *futhark_mc_task_131702->retval_defunc_2_reduce_res_129016 =
        defunc_2_reduce_res_129016;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131692(void *args, int64_t start,
                                            int64_t end, int flat_tid_119835,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131691
    *futhark_mc_segmap_parloop_struct_131691 =
    (struct futhark_mc_segmap_parloop_struct_131691 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131691->ctx;
    uint64_t futhark_mc_segmap_parloop_131692_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131692_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131691->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131691->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131691->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131691->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131691->free_i_114610;
    int64_t gtid_119832 =
            futhark_mc_segmap_parloop_struct_131691->free_gtid_119832;
    int64_t x_119962 = futhark_mc_segmap_parloop_struct_131691->free_x_119962;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131691->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131691->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131691->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131691->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131691->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123058 = {.desc ="mem_123058", .mem =
                                  futhark_mc_segmap_parloop_struct_131691->free_mem_123058,
                                  .size =0, .references =NULL};
    struct memblock mem_123061 = {.desc ="mem_123061", .mem =
                                  futhark_mc_segmap_parloop_struct_131691->free_mem_123061,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_129249 = start;
    
    for (; iter_129249 < end; iter_129249++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_129326 = t_n_m_114591;
        int64_t gtid_119836 = iter_129249;
        int64_t remnant_129327 = iter_129249 - gtid_119836;
        int64_t x_128944 = ((int64_t *) mem_122204.mem)[gtid_119832 *
                                                        t_n_m_114591 +
                                                        gtid_119836];
        float x_128945 = ((float *) mem_122208.mem)[gtid_119832 * t_n_m_114591 +
                                                    gtid_119836];
        int64_t min_arg_128946 = mul64(t_jump_114541, gtid_119836);
        int64_t min_res_128947 = smin64(i_114610, min_arg_128946);
        float defunc_0_f_res_128948 = sitofp_i64_f32(min_res_128947);
        float defunc_2_reduce_res_128949;
        float defunc_2_reduce_res_128950;
        float defunc_2_reduce_res_128951;
        float defunc_2_reduce_res_128952;
        float defunc_2_reduce_res_128953;
        int64_t flat_tid_119837 = (int64_t) 0;
        int32_t num_tasks_129328;
        struct futhark_mc_task_131693 futhark_mc_task_131693;
        
        futhark_mc_task_131693.ctx = ctx;
        futhark_mc_task_131693.free_n_114534 = n_114534;
        futhark_mc_task_131693.free_gtid_119832 = gtid_119832;
        futhark_mc_task_131693.free_x_119962 = x_119962;
        futhark_mc_task_131693.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131693.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131693.free_x_128944 = x_128944;
        futhark_mc_task_131693.free_x_128945 = x_128945;
        futhark_mc_task_131693.free_defunc_0_f_res_128948 =
            defunc_0_f_res_128948;
        futhark_mc_task_131693.retval_defunc_2_reduce_res_128949 =
            &defunc_2_reduce_res_128949;
        futhark_mc_task_131693.retval_defunc_2_reduce_res_128950 =
            &defunc_2_reduce_res_128950;
        futhark_mc_task_131693.retval_defunc_2_reduce_res_128951 =
            &defunc_2_reduce_res_128951;
        futhark_mc_task_131693.retval_defunc_2_reduce_res_128952 =
            &defunc_2_reduce_res_128952;
        futhark_mc_task_131693.retval_defunc_2_reduce_res_128953 =
            &defunc_2_reduce_res_128953;
        
        struct scheduler_segop futhark_mc_task_131693_task;
        
        futhark_mc_task_131693_task.args = &futhark_mc_task_131693;
        futhark_mc_task_131693_task.top_level_fn =
            futhark_mc_segred_task_131694;
        futhark_mc_task_131693_task.name = "futhark_mc_segred_task_131694";
        futhark_mc_task_131693_task.iterations = t_window_114537;
        futhark_mc_task_131693_task.task_time =
            &ctx->futhark_mc_segred_task_131694_total_time;
        futhark_mc_task_131693_task.task_iter =
            &ctx->futhark_mc_segred_task_131694_total_iter;
        futhark_mc_task_131693_task.sched = STATIC;
        futhark_mc_task_131693_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131694_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131693_task);
        
        if (futhark_mc_segred_task_131694_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float x_128990 = defunc_2_reduce_res_128951 *
              defunc_2_reduce_res_128953;
        float y_128991 = defunc_2_reduce_res_128952 *
              defunc_2_reduce_res_128952;
        float a12_128992 = x_128990 - y_128991;
        float x_128993 = defunc_2_reduce_res_128951 *
              defunc_2_reduce_res_128952;
        float y_128994 = defunc_2_reduce_res_128950 *
              defunc_2_reduce_res_128953;
        float b12_128995 = x_128993 - y_128994;
        float x_128996 = defunc_2_reduce_res_128950 *
              defunc_2_reduce_res_128952;
        float y_128997 = defunc_2_reduce_res_128951 *
              defunc_2_reduce_res_128951;
        float c12_128998 = x_128996 - y_128997;
        float x_128999 = defunc_2_reduce_res_128949 *
              defunc_2_reduce_res_128953;
        float b2_129000 = x_128999 - y_128997;
        float x_129001 = defunc_2_reduce_res_128950 *
              defunc_2_reduce_res_128951;
        float y_129002 = defunc_2_reduce_res_128949 *
              defunc_2_reduce_res_128952;
        float c2_129003 = x_129001 - y_129002;
        float x_129004 = defunc_2_reduce_res_128949 * a12_128992;
        float y_129005 = defunc_2_reduce_res_128950 * b12_128995;
        float x_129006 = x_129004 + y_129005;
        float y_129007 = defunc_2_reduce_res_128951 * c12_128998;
        float y_129008 = x_129006 + y_129007;
        float det_129009 = 1.0F / y_129008;
        float a12_129010 = a12_128992 * det_129009;
        float b12_129011 = b12_128995 * det_129009;
        float c12_129012 = c12_128998 * det_129009;
        float b2_129013 = b2_129000 * det_129009;
        float c2_129014 = c2_129003 * det_129009;
        float defunc_2_reduce_res_129015;
        float defunc_2_reduce_res_129016;
        int64_t flat_tid_119839 = (int64_t) 0;
        int32_t num_tasks_129361;
        struct futhark_mc_task_131702 futhark_mc_task_131702;
        
        futhark_mc_task_131702.ctx = ctx;
        futhark_mc_task_131702.free_n_114534 = n_114534;
        futhark_mc_task_131702.free_gtid_119832 = gtid_119832;
        futhark_mc_task_131702.free_x_119962 = x_119962;
        futhark_mc_task_131702.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131702.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131702.free_mem_122985 = mem_122985.mem;
        futhark_mc_task_131702.free_x_128944 = x_128944;
        futhark_mc_task_131702.free_x_128945 = x_128945;
        futhark_mc_task_131702.free_defunc_0_f_res_128948 =
            defunc_0_f_res_128948;
        futhark_mc_task_131702.free_a12_129010 = a12_129010;
        futhark_mc_task_131702.free_b12_129011 = b12_129011;
        futhark_mc_task_131702.free_c12_129012 = c12_129012;
        futhark_mc_task_131702.free_b2_129013 = b2_129013;
        futhark_mc_task_131702.free_c2_129014 = c2_129014;
        futhark_mc_task_131702.retval_defunc_2_reduce_res_129015 =
            &defunc_2_reduce_res_129015;
        futhark_mc_task_131702.retval_defunc_2_reduce_res_129016 =
            &defunc_2_reduce_res_129016;
        
        struct scheduler_segop futhark_mc_task_131702_task;
        
        futhark_mc_task_131702_task.args = &futhark_mc_task_131702;
        futhark_mc_task_131702_task.top_level_fn =
            futhark_mc_segred_task_131703;
        futhark_mc_task_131702_task.name = "futhark_mc_segred_task_131703";
        futhark_mc_task_131702_task.iterations = t_window_114537;
        futhark_mc_task_131702_task.task_time =
            &ctx->futhark_mc_segred_task_131703_total_time;
        futhark_mc_task_131702_task.task_iter =
            &ctx->futhark_mc_segred_task_131703_total_iter;
        futhark_mc_task_131702_task.sched = STATIC;
        futhark_mc_task_131702_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131703_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131702_task);
        
        if (futhark_mc_segred_task_131703_err != 0) {
            err = 1;
            goto cleanup;
        }
        ((float *) mem_123058.mem)[gtid_119836] = defunc_2_reduce_res_129015;
        ((float *) mem_123061.mem)[gtid_119836] = defunc_2_reduce_res_129016;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131692_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131692_end -
                 futhark_mc_segmap_parloop_131692_start;
        
        ctx->futhark_mc_segmap_parloop_131692_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131692_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131692_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131690(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119835 = tid;
    int num_tasks_129167 = info.nsubtasks;
    struct futhark_mc_task_131686 *futhark_mc_task_131686 =
                                  (struct futhark_mc_task_131686 *) args;
    struct futhark_context *ctx = futhark_mc_task_131686->ctx;
    uint64_t futhark_mc_segmap_nested_task_131690_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131690_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131686->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131686->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131686->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131686->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131686->free_i_114610;
    int64_t gtid_119832 = futhark_mc_task_131686->free_gtid_119832;
    int64_t x_119962 = futhark_mc_task_131686->free_x_119962;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131686->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131686->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131686->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131686->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131686->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123058 = {.desc ="mem_123058", .mem =
                                  futhark_mc_task_131686->free_mem_123058,
                                  .size =0, .references =NULL};
    struct memblock mem_123061 = {.desc ="mem_123061", .mem =
                                  futhark_mc_task_131686->free_mem_123061,
                                  .size =0, .references =NULL};
    int64_t iter_129249;
    struct futhark_mc_segmap_parloop_struct_131691
    futhark_mc_segmap_parloop_struct_131691;
    
    futhark_mc_segmap_parloop_struct_131691.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131691.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131691.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131691.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131691.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131691.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131691.free_gtid_119832 = gtid_119832;
    futhark_mc_segmap_parloop_struct_131691.free_x_119962 = x_119962;
    futhark_mc_segmap_parloop_struct_131691.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131691.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131691.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131691.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131691.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131691.free_mem_123058 = mem_123058.mem;
    futhark_mc_segmap_parloop_struct_131691.free_mem_123061 = mem_123061.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131692_task;
    
    futhark_mc_segmap_parloop_131692_task.name =
        "futhark_mc_segmap_parloop_131692";
    futhark_mc_segmap_parloop_131692_task.fn = futhark_mc_segmap_parloop_131692;
    futhark_mc_segmap_parloop_131692_task.args =
        &futhark_mc_segmap_parloop_struct_131691;
    futhark_mc_segmap_parloop_131692_task.iterations = iterations;
    futhark_mc_segmap_parloop_131692_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131692_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131692_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131692_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131692_task);
    
    if (futhark_mc_segmap_parloop_131692_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131692_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131692_total_end -
                 futhark_mc_segmap_parloop_131692_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131692_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131692_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131692_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131690_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131690_end -
                 futhark_mc_segmap_nested_task_131690_start;
        
        ctx->futhark_mc_segmap_nested_task_131690_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131690_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131690_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131683(void *args, int64_t start,
                                            int64_t end, int flat_tid_119831,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131682
    *futhark_mc_segmap_parloop_struct_131682 =
    (struct futhark_mc_segmap_parloop_struct_131682 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131682->ctx;
    uint64_t futhark_mc_segmap_parloop_131683_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131683_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131682->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131682->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131682->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131682->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131682->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131682->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131682->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131682->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131682->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131682->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131682->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131682->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131682->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123095 = {.desc ="mem_123095", .mem =
                                  futhark_mc_segmap_parloop_struct_131682->free_mem_123095,
                                  .size =0, .references =NULL};
    struct memblock mem_123099 = {.desc ="mem_123099", .mem =
                                  futhark_mc_segmap_parloop_struct_131682->free_mem_123099,
                                  .size =0, .references =NULL};
    size_t mem_123058_cached_sizze_131684 = 0;
    char *mem_123058 = NULL;
    size_t mem_123061_cached_sizze_131685 = 0;
    char *mem_123061 = NULL;
    int64_t iterations = end - start;
    int64_t iter_128943 = start;
    
    if (mem_123058_cached_sizze_131684 < (size_t) bytes_122135) {
        mem_123058 = realloc(mem_123058, bytes_122135);
        mem_123058_cached_sizze_131684 = bytes_122135;
    }
    if (mem_123061_cached_sizze_131685 < (size_t) bytes_122135) {
        mem_123061 = realloc(mem_123061, bytes_122135);
        mem_123061_cached_sizze_131685 = bytes_122135;
    }
    for (; iter_128943 < end; iter_128943++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_129165 = m_114533;
        int64_t gtid_119832 = iter_128943;
        int64_t remnant_129166 = iter_128943 - gtid_119832;
        int64_t x_119962 = ((int64_t *) mem_121982.mem)[gtid_119832];
        int64_t flat_tid_119833 = (int64_t) 0;
        int32_t num_tasks_129167;
        int64_t flat_tid_119835 = (int64_t) 0;
        struct futhark_mc_task_131686 futhark_mc_task_131686;
        
        futhark_mc_task_131686.ctx = ctx;
        futhark_mc_task_131686.free_n_114534 = n_114534;
        futhark_mc_task_131686.free_t_window_114537 = t_window_114537;
        futhark_mc_task_131686.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131686.free_t_n_m_114591 = t_n_m_114591;
        futhark_mc_task_131686.free_i_114610 = i_114610;
        futhark_mc_task_131686.free_gtid_119832 = gtid_119832;
        futhark_mc_task_131686.free_x_119962 = x_119962;
        futhark_mc_task_131686.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131686.free_mem_122204 = mem_122204.mem;
        futhark_mc_task_131686.free_mem_122208 = mem_122208.mem;
        futhark_mc_task_131686.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131686.free_mem_122985 = mem_122985.mem;
        futhark_mc_task_131686.free_mem_123058 = mem_123058;
        futhark_mc_task_131686.free_mem_123061 = mem_123061;
        
        struct scheduler_segop futhark_mc_task_131686_task;
        
        futhark_mc_task_131686_task.args = &futhark_mc_task_131686;
        futhark_mc_task_131686_task.top_level_fn =
            futhark_mc_segmap_task_131687;
        futhark_mc_task_131686_task.name = "futhark_mc_segmap_task_131687";
        futhark_mc_task_131686_task.iterations = t_n_m_114591;
        futhark_mc_task_131686_task.task_time =
            &ctx->futhark_mc_segmap_task_131687_total_time;
        futhark_mc_task_131686_task.task_iter =
            &ctx->futhark_mc_segmap_task_131687_total_iter;
        futhark_mc_task_131686_task.sched = STATIC;
        futhark_mc_task_131686_task.nested_fn =
            futhark_mc_segmap_nested_task_131690;
        
        int futhark_mc_segmap_task_131687_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131686_task);
        
        if (futhark_mc_segmap_task_131687_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_123095.mem + gtid_119832 * t_n_m_114591 * (int64_t) 4,
                mem_123058 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
        memmove(mem_123099.mem + gtid_119832 * t_n_m_114591 * (int64_t) 4,
                mem_123061 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123058);
    free(mem_123061);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131683_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131683_end -
                 futhark_mc_segmap_parloop_131683_start;
        
        ctx->futhark_mc_segmap_parloop_131683_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131683_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131683_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131681(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_119831 = tid;
    int num_tasks_128817 = info.nsubtasks;
    struct futhark_mc_task_131675 *futhark_mc_task_131675 =
                                  (struct futhark_mc_task_131675 *) args;
    struct futhark_context *ctx = futhark_mc_task_131675->ctx;
    uint64_t futhark_mc_segmap_nested_task_131681_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131681_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131675->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131675->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131675->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131675->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131675->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131675->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131675->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131675->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131675->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131675->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131675->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131675->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131675->free_mem_122985,
                                  .size =0, .references =NULL};
    struct memblock mem_123095 = {.desc ="mem_123095", .mem =
                                  futhark_mc_task_131675->free_mem_123095,
                                  .size =0, .references =NULL};
    struct memblock mem_123099 = {.desc ="mem_123099", .mem =
                                  futhark_mc_task_131675->free_mem_123099,
                                  .size =0, .references =NULL};
    int64_t iter_128943;
    struct futhark_mc_segmap_parloop_struct_131682
    futhark_mc_segmap_parloop_struct_131682;
    
    futhark_mc_segmap_parloop_struct_131682.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131682.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131682.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131682.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131682.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131682.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131682.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131682.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131682.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131682.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131682.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131682.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131682.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131682.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131682.free_mem_123095 = mem_123095.mem;
    futhark_mc_segmap_parloop_struct_131682.free_mem_123099 = mem_123099.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131683_task;
    
    futhark_mc_segmap_parloop_131683_task.name =
        "futhark_mc_segmap_parloop_131683";
    futhark_mc_segmap_parloop_131683_task.fn = futhark_mc_segmap_parloop_131683;
    futhark_mc_segmap_parloop_131683_task.args =
        &futhark_mc_segmap_parloop_struct_131682;
    futhark_mc_segmap_parloop_131683_task.iterations = iterations;
    futhark_mc_segmap_parloop_131683_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131683_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131683_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131683_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131683_task);
    
    if (futhark_mc_segmap_parloop_131683_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131683_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131683_total_end -
                 futhark_mc_segmap_parloop_131683_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131683_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131683_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131683_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131681_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131681_end -
                 futhark_mc_segmap_nested_task_131681_start;
        
        ctx->futhark_mc_segmap_nested_task_131681_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131681_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131681_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131708 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123108;
    char *free_mem_123162;
};
struct futhark_mc_segmap_parloop_struct_131710 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123108;
    char *free_mem_123162;
};
static int futhark_mc_segmap_parloop_131711(void *args, int64_t start,
                                            int64_t end, int flat_tid_120197,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131710
    *futhark_mc_segmap_parloop_struct_131710 =
    (struct futhark_mc_segmap_parloop_struct_131710 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131710->ctx;
    uint64_t futhark_mc_segmap_parloop_131711_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131711_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131710->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131710->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131710->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131710->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131710->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131710->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131710->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131710->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131710->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131710->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131710->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131710->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131710->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123108 =
            futhark_mc_segmap_parloop_struct_131710->free_bytes_123108;
    struct memblock mem_123162 = {.desc ="mem_123162", .mem =
                                  futhark_mc_segmap_parloop_struct_131710->free_mem_123162,
                                  .size =0, .references =NULL};
    size_t mem_123131_cached_sizze_131712 = 0;
    char *mem_123131 = NULL;
    size_t mem_123141_cached_sizze_131713 = 0;
    char *mem_123141 = NULL;
    int64_t iterations = end - start;
    int64_t iter_129379 = start;
    
    if (mem_123131_cached_sizze_131712 < (size_t) bytes_122135) {
        mem_123131 = realloc(mem_123131, bytes_122135);
        mem_123131_cached_sizze_131712 = bytes_122135;
    }
    if (mem_123141_cached_sizze_131713 < (size_t) bytes_123108) {
        mem_123141 = realloc(mem_123141, bytes_123108);
        mem_123141_cached_sizze_131713 = bytes_123108;
    }
    for (; iter_129379 < end; iter_129379++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_129425 = m_114533;
        int64_t gtid_120198 = iter_129379;
        int64_t remnant_129426 = iter_129379 - gtid_120198;
        int64_t x_116189 = ((int64_t *) mem_121982.mem)[gtid_120198];
        
        for (int64_t i_129380 = 0; i_129380 < t_n_m_114591; i_129380++) {
            int64_t x_129382 = ((int64_t *) mem_122204.mem)[gtid_120198 *
                                                            t_n_m_114591 +
                                                            i_129380];
            float x_129383 = ((float *) mem_122208.mem)[gtid_120198 *
                                                        t_n_m_114591 +
                                                        i_129380];
            int64_t min_arg_129384 = mul64(t_jump_114541, i_129380);
            int64_t min_res_129385 = smin64(i_114610, min_arg_129384);
            float defunc_0_f_res_129386 = sitofp_i64_f32(min_res_129385);
            float defunc_2_reduce_res_129388;
            float redout_129391 = 0.0F;
            
            for (int64_t i_129390 = 0; i_129390 < t_window_114537; i_129390++) {
                bool cond_129393 = sle64(x_116189, i_129390);
                float defunc_0_f_res_129394;
                
                if (cond_129393) {
                    defunc_0_f_res_129394 = 0.0F;
                } else {
                    int64_t i_129395 = add64(x_129382, i_129390);
                    float x_129396 = ((float *) mem_122004.mem)[gtid_120198 *
                                                                n_114534 +
                                                                i_129395];
                    float defunc_0_f_res_f_res_129397 = 1.0F + x_129396;
                    
                    defunc_0_f_res_129394 = defunc_0_f_res_f_res_129397;
                }
                
                float defunc_0_f_res_129398;
                
                if (cond_129393) {
                    defunc_0_f_res_129398 = 0.0F;
                } else {
                    int64_t i_129399 = add64(x_129382, i_129390);
                    float x_129400 = ((float *) mem_122430.mem)[gtid_120198 *
                                                                n_114534 +
                                                                i_129399];
                    
                    defunc_0_f_res_129398 = x_129400;
                }
                
                float x_j_129401 = defunc_0_f_res_129394 -
                      defunc_0_f_res_129386;
                float abs_res_129402 = (float) fabs(x_j_129401);
                float tmp1_129403 = abs_res_129402 / x_129383;
                float x_129404 = tmp1_129403 * tmp1_129403;
                float y_129405 = tmp1_129403 * x_129404;
                float tmp2_129406 = 1.0F - y_129405;
                float x_129407 = tmp2_129406 * tmp2_129406;
                float tmp3_129408 = tmp2_129406 * x_129407;
                float tmp4_129409 = defunc_0_f_res_129398 * tmp3_129408;
                float defunc_1_op_res_129410 = tmp4_129409 + redout_129391;
                
                ((float *) mem_123141)[i_129390] = tmp4_129409;
                
                float redout_tmp_129428 = defunc_1_op_res_129410;
                
                redout_129391 = redout_tmp_129428;
            }
            defunc_2_reduce_res_129388 = redout_129391;
            
            float a0_129412 = 1.0F / defunc_2_reduce_res_129388;
            float defunc_2_reduce_res_129413;
            float redout_129415 = 0.0F;
            
            for (int64_t i_129414 = 0; i_129414 < t_window_114537; i_129414++) {
                float x_129416 = ((float *) mem_123141)[i_129414];
                bool cond_129417 = sle64(x_116189, i_129414);
                float defunc_0_f_res_129418;
                
                if (cond_129417) {
                    defunc_0_f_res_129418 = 0.0F;
                } else {
                    int64_t i_129419 = add64(x_129382, i_129414);
                    float x_129420 = ((float *) mem_122985.mem)[gtid_120198 *
                                                                n_114534 +
                                                                i_129419];
                    
                    defunc_0_f_res_129418 = x_129420;
                }
                
                float x_129421 = a0_129412 * x_129416;
                float defunc_9_fit_fun_res_129422 = defunc_0_f_res_129418 *
                      x_129421;
                float defunc_1_op_res_129423 = defunc_9_fit_fun_res_129422 +
                      redout_129415;
                float redout_tmp_129430 = defunc_1_op_res_129423;
                
                redout_129415 = redout_tmp_129430;
            }
            defunc_2_reduce_res_129413 = redout_129415;
            ((float *) mem_123131)[i_129380] = defunc_2_reduce_res_129413;
        }
        memmove(mem_123162.mem + gtid_120198 * t_n_m_114591 * (int64_t) 4,
                mem_123131 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123131);
    free(mem_123141);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131711_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131711_end -
                 futhark_mc_segmap_parloop_131711_start;
        
        ctx->futhark_mc_segmap_parloop_131711_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131711_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131711_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131709(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120197 = tid;
    int num_tasks_129378 = info.nsubtasks;
    struct futhark_mc_task_131708 *futhark_mc_task_131708 =
                                  (struct futhark_mc_task_131708 *) args;
    struct futhark_context *ctx = futhark_mc_task_131708->ctx;
    uint64_t futhark_mc_segmap_task_131709_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131709_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131708->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131708->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131708->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131708->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131708->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131708->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131708->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131708->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131708->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131708->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131708->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131708->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131708->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123108 = futhark_mc_task_131708->free_bytes_123108;
    struct memblock mem_123162 = {.desc ="mem_123162", .mem =
                                  futhark_mc_task_131708->free_mem_123162,
                                  .size =0, .references =NULL};
    int64_t iter_129379;
    struct futhark_mc_segmap_parloop_struct_131710
    futhark_mc_segmap_parloop_struct_131710;
    
    futhark_mc_segmap_parloop_struct_131710.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131710.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131710.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131710.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131710.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131710.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131710.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131710.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131710.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131710.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131710.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131710.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131710.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131710.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131710.free_bytes_123108 = bytes_123108;
    futhark_mc_segmap_parloop_struct_131710.free_mem_123162 = mem_123162.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131711_task;
    
    futhark_mc_segmap_parloop_131711_task.name =
        "futhark_mc_segmap_parloop_131711";
    futhark_mc_segmap_parloop_131711_task.fn = futhark_mc_segmap_parloop_131711;
    futhark_mc_segmap_parloop_131711_task.args =
        &futhark_mc_segmap_parloop_struct_131710;
    futhark_mc_segmap_parloop_131711_task.iterations = iterations;
    futhark_mc_segmap_parloop_131711_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131711_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131711_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131711_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131711_task);
    
    if (futhark_mc_segmap_parloop_131711_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131711_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131711_total_end -
                 futhark_mc_segmap_parloop_131711_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131711_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131711_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131711_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131709_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131709_end -
                 futhark_mc_segmap_task_131709_start;
        
        ctx->futhark_mc_segmap_task_131709_runs[tid]++;
        ctx->futhark_mc_segmap_task_131709_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131709_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131715 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123108;
    char *free_mem_123162;
};
struct futhark_mc_task_131718 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_120200;
    int64_t free_x_120256;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123108;
    char *free_mem_123128;
};
struct futhark_mc_segmap_parloop_struct_131720 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_120200;
    int64_t free_x_120256;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123108;
    char *free_mem_123128;
};
static int futhark_mc_segmap_parloop_131721(void *args, int64_t start,
                                            int64_t end, int flat_tid_120201,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131720
    *futhark_mc_segmap_parloop_struct_131720 =
    (struct futhark_mc_segmap_parloop_struct_131720 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131720->ctx;
    uint64_t futhark_mc_segmap_parloop_131721_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131721_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131720->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131720->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131720->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131720->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131720->free_i_114610;
    int64_t gtid_120200 =
            futhark_mc_segmap_parloop_struct_131720->free_gtid_120200;
    int64_t x_120256 = futhark_mc_segmap_parloop_struct_131720->free_x_120256;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131720->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131720->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131720->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131720->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131720->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123108 =
            futhark_mc_segmap_parloop_struct_131720->free_bytes_123108;
    struct memblock mem_123128 = {.desc ="mem_123128", .mem =
                                  futhark_mc_segmap_parloop_struct_131720->free_mem_123128,
                                  .size =0, .references =NULL};
    size_t mem_129477_cached_sizze_131722 = 0;
    char *mem_129477 = NULL;
    int64_t iterations = end - start;
    int64_t iter_129518 = start;
    
    if (mem_129477_cached_sizze_131722 < (size_t) bytes_123108) {
        mem_129477 = realloc(mem_129477, bytes_123108);
        mem_129477_cached_sizze_131722 = bytes_123108;
    }
    for (; iter_129518 < end; iter_129518++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_129551 = t_n_m_114591;
        int64_t gtid_120202 = iter_129518;
        int64_t remnant_129552 = iter_129518 - gtid_120202;
        int64_t x_129472 = ((int64_t *) mem_122204.mem)[gtid_120200 *
                                                        t_n_m_114591 +
                                                        gtid_120202];
        float x_129473 = ((float *) mem_122208.mem)[gtid_120200 * t_n_m_114591 +
                                                    gtid_120202];
        int64_t min_arg_129474 = mul64(t_jump_114541, gtid_120202);
        int64_t min_res_129475 = smin64(i_114610, min_arg_129474);
        float defunc_0_f_res_129476 = sitofp_i64_f32(min_res_129475);
        float defunc_2_reduce_res_129479;
        float redout_129520 = 0.0F;
        
        for (int64_t i_129519 = 0; i_129519 < t_window_114537; i_129519++) {
            bool cond_129522 = sle64(x_120256, i_129519);
            float defunc_0_f_res_129523;
            
            if (cond_129522) {
                defunc_0_f_res_129523 = 0.0F;
            } else {
                int64_t i_129524 = add64(x_129472, i_129519);
                float x_129525 = ((float *) mem_122004.mem)[gtid_120200 *
                                                            n_114534 +
                                                            i_129524];
                float defunc_0_f_res_f_res_129526 = 1.0F + x_129525;
                
                defunc_0_f_res_129523 = defunc_0_f_res_f_res_129526;
            }
            
            float defunc_0_f_res_129527;
            
            if (cond_129522) {
                defunc_0_f_res_129527 = 0.0F;
            } else {
                int64_t i_129528 = add64(x_129472, i_129519);
                float x_129529 = ((float *) mem_122430.mem)[gtid_120200 *
                                                            n_114534 +
                                                            i_129528];
                
                defunc_0_f_res_129527 = x_129529;
            }
            
            float x_j_129530 = defunc_0_f_res_129523 - defunc_0_f_res_129476;
            float abs_res_129531 = (float) fabs(x_j_129530);
            float tmp1_129532 = abs_res_129531 / x_129473;
            float x_129533 = tmp1_129532 * tmp1_129532;
            float y_129534 = tmp1_129532 * x_129533;
            float tmp2_129535 = 1.0F - y_129534;
            float x_129536 = tmp2_129535 * tmp2_129535;
            float tmp3_129537 = tmp2_129535 * x_129536;
            float tmp4_129538 = defunc_0_f_res_129527 * tmp3_129537;
            float defunc_1_op_res_129539 = tmp4_129538 + redout_129520;
            
            ((float *) mem_129477)[i_129519] = tmp4_129538;
            
            float redout_tmp_129553 = defunc_1_op_res_129539;
            
            redout_129520 = redout_tmp_129553;
        }
        defunc_2_reduce_res_129479 = redout_129520;
        
        float a0_129503 = 1.0F / defunc_2_reduce_res_129479;
        float defunc_2_reduce_res_129504;
        float redout_129542 = 0.0F;
        
        for (int64_t i_129541 = 0; i_129541 < t_window_114537; i_129541++) {
            float x_129543 = ((float *) mem_129477)[i_129541];
            bool cond_129544 = sle64(x_120256, i_129541);
            float defunc_0_f_res_129545;
            
            if (cond_129544) {
                defunc_0_f_res_129545 = 0.0F;
            } else {
                int64_t i_129546 = add64(x_129472, i_129541);
                float x_129547 = ((float *) mem_122985.mem)[gtid_120200 *
                                                            n_114534 +
                                                            i_129546];
                
                defunc_0_f_res_129545 = x_129547;
            }
            
            float x_129548 = a0_129503 * x_129543;
            float defunc_9_fit_fun_res_129549 = defunc_0_f_res_129545 *
                  x_129548;
            float defunc_1_op_res_129550 = defunc_9_fit_fun_res_129549 +
                  redout_129542;
            float redout_tmp_129555 = defunc_1_op_res_129550;
            
            redout_129542 = redout_tmp_129555;
        }
        defunc_2_reduce_res_129504 = redout_129542;
        ((float *) mem_123128.mem)[gtid_120202] = defunc_2_reduce_res_129504;
    }
    
  cleanup:
    { }
    free(mem_129477);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131721_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131721_end -
                 futhark_mc_segmap_parloop_131721_start;
        
        ctx->futhark_mc_segmap_parloop_131721_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131721_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131721_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131719(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120201 = tid;
    int num_tasks_129517 = info.nsubtasks;
    struct futhark_mc_task_131718 *futhark_mc_task_131718 =
                                  (struct futhark_mc_task_131718 *) args;
    struct futhark_context *ctx = futhark_mc_task_131718->ctx;
    uint64_t futhark_mc_segmap_task_131719_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131719_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131718->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131718->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131718->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131718->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131718->free_i_114610;
    int64_t gtid_120200 = futhark_mc_task_131718->free_gtid_120200;
    int64_t x_120256 = futhark_mc_task_131718->free_x_120256;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131718->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131718->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131718->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131718->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131718->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123108 = futhark_mc_task_131718->free_bytes_123108;
    struct memblock mem_123128 = {.desc ="mem_123128", .mem =
                                  futhark_mc_task_131718->free_mem_123128,
                                  .size =0, .references =NULL};
    int64_t iter_129518;
    struct futhark_mc_segmap_parloop_struct_131720
    futhark_mc_segmap_parloop_struct_131720;
    
    futhark_mc_segmap_parloop_struct_131720.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131720.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131720.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131720.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131720.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131720.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131720.free_gtid_120200 = gtid_120200;
    futhark_mc_segmap_parloop_struct_131720.free_x_120256 = x_120256;
    futhark_mc_segmap_parloop_struct_131720.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131720.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131720.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131720.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131720.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131720.free_bytes_123108 = bytes_123108;
    futhark_mc_segmap_parloop_struct_131720.free_mem_123128 = mem_123128.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131721_task;
    
    futhark_mc_segmap_parloop_131721_task.name =
        "futhark_mc_segmap_parloop_131721";
    futhark_mc_segmap_parloop_131721_task.fn = futhark_mc_segmap_parloop_131721;
    futhark_mc_segmap_parloop_131721_task.args =
        &futhark_mc_segmap_parloop_struct_131720;
    futhark_mc_segmap_parloop_131721_task.iterations = iterations;
    futhark_mc_segmap_parloop_131721_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131721_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131721_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131721_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131721_task);
    
    if (futhark_mc_segmap_parloop_131721_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131721_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131721_total_end -
                 futhark_mc_segmap_parloop_131721_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131721_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131721_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131721_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131719_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131719_end -
                 futhark_mc_segmap_task_131719_start;
        
        ctx->futhark_mc_segmap_task_131719_runs[tid]++;
        ctx->futhark_mc_segmap_task_131719_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131719_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131724 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_120200;
    int64_t free_x_120256;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123108;
    char *free_mem_123128;
};
struct futhark_mc_task_131727 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120200;
    int64_t free_x_120256;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_129432;
    float free_x_129433;
    float free_defunc_0_f_res_129436;
    float *retval_defunc_2_reduce_res_129438;
    char *retval_mem_129437;
};
struct futhark_mc_segred_stage_1_parloop_struct_131730 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120200;
    int64_t free_x_120256;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_129432;
    float free_x_129433;
    float free_defunc_0_f_res_129436;
    char *free_mem_129437;
    char *free_reduce_stage_1_tid_res_arr_mem_129590;
};
static int futhark_mc_segred_stage_1_parloop_131731(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_120205,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131730
    *futhark_mc_segred_stage_1_parloop_struct_131730 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131730 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131730->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131731_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131731_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131730->free_n_114534;
    int64_t gtid_120200 =
            futhark_mc_segred_stage_1_parloop_struct_131730->free_gtid_120200;
    int64_t x_120256 =
            futhark_mc_segred_stage_1_parloop_struct_131730->free_x_120256;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131730->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131730->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_129432 =
            futhark_mc_segred_stage_1_parloop_struct_131730->free_x_129432;
    float x_129433 =
          futhark_mc_segred_stage_1_parloop_struct_131730->free_x_129433;
    float defunc_0_f_res_129436 =
          futhark_mc_segred_stage_1_parloop_struct_131730->free_defunc_0_f_res_129436;
    struct memblock mem_129437 = {.desc ="mem_129437", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131730->free_mem_129437,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_129590 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129590",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131730->free_reduce_stage_1_tid_res_arr_mem_129590,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_129592 = start;
    float x_129557;
    float x_129558;
    float local_acc_129593 = 0.0F;
    
    for (; iter_129592 < end; iter_129592++) {
        int64_t gtid_120206 = iter_129592;
        bool cond_129560 = sle64(x_120256, gtid_120206);
        float defunc_0_f_res_129561;
        
        if (cond_129560) {
            defunc_0_f_res_129561 = 0.0F;
        } else {
            int64_t i_129562 = add64(gtid_120206, x_129432);
            float x_129563 = ((float *) mem_122004.mem)[gtid_120200 * n_114534 +
                                                        i_129562];
            float defunc_0_f_res_f_res_129564 = 1.0F + x_129563;
            
            defunc_0_f_res_129561 = defunc_0_f_res_f_res_129564;
        }
        
        float defunc_0_f_res_129565;
        
        if (cond_129560) {
            defunc_0_f_res_129565 = 0.0F;
        } else {
            int64_t i_129566 = add64(gtid_120206, x_129432);
            float x_129567 = ((float *) mem_122430.mem)[gtid_120200 * n_114534 +
                                                        i_129566];
            
            defunc_0_f_res_129565 = x_129567;
        }
        
        float x_j_129568 = defunc_0_f_res_129561 - defunc_0_f_res_129436;
        float abs_res_129569 = (float) fabs(x_j_129568);
        float tmp1_129570 = abs_res_129569 / x_129433;
        float x_129571 = tmp1_129570 * tmp1_129570;
        float y_129572 = tmp1_129570 * x_129571;
        float tmp2_129573 = 1.0F - y_129572;
        float x_129574 = tmp2_129573 * tmp2_129573;
        float tmp3_129575 = tmp2_129573 * x_129574;
        float tmp4_129576 = defunc_0_f_res_129565 * tmp3_129575;
        
        // save map-out results
        {
            ((float *) mem_129437.mem)[gtid_120206] = tmp4_129576;
        }
        // Load accum params
        {
            x_129557 = local_acc_129593;
        }
        // Load next params
        {
            x_129558 = tmp4_129576;
        }
        // Red body
        {
            float defunc_1_op_res_129559 = x_129557 + x_129558;
            
            local_acc_129593 = defunc_1_op_res_129559;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_129590.mem)[flat_tid_120205] =
        local_acc_129593;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131731_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131731_end -
                 futhark_mc_segred_stage_1_parloop_131731_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131731_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131731_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131731_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131728(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120205 = tid;
    int num_tasks_129589 = info.nsubtasks;
    struct futhark_mc_task_131727 *futhark_mc_task_131727 =
                                  (struct futhark_mc_task_131727 *) args;
    struct futhark_context *ctx = futhark_mc_task_131727->ctx;
    uint64_t futhark_mc_segred_task_131728_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131728_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131727->free_n_114534;
    int64_t gtid_120200 = futhark_mc_task_131727->free_gtid_120200;
    int64_t x_120256 = futhark_mc_task_131727->free_x_120256;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131727->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131727->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_129432 = futhark_mc_task_131727->free_x_129432;
    float x_129433 = futhark_mc_task_131727->free_x_129433;
    float defunc_0_f_res_129436 =
          futhark_mc_task_131727->free_defunc_0_f_res_129436;
    float defunc_2_reduce_res_129438 =
          *futhark_mc_task_131727->retval_defunc_2_reduce_res_129438;
    struct memblock mem_129437 = {.desc ="mem_129437", .mem =
                                  futhark_mc_task_131727->retval_mem_129437,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_129590_cached_sizze_131729 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129590 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_129590_cached_sizze_131729 <
        (size_t) ((int64_t) 4 * num_tasks_129589)) {
        reduce_stage_1_tid_res_arr_mem_129590 =
            realloc(reduce_stage_1_tid_res_arr_mem_129590, (int64_t) 4 *
                    num_tasks_129589);
        reduce_stage_1_tid_res_arr_mem_129590_cached_sizze_131729 =
            (int64_t) 4 * num_tasks_129589;
    }
    
    int64_t iter_129592;
    struct futhark_mc_segred_stage_1_parloop_struct_131730
    futhark_mc_segred_stage_1_parloop_struct_131730;
    
    futhark_mc_segred_stage_1_parloop_struct_131730.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131730.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131730.free_gtid_120200 =
        gtid_120200;
    futhark_mc_segred_stage_1_parloop_struct_131730.free_x_120256 = x_120256;
    futhark_mc_segred_stage_1_parloop_struct_131730.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131730.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131730.free_x_129432 = x_129432;
    futhark_mc_segred_stage_1_parloop_struct_131730.free_x_129433 = x_129433;
    futhark_mc_segred_stage_1_parloop_struct_131730.free_defunc_0_f_res_129436 =
        defunc_0_f_res_129436;
    futhark_mc_segred_stage_1_parloop_struct_131730.free_mem_129437 =
        mem_129437.mem;
    futhark_mc_segred_stage_1_parloop_struct_131730.free_reduce_stage_1_tid_res_arr_mem_129590 =
        reduce_stage_1_tid_res_arr_mem_129590;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131731_task;
    
    futhark_mc_segred_stage_1_parloop_131731_task.name =
        "futhark_mc_segred_stage_1_parloop_131731";
    futhark_mc_segred_stage_1_parloop_131731_task.fn =
        futhark_mc_segred_stage_1_parloop_131731;
    futhark_mc_segred_stage_1_parloop_131731_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131730;
    futhark_mc_segred_stage_1_parloop_131731_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131731_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131731_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131731_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131731_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131731_task);
    
    if (futhark_mc_segred_stage_1_parloop_131731_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131731_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131731_total_end -
                 futhark_mc_segred_stage_1_parloop_131731_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131731_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131731_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131731_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_129438 = 0.0F;
    }
    
    float x_129594;
    float x_129595;
    
    for (int32_t i_129597 = 0; i_129597 < num_tasks_129589; i_129597++) {
        flat_tid_120205 = i_129597;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_129594 = defunc_2_reduce_res_129438;
            }
            // load next params
            {
                x_129595 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129590)[flat_tid_120205];
            }
            // red body
            {
                float defunc_1_op_res_129596 = x_129594 + x_129595;
                
                defunc_2_reduce_res_129438 = defunc_1_op_res_129596;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_129590);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131728_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131728_end -
                 futhark_mc_segred_task_131728_start;
        
        ctx->futhark_mc_segred_task_131728_runs[tid]++;
        ctx->futhark_mc_segred_task_131728_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131728_iter[tid] += iterations;
    }
    *futhark_mc_task_131727->retval_defunc_2_reduce_res_129438 =
        defunc_2_reduce_res_129438;
    futhark_mc_task_131727->retval_mem_129437 = mem_129437.mem;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131732 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120200;
    int64_t free_x_120256;
    char *free_mem_122985;
    int64_t free_x_129432;
    char *free_mem_129437;
    float free_a0_129460;
    float *retval_defunc_2_reduce_res_129461;
};
struct futhark_mc_segred_stage_1_parloop_struct_131735 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120200;
    int64_t free_x_120256;
    char *free_mem_122985;
    int64_t free_x_129432;
    char *free_mem_129437;
    float free_a0_129460;
    char *free_reduce_stage_1_tid_res_arr_mem_129599;
};
static int futhark_mc_segred_stage_1_parloop_131736(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_120207,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131735
    *futhark_mc_segred_stage_1_parloop_struct_131735 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131735 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131735->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131736_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131736_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131735->free_n_114534;
    int64_t gtid_120200 =
            futhark_mc_segred_stage_1_parloop_struct_131735->free_gtid_120200;
    int64_t x_120256 =
            futhark_mc_segred_stage_1_parloop_struct_131735->free_x_120256;
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131735->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t x_129432 =
            futhark_mc_segred_stage_1_parloop_struct_131735->free_x_129432;
    struct memblock mem_129437 = {.desc ="mem_129437", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131735->free_mem_129437,
                                  .size =0, .references =NULL};
    float a0_129460 =
          futhark_mc_segred_stage_1_parloop_struct_131735->free_a0_129460;
    struct memblock reduce_stage_1_tid_res_arr_mem_129599 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129599",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131735->free_reduce_stage_1_tid_res_arr_mem_129599,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_129601 = start;
    float x_129577;
    float x_129578;
    float local_acc_129602 = 0.0F;
    
    for (; iter_129601 < end; iter_129601++) {
        int64_t gtid_120208 = iter_129601;
        float x_129580 = ((float *) mem_129437.mem)[gtid_120208];
        bool cond_129581 = sle64(x_120256, gtid_120208);
        float defunc_0_f_res_129582;
        
        if (cond_129581) {
            defunc_0_f_res_129582 = 0.0F;
        } else {
            int64_t i_129583 = add64(gtid_120208, x_129432);
            float x_129584 = ((float *) mem_122985.mem)[gtid_120200 * n_114534 +
                                                        i_129583];
            
            defunc_0_f_res_129582 = x_129584;
        }
        
        float x_129585 = a0_129460 * x_129580;
        float defunc_9_fit_fun_res_129586 = defunc_0_f_res_129582 * x_129585;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_129577 = local_acc_129602;
        }
        // Load next params
        {
            x_129578 = defunc_9_fit_fun_res_129586;
        }
        // Red body
        {
            float defunc_1_op_res_129579 = x_129577 + x_129578;
            
            local_acc_129602 = defunc_1_op_res_129579;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_129599.mem)[flat_tid_120207] =
        local_acc_129602;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131736_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131736_end -
                 futhark_mc_segred_stage_1_parloop_131736_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131736_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131736_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131736_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131733(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120207 = tid;
    int num_tasks_129598 = info.nsubtasks;
    struct futhark_mc_task_131732 *futhark_mc_task_131732 =
                                  (struct futhark_mc_task_131732 *) args;
    struct futhark_context *ctx = futhark_mc_task_131732->ctx;
    uint64_t futhark_mc_segred_task_131733_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131733_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131732->free_n_114534;
    int64_t gtid_120200 = futhark_mc_task_131732->free_gtid_120200;
    int64_t x_120256 = futhark_mc_task_131732->free_x_120256;
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131732->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t x_129432 = futhark_mc_task_131732->free_x_129432;
    struct memblock mem_129437 = {.desc ="mem_129437", .mem =
                                  futhark_mc_task_131732->free_mem_129437,
                                  .size =0, .references =NULL};
    float a0_129460 = futhark_mc_task_131732->free_a0_129460;
    float defunc_2_reduce_res_129461 =
          *futhark_mc_task_131732->retval_defunc_2_reduce_res_129461;
    size_t reduce_stage_1_tid_res_arr_mem_129599_cached_sizze_131734 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129599 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_129599_cached_sizze_131734 <
        (size_t) ((int64_t) 4 * num_tasks_129598)) {
        reduce_stage_1_tid_res_arr_mem_129599 =
            realloc(reduce_stage_1_tid_res_arr_mem_129599, (int64_t) 4 *
                    num_tasks_129598);
        reduce_stage_1_tid_res_arr_mem_129599_cached_sizze_131734 =
            (int64_t) 4 * num_tasks_129598;
    }
    
    int64_t iter_129601;
    struct futhark_mc_segred_stage_1_parloop_struct_131735
    futhark_mc_segred_stage_1_parloop_struct_131735;
    
    futhark_mc_segred_stage_1_parloop_struct_131735.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131735.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131735.free_gtid_120200 =
        gtid_120200;
    futhark_mc_segred_stage_1_parloop_struct_131735.free_x_120256 = x_120256;
    futhark_mc_segred_stage_1_parloop_struct_131735.free_mem_122985 =
        mem_122985.mem;
    futhark_mc_segred_stage_1_parloop_struct_131735.free_x_129432 = x_129432;
    futhark_mc_segred_stage_1_parloop_struct_131735.free_mem_129437 =
        mem_129437.mem;
    futhark_mc_segred_stage_1_parloop_struct_131735.free_a0_129460 = a0_129460;
    futhark_mc_segred_stage_1_parloop_struct_131735.free_reduce_stage_1_tid_res_arr_mem_129599 =
        reduce_stage_1_tid_res_arr_mem_129599;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131736_task;
    
    futhark_mc_segred_stage_1_parloop_131736_task.name =
        "futhark_mc_segred_stage_1_parloop_131736";
    futhark_mc_segred_stage_1_parloop_131736_task.fn =
        futhark_mc_segred_stage_1_parloop_131736;
    futhark_mc_segred_stage_1_parloop_131736_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131735;
    futhark_mc_segred_stage_1_parloop_131736_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131736_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131736_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131736_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131736_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131736_task);
    
    if (futhark_mc_segred_stage_1_parloop_131736_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131736_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131736_total_end -
                 futhark_mc_segred_stage_1_parloop_131736_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131736_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131736_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131736_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_129461 = 0.0F;
    }
    
    float x_129603;
    float x_129604;
    
    for (int32_t i_129606 = 0; i_129606 < num_tasks_129598; i_129606++) {
        flat_tid_120207 = i_129606;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_129603 = defunc_2_reduce_res_129461;
            }
            // load next params
            {
                x_129604 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129599)[flat_tid_120207];
            }
            // red body
            {
                float defunc_1_op_res_129605 = x_129603 + x_129604;
                
                defunc_2_reduce_res_129461 = defunc_1_op_res_129605;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_129599);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131733_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131733_end -
                 futhark_mc_segred_task_131733_start;
        
        ctx->futhark_mc_segred_task_131733_runs[tid]++;
        ctx->futhark_mc_segred_task_131733_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131733_iter[tid] += iterations;
    }
    *futhark_mc_task_131732->retval_defunc_2_reduce_res_129461 =
        defunc_2_reduce_res_129461;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131725(void *args, int64_t start,
                                            int64_t end, int flat_tid_120203,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131724
    *futhark_mc_segmap_parloop_struct_131724 =
    (struct futhark_mc_segmap_parloop_struct_131724 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131724->ctx;
    uint64_t futhark_mc_segmap_parloop_131725_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131725_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131724->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131724->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131724->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131724->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131724->free_i_114610;
    int64_t gtid_120200 =
            futhark_mc_segmap_parloop_struct_131724->free_gtid_120200;
    int64_t x_120256 = futhark_mc_segmap_parloop_struct_131724->free_x_120256;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131724->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131724->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131724->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131724->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131724->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123108 =
            futhark_mc_segmap_parloop_struct_131724->free_bytes_123108;
    struct memblock mem_123128 = {.desc ="mem_123128", .mem =
                                  futhark_mc_segmap_parloop_struct_131724->free_mem_123128,
                                  .size =0, .references =NULL};
    size_t mem_129437_cached_sizze_131726 = 0;
    char *mem_129437 = NULL;
    int64_t iterations = end - start;
    int64_t iter_129556 = start;
    
    if (mem_129437_cached_sizze_131726 < (size_t) bytes_123108) {
        mem_129437 = realloc(mem_129437, bytes_123108);
        mem_129437_cached_sizze_131726 = bytes_123108;
    }
    for (; iter_129556 < end; iter_129556++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_129587 = t_n_m_114591;
        int64_t gtid_120204 = iter_129556;
        int64_t remnant_129588 = iter_129556 - gtid_120204;
        int64_t x_129432 = ((int64_t *) mem_122204.mem)[gtid_120200 *
                                                        t_n_m_114591 +
                                                        gtid_120204];
        float x_129433 = ((float *) mem_122208.mem)[gtid_120200 * t_n_m_114591 +
                                                    gtid_120204];
        int64_t min_arg_129434 = mul64(t_jump_114541, gtid_120204);
        int64_t min_res_129435 = smin64(i_114610, min_arg_129434);
        float defunc_0_f_res_129436 = sitofp_i64_f32(min_res_129435);
        float defunc_2_reduce_res_129438;
        int64_t flat_tid_120205 = (int64_t) 0;
        int32_t num_tasks_129589;
        struct futhark_mc_task_131727 futhark_mc_task_131727;
        
        futhark_mc_task_131727.ctx = ctx;
        futhark_mc_task_131727.free_n_114534 = n_114534;
        futhark_mc_task_131727.free_gtid_120200 = gtid_120200;
        futhark_mc_task_131727.free_x_120256 = x_120256;
        futhark_mc_task_131727.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131727.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131727.free_x_129432 = x_129432;
        futhark_mc_task_131727.free_x_129433 = x_129433;
        futhark_mc_task_131727.free_defunc_0_f_res_129436 =
            defunc_0_f_res_129436;
        futhark_mc_task_131727.retval_defunc_2_reduce_res_129438 =
            &defunc_2_reduce_res_129438;
        futhark_mc_task_131727.retval_mem_129437 = mem_129437;
        
        struct scheduler_segop futhark_mc_task_131727_task;
        
        futhark_mc_task_131727_task.args = &futhark_mc_task_131727;
        futhark_mc_task_131727_task.top_level_fn =
            futhark_mc_segred_task_131728;
        futhark_mc_task_131727_task.name = "futhark_mc_segred_task_131728";
        futhark_mc_task_131727_task.iterations = t_window_114537;
        futhark_mc_task_131727_task.task_time =
            &ctx->futhark_mc_segred_task_131728_total_time;
        futhark_mc_task_131727_task.task_iter =
            &ctx->futhark_mc_segred_task_131728_total_iter;
        futhark_mc_task_131727_task.sched = STATIC;
        futhark_mc_task_131727_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131728_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131727_task);
        
        if (futhark_mc_segred_task_131728_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float a0_129460 = 1.0F / defunc_2_reduce_res_129438;
        float defunc_2_reduce_res_129461;
        int64_t flat_tid_120207 = (int64_t) 0;
        int32_t num_tasks_129598;
        struct futhark_mc_task_131732 futhark_mc_task_131732;
        
        futhark_mc_task_131732.ctx = ctx;
        futhark_mc_task_131732.free_n_114534 = n_114534;
        futhark_mc_task_131732.free_gtid_120200 = gtid_120200;
        futhark_mc_task_131732.free_x_120256 = x_120256;
        futhark_mc_task_131732.free_mem_122985 = mem_122985.mem;
        futhark_mc_task_131732.free_x_129432 = x_129432;
        futhark_mc_task_131732.free_mem_129437 = mem_129437;
        futhark_mc_task_131732.free_a0_129460 = a0_129460;
        futhark_mc_task_131732.retval_defunc_2_reduce_res_129461 =
            &defunc_2_reduce_res_129461;
        
        struct scheduler_segop futhark_mc_task_131732_task;
        
        futhark_mc_task_131732_task.args = &futhark_mc_task_131732;
        futhark_mc_task_131732_task.top_level_fn =
            futhark_mc_segred_task_131733;
        futhark_mc_task_131732_task.name = "futhark_mc_segred_task_131733";
        futhark_mc_task_131732_task.iterations = t_window_114537;
        futhark_mc_task_131732_task.task_time =
            &ctx->futhark_mc_segred_task_131733_total_time;
        futhark_mc_task_131732_task.task_iter =
            &ctx->futhark_mc_segred_task_131733_total_iter;
        futhark_mc_task_131732_task.sched = STATIC;
        futhark_mc_task_131732_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131733_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131732_task);
        
        if (futhark_mc_segred_task_131733_err != 0) {
            err = 1;
            goto cleanup;
        }
        ((float *) mem_123128.mem)[gtid_120204] = defunc_2_reduce_res_129461;
    }
    
  cleanup:
    { }
    free(mem_129437);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131725_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131725_end -
                 futhark_mc_segmap_parloop_131725_start;
        
        ctx->futhark_mc_segmap_parloop_131725_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131725_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131725_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131723(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120203 = tid;
    int num_tasks_129517 = info.nsubtasks;
    struct futhark_mc_task_131718 *futhark_mc_task_131718 =
                                  (struct futhark_mc_task_131718 *) args;
    struct futhark_context *ctx = futhark_mc_task_131718->ctx;
    uint64_t futhark_mc_segmap_nested_task_131723_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131723_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131718->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131718->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131718->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131718->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131718->free_i_114610;
    int64_t gtid_120200 = futhark_mc_task_131718->free_gtid_120200;
    int64_t x_120256 = futhark_mc_task_131718->free_x_120256;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131718->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131718->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131718->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131718->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131718->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123108 = futhark_mc_task_131718->free_bytes_123108;
    struct memblock mem_123128 = {.desc ="mem_123128", .mem =
                                  futhark_mc_task_131718->free_mem_123128,
                                  .size =0, .references =NULL};
    int64_t iter_129556;
    struct futhark_mc_segmap_parloop_struct_131724
    futhark_mc_segmap_parloop_struct_131724;
    
    futhark_mc_segmap_parloop_struct_131724.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131724.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131724.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131724.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131724.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131724.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131724.free_gtid_120200 = gtid_120200;
    futhark_mc_segmap_parloop_struct_131724.free_x_120256 = x_120256;
    futhark_mc_segmap_parloop_struct_131724.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131724.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131724.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131724.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131724.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131724.free_bytes_123108 = bytes_123108;
    futhark_mc_segmap_parloop_struct_131724.free_mem_123128 = mem_123128.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131725_task;
    
    futhark_mc_segmap_parloop_131725_task.name =
        "futhark_mc_segmap_parloop_131725";
    futhark_mc_segmap_parloop_131725_task.fn = futhark_mc_segmap_parloop_131725;
    futhark_mc_segmap_parloop_131725_task.args =
        &futhark_mc_segmap_parloop_struct_131724;
    futhark_mc_segmap_parloop_131725_task.iterations = iterations;
    futhark_mc_segmap_parloop_131725_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131725_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131725_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131725_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131725_task);
    
    if (futhark_mc_segmap_parloop_131725_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131725_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131725_total_end -
                 futhark_mc_segmap_parloop_131725_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131725_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131725_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131725_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131723_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131723_end -
                 futhark_mc_segmap_nested_task_131723_start;
        
        ctx->futhark_mc_segmap_nested_task_131723_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131723_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131723_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131716(void *args, int64_t start,
                                            int64_t end, int flat_tid_120199,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131715
    *futhark_mc_segmap_parloop_struct_131715 =
    (struct futhark_mc_segmap_parloop_struct_131715 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131715->ctx;
    uint64_t futhark_mc_segmap_parloop_131716_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131716_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131715->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131715->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131715->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131715->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131715->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131715->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131715->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131715->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131715->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131715->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131715->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131715->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131715->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123108 =
            futhark_mc_segmap_parloop_struct_131715->free_bytes_123108;
    struct memblock mem_123162 = {.desc ="mem_123162", .mem =
                                  futhark_mc_segmap_parloop_struct_131715->free_mem_123162,
                                  .size =0, .references =NULL};
    size_t mem_123128_cached_sizze_131717 = 0;
    char *mem_123128 = NULL;
    int64_t iterations = end - start;
    int64_t iter_129431 = start;
    
    if (mem_123128_cached_sizze_131717 < (size_t) bytes_122135) {
        mem_123128 = realloc(mem_123128, bytes_122135);
        mem_123128_cached_sizze_131717 = bytes_122135;
    }
    for (; iter_129431 < end; iter_129431++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_129515 = m_114533;
        int64_t gtid_120200 = iter_129431;
        int64_t remnant_129516 = iter_129431 - gtid_120200;
        int64_t x_120256 = ((int64_t *) mem_121982.mem)[gtid_120200];
        int64_t flat_tid_120201 = (int64_t) 0;
        int32_t num_tasks_129517;
        int64_t flat_tid_120203 = (int64_t) 0;
        struct futhark_mc_task_131718 futhark_mc_task_131718;
        
        futhark_mc_task_131718.ctx = ctx;
        futhark_mc_task_131718.free_n_114534 = n_114534;
        futhark_mc_task_131718.free_t_window_114537 = t_window_114537;
        futhark_mc_task_131718.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131718.free_t_n_m_114591 = t_n_m_114591;
        futhark_mc_task_131718.free_i_114610 = i_114610;
        futhark_mc_task_131718.free_gtid_120200 = gtid_120200;
        futhark_mc_task_131718.free_x_120256 = x_120256;
        futhark_mc_task_131718.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131718.free_mem_122204 = mem_122204.mem;
        futhark_mc_task_131718.free_mem_122208 = mem_122208.mem;
        futhark_mc_task_131718.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131718.free_mem_122985 = mem_122985.mem;
        futhark_mc_task_131718.free_bytes_123108 = bytes_123108;
        futhark_mc_task_131718.free_mem_123128 = mem_123128;
        
        struct scheduler_segop futhark_mc_task_131718_task;
        
        futhark_mc_task_131718_task.args = &futhark_mc_task_131718;
        futhark_mc_task_131718_task.top_level_fn =
            futhark_mc_segmap_task_131719;
        futhark_mc_task_131718_task.name = "futhark_mc_segmap_task_131719";
        futhark_mc_task_131718_task.iterations = t_n_m_114591;
        futhark_mc_task_131718_task.task_time =
            &ctx->futhark_mc_segmap_task_131719_total_time;
        futhark_mc_task_131718_task.task_iter =
            &ctx->futhark_mc_segmap_task_131719_total_iter;
        futhark_mc_task_131718_task.sched = STATIC;
        futhark_mc_task_131718_task.nested_fn =
            futhark_mc_segmap_nested_task_131723;
        
        int futhark_mc_segmap_task_131719_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131718_task);
        
        if (futhark_mc_segmap_task_131719_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_123162.mem + gtid_120200 * t_n_m_114591 * (int64_t) 4,
                mem_123128 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123128);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131716_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131716_end -
                 futhark_mc_segmap_parloop_131716_start;
        
        ctx->futhark_mc_segmap_parloop_131716_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131716_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131716_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131714(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120199 = tid;
    int num_tasks_129378 = info.nsubtasks;
    struct futhark_mc_task_131708 *futhark_mc_task_131708 =
                                  (struct futhark_mc_task_131708 *) args;
    struct futhark_context *ctx = futhark_mc_task_131708->ctx;
    uint64_t futhark_mc_segmap_nested_task_131714_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131714_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131708->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131708->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131708->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131708->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131708->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131708->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131708->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131708->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131708->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131708->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131708->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131708->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131708->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123108 = futhark_mc_task_131708->free_bytes_123108;
    struct memblock mem_123162 = {.desc ="mem_123162", .mem =
                                  futhark_mc_task_131708->free_mem_123162,
                                  .size =0, .references =NULL};
    int64_t iter_129431;
    struct futhark_mc_segmap_parloop_struct_131715
    futhark_mc_segmap_parloop_struct_131715;
    
    futhark_mc_segmap_parloop_struct_131715.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131715.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131715.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131715.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131715.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131715.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131715.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131715.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131715.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131715.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131715.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131715.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131715.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131715.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131715.free_bytes_123108 = bytes_123108;
    futhark_mc_segmap_parloop_struct_131715.free_mem_123162 = mem_123162.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131716_task;
    
    futhark_mc_segmap_parloop_131716_task.name =
        "futhark_mc_segmap_parloop_131716";
    futhark_mc_segmap_parloop_131716_task.fn = futhark_mc_segmap_parloop_131716;
    futhark_mc_segmap_parloop_131716_task.args =
        &futhark_mc_segmap_parloop_struct_131715;
    futhark_mc_segmap_parloop_131716_task.iterations = iterations;
    futhark_mc_segmap_parloop_131716_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131716_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131716_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131716_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131716_task);
    
    if (futhark_mc_segmap_parloop_131716_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131716_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131716_total_end -
                 futhark_mc_segmap_parloop_131716_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131716_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131716_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131716_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131714_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131714_end -
                 futhark_mc_segmap_nested_task_131714_start;
        
        ctx->futhark_mc_segmap_nested_task_131714_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131714_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131714_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131737 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123163;
    char *free_mem_123268;
    char *free_mem_123272;
};
struct futhark_mc_segmap_parloop_struct_131739 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123163;
    char *free_mem_123268;
    char *free_mem_123272;
};
static int futhark_mc_segmap_parloop_131740(void *args, int64_t start,
                                            int64_t end, int flat_tid_120342,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131739
    *futhark_mc_segmap_parloop_struct_131739 =
    (struct futhark_mc_segmap_parloop_struct_131739 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131739->ctx;
    uint64_t futhark_mc_segmap_parloop_131740_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131740_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131739->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131739->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131739->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131739->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131739->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131739->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131739->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131739->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131739->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131739->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131739->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131739->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131739->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123163 =
            futhark_mc_segmap_parloop_struct_131739->free_bytes_123163;
    struct memblock mem_123268 = {.desc ="mem_123268", .mem =
                                  futhark_mc_segmap_parloop_struct_131739->free_mem_123268,
                                  .size =0, .references =NULL};
    struct memblock mem_123272 = {.desc ="mem_123272", .mem =
                                  futhark_mc_segmap_parloop_struct_131739->free_mem_123272,
                                  .size =0, .references =NULL};
    size_t mem_123207_cached_sizze_131741 = 0;
    char *mem_123207 = NULL;
    size_t mem_123210_cached_sizze_131742 = 0;
    char *mem_123210 = NULL;
    size_t mem_123227_cached_sizze_131743 = 0;
    char *mem_123227 = NULL;
    size_t mem_123230_cached_sizze_131744 = 0;
    char *mem_123230 = NULL;
    int64_t iterations = end - start;
    int64_t iter_129608 = start;
    
    if (mem_123207_cached_sizze_131741 < (size_t) bytes_122135) {
        mem_123207 = realloc(mem_123207, bytes_122135);
        mem_123207_cached_sizze_131741 = bytes_122135;
    }
    if (mem_123210_cached_sizze_131742 < (size_t) bytes_122135) {
        mem_123210 = realloc(mem_123210, bytes_122135);
        mem_123210_cached_sizze_131742 = bytes_122135;
    }
    if (mem_123227_cached_sizze_131743 < (size_t) bytes_123163) {
        mem_123227 = realloc(mem_123227, bytes_123163);
        mem_123227_cached_sizze_131743 = bytes_123163;
    }
    if (mem_123230_cached_sizze_131744 < (size_t) bytes_123163) {
        mem_123230 = realloc(mem_123230, bytes_123163);
        mem_123230_cached_sizze_131744 = bytes_123163;
    }
    for (; iter_129608 < end; iter_129608++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_129685 = m_114533;
        int64_t gtid_120343 = iter_129608;
        int64_t remnant_129686 = iter_129608 - gtid_120343;
        int64_t x_116246 = ((int64_t *) mem_121982.mem)[gtid_120343];
        
        for (int64_t i_129609 = 0; i_129609 < t_n_m_114591; i_129609++) {
            int64_t x_129612 = ((int64_t *) mem_122204.mem)[gtid_120343 *
                                                            t_n_m_114591 +
                                                            i_129609];
            float x_129613 = ((float *) mem_122208.mem)[gtid_120343 *
                                                        t_n_m_114591 +
                                                        i_129609];
            int64_t min_arg_129614 = mul64(t_jump_114541, i_129609);
            int64_t min_res_129615 = smin64(i_114610, min_arg_129614);
            float defunc_0_f_res_129616 = sitofp_i64_f32(min_res_129615);
            float defunc_2_reduce_res_129619;
            float defunc_2_reduce_res_129620;
            float defunc_2_reduce_res_129621;
            float redout_129625;
            float redout_129626;
            float redout_129627;
            
            redout_129625 = 0.0F;
            redout_129626 = 0.0F;
            redout_129627 = 0.0F;
            for (int64_t i_129624 = 0; i_129624 < t_window_114537; i_129624++) {
                bool cond_129630 = sle64(x_116246, i_129624);
                float defunc_0_f_res_129631;
                
                if (cond_129630) {
                    defunc_0_f_res_129631 = 0.0F;
                } else {
                    int64_t i_129632 = add64(x_129612, i_129624);
                    float x_129633 = ((float *) mem_122004.mem)[gtid_120343 *
                                                                n_114534 +
                                                                i_129632];
                    float defunc_0_f_res_f_res_129634 = 1.0F + x_129633;
                    
                    defunc_0_f_res_129631 = defunc_0_f_res_f_res_129634;
                }
                
                float defunc_0_f_res_129635;
                
                if (cond_129630) {
                    defunc_0_f_res_129635 = 0.0F;
                } else {
                    int64_t i_129636 = add64(x_129612, i_129624);
                    float x_129637 = ((float *) mem_122430.mem)[gtid_120343 *
                                                                n_114534 +
                                                                i_129636];
                    
                    defunc_0_f_res_129635 = x_129637;
                }
                
                float x_j_129638 = defunc_0_f_res_129631 -
                      defunc_0_f_res_129616;
                float abs_res_129639 = (float) fabs(x_j_129638);
                float tmp1_129640 = abs_res_129639 / x_129613;
                float x_129641 = tmp1_129640 * tmp1_129640;
                float y_129642 = tmp1_129640 * x_129641;
                float tmp2_129643 = 1.0F - y_129642;
                float x_129644 = tmp2_129643 * tmp2_129643;
                float tmp3_129645 = tmp2_129643 * x_129644;
                float tmp4_129646 = defunc_0_f_res_129635 * tmp3_129645;
                float defunc_1_f_res_129647 = x_j_129638 * tmp4_129646;
                float defunc_1_f_res_129648 = x_j_129638 *
                      defunc_1_f_res_129647;
                float defunc_1_op_res_129649 = tmp4_129646 + redout_129625;
                float defunc_1_op_res_129650 = defunc_1_f_res_129647 +
                      redout_129626;
                float defunc_1_op_res_129651 = defunc_1_f_res_129648 +
                      redout_129627;
                
                ((float *) mem_123227)[i_129624] = defunc_1_f_res_129647;
                ((float *) mem_123230)[i_129624] = tmp4_129646;
                
                float redout_tmp_129689 = defunc_1_op_res_129649;
                float redout_tmp_129690 = defunc_1_op_res_129650;
                float redout_tmp_129691 = defunc_1_op_res_129651;
                
                redout_129625 = redout_tmp_129689;
                redout_129626 = redout_tmp_129690;
                redout_129627 = redout_tmp_129691;
            }
            defunc_2_reduce_res_129619 = redout_129625;
            defunc_2_reduce_res_129620 = redout_129626;
            defunc_2_reduce_res_129621 = redout_129627;
            
            float x_129654 = defunc_2_reduce_res_129619 *
                  defunc_2_reduce_res_129621;
            float y_129655 = defunc_2_reduce_res_129620 *
                  defunc_2_reduce_res_129620;
            float y_129656 = x_129654 - y_129655;
            float det1_129657 = 1.0F / y_129656;
            float a11_129658 = defunc_2_reduce_res_129621 * det1_129657;
            float negate_arg_129659 = defunc_2_reduce_res_129620 * det1_129657;
            float b11_129660 = 0.0F - negate_arg_129659;
            float c11_129661 = defunc_2_reduce_res_129619 * det1_129657;
            float defunc_2_reduce_res_129662;
            float defunc_2_reduce_res_129663;
            float redout_129665;
            float redout_129666;
            
            redout_129665 = 0.0F;
            redout_129666 = 0.0F;
            for (int64_t i_129664 = 0; i_129664 < t_window_114537; i_129664++) {
                float x_129667 = ((float *) mem_123230)[i_129664];
                float x_129668 = ((float *) mem_123227)[i_129664];
                bool cond_129669 = sle64(x_116246, i_129664);
                float defunc_0_f_res_129670;
                
                if (cond_129669) {
                    defunc_0_f_res_129670 = 0.0F;
                } else {
                    int64_t i_129671 = add64(x_129612, i_129664);
                    float x_129672 = ((float *) mem_122985.mem)[gtid_120343 *
                                                                n_114534 +
                                                                i_129671];
                    
                    defunc_0_f_res_129670 = x_129672;
                }
                
                float x_129673 = a11_129658 * x_129667;
                float y_129674 = b11_129660 * x_129668;
                float x_129675 = x_129673 + y_129674;
                float defunc_9_fit_fun_res_129676 = defunc_0_f_res_129670 *
                      x_129675;
                float x_129677 = b11_129660 * x_129667;
                float y_129678 = c11_129661 * x_129668;
                float x_129679 = x_129677 + y_129678;
                float defunc_9_slope_fun_res_129680 = defunc_0_f_res_129670 *
                      x_129679;
                float defunc_1_op_res_129681 = defunc_9_fit_fun_res_129676 +
                      redout_129665;
                float defunc_1_op_res_129682 = defunc_9_slope_fun_res_129680 +
                      redout_129666;
                float redout_tmp_129694 = defunc_1_op_res_129681;
                float redout_tmp_129695 = defunc_1_op_res_129682;
                
                redout_129665 = redout_tmp_129694;
                redout_129666 = redout_tmp_129695;
            }
            defunc_2_reduce_res_129662 = redout_129665;
            defunc_2_reduce_res_129663 = redout_129666;
            ((float *) mem_123207)[i_129609] = defunc_2_reduce_res_129662;
            ((float *) mem_123210)[i_129609] = defunc_2_reduce_res_129663;
        }
        memmove(mem_123268.mem + gtid_120343 * t_n_m_114591 * (int64_t) 4,
                mem_123207 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
        memmove(mem_123272.mem + gtid_120343 * t_n_m_114591 * (int64_t) 4,
                mem_123210 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123207);
    free(mem_123210);
    free(mem_123227);
    free(mem_123230);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131740_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131740_end -
                 futhark_mc_segmap_parloop_131740_start;
        
        ctx->futhark_mc_segmap_parloop_131740_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131740_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131740_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131738(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120342 = tid;
    int num_tasks_129607 = info.nsubtasks;
    struct futhark_mc_task_131737 *futhark_mc_task_131737 =
                                  (struct futhark_mc_task_131737 *) args;
    struct futhark_context *ctx = futhark_mc_task_131737->ctx;
    uint64_t futhark_mc_segmap_task_131738_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131738_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131737->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131737->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131737->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131737->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131737->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131737->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131737->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131737->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131737->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131737->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131737->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131737->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131737->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123163 = futhark_mc_task_131737->free_bytes_123163;
    struct memblock mem_123268 = {.desc ="mem_123268", .mem =
                                  futhark_mc_task_131737->free_mem_123268,
                                  .size =0, .references =NULL};
    struct memblock mem_123272 = {.desc ="mem_123272", .mem =
                                  futhark_mc_task_131737->free_mem_123272,
                                  .size =0, .references =NULL};
    int64_t iter_129608;
    struct futhark_mc_segmap_parloop_struct_131739
    futhark_mc_segmap_parloop_struct_131739;
    
    futhark_mc_segmap_parloop_struct_131739.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131739.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131739.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131739.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131739.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131739.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131739.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131739.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131739.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131739.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131739.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131739.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131739.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131739.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131739.free_bytes_123163 = bytes_123163;
    futhark_mc_segmap_parloop_struct_131739.free_mem_123268 = mem_123268.mem;
    futhark_mc_segmap_parloop_struct_131739.free_mem_123272 = mem_123272.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131740_task;
    
    futhark_mc_segmap_parloop_131740_task.name =
        "futhark_mc_segmap_parloop_131740";
    futhark_mc_segmap_parloop_131740_task.fn = futhark_mc_segmap_parloop_131740;
    futhark_mc_segmap_parloop_131740_task.args =
        &futhark_mc_segmap_parloop_struct_131739;
    futhark_mc_segmap_parloop_131740_task.iterations = iterations;
    futhark_mc_segmap_parloop_131740_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131740_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131740_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131740_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131740_task);
    
    if (futhark_mc_segmap_parloop_131740_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131740_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131740_total_end -
                 futhark_mc_segmap_parloop_131740_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131740_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131740_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131740_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131738_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131738_end -
                 futhark_mc_segmap_task_131738_start;
        
        ctx->futhark_mc_segmap_task_131738_runs[tid]++;
        ctx->futhark_mc_segmap_task_131738_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131738_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131746 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123163;
    char *free_mem_123268;
    char *free_mem_123272;
};
struct futhark_mc_task_131750 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_120345;
    int64_t free_x_120430;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123163;
    char *free_mem_123201;
    char *free_mem_123204;
};
struct futhark_mc_segmap_parloop_struct_131752 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_120345;
    int64_t free_x_120430;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123163;
    char *free_mem_123201;
    char *free_mem_123204;
};
static int futhark_mc_segmap_parloop_131753(void *args, int64_t start,
                                            int64_t end, int flat_tid_120346,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131752
    *futhark_mc_segmap_parloop_struct_131752 =
    (struct futhark_mc_segmap_parloop_struct_131752 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131752->ctx;
    uint64_t futhark_mc_segmap_parloop_131753_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131753_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131752->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131752->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131752->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131752->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131752->free_i_114610;
    int64_t gtid_120345 =
            futhark_mc_segmap_parloop_struct_131752->free_gtid_120345;
    int64_t x_120430 = futhark_mc_segmap_parloop_struct_131752->free_x_120430;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131752->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131752->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131752->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131752->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131752->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123163 =
            futhark_mc_segmap_parloop_struct_131752->free_bytes_123163;
    struct memblock mem_123201 = {.desc ="mem_123201", .mem =
                                  futhark_mc_segmap_parloop_struct_131752->free_mem_123201,
                                  .size =0, .references =NULL};
    struct memblock mem_123204 = {.desc ="mem_123204", .mem =
                                  futhark_mc_segmap_parloop_struct_131752->free_mem_123204,
                                  .size =0, .references =NULL};
    size_t mem_129772_cached_sizze_131754 = 0;
    char *mem_129772 = NULL;
    size_t mem_129774_cached_sizze_131755 = 0;
    char *mem_129774 = NULL;
    int64_t iterations = end - start;
    int64_t iter_129843 = start;
    
    if (mem_129772_cached_sizze_131754 < (size_t) bytes_123163) {
        mem_129772 = realloc(mem_129772, bytes_123163);
        mem_129772_cached_sizze_131754 = bytes_123163;
    }
    if (mem_129774_cached_sizze_131755 < (size_t) bytes_123163) {
        mem_129774 = realloc(mem_129774, bytes_123163);
        mem_129774_cached_sizze_131755 = bytes_123163;
    }
    for (; iter_129843 < end; iter_129843++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_129893 = t_n_m_114591;
        int64_t gtid_120347 = iter_129843;
        int64_t remnant_129894 = iter_129843 - gtid_120347;
        int64_t x_129767 = ((int64_t *) mem_122204.mem)[gtid_120345 *
                                                        t_n_m_114591 +
                                                        gtid_120347];
        float x_129768 = ((float *) mem_122208.mem)[gtid_120345 * t_n_m_114591 +
                                                    gtid_120347];
        int64_t min_arg_129769 = mul64(t_jump_114541, gtid_120347);
        int64_t min_res_129770 = smin64(i_114610, min_arg_129769);
        float defunc_0_f_res_129771 = sitofp_i64_f32(min_res_129770);
        float defunc_2_reduce_res_129776;
        float defunc_2_reduce_res_129777;
        float defunc_2_reduce_res_129778;
        float redout_129845;
        float redout_129846;
        float redout_129847;
        
        redout_129845 = 0.0F;
        redout_129846 = 0.0F;
        redout_129847 = 0.0F;
        for (int64_t i_129844 = 0; i_129844 < t_window_114537; i_129844++) {
            bool cond_129850 = sle64(x_120430, i_129844);
            float defunc_0_f_res_129851;
            
            if (cond_129850) {
                defunc_0_f_res_129851 = 0.0F;
            } else {
                int64_t i_129852 = add64(x_129767, i_129844);
                float x_129853 = ((float *) mem_122004.mem)[gtid_120345 *
                                                            n_114534 +
                                                            i_129852];
                float defunc_0_f_res_f_res_129854 = 1.0F + x_129853;
                
                defunc_0_f_res_129851 = defunc_0_f_res_f_res_129854;
            }
            
            float defunc_0_f_res_129855;
            
            if (cond_129850) {
                defunc_0_f_res_129855 = 0.0F;
            } else {
                int64_t i_129856 = add64(x_129767, i_129844);
                float x_129857 = ((float *) mem_122430.mem)[gtid_120345 *
                                                            n_114534 +
                                                            i_129856];
                
                defunc_0_f_res_129855 = x_129857;
            }
            
            float x_j_129858 = defunc_0_f_res_129851 - defunc_0_f_res_129771;
            float abs_res_129859 = (float) fabs(x_j_129858);
            float tmp1_129860 = abs_res_129859 / x_129768;
            float x_129861 = tmp1_129860 * tmp1_129860;
            float y_129862 = tmp1_129860 * x_129861;
            float tmp2_129863 = 1.0F - y_129862;
            float x_129864 = tmp2_129863 * tmp2_129863;
            float tmp3_129865 = tmp2_129863 * x_129864;
            float tmp4_129866 = defunc_0_f_res_129855 * tmp3_129865;
            float defunc_1_f_res_129867 = x_j_129858 * tmp4_129866;
            float defunc_1_f_res_129868 = x_j_129858 * defunc_1_f_res_129867;
            float defunc_1_op_res_129869 = tmp4_129866 + redout_129845;
            float defunc_1_op_res_129870 = defunc_1_f_res_129867 +
                  redout_129846;
            float defunc_1_op_res_129871 = defunc_1_f_res_129868 +
                  redout_129847;
            
            ((float *) mem_129772)[i_129844] = defunc_1_f_res_129867;
            ((float *) mem_129774)[i_129844] = tmp4_129866;
            
            float redout_tmp_129895 = defunc_1_op_res_129869;
            float redout_tmp_129896 = defunc_1_op_res_129870;
            float redout_tmp_129897 = defunc_1_op_res_129871;
            
            redout_129845 = redout_tmp_129895;
            redout_129846 = redout_tmp_129896;
            redout_129847 = redout_tmp_129897;
        }
        defunc_2_reduce_res_129776 = redout_129845;
        defunc_2_reduce_res_129777 = redout_129846;
        defunc_2_reduce_res_129778 = redout_129847;
        
        float x_129811 = defunc_2_reduce_res_129776 *
              defunc_2_reduce_res_129778;
        float y_129812 = defunc_2_reduce_res_129777 *
              defunc_2_reduce_res_129777;
        float y_129813 = x_129811 - y_129812;
        float det1_129814 = 1.0F / y_129813;
        float a11_129815 = defunc_2_reduce_res_129778 * det1_129814;
        float negate_arg_129816 = defunc_2_reduce_res_129777 * det1_129814;
        float b11_129817 = 0.0F - negate_arg_129816;
        float c11_129818 = defunc_2_reduce_res_129776 * det1_129814;
        float defunc_2_reduce_res_129819;
        float defunc_2_reduce_res_129820;
        float redout_129875;
        float redout_129876;
        
        redout_129875 = 0.0F;
        redout_129876 = 0.0F;
        for (int64_t i_129874 = 0; i_129874 < t_window_114537; i_129874++) {
            float x_129877 = ((float *) mem_129774)[i_129874];
            float x_129878 = ((float *) mem_129772)[i_129874];
            bool cond_129879 = sle64(x_120430, i_129874);
            float defunc_0_f_res_129880;
            
            if (cond_129879) {
                defunc_0_f_res_129880 = 0.0F;
            } else {
                int64_t i_129881 = add64(x_129767, i_129874);
                float x_129882 = ((float *) mem_122985.mem)[gtid_120345 *
                                                            n_114534 +
                                                            i_129881];
                
                defunc_0_f_res_129880 = x_129882;
            }
            
            float x_129883 = a11_129815 * x_129877;
            float y_129884 = b11_129817 * x_129878;
            float x_129885 = x_129883 + y_129884;
            float defunc_9_fit_fun_res_129886 = defunc_0_f_res_129880 *
                  x_129885;
            float x_129887 = b11_129817 * x_129877;
            float y_129888 = c11_129818 * x_129878;
            float x_129889 = x_129887 + y_129888;
            float defunc_9_slope_fun_res_129890 = defunc_0_f_res_129880 *
                  x_129889;
            float defunc_1_op_res_129891 = defunc_9_fit_fun_res_129886 +
                  redout_129875;
            float defunc_1_op_res_129892 = defunc_9_slope_fun_res_129890 +
                  redout_129876;
            float redout_tmp_129900 = defunc_1_op_res_129891;
            float redout_tmp_129901 = defunc_1_op_res_129892;
            
            redout_129875 = redout_tmp_129900;
            redout_129876 = redout_tmp_129901;
        }
        defunc_2_reduce_res_129819 = redout_129875;
        defunc_2_reduce_res_129820 = redout_129876;
        ((float *) mem_123201.mem)[gtid_120347] = defunc_2_reduce_res_129819;
        ((float *) mem_123204.mem)[gtid_120347] = defunc_2_reduce_res_129820;
    }
    
  cleanup:
    { }
    free(mem_129772);
    free(mem_129774);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131753_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131753_end -
                 futhark_mc_segmap_parloop_131753_start;
        
        ctx->futhark_mc_segmap_parloop_131753_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131753_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131753_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131751(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120346 = tid;
    int num_tasks_129842 = info.nsubtasks;
    struct futhark_mc_task_131750 *futhark_mc_task_131750 =
                                  (struct futhark_mc_task_131750 *) args;
    struct futhark_context *ctx = futhark_mc_task_131750->ctx;
    uint64_t futhark_mc_segmap_task_131751_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131751_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131750->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131750->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131750->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131750->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131750->free_i_114610;
    int64_t gtid_120345 = futhark_mc_task_131750->free_gtid_120345;
    int64_t x_120430 = futhark_mc_task_131750->free_x_120430;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131750->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131750->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131750->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131750->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131750->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123163 = futhark_mc_task_131750->free_bytes_123163;
    struct memblock mem_123201 = {.desc ="mem_123201", .mem =
                                  futhark_mc_task_131750->free_mem_123201,
                                  .size =0, .references =NULL};
    struct memblock mem_123204 = {.desc ="mem_123204", .mem =
                                  futhark_mc_task_131750->free_mem_123204,
                                  .size =0, .references =NULL};
    int64_t iter_129843;
    struct futhark_mc_segmap_parloop_struct_131752
    futhark_mc_segmap_parloop_struct_131752;
    
    futhark_mc_segmap_parloop_struct_131752.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131752.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131752.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131752.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131752.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131752.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131752.free_gtid_120345 = gtid_120345;
    futhark_mc_segmap_parloop_struct_131752.free_x_120430 = x_120430;
    futhark_mc_segmap_parloop_struct_131752.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131752.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131752.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131752.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131752.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131752.free_bytes_123163 = bytes_123163;
    futhark_mc_segmap_parloop_struct_131752.free_mem_123201 = mem_123201.mem;
    futhark_mc_segmap_parloop_struct_131752.free_mem_123204 = mem_123204.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131753_task;
    
    futhark_mc_segmap_parloop_131753_task.name =
        "futhark_mc_segmap_parloop_131753";
    futhark_mc_segmap_parloop_131753_task.fn = futhark_mc_segmap_parloop_131753;
    futhark_mc_segmap_parloop_131753_task.args =
        &futhark_mc_segmap_parloop_struct_131752;
    futhark_mc_segmap_parloop_131753_task.iterations = iterations;
    futhark_mc_segmap_parloop_131753_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131753_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131753_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131753_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131753_task);
    
    if (futhark_mc_segmap_parloop_131753_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131753_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131753_total_end -
                 futhark_mc_segmap_parloop_131753_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131753_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131753_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131753_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131751_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131751_end -
                 futhark_mc_segmap_task_131751_start;
        
        ctx->futhark_mc_segmap_task_131751_runs[tid]++;
        ctx->futhark_mc_segmap_task_131751_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131751_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131757 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_120345;
    int64_t free_x_120430;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123163;
    char *free_mem_123201;
    char *free_mem_123204;
};
struct futhark_mc_task_131761 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120345;
    int64_t free_x_120430;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_129697;
    float free_x_129698;
    float free_defunc_0_f_res_129701;
    float *retval_defunc_2_reduce_res_129704;
    float *retval_defunc_2_reduce_res_129705;
    float *retval_defunc_2_reduce_res_129706;
    char *retval_mem_129702;
    char *retval_mem_129703;
};
struct futhark_mc_segred_stage_1_parloop_struct_131766 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120345;
    int64_t free_x_120430;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_129697;
    float free_x_129698;
    float free_defunc_0_f_res_129701;
    char *free_mem_129702;
    char *free_mem_129703;
    char *free_reduce_stage_1_tid_res_arr_mem_129954;
    char *free_reduce_stage_1_tid_res_arr_mem_129956;
    char *free_reduce_stage_1_tid_res_arr_mem_129958;
};
static int futhark_mc_segred_stage_1_parloop_131767(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_120350,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131766
    *futhark_mc_segred_stage_1_parloop_struct_131766 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131766 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131766->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131767_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131767_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131766->free_n_114534;
    int64_t gtid_120345 =
            futhark_mc_segred_stage_1_parloop_struct_131766->free_gtid_120345;
    int64_t x_120430 =
            futhark_mc_segred_stage_1_parloop_struct_131766->free_x_120430;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131766->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131766->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_129697 =
            futhark_mc_segred_stage_1_parloop_struct_131766->free_x_129697;
    float x_129698 =
          futhark_mc_segred_stage_1_parloop_struct_131766->free_x_129698;
    float defunc_0_f_res_129701 =
          futhark_mc_segred_stage_1_parloop_struct_131766->free_defunc_0_f_res_129701;
    struct memblock mem_129702 = {.desc ="mem_129702", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131766->free_mem_129702,
                                  .size =0, .references =NULL};
    struct memblock mem_129703 = {.desc ="mem_129703", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131766->free_mem_129703,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_129954 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129954",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131766->free_reduce_stage_1_tid_res_arr_mem_129954,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_129956 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129956",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131766->free_reduce_stage_1_tid_res_arr_mem_129956,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_129958 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129958",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131766->free_reduce_stage_1_tid_res_arr_mem_129958,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_129960 = start;
    float x_129903;
    float x_129904;
    float x_129906;
    float x_129907;
    float x_129909;
    float x_129910;
    float local_acc_129961 = 0.0F;
    float local_acc_129962 = 0.0F;
    float local_acc_129963 = 0.0F;
    
    for (; iter_129960 < end; iter_129960++) {
        int64_t gtid_120351 = iter_129960;
        bool cond_129912 = sle64(x_120430, gtid_120351);
        float defunc_0_f_res_129913;
        
        if (cond_129912) {
            defunc_0_f_res_129913 = 0.0F;
        } else {
            int64_t i_129914 = add64(gtid_120351, x_129697);
            float x_129915 = ((float *) mem_122004.mem)[gtid_120345 * n_114534 +
                                                        i_129914];
            float defunc_0_f_res_f_res_129916 = 1.0F + x_129915;
            
            defunc_0_f_res_129913 = defunc_0_f_res_f_res_129916;
        }
        
        float defunc_0_f_res_129917;
        
        if (cond_129912) {
            defunc_0_f_res_129917 = 0.0F;
        } else {
            int64_t i_129918 = add64(gtid_120351, x_129697);
            float x_129919 = ((float *) mem_122430.mem)[gtid_120345 * n_114534 +
                                                        i_129918];
            
            defunc_0_f_res_129917 = x_129919;
        }
        
        float x_j_129920 = defunc_0_f_res_129913 - defunc_0_f_res_129701;
        float abs_res_129921 = (float) fabs(x_j_129920);
        float tmp1_129922 = abs_res_129921 / x_129698;
        float x_129923 = tmp1_129922 * tmp1_129922;
        float y_129924 = tmp1_129922 * x_129923;
        float tmp2_129925 = 1.0F - y_129924;
        float x_129926 = tmp2_129925 * tmp2_129925;
        float tmp3_129927 = tmp2_129925 * x_129926;
        float tmp4_129928 = defunc_0_f_res_129917 * tmp3_129927;
        float defunc_1_f_res_129929 = x_j_129920 * tmp4_129928;
        float defunc_1_f_res_129930 = x_j_129920 * defunc_1_f_res_129929;
        
        // save map-out results
        {
            ((float *) mem_129702.mem)[gtid_120351] = defunc_1_f_res_129929;
            ((float *) mem_129703.mem)[gtid_120351] = tmp4_129928;
        }
        // Load accum params
        {
            x_129903 = local_acc_129961;
        }
        // Load next params
        {
            x_129904 = tmp4_129928;
        }
        // Red body
        {
            float defunc_1_op_res_129905 = x_129903 + x_129904;
            
            local_acc_129961 = defunc_1_op_res_129905;
        }
        // Load accum params
        {
            x_129906 = local_acc_129962;
        }
        // Load next params
        {
            x_129907 = defunc_1_f_res_129929;
        }
        // Red body
        {
            float defunc_1_op_res_129908 = x_129906 + x_129907;
            
            local_acc_129962 = defunc_1_op_res_129908;
        }
        // Load accum params
        {
            x_129909 = local_acc_129963;
        }
        // Load next params
        {
            x_129910 = defunc_1_f_res_129930;
        }
        // Red body
        {
            float defunc_1_op_res_129911 = x_129909 + x_129910;
            
            local_acc_129963 = defunc_1_op_res_129911;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_129954.mem)[flat_tid_120350] =
        local_acc_129961;
    ((float *) reduce_stage_1_tid_res_arr_mem_129956.mem)[flat_tid_120350] =
        local_acc_129962;
    ((float *) reduce_stage_1_tid_res_arr_mem_129958.mem)[flat_tid_120350] =
        local_acc_129963;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131767_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131767_end -
                 futhark_mc_segred_stage_1_parloop_131767_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131767_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131767_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131767_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131762(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120350 = tid;
    int num_tasks_129953 = info.nsubtasks;
    struct futhark_mc_task_131761 *futhark_mc_task_131761 =
                                  (struct futhark_mc_task_131761 *) args;
    struct futhark_context *ctx = futhark_mc_task_131761->ctx;
    uint64_t futhark_mc_segred_task_131762_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131762_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131761->free_n_114534;
    int64_t gtid_120345 = futhark_mc_task_131761->free_gtid_120345;
    int64_t x_120430 = futhark_mc_task_131761->free_x_120430;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131761->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131761->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_129697 = futhark_mc_task_131761->free_x_129697;
    float x_129698 = futhark_mc_task_131761->free_x_129698;
    float defunc_0_f_res_129701 =
          futhark_mc_task_131761->free_defunc_0_f_res_129701;
    float defunc_2_reduce_res_129704 =
          *futhark_mc_task_131761->retval_defunc_2_reduce_res_129704;
    float defunc_2_reduce_res_129705 =
          *futhark_mc_task_131761->retval_defunc_2_reduce_res_129705;
    float defunc_2_reduce_res_129706 =
          *futhark_mc_task_131761->retval_defunc_2_reduce_res_129706;
    struct memblock mem_129702 = {.desc ="mem_129702", .mem =
                                  futhark_mc_task_131761->retval_mem_129702,
                                  .size =0, .references =NULL};
    struct memblock mem_129703 = {.desc ="mem_129703", .mem =
                                  futhark_mc_task_131761->retval_mem_129703,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_129954_cached_sizze_131763 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129954 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_129956_cached_sizze_131764 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129956 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_129958_cached_sizze_131765 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129958 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_129954_cached_sizze_131763 <
        (size_t) ((int64_t) 4 * num_tasks_129953)) {
        reduce_stage_1_tid_res_arr_mem_129954 =
            realloc(reduce_stage_1_tid_res_arr_mem_129954, (int64_t) 4 *
                    num_tasks_129953);
        reduce_stage_1_tid_res_arr_mem_129954_cached_sizze_131763 =
            (int64_t) 4 * num_tasks_129953;
    }
    if (reduce_stage_1_tid_res_arr_mem_129956_cached_sizze_131764 <
        (size_t) ((int64_t) 4 * num_tasks_129953)) {
        reduce_stage_1_tid_res_arr_mem_129956 =
            realloc(reduce_stage_1_tid_res_arr_mem_129956, (int64_t) 4 *
                    num_tasks_129953);
        reduce_stage_1_tid_res_arr_mem_129956_cached_sizze_131764 =
            (int64_t) 4 * num_tasks_129953;
    }
    if (reduce_stage_1_tid_res_arr_mem_129958_cached_sizze_131765 <
        (size_t) ((int64_t) 4 * num_tasks_129953)) {
        reduce_stage_1_tid_res_arr_mem_129958 =
            realloc(reduce_stage_1_tid_res_arr_mem_129958, (int64_t) 4 *
                    num_tasks_129953);
        reduce_stage_1_tid_res_arr_mem_129958_cached_sizze_131765 =
            (int64_t) 4 * num_tasks_129953;
    }
    
    int64_t iter_129960;
    struct futhark_mc_segred_stage_1_parloop_struct_131766
    futhark_mc_segred_stage_1_parloop_struct_131766;
    
    futhark_mc_segred_stage_1_parloop_struct_131766.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131766.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131766.free_gtid_120345 =
        gtid_120345;
    futhark_mc_segred_stage_1_parloop_struct_131766.free_x_120430 = x_120430;
    futhark_mc_segred_stage_1_parloop_struct_131766.free_mem_122004 =
        mem_122004.mem;
    futhark_mc_segred_stage_1_parloop_struct_131766.free_mem_122430 =
        mem_122430.mem;
    futhark_mc_segred_stage_1_parloop_struct_131766.free_x_129697 = x_129697;
    futhark_mc_segred_stage_1_parloop_struct_131766.free_x_129698 = x_129698;
    futhark_mc_segred_stage_1_parloop_struct_131766.free_defunc_0_f_res_129701 =
        defunc_0_f_res_129701;
    futhark_mc_segred_stage_1_parloop_struct_131766.free_mem_129702 =
        mem_129702.mem;
    futhark_mc_segred_stage_1_parloop_struct_131766.free_mem_129703 =
        mem_129703.mem;
    futhark_mc_segred_stage_1_parloop_struct_131766.free_reduce_stage_1_tid_res_arr_mem_129954 =
        reduce_stage_1_tid_res_arr_mem_129954;
    futhark_mc_segred_stage_1_parloop_struct_131766.free_reduce_stage_1_tid_res_arr_mem_129956 =
        reduce_stage_1_tid_res_arr_mem_129956;
    futhark_mc_segred_stage_1_parloop_struct_131766.free_reduce_stage_1_tid_res_arr_mem_129958 =
        reduce_stage_1_tid_res_arr_mem_129958;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131767_task;
    
    futhark_mc_segred_stage_1_parloop_131767_task.name =
        "futhark_mc_segred_stage_1_parloop_131767";
    futhark_mc_segred_stage_1_parloop_131767_task.fn =
        futhark_mc_segred_stage_1_parloop_131767;
    futhark_mc_segred_stage_1_parloop_131767_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131766;
    futhark_mc_segred_stage_1_parloop_131767_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131767_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131767_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131767_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131767_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131767_task);
    
    if (futhark_mc_segred_stage_1_parloop_131767_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131767_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131767_total_end -
                 futhark_mc_segred_stage_1_parloop_131767_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131767_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131767_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131767_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_129704 = 0.0F;
        defunc_2_reduce_res_129705 = 0.0F;
        defunc_2_reduce_res_129706 = 0.0F;
    }
    
    float x_129964;
    float x_129965;
    float x_129967;
    float x_129968;
    float x_129970;
    float x_129971;
    
    for (int32_t i_129973 = 0; i_129973 < num_tasks_129953; i_129973++) {
        flat_tid_120350 = i_129973;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_129964 = defunc_2_reduce_res_129704;
            }
            // load next params
            {
                x_129965 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129954)[flat_tid_120350];
            }
            // red body
            {
                float defunc_1_op_res_129966 = x_129964 + x_129965;
                
                defunc_2_reduce_res_129704 = defunc_1_op_res_129966;
            }
            // load acc params
            {
                x_129967 = defunc_2_reduce_res_129705;
            }
            // load next params
            {
                x_129968 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129956)[flat_tid_120350];
            }
            // red body
            {
                float defunc_1_op_res_129969 = x_129967 + x_129968;
                
                defunc_2_reduce_res_129705 = defunc_1_op_res_129969;
            }
            // load acc params
            {
                x_129970 = defunc_2_reduce_res_129706;
            }
            // load next params
            {
                x_129971 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129958)[flat_tid_120350];
            }
            // red body
            {
                float defunc_1_op_res_129972 = x_129970 + x_129971;
                
                defunc_2_reduce_res_129706 = defunc_1_op_res_129972;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_129954);
    free(reduce_stage_1_tid_res_arr_mem_129956);
    free(reduce_stage_1_tid_res_arr_mem_129958);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131762_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131762_end -
                 futhark_mc_segred_task_131762_start;
        
        ctx->futhark_mc_segred_task_131762_runs[tid]++;
        ctx->futhark_mc_segred_task_131762_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131762_iter[tid] += iterations;
    }
    *futhark_mc_task_131761->retval_defunc_2_reduce_res_129704 =
        defunc_2_reduce_res_129704;
    *futhark_mc_task_131761->retval_defunc_2_reduce_res_129705 =
        defunc_2_reduce_res_129705;
    *futhark_mc_task_131761->retval_defunc_2_reduce_res_129706 =
        defunc_2_reduce_res_129706;
    futhark_mc_task_131761->retval_mem_129702 = mem_129702.mem;
    futhark_mc_task_131761->retval_mem_129703 = mem_129703.mem;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131768 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120345;
    int64_t free_x_120430;
    char *free_mem_122985;
    int64_t free_x_129697;
    char *free_mem_129702;
    char *free_mem_129703;
    float free_a11_129741;
    float free_b11_129743;
    float free_c11_129744;
    float *retval_defunc_2_reduce_res_129745;
    float *retval_defunc_2_reduce_res_129746;
};
struct futhark_mc_segred_stage_1_parloop_struct_131772 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120345;
    int64_t free_x_120430;
    char *free_mem_122985;
    int64_t free_x_129697;
    char *free_mem_129702;
    char *free_mem_129703;
    float free_a11_129741;
    float free_b11_129743;
    float free_c11_129744;
    char *free_reduce_stage_1_tid_res_arr_mem_129975;
    char *free_reduce_stage_1_tid_res_arr_mem_129977;
};
static int futhark_mc_segred_stage_1_parloop_131773(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_120352,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131772
    *futhark_mc_segred_stage_1_parloop_struct_131772 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131772 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131772->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131773_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131773_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131772->free_n_114534;
    int64_t gtid_120345 =
            futhark_mc_segred_stage_1_parloop_struct_131772->free_gtid_120345;
    int64_t x_120430 =
            futhark_mc_segred_stage_1_parloop_struct_131772->free_x_120430;
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131772->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t x_129697 =
            futhark_mc_segred_stage_1_parloop_struct_131772->free_x_129697;
    struct memblock mem_129702 = {.desc ="mem_129702", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131772->free_mem_129702,
                                  .size =0, .references =NULL};
    struct memblock mem_129703 = {.desc ="mem_129703", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131772->free_mem_129703,
                                  .size =0, .references =NULL};
    float a11_129741 =
          futhark_mc_segred_stage_1_parloop_struct_131772->free_a11_129741;
    float b11_129743 =
          futhark_mc_segred_stage_1_parloop_struct_131772->free_b11_129743;
    float c11_129744 =
          futhark_mc_segred_stage_1_parloop_struct_131772->free_c11_129744;
    struct memblock reduce_stage_1_tid_res_arr_mem_129975 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129975",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131772->free_reduce_stage_1_tid_res_arr_mem_129975,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_129977 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_129977",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131772->free_reduce_stage_1_tid_res_arr_mem_129977,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_129979 = start;
    float x_129931;
    float x_129932;
    float x_129934;
    float x_129935;
    float local_acc_129980 = 0.0F;
    float local_acc_129981 = 0.0F;
    
    for (; iter_129979 < end; iter_129979++) {
        int64_t gtid_120353 = iter_129979;
        float x_129937 = ((float *) mem_129703.mem)[gtid_120353];
        float x_129938 = ((float *) mem_129702.mem)[gtid_120353];
        bool cond_129939 = sle64(x_120430, gtid_120353);
        float defunc_0_f_res_129940;
        
        if (cond_129939) {
            defunc_0_f_res_129940 = 0.0F;
        } else {
            int64_t i_129941 = add64(gtid_120353, x_129697);
            float x_129942 = ((float *) mem_122985.mem)[gtid_120345 * n_114534 +
                                                        i_129941];
            
            defunc_0_f_res_129940 = x_129942;
        }
        
        float x_129943 = a11_129741 * x_129937;
        float y_129944 = b11_129743 * x_129938;
        float x_129945 = x_129943 + y_129944;
        float defunc_9_fit_fun_res_129946 = defunc_0_f_res_129940 * x_129945;
        float x_129947 = b11_129743 * x_129937;
        float y_129948 = c11_129744 * x_129938;
        float x_129949 = x_129947 + y_129948;
        float defunc_9_slope_fun_res_129950 = defunc_0_f_res_129940 * x_129949;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_129931 = local_acc_129980;
        }
        // Load next params
        {
            x_129932 = defunc_9_fit_fun_res_129946;
        }
        // Red body
        {
            float defunc_1_op_res_129933 = x_129931 + x_129932;
            
            local_acc_129980 = defunc_1_op_res_129933;
        }
        // Load accum params
        {
            x_129934 = local_acc_129981;
        }
        // Load next params
        {
            x_129935 = defunc_9_slope_fun_res_129950;
        }
        // Red body
        {
            float defunc_1_op_res_129936 = x_129934 + x_129935;
            
            local_acc_129981 = defunc_1_op_res_129936;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_129975.mem)[flat_tid_120352] =
        local_acc_129980;
    ((float *) reduce_stage_1_tid_res_arr_mem_129977.mem)[flat_tid_120352] =
        local_acc_129981;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131773_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131773_end -
                 futhark_mc_segred_stage_1_parloop_131773_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131773_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131773_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131773_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131769(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120352 = tid;
    int num_tasks_129974 = info.nsubtasks;
    struct futhark_mc_task_131768 *futhark_mc_task_131768 =
                                  (struct futhark_mc_task_131768 *) args;
    struct futhark_context *ctx = futhark_mc_task_131768->ctx;
    uint64_t futhark_mc_segred_task_131769_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131769_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131768->free_n_114534;
    int64_t gtid_120345 = futhark_mc_task_131768->free_gtid_120345;
    int64_t x_120430 = futhark_mc_task_131768->free_x_120430;
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131768->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t x_129697 = futhark_mc_task_131768->free_x_129697;
    struct memblock mem_129702 = {.desc ="mem_129702", .mem =
                                  futhark_mc_task_131768->free_mem_129702,
                                  .size =0, .references =NULL};
    struct memblock mem_129703 = {.desc ="mem_129703", .mem =
                                  futhark_mc_task_131768->free_mem_129703,
                                  .size =0, .references =NULL};
    float a11_129741 = futhark_mc_task_131768->free_a11_129741;
    float b11_129743 = futhark_mc_task_131768->free_b11_129743;
    float c11_129744 = futhark_mc_task_131768->free_c11_129744;
    float defunc_2_reduce_res_129745 =
          *futhark_mc_task_131768->retval_defunc_2_reduce_res_129745;
    float defunc_2_reduce_res_129746 =
          *futhark_mc_task_131768->retval_defunc_2_reduce_res_129746;
    size_t reduce_stage_1_tid_res_arr_mem_129975_cached_sizze_131770 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129975 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_129977_cached_sizze_131771 = 0;
    char *reduce_stage_1_tid_res_arr_mem_129977 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_129975_cached_sizze_131770 <
        (size_t) ((int64_t) 4 * num_tasks_129974)) {
        reduce_stage_1_tid_res_arr_mem_129975 =
            realloc(reduce_stage_1_tid_res_arr_mem_129975, (int64_t) 4 *
                    num_tasks_129974);
        reduce_stage_1_tid_res_arr_mem_129975_cached_sizze_131770 =
            (int64_t) 4 * num_tasks_129974;
    }
    if (reduce_stage_1_tid_res_arr_mem_129977_cached_sizze_131771 <
        (size_t) ((int64_t) 4 * num_tasks_129974)) {
        reduce_stage_1_tid_res_arr_mem_129977 =
            realloc(reduce_stage_1_tid_res_arr_mem_129977, (int64_t) 4 *
                    num_tasks_129974);
        reduce_stage_1_tid_res_arr_mem_129977_cached_sizze_131771 =
            (int64_t) 4 * num_tasks_129974;
    }
    
    int64_t iter_129979;
    struct futhark_mc_segred_stage_1_parloop_struct_131772
    futhark_mc_segred_stage_1_parloop_struct_131772;
    
    futhark_mc_segred_stage_1_parloop_struct_131772.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131772.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131772.free_gtid_120345 =
        gtid_120345;
    futhark_mc_segred_stage_1_parloop_struct_131772.free_x_120430 = x_120430;
    futhark_mc_segred_stage_1_parloop_struct_131772.free_mem_122985 =
        mem_122985.mem;
    futhark_mc_segred_stage_1_parloop_struct_131772.free_x_129697 = x_129697;
    futhark_mc_segred_stage_1_parloop_struct_131772.free_mem_129702 =
        mem_129702.mem;
    futhark_mc_segred_stage_1_parloop_struct_131772.free_mem_129703 =
        mem_129703.mem;
    futhark_mc_segred_stage_1_parloop_struct_131772.free_a11_129741 =
        a11_129741;
    futhark_mc_segred_stage_1_parloop_struct_131772.free_b11_129743 =
        b11_129743;
    futhark_mc_segred_stage_1_parloop_struct_131772.free_c11_129744 =
        c11_129744;
    futhark_mc_segred_stage_1_parloop_struct_131772.free_reduce_stage_1_tid_res_arr_mem_129975 =
        reduce_stage_1_tid_res_arr_mem_129975;
    futhark_mc_segred_stage_1_parloop_struct_131772.free_reduce_stage_1_tid_res_arr_mem_129977 =
        reduce_stage_1_tid_res_arr_mem_129977;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131773_task;
    
    futhark_mc_segred_stage_1_parloop_131773_task.name =
        "futhark_mc_segred_stage_1_parloop_131773";
    futhark_mc_segred_stage_1_parloop_131773_task.fn =
        futhark_mc_segred_stage_1_parloop_131773;
    futhark_mc_segred_stage_1_parloop_131773_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131772;
    futhark_mc_segred_stage_1_parloop_131773_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131773_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131773_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131773_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131773_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131773_task);
    
    if (futhark_mc_segred_stage_1_parloop_131773_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131773_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131773_total_end -
                 futhark_mc_segred_stage_1_parloop_131773_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131773_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131773_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131773_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_129745 = 0.0F;
        defunc_2_reduce_res_129746 = 0.0F;
    }
    
    float x_129982;
    float x_129983;
    float x_129985;
    float x_129986;
    
    for (int32_t i_129988 = 0; i_129988 < num_tasks_129974; i_129988++) {
        flat_tid_120352 = i_129988;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_129982 = defunc_2_reduce_res_129745;
            }
            // load next params
            {
                x_129983 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129975)[flat_tid_120352];
            }
            // red body
            {
                float defunc_1_op_res_129984 = x_129982 + x_129983;
                
                defunc_2_reduce_res_129745 = defunc_1_op_res_129984;
            }
            // load acc params
            {
                x_129985 = defunc_2_reduce_res_129746;
            }
            // load next params
            {
                x_129986 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_129977)[flat_tid_120352];
            }
            // red body
            {
                float defunc_1_op_res_129987 = x_129985 + x_129986;
                
                defunc_2_reduce_res_129746 = defunc_1_op_res_129987;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_129975);
    free(reduce_stage_1_tid_res_arr_mem_129977);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131769_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131769_end -
                 futhark_mc_segred_task_131769_start;
        
        ctx->futhark_mc_segred_task_131769_runs[tid]++;
        ctx->futhark_mc_segred_task_131769_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131769_iter[tid] += iterations;
    }
    *futhark_mc_task_131768->retval_defunc_2_reduce_res_129745 =
        defunc_2_reduce_res_129745;
    *futhark_mc_task_131768->retval_defunc_2_reduce_res_129746 =
        defunc_2_reduce_res_129746;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131758(void *args, int64_t start,
                                            int64_t end, int flat_tid_120348,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131757
    *futhark_mc_segmap_parloop_struct_131757 =
    (struct futhark_mc_segmap_parloop_struct_131757 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131757->ctx;
    uint64_t futhark_mc_segmap_parloop_131758_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131758_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131757->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131757->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131757->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131757->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131757->free_i_114610;
    int64_t gtid_120345 =
            futhark_mc_segmap_parloop_struct_131757->free_gtid_120345;
    int64_t x_120430 = futhark_mc_segmap_parloop_struct_131757->free_x_120430;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131757->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131757->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131757->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131757->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131757->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123163 =
            futhark_mc_segmap_parloop_struct_131757->free_bytes_123163;
    struct memblock mem_123201 = {.desc ="mem_123201", .mem =
                                  futhark_mc_segmap_parloop_struct_131757->free_mem_123201,
                                  .size =0, .references =NULL};
    struct memblock mem_123204 = {.desc ="mem_123204", .mem =
                                  futhark_mc_segmap_parloop_struct_131757->free_mem_123204,
                                  .size =0, .references =NULL};
    size_t mem_129702_cached_sizze_131759 = 0;
    char *mem_129702 = NULL;
    size_t mem_129703_cached_sizze_131760 = 0;
    char *mem_129703 = NULL;
    int64_t iterations = end - start;
    int64_t iter_129902 = start;
    
    if (mem_129702_cached_sizze_131759 < (size_t) bytes_123163) {
        mem_129702 = realloc(mem_129702, bytes_123163);
        mem_129702_cached_sizze_131759 = bytes_123163;
    }
    if (mem_129703_cached_sizze_131760 < (size_t) bytes_123163) {
        mem_129703 = realloc(mem_129703, bytes_123163);
        mem_129703_cached_sizze_131760 = bytes_123163;
    }
    for (; iter_129902 < end; iter_129902++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_129951 = t_n_m_114591;
        int64_t gtid_120349 = iter_129902;
        int64_t remnant_129952 = iter_129902 - gtid_120349;
        int64_t x_129697 = ((int64_t *) mem_122204.mem)[gtid_120345 *
                                                        t_n_m_114591 +
                                                        gtid_120349];
        float x_129698 = ((float *) mem_122208.mem)[gtid_120345 * t_n_m_114591 +
                                                    gtid_120349];
        int64_t min_arg_129699 = mul64(t_jump_114541, gtid_120349);
        int64_t min_res_129700 = smin64(i_114610, min_arg_129699);
        float defunc_0_f_res_129701 = sitofp_i64_f32(min_res_129700);
        float defunc_2_reduce_res_129704;
        float defunc_2_reduce_res_129705;
        float defunc_2_reduce_res_129706;
        int64_t flat_tid_120350 = (int64_t) 0;
        int32_t num_tasks_129953;
        struct futhark_mc_task_131761 futhark_mc_task_131761;
        
        futhark_mc_task_131761.ctx = ctx;
        futhark_mc_task_131761.free_n_114534 = n_114534;
        futhark_mc_task_131761.free_gtid_120345 = gtid_120345;
        futhark_mc_task_131761.free_x_120430 = x_120430;
        futhark_mc_task_131761.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131761.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131761.free_x_129697 = x_129697;
        futhark_mc_task_131761.free_x_129698 = x_129698;
        futhark_mc_task_131761.free_defunc_0_f_res_129701 =
            defunc_0_f_res_129701;
        futhark_mc_task_131761.retval_defunc_2_reduce_res_129704 =
            &defunc_2_reduce_res_129704;
        futhark_mc_task_131761.retval_defunc_2_reduce_res_129705 =
            &defunc_2_reduce_res_129705;
        futhark_mc_task_131761.retval_defunc_2_reduce_res_129706 =
            &defunc_2_reduce_res_129706;
        futhark_mc_task_131761.retval_mem_129702 = mem_129702;
        futhark_mc_task_131761.retval_mem_129703 = mem_129703;
        
        struct scheduler_segop futhark_mc_task_131761_task;
        
        futhark_mc_task_131761_task.args = &futhark_mc_task_131761;
        futhark_mc_task_131761_task.top_level_fn =
            futhark_mc_segred_task_131762;
        futhark_mc_task_131761_task.name = "futhark_mc_segred_task_131762";
        futhark_mc_task_131761_task.iterations = t_window_114537;
        futhark_mc_task_131761_task.task_time =
            &ctx->futhark_mc_segred_task_131762_total_time;
        futhark_mc_task_131761_task.task_iter =
            &ctx->futhark_mc_segred_task_131762_total_iter;
        futhark_mc_task_131761_task.sched = STATIC;
        futhark_mc_task_131761_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131762_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131761_task);
        
        if (futhark_mc_segred_task_131762_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float x_129737 = defunc_2_reduce_res_129704 *
              defunc_2_reduce_res_129706;
        float y_129738 = defunc_2_reduce_res_129705 *
              defunc_2_reduce_res_129705;
        float y_129739 = x_129737 - y_129738;
        float det1_129740 = 1.0F / y_129739;
        float a11_129741 = defunc_2_reduce_res_129706 * det1_129740;
        float negate_arg_129742 = defunc_2_reduce_res_129705 * det1_129740;
        float b11_129743 = 0.0F - negate_arg_129742;
        float c11_129744 = defunc_2_reduce_res_129704 * det1_129740;
        float defunc_2_reduce_res_129745;
        float defunc_2_reduce_res_129746;
        int64_t flat_tid_120352 = (int64_t) 0;
        int32_t num_tasks_129974;
        struct futhark_mc_task_131768 futhark_mc_task_131768;
        
        futhark_mc_task_131768.ctx = ctx;
        futhark_mc_task_131768.free_n_114534 = n_114534;
        futhark_mc_task_131768.free_gtid_120345 = gtid_120345;
        futhark_mc_task_131768.free_x_120430 = x_120430;
        futhark_mc_task_131768.free_mem_122985 = mem_122985.mem;
        futhark_mc_task_131768.free_x_129697 = x_129697;
        futhark_mc_task_131768.free_mem_129702 = mem_129702;
        futhark_mc_task_131768.free_mem_129703 = mem_129703;
        futhark_mc_task_131768.free_a11_129741 = a11_129741;
        futhark_mc_task_131768.free_b11_129743 = b11_129743;
        futhark_mc_task_131768.free_c11_129744 = c11_129744;
        futhark_mc_task_131768.retval_defunc_2_reduce_res_129745 =
            &defunc_2_reduce_res_129745;
        futhark_mc_task_131768.retval_defunc_2_reduce_res_129746 =
            &defunc_2_reduce_res_129746;
        
        struct scheduler_segop futhark_mc_task_131768_task;
        
        futhark_mc_task_131768_task.args = &futhark_mc_task_131768;
        futhark_mc_task_131768_task.top_level_fn =
            futhark_mc_segred_task_131769;
        futhark_mc_task_131768_task.name = "futhark_mc_segred_task_131769";
        futhark_mc_task_131768_task.iterations = t_window_114537;
        futhark_mc_task_131768_task.task_time =
            &ctx->futhark_mc_segred_task_131769_total_time;
        futhark_mc_task_131768_task.task_iter =
            &ctx->futhark_mc_segred_task_131769_total_iter;
        futhark_mc_task_131768_task.sched = STATIC;
        futhark_mc_task_131768_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131769_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131768_task);
        
        if (futhark_mc_segred_task_131769_err != 0) {
            err = 1;
            goto cleanup;
        }
        ((float *) mem_123201.mem)[gtid_120349] = defunc_2_reduce_res_129745;
        ((float *) mem_123204.mem)[gtid_120349] = defunc_2_reduce_res_129746;
    }
    
  cleanup:
    { }
    free(mem_129702);
    free(mem_129703);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131758_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131758_end -
                 futhark_mc_segmap_parloop_131758_start;
        
        ctx->futhark_mc_segmap_parloop_131758_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131758_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131758_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131756(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120348 = tid;
    int num_tasks_129842 = info.nsubtasks;
    struct futhark_mc_task_131750 *futhark_mc_task_131750 =
                                  (struct futhark_mc_task_131750 *) args;
    struct futhark_context *ctx = futhark_mc_task_131750->ctx;
    uint64_t futhark_mc_segmap_nested_task_131756_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131756_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131750->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131750->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131750->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131750->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131750->free_i_114610;
    int64_t gtid_120345 = futhark_mc_task_131750->free_gtid_120345;
    int64_t x_120430 = futhark_mc_task_131750->free_x_120430;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131750->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131750->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131750->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131750->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131750->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123163 = futhark_mc_task_131750->free_bytes_123163;
    struct memblock mem_123201 = {.desc ="mem_123201", .mem =
                                  futhark_mc_task_131750->free_mem_123201,
                                  .size =0, .references =NULL};
    struct memblock mem_123204 = {.desc ="mem_123204", .mem =
                                  futhark_mc_task_131750->free_mem_123204,
                                  .size =0, .references =NULL};
    int64_t iter_129902;
    struct futhark_mc_segmap_parloop_struct_131757
    futhark_mc_segmap_parloop_struct_131757;
    
    futhark_mc_segmap_parloop_struct_131757.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131757.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131757.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131757.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131757.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131757.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131757.free_gtid_120345 = gtid_120345;
    futhark_mc_segmap_parloop_struct_131757.free_x_120430 = x_120430;
    futhark_mc_segmap_parloop_struct_131757.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131757.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131757.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131757.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131757.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131757.free_bytes_123163 = bytes_123163;
    futhark_mc_segmap_parloop_struct_131757.free_mem_123201 = mem_123201.mem;
    futhark_mc_segmap_parloop_struct_131757.free_mem_123204 = mem_123204.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131758_task;
    
    futhark_mc_segmap_parloop_131758_task.name =
        "futhark_mc_segmap_parloop_131758";
    futhark_mc_segmap_parloop_131758_task.fn = futhark_mc_segmap_parloop_131758;
    futhark_mc_segmap_parloop_131758_task.args =
        &futhark_mc_segmap_parloop_struct_131757;
    futhark_mc_segmap_parloop_131758_task.iterations = iterations;
    futhark_mc_segmap_parloop_131758_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131758_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131758_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131758_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131758_task);
    
    if (futhark_mc_segmap_parloop_131758_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131758_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131758_total_end -
                 futhark_mc_segmap_parloop_131758_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131758_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131758_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131758_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131756_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131756_end -
                 futhark_mc_segmap_nested_task_131756_start;
        
        ctx->futhark_mc_segmap_nested_task_131756_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131756_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131756_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131747(void *args, int64_t start,
                                            int64_t end, int flat_tid_120344,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131746
    *futhark_mc_segmap_parloop_struct_131746 =
    (struct futhark_mc_segmap_parloop_struct_131746 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131746->ctx;
    uint64_t futhark_mc_segmap_parloop_131747_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131747_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131746->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131746->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131746->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131746->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131746->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131746->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131746->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131746->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131746->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131746->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131746->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131746->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131746->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123163 =
            futhark_mc_segmap_parloop_struct_131746->free_bytes_123163;
    struct memblock mem_123268 = {.desc ="mem_123268", .mem =
                                  futhark_mc_segmap_parloop_struct_131746->free_mem_123268,
                                  .size =0, .references =NULL};
    struct memblock mem_123272 = {.desc ="mem_123272", .mem =
                                  futhark_mc_segmap_parloop_struct_131746->free_mem_123272,
                                  .size =0, .references =NULL};
    size_t mem_123201_cached_sizze_131748 = 0;
    char *mem_123201 = NULL;
    size_t mem_123204_cached_sizze_131749 = 0;
    char *mem_123204 = NULL;
    int64_t iterations = end - start;
    int64_t iter_129696 = start;
    
    if (mem_123201_cached_sizze_131748 < (size_t) bytes_122135) {
        mem_123201 = realloc(mem_123201, bytes_122135);
        mem_123201_cached_sizze_131748 = bytes_122135;
    }
    if (mem_123204_cached_sizze_131749 < (size_t) bytes_122135) {
        mem_123204 = realloc(mem_123204, bytes_122135);
        mem_123204_cached_sizze_131749 = bytes_122135;
    }
    for (; iter_129696 < end; iter_129696++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_129840 = m_114533;
        int64_t gtid_120345 = iter_129696;
        int64_t remnant_129841 = iter_129696 - gtid_120345;
        int64_t x_120430 = ((int64_t *) mem_121982.mem)[gtid_120345];
        int64_t flat_tid_120346 = (int64_t) 0;
        int32_t num_tasks_129842;
        int64_t flat_tid_120348 = (int64_t) 0;
        struct futhark_mc_task_131750 futhark_mc_task_131750;
        
        futhark_mc_task_131750.ctx = ctx;
        futhark_mc_task_131750.free_n_114534 = n_114534;
        futhark_mc_task_131750.free_t_window_114537 = t_window_114537;
        futhark_mc_task_131750.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131750.free_t_n_m_114591 = t_n_m_114591;
        futhark_mc_task_131750.free_i_114610 = i_114610;
        futhark_mc_task_131750.free_gtid_120345 = gtid_120345;
        futhark_mc_task_131750.free_x_120430 = x_120430;
        futhark_mc_task_131750.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131750.free_mem_122204 = mem_122204.mem;
        futhark_mc_task_131750.free_mem_122208 = mem_122208.mem;
        futhark_mc_task_131750.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131750.free_mem_122985 = mem_122985.mem;
        futhark_mc_task_131750.free_bytes_123163 = bytes_123163;
        futhark_mc_task_131750.free_mem_123201 = mem_123201;
        futhark_mc_task_131750.free_mem_123204 = mem_123204;
        
        struct scheduler_segop futhark_mc_task_131750_task;
        
        futhark_mc_task_131750_task.args = &futhark_mc_task_131750;
        futhark_mc_task_131750_task.top_level_fn =
            futhark_mc_segmap_task_131751;
        futhark_mc_task_131750_task.name = "futhark_mc_segmap_task_131751";
        futhark_mc_task_131750_task.iterations = t_n_m_114591;
        futhark_mc_task_131750_task.task_time =
            &ctx->futhark_mc_segmap_task_131751_total_time;
        futhark_mc_task_131750_task.task_iter =
            &ctx->futhark_mc_segmap_task_131751_total_iter;
        futhark_mc_task_131750_task.sched = STATIC;
        futhark_mc_task_131750_task.nested_fn =
            futhark_mc_segmap_nested_task_131756;
        
        int futhark_mc_segmap_task_131751_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131750_task);
        
        if (futhark_mc_segmap_task_131751_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_123268.mem + gtid_120345 * t_n_m_114591 * (int64_t) 4,
                mem_123201 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
        memmove(mem_123272.mem + gtid_120345 * t_n_m_114591 * (int64_t) 4,
                mem_123204 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123201);
    free(mem_123204);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131747_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131747_end -
                 futhark_mc_segmap_parloop_131747_start;
        
        ctx->futhark_mc_segmap_parloop_131747_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131747_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131747_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131745(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120344 = tid;
    int num_tasks_129607 = info.nsubtasks;
    struct futhark_mc_task_131737 *futhark_mc_task_131737 =
                                  (struct futhark_mc_task_131737 *) args;
    struct futhark_context *ctx = futhark_mc_task_131737->ctx;
    uint64_t futhark_mc_segmap_nested_task_131745_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131745_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131737->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131737->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131737->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131737->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131737->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131737->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131737->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131737->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131737->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131737->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131737->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131737->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131737->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123163 = futhark_mc_task_131737->free_bytes_123163;
    struct memblock mem_123268 = {.desc ="mem_123268", .mem =
                                  futhark_mc_task_131737->free_mem_123268,
                                  .size =0, .references =NULL};
    struct memblock mem_123272 = {.desc ="mem_123272", .mem =
                                  futhark_mc_task_131737->free_mem_123272,
                                  .size =0, .references =NULL};
    int64_t iter_129696;
    struct futhark_mc_segmap_parloop_struct_131746
    futhark_mc_segmap_parloop_struct_131746;
    
    futhark_mc_segmap_parloop_struct_131746.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131746.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131746.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131746.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131746.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131746.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131746.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131746.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131746.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131746.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131746.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131746.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131746.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131746.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131746.free_bytes_123163 = bytes_123163;
    futhark_mc_segmap_parloop_struct_131746.free_mem_123268 = mem_123268.mem;
    futhark_mc_segmap_parloop_struct_131746.free_mem_123272 = mem_123272.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131747_task;
    
    futhark_mc_segmap_parloop_131747_task.name =
        "futhark_mc_segmap_parloop_131747";
    futhark_mc_segmap_parloop_131747_task.fn = futhark_mc_segmap_parloop_131747;
    futhark_mc_segmap_parloop_131747_task.args =
        &futhark_mc_segmap_parloop_struct_131746;
    futhark_mc_segmap_parloop_131747_task.iterations = iterations;
    futhark_mc_segmap_parloop_131747_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131747_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131747_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131747_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131747_task);
    
    if (futhark_mc_segmap_parloop_131747_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131747_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131747_total_end -
                 futhark_mc_segmap_parloop_131747_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131747_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131747_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131747_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131745_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131745_end -
                 futhark_mc_segmap_nested_task_131745_start;
        
        ctx->futhark_mc_segmap_nested_task_131745_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131745_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131745_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131774 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123273;
    char *free_mem_123444;
    char *free_mem_123448;
};
struct futhark_mc_segmap_parloop_struct_131776 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123273;
    char *free_mem_123444;
    char *free_mem_123448;
};
static int futhark_mc_segmap_parloop_131777(void *args, int64_t start,
                                            int64_t end, int flat_tid_120575,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131776
    *futhark_mc_segmap_parloop_struct_131776 =
    (struct futhark_mc_segmap_parloop_struct_131776 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131776->ctx;
    uint64_t futhark_mc_segmap_parloop_131777_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131777_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131776->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131776->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131776->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131776->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131776->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131776->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131776->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131776->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131776->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131776->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131776->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131776->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131776->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123273 =
            futhark_mc_segmap_parloop_struct_131776->free_bytes_123273;
    struct memblock mem_123444 = {.desc ="mem_123444", .mem =
                                  futhark_mc_segmap_parloop_struct_131776->free_mem_123444,
                                  .size =0, .references =NULL};
    struct memblock mem_123448 = {.desc ="mem_123448", .mem =
                                  futhark_mc_segmap_parloop_struct_131776->free_mem_123448,
                                  .size =0, .references =NULL};
    size_t mem_123353_cached_sizze_131778 = 0;
    char *mem_123353 = NULL;
    size_t mem_123356_cached_sizze_131779 = 0;
    char *mem_123356 = NULL;
    size_t mem_123373_cached_sizze_131780 = 0;
    char *mem_123373 = NULL;
    size_t mem_123376_cached_sizze_131781 = 0;
    char *mem_123376 = NULL;
    size_t mem_123403_cached_sizze_131782 = 0;
    char *mem_123403 = NULL;
    size_t mem_123406_cached_sizze_131783 = 0;
    char *mem_123406 = NULL;
    int64_t iterations = end - start;
    int64_t iter_129990 = start;
    
    if (mem_123353_cached_sizze_131778 < (size_t) bytes_122135) {
        mem_123353 = realloc(mem_123353, bytes_122135);
        mem_123353_cached_sizze_131778 = bytes_122135;
    }
    if (mem_123356_cached_sizze_131779 < (size_t) bytes_122135) {
        mem_123356 = realloc(mem_123356, bytes_122135);
        mem_123356_cached_sizze_131779 = bytes_122135;
    }
    if (mem_123373_cached_sizze_131780 < (size_t) bytes_123273) {
        mem_123373 = realloc(mem_123373, bytes_123273);
        mem_123373_cached_sizze_131780 = bytes_123273;
    }
    if (mem_123376_cached_sizze_131781 < (size_t) bytes_123273) {
        mem_123376 = realloc(mem_123376, bytes_123273);
        mem_123376_cached_sizze_131781 = bytes_123273;
    }
    if (mem_123403_cached_sizze_131782 < (size_t) bytes_123273) {
        mem_123403 = realloc(mem_123403, bytes_123273);
        mem_123403_cached_sizze_131782 = bytes_123273;
    }
    if (mem_123406_cached_sizze_131783 < (size_t) bytes_123273) {
        mem_123406 = realloc(mem_123406, bytes_123273);
        mem_123406_cached_sizze_131783 = bytes_123273;
    }
    for (; iter_129990 < end; iter_129990++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130108 = m_114533;
        int64_t gtid_120576 = iter_129990;
        int64_t remnant_130109 = iter_129990 - gtid_120576;
        int64_t x_116357 = ((int64_t *) mem_121982.mem)[gtid_120576];
        
        for (int64_t i_129991 = 0; i_129991 < t_n_m_114591; i_129991++) {
            int64_t x_129994 = ((int64_t *) mem_122204.mem)[gtid_120576 *
                                                            t_n_m_114591 +
                                                            i_129991];
            float x_129995 = ((float *) mem_122208.mem)[gtid_120576 *
                                                        t_n_m_114591 +
                                                        i_129991];
            int64_t min_arg_129996 = mul64(t_jump_114541, i_129991);
            int64_t min_res_129997 = smin64(i_114610, min_arg_129996);
            float defunc_0_f_res_129998 = sitofp_i64_f32(min_res_129997);
            
            for (int64_t i_130003 = 0; i_130003 < t_window_114537; i_130003++) {
                bool cond_130006 = sle64(x_116357, i_130003);
                float defunc_0_f_res_130007;
                
                if (cond_130006) {
                    defunc_0_f_res_130007 = 0.0F;
                } else {
                    int64_t i_130008 = add64(x_129994, i_130003);
                    float x_130009 = ((float *) mem_122004.mem)[gtid_120576 *
                                                                n_114534 +
                                                                i_130008];
                    float defunc_0_f_res_f_res_130010 = 1.0F + x_130009;
                    
                    defunc_0_f_res_130007 = defunc_0_f_res_f_res_130010;
                }
                
                float defunc_0_f_res_130011;
                
                if (cond_130006) {
                    defunc_0_f_res_130011 = 0.0F;
                } else {
                    int64_t i_130012 = add64(x_129994, i_130003);
                    float x_130013 = ((float *) mem_122430.mem)[gtid_120576 *
                                                                n_114534 +
                                                                i_130012];
                    
                    defunc_0_f_res_130011 = x_130013;
                }
                
                float x_j_130014 = defunc_0_f_res_130007 -
                      defunc_0_f_res_129998;
                float abs_res_130015 = (float) fabs(x_j_130014);
                float tmp1_130016 = abs_res_130015 / x_129995;
                float x_130017 = tmp1_130016 * tmp1_130016;
                float y_130018 = tmp1_130016 * x_130017;
                float tmp2_130019 = 1.0F - y_130018;
                float x_130020 = tmp2_130019 * tmp2_130019;
                float tmp3_130021 = tmp2_130019 * x_130020;
                float tmp4_130022 = defunc_0_f_res_130011 * tmp3_130021;
                
                ((float *) mem_123373)[i_130003] = x_j_130014;
                ((float *) mem_123376)[i_130003] = tmp4_130022;
            }
            
            float defunc_2_reduce_res_130027;
            float defunc_2_reduce_res_130028;
            float defunc_2_reduce_res_130029;
            float defunc_2_reduce_res_130030;
            float defunc_2_reduce_res_130031;
            float redout_130035;
            float redout_130036;
            float redout_130037;
            float redout_130038;
            float redout_130039;
            
            redout_130035 = 0.0F;
            redout_130036 = 0.0F;
            redout_130037 = 0.0F;
            redout_130038 = 0.0F;
            redout_130039 = 0.0F;
            for (int64_t i_130034 = 0; i_130034 < t_window_114537; i_130034++) {
                float x_130042 = ((float *) mem_123373)[i_130034];
                float x_130043 = ((float *) mem_123376)[i_130034];
                float defunc_1_f_res_130044 = x_130042 * x_130043;
                float defunc_1_f_res_130045 = x_130042 * defunc_1_f_res_130044;
                float defunc_1_f_res_130046 = x_130042 * defunc_1_f_res_130045;
                float defunc_1_f_res_130047 = x_130042 * defunc_1_f_res_130046;
                float defunc_1_op_res_130048 = x_130043 + redout_130035;
                float defunc_1_op_res_130049 = defunc_1_f_res_130044 +
                      redout_130036;
                float defunc_1_op_res_130050 = defunc_1_f_res_130045 +
                      redout_130037;
                float defunc_1_op_res_130051 = defunc_1_f_res_130046 +
                      redout_130038;
                float defunc_1_op_res_130052 = defunc_1_f_res_130047 +
                      redout_130039;
                
                ((float *) mem_123403)[i_130034] = defunc_1_f_res_130045;
                ((float *) mem_123406)[i_130034] = defunc_1_f_res_130044;
                
                float redout_tmp_130114 = defunc_1_op_res_130048;
                float redout_tmp_130115 = defunc_1_op_res_130049;
                float redout_tmp_130116 = defunc_1_op_res_130050;
                float redout_tmp_130117 = defunc_1_op_res_130051;
                float redout_tmp_130118 = defunc_1_op_res_130052;
                
                redout_130035 = redout_tmp_130114;
                redout_130036 = redout_tmp_130115;
                redout_130037 = redout_tmp_130116;
                redout_130038 = redout_tmp_130117;
                redout_130039 = redout_tmp_130118;
            }
            defunc_2_reduce_res_130027 = redout_130035;
            defunc_2_reduce_res_130028 = redout_130036;
            defunc_2_reduce_res_130029 = redout_130037;
            defunc_2_reduce_res_130030 = redout_130038;
            defunc_2_reduce_res_130031 = redout_130039;
            
            float x_130055 = defunc_2_reduce_res_130029 *
                  defunc_2_reduce_res_130031;
            float y_130056 = defunc_2_reduce_res_130030 *
                  defunc_2_reduce_res_130030;
            float a12_130057 = x_130055 - y_130056;
            float x_130058 = defunc_2_reduce_res_130029 *
                  defunc_2_reduce_res_130030;
            float y_130059 = defunc_2_reduce_res_130028 *
                  defunc_2_reduce_res_130031;
            float b12_130060 = x_130058 - y_130059;
            float x_130061 = defunc_2_reduce_res_130028 *
                  defunc_2_reduce_res_130030;
            float y_130062 = defunc_2_reduce_res_130029 *
                  defunc_2_reduce_res_130029;
            float c12_130063 = x_130061 - y_130062;
            float x_130064 = defunc_2_reduce_res_130027 *
                  defunc_2_reduce_res_130031;
            float b2_130065 = x_130064 - y_130062;
            float x_130066 = defunc_2_reduce_res_130028 *
                  defunc_2_reduce_res_130029;
            float y_130067 = defunc_2_reduce_res_130027 *
                  defunc_2_reduce_res_130030;
            float c2_130068 = x_130066 - y_130067;
            float x_130069 = defunc_2_reduce_res_130027 * a12_130057;
            float y_130070 = defunc_2_reduce_res_130028 * b12_130060;
            float x_130071 = x_130069 + y_130070;
            float y_130072 = defunc_2_reduce_res_130029 * c12_130063;
            float y_130073 = x_130071 + y_130072;
            float det_130074 = 1.0F / y_130073;
            float a12_130075 = a12_130057 * det_130074;
            float b12_130076 = b12_130060 * det_130074;
            float c12_130077 = c12_130063 * det_130074;
            float b2_130078 = b2_130065 * det_130074;
            float c2_130079 = c2_130068 * det_130074;
            float defunc_2_reduce_res_130080;
            float defunc_2_reduce_res_130081;
            float redout_130083;
            float redout_130084;
            
            redout_130083 = 0.0F;
            redout_130084 = 0.0F;
            for (int64_t i_130082 = 0; i_130082 < t_window_114537; i_130082++) {
                float x_130085 = ((float *) mem_123376)[i_130082];
                float x_130086 = ((float *) mem_123406)[i_130082];
                float x_130087 = ((float *) mem_123403)[i_130082];
                bool cond_130088 = sle64(x_116357, i_130082);
                float defunc_0_f_res_130089;
                
                if (cond_130088) {
                    defunc_0_f_res_130089 = 0.0F;
                } else {
                    int64_t i_130090 = add64(x_129994, i_130082);
                    float x_130091 = ((float *) mem_122985.mem)[gtid_120576 *
                                                                n_114534 +
                                                                i_130090];
                    
                    defunc_0_f_res_130089 = x_130091;
                }
                
                float x_130092 = a12_130075 * x_130085;
                float y_130093 = b12_130076 * x_130086;
                float x_130094 = x_130092 + y_130093;
                float y_130095 = c12_130077 * x_130087;
                float x_130096 = x_130094 + y_130095;
                float defunc_9_fit_fun_res_130097 = defunc_0_f_res_130089 *
                      x_130096;
                float x_130098 = b12_130076 * x_130085;
                float y_130099 = b2_130078 * x_130086;
                float x_130100 = x_130098 + y_130099;
                float y_130101 = c2_130079 * x_130087;
                float x_130102 = x_130100 + y_130101;
                float defunc_9_slope_fun_res_130103 = defunc_0_f_res_130089 *
                      x_130102;
                float defunc_1_op_res_130104 = defunc_9_fit_fun_res_130097 +
                      redout_130083;
                float defunc_1_op_res_130105 = defunc_9_slope_fun_res_130103 +
                      redout_130084;
                float redout_tmp_130121 = defunc_1_op_res_130104;
                float redout_tmp_130122 = defunc_1_op_res_130105;
                
                redout_130083 = redout_tmp_130121;
                redout_130084 = redout_tmp_130122;
            }
            defunc_2_reduce_res_130080 = redout_130083;
            defunc_2_reduce_res_130081 = redout_130084;
            ((float *) mem_123353)[i_129991] = defunc_2_reduce_res_130080;
            ((float *) mem_123356)[i_129991] = defunc_2_reduce_res_130081;
        }
        memmove(mem_123444.mem + gtid_120576 * t_n_m_114591 * (int64_t) 4,
                mem_123353 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
        memmove(mem_123448.mem + gtid_120576 * t_n_m_114591 * (int64_t) 4,
                mem_123356 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123353);
    free(mem_123356);
    free(mem_123373);
    free(mem_123376);
    free(mem_123403);
    free(mem_123406);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131777_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131777_end -
                 futhark_mc_segmap_parloop_131777_start;
        
        ctx->futhark_mc_segmap_parloop_131777_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131777_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131777_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131775(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120575 = tid;
    int num_tasks_129989 = info.nsubtasks;
    struct futhark_mc_task_131774 *futhark_mc_task_131774 =
                                  (struct futhark_mc_task_131774 *) args;
    struct futhark_context *ctx = futhark_mc_task_131774->ctx;
    uint64_t futhark_mc_segmap_task_131775_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131775_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131774->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131774->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131774->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131774->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131774->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131774->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131774->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131774->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131774->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131774->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131774->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131774->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131774->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123273 = futhark_mc_task_131774->free_bytes_123273;
    struct memblock mem_123444 = {.desc ="mem_123444", .mem =
                                  futhark_mc_task_131774->free_mem_123444,
                                  .size =0, .references =NULL};
    struct memblock mem_123448 = {.desc ="mem_123448", .mem =
                                  futhark_mc_task_131774->free_mem_123448,
                                  .size =0, .references =NULL};
    int64_t iter_129990;
    struct futhark_mc_segmap_parloop_struct_131776
    futhark_mc_segmap_parloop_struct_131776;
    
    futhark_mc_segmap_parloop_struct_131776.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131776.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131776.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131776.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131776.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131776.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131776.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131776.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131776.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131776.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131776.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131776.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131776.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131776.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131776.free_bytes_123273 = bytes_123273;
    futhark_mc_segmap_parloop_struct_131776.free_mem_123444 = mem_123444.mem;
    futhark_mc_segmap_parloop_struct_131776.free_mem_123448 = mem_123448.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131777_task;
    
    futhark_mc_segmap_parloop_131777_task.name =
        "futhark_mc_segmap_parloop_131777";
    futhark_mc_segmap_parloop_131777_task.fn = futhark_mc_segmap_parloop_131777;
    futhark_mc_segmap_parloop_131777_task.args =
        &futhark_mc_segmap_parloop_struct_131776;
    futhark_mc_segmap_parloop_131777_task.iterations = iterations;
    futhark_mc_segmap_parloop_131777_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131777_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131777_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131777_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131777_task);
    
    if (futhark_mc_segmap_parloop_131777_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131777_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131777_total_end -
                 futhark_mc_segmap_parloop_131777_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131777_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131777_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131777_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131775_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131775_end -
                 futhark_mc_segmap_task_131775_start;
        
        ctx->futhark_mc_segmap_task_131775_runs[tid]++;
        ctx->futhark_mc_segmap_task_131775_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131775_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131785 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    char *free_mem_121982;
    char *free_mem_122004;
    int64_t free_bytes_122135;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123273;
    char *free_mem_123444;
    char *free_mem_123448;
};
struct futhark_mc_task_131789 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_120578;
    int64_t free_x_120701;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123273;
    char *free_mem_123347;
    char *free_mem_123350;
};
struct futhark_mc_segmap_parloop_struct_131791 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_120578;
    int64_t free_x_120701;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123273;
    char *free_mem_123347;
    char *free_mem_123350;
};
static int futhark_mc_segmap_parloop_131792(void *args, int64_t start,
                                            int64_t end, int flat_tid_120579,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131791
    *futhark_mc_segmap_parloop_struct_131791 =
    (struct futhark_mc_segmap_parloop_struct_131791 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131791->ctx;
    uint64_t futhark_mc_segmap_parloop_131792_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131792_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131791->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131791->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131791->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131791->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131791->free_i_114610;
    int64_t gtid_120578 =
            futhark_mc_segmap_parloop_struct_131791->free_gtid_120578;
    int64_t x_120701 = futhark_mc_segmap_parloop_struct_131791->free_x_120701;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131791->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131791->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131791->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131791->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131791->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123273 =
            futhark_mc_segmap_parloop_struct_131791->free_bytes_123273;
    struct memblock mem_123347 = {.desc ="mem_123347", .mem =
                                  futhark_mc_segmap_parloop_struct_131791->free_mem_123347,
                                  .size =0, .references =NULL};
    struct memblock mem_123350 = {.desc ="mem_123350", .mem =
                                  futhark_mc_segmap_parloop_struct_131791->free_mem_123350,
                                  .size =0, .references =NULL};
    size_t mem_130237_cached_sizze_131793 = 0;
    char *mem_130237 = NULL;
    size_t mem_130239_cached_sizze_131794 = 0;
    char *mem_130239 = NULL;
    size_t mem_130265_cached_sizze_131795 = 0;
    char *mem_130265 = NULL;
    size_t mem_130267_cached_sizze_131796 = 0;
    char *mem_130267 = NULL;
    int64_t iterations = end - start;
    int64_t iter_130351 = start;
    
    if (mem_130237_cached_sizze_131793 < (size_t) bytes_123273) {
        mem_130237 = realloc(mem_130237, bytes_123273);
        mem_130237_cached_sizze_131793 = bytes_123273;
    }
    if (mem_130239_cached_sizze_131794 < (size_t) bytes_123273) {
        mem_130239 = realloc(mem_130239, bytes_123273);
        mem_130239_cached_sizze_131794 = bytes_123273;
    }
    if (mem_130265_cached_sizze_131795 < (size_t) bytes_123273) {
        mem_130265 = realloc(mem_130265, bytes_123273);
        mem_130265_cached_sizze_131795 = bytes_123273;
    }
    if (mem_130267_cached_sizze_131796 < (size_t) bytes_123273) {
        mem_130267 = realloc(mem_130267, bytes_123273);
        mem_130267_cached_sizze_131796 = bytes_123273;
    }
    for (; iter_130351 < end; iter_130351++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130419 = t_n_m_114591;
        int64_t gtid_120580 = iter_130351;
        int64_t remnant_130420 = iter_130351 - gtid_120580;
        int64_t x_130232 = ((int64_t *) mem_122204.mem)[gtid_120578 *
                                                        t_n_m_114591 +
                                                        gtid_120580];
        float x_130233 = ((float *) mem_122208.mem)[gtid_120578 * t_n_m_114591 +
                                                    gtid_120580];
        int64_t min_arg_130234 = mul64(t_jump_114541, gtid_120580);
        int64_t min_res_130235 = smin64(i_114610, min_arg_130234);
        float defunc_0_f_res_130236 = sitofp_i64_f32(min_res_130235);
        
        for (int64_t i_130352 = 0; i_130352 < t_window_114537; i_130352++) {
            bool cond_130355 = sle64(x_120701, i_130352);
            float defunc_0_f_res_130356;
            
            if (cond_130355) {
                defunc_0_f_res_130356 = 0.0F;
            } else {
                int64_t i_130357 = add64(x_130232, i_130352);
                float x_130358 = ((float *) mem_122004.mem)[gtid_120578 *
                                                            n_114534 +
                                                            i_130357];
                float defunc_0_f_res_f_res_130359 = 1.0F + x_130358;
                
                defunc_0_f_res_130356 = defunc_0_f_res_f_res_130359;
            }
            
            float defunc_0_f_res_130360;
            
            if (cond_130355) {
                defunc_0_f_res_130360 = 0.0F;
            } else {
                int64_t i_130361 = add64(x_130232, i_130352);
                float x_130362 = ((float *) mem_122430.mem)[gtid_120578 *
                                                            n_114534 +
                                                            i_130361];
                
                defunc_0_f_res_130360 = x_130362;
            }
            
            float x_j_130363 = defunc_0_f_res_130356 - defunc_0_f_res_130236;
            float abs_res_130364 = (float) fabs(x_j_130363);
            float tmp1_130365 = abs_res_130364 / x_130233;
            float x_130366 = tmp1_130365 * tmp1_130365;
            float y_130367 = tmp1_130365 * x_130366;
            float tmp2_130368 = 1.0F - y_130367;
            float x_130369 = tmp2_130368 * tmp2_130368;
            float tmp3_130370 = tmp2_130368 * x_130369;
            float tmp4_130371 = defunc_0_f_res_130360 * tmp3_130370;
            
            ((float *) mem_130237)[i_130352] = x_j_130363;
            ((float *) mem_130239)[i_130352] = tmp4_130371;
        }
        
        float defunc_2_reduce_res_130269;
        float defunc_2_reduce_res_130270;
        float defunc_2_reduce_res_130271;
        float defunc_2_reduce_res_130272;
        float defunc_2_reduce_res_130273;
        float redout_130375;
        float redout_130376;
        float redout_130377;
        float redout_130378;
        float redout_130379;
        
        redout_130375 = 0.0F;
        redout_130376 = 0.0F;
        redout_130377 = 0.0F;
        redout_130378 = 0.0F;
        redout_130379 = 0.0F;
        for (int64_t i_130374 = 0; i_130374 < t_window_114537; i_130374++) {
            float x_130382 = ((float *) mem_130237)[i_130374];
            float x_130383 = ((float *) mem_130239)[i_130374];
            float defunc_1_f_res_130384 = x_130382 * x_130383;
            float defunc_1_f_res_130385 = x_130382 * defunc_1_f_res_130384;
            float defunc_1_f_res_130386 = x_130382 * defunc_1_f_res_130385;
            float defunc_1_f_res_130387 = x_130382 * defunc_1_f_res_130386;
            float defunc_1_op_res_130388 = x_130383 + redout_130375;
            float defunc_1_op_res_130389 = defunc_1_f_res_130384 +
                  redout_130376;
            float defunc_1_op_res_130390 = defunc_1_f_res_130385 +
                  redout_130377;
            float defunc_1_op_res_130391 = defunc_1_f_res_130386 +
                  redout_130378;
            float defunc_1_op_res_130392 = defunc_1_f_res_130387 +
                  redout_130379;
            
            ((float *) mem_130265)[i_130374] = defunc_1_f_res_130385;
            ((float *) mem_130267)[i_130374] = defunc_1_f_res_130384;
            
            float redout_tmp_130423 = defunc_1_op_res_130388;
            float redout_tmp_130424 = defunc_1_op_res_130389;
            float redout_tmp_130425 = defunc_1_op_res_130390;
            float redout_tmp_130426 = defunc_1_op_res_130391;
            float redout_tmp_130427 = defunc_1_op_res_130392;
            
            redout_130375 = redout_tmp_130423;
            redout_130376 = redout_tmp_130424;
            redout_130377 = redout_tmp_130425;
            redout_130378 = redout_tmp_130426;
            redout_130379 = redout_tmp_130427;
        }
        defunc_2_reduce_res_130269 = redout_130375;
        defunc_2_reduce_res_130270 = redout_130376;
        defunc_2_reduce_res_130271 = redout_130377;
        defunc_2_reduce_res_130272 = redout_130378;
        defunc_2_reduce_res_130273 = redout_130379;
        
        float x_130297 = defunc_2_reduce_res_130271 *
              defunc_2_reduce_res_130273;
        float y_130298 = defunc_2_reduce_res_130272 *
              defunc_2_reduce_res_130272;
        float a12_130299 = x_130297 - y_130298;
        float x_130300 = defunc_2_reduce_res_130271 *
              defunc_2_reduce_res_130272;
        float y_130301 = defunc_2_reduce_res_130270 *
              defunc_2_reduce_res_130273;
        float b12_130302 = x_130300 - y_130301;
        float x_130303 = defunc_2_reduce_res_130270 *
              defunc_2_reduce_res_130272;
        float y_130304 = defunc_2_reduce_res_130271 *
              defunc_2_reduce_res_130271;
        float c12_130305 = x_130303 - y_130304;
        float x_130306 = defunc_2_reduce_res_130269 *
              defunc_2_reduce_res_130273;
        float b2_130307 = x_130306 - y_130304;
        float x_130308 = defunc_2_reduce_res_130270 *
              defunc_2_reduce_res_130271;
        float y_130309 = defunc_2_reduce_res_130269 *
              defunc_2_reduce_res_130272;
        float c2_130310 = x_130308 - y_130309;
        float x_130311 = defunc_2_reduce_res_130269 * a12_130299;
        float y_130312 = defunc_2_reduce_res_130270 * b12_130302;
        float x_130313 = x_130311 + y_130312;
        float y_130314 = defunc_2_reduce_res_130271 * c12_130305;
        float y_130315 = x_130313 + y_130314;
        float det_130316 = 1.0F / y_130315;
        float a12_130317 = a12_130299 * det_130316;
        float b12_130318 = b12_130302 * det_130316;
        float c12_130319 = c12_130305 * det_130316;
        float b2_130320 = b2_130307 * det_130316;
        float c2_130321 = c2_130310 * det_130316;
        float defunc_2_reduce_res_130322;
        float defunc_2_reduce_res_130323;
        float redout_130396;
        float redout_130397;
        
        redout_130396 = 0.0F;
        redout_130397 = 0.0F;
        for (int64_t i_130395 = 0; i_130395 < t_window_114537; i_130395++) {
            float x_130398 = ((float *) mem_130239)[i_130395];
            float x_130399 = ((float *) mem_130267)[i_130395];
            float x_130400 = ((float *) mem_130265)[i_130395];
            bool cond_130401 = sle64(x_120701, i_130395);
            float defunc_0_f_res_130402;
            
            if (cond_130401) {
                defunc_0_f_res_130402 = 0.0F;
            } else {
                int64_t i_130403 = add64(x_130232, i_130395);
                float x_130404 = ((float *) mem_122985.mem)[gtid_120578 *
                                                            n_114534 +
                                                            i_130403];
                
                defunc_0_f_res_130402 = x_130404;
            }
            
            float x_130405 = a12_130317 * x_130398;
            float y_130406 = b12_130318 * x_130399;
            float x_130407 = x_130405 + y_130406;
            float y_130408 = c12_130319 * x_130400;
            float x_130409 = x_130407 + y_130408;
            float defunc_9_fit_fun_res_130410 = defunc_0_f_res_130402 *
                  x_130409;
            float x_130411 = b12_130318 * x_130398;
            float y_130412 = b2_130320 * x_130399;
            float x_130413 = x_130411 + y_130412;
            float y_130414 = c2_130321 * x_130400;
            float x_130415 = x_130413 + y_130414;
            float defunc_9_slope_fun_res_130416 = defunc_0_f_res_130402 *
                  x_130415;
            float defunc_1_op_res_130417 = defunc_9_fit_fun_res_130410 +
                  redout_130396;
            float defunc_1_op_res_130418 = defunc_9_slope_fun_res_130416 +
                  redout_130397;
            float redout_tmp_130430 = defunc_1_op_res_130417;
            float redout_tmp_130431 = defunc_1_op_res_130418;
            
            redout_130396 = redout_tmp_130430;
            redout_130397 = redout_tmp_130431;
        }
        defunc_2_reduce_res_130322 = redout_130396;
        defunc_2_reduce_res_130323 = redout_130397;
        ((float *) mem_123347.mem)[gtid_120580] = defunc_2_reduce_res_130322;
        ((float *) mem_123350.mem)[gtid_120580] = defunc_2_reduce_res_130323;
    }
    
  cleanup:
    { }
    free(mem_130237);
    free(mem_130239);
    free(mem_130265);
    free(mem_130267);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131792_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131792_end -
                 futhark_mc_segmap_parloop_131792_start;
        
        ctx->futhark_mc_segmap_parloop_131792_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131792_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131792_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131790(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120579 = tid;
    int num_tasks_130350 = info.nsubtasks;
    struct futhark_mc_task_131789 *futhark_mc_task_131789 =
                                  (struct futhark_mc_task_131789 *) args;
    struct futhark_context *ctx = futhark_mc_task_131789->ctx;
    uint64_t futhark_mc_segmap_task_131790_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131790_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131789->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131789->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131789->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131789->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131789->free_i_114610;
    int64_t gtid_120578 = futhark_mc_task_131789->free_gtid_120578;
    int64_t x_120701 = futhark_mc_task_131789->free_x_120701;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131789->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131789->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131789->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131789->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131789->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123273 = futhark_mc_task_131789->free_bytes_123273;
    struct memblock mem_123347 = {.desc ="mem_123347", .mem =
                                  futhark_mc_task_131789->free_mem_123347,
                                  .size =0, .references =NULL};
    struct memblock mem_123350 = {.desc ="mem_123350", .mem =
                                  futhark_mc_task_131789->free_mem_123350,
                                  .size =0, .references =NULL};
    int64_t iter_130351;
    struct futhark_mc_segmap_parloop_struct_131791
    futhark_mc_segmap_parloop_struct_131791;
    
    futhark_mc_segmap_parloop_struct_131791.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131791.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131791.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131791.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131791.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131791.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131791.free_gtid_120578 = gtid_120578;
    futhark_mc_segmap_parloop_struct_131791.free_x_120701 = x_120701;
    futhark_mc_segmap_parloop_struct_131791.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131791.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131791.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131791.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131791.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131791.free_bytes_123273 = bytes_123273;
    futhark_mc_segmap_parloop_struct_131791.free_mem_123347 = mem_123347.mem;
    futhark_mc_segmap_parloop_struct_131791.free_mem_123350 = mem_123350.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131792_task;
    
    futhark_mc_segmap_parloop_131792_task.name =
        "futhark_mc_segmap_parloop_131792";
    futhark_mc_segmap_parloop_131792_task.fn = futhark_mc_segmap_parloop_131792;
    futhark_mc_segmap_parloop_131792_task.args =
        &futhark_mc_segmap_parloop_struct_131791;
    futhark_mc_segmap_parloop_131792_task.iterations = iterations;
    futhark_mc_segmap_parloop_131792_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131792_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131792_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131792_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131792_task);
    
    if (futhark_mc_segmap_parloop_131792_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131792_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131792_total_end -
                 futhark_mc_segmap_parloop_131792_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131792_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131792_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131792_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131790_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131790_end -
                 futhark_mc_segmap_task_131790_start;
        
        ctx->futhark_mc_segmap_task_131790_runs[tid]++;
        ctx->futhark_mc_segmap_task_131790_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131790_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131798 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_gtid_120578;
    int64_t free_x_120701;
    char *free_mem_122004;
    char *free_mem_122204;
    char *free_mem_122208;
    char *free_mem_122430;
    char *free_mem_122985;
    int64_t free_bytes_123273;
    char *free_mem_123347;
    char *free_mem_123350;
};
struct futhark_mc_task_131804 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_gtid_120578;
    int64_t free_x_120701;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_130124;
    float free_x_130125;
    float free_defunc_0_f_res_130128;
    char *free_mem_130129;
    char *free_mem_130130;
};
struct futhark_mc_segmap_parloop_struct_131806 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_window_114537;
    int64_t free_gtid_120578;
    int64_t free_x_120701;
    char *free_mem_122004;
    char *free_mem_122430;
    int64_t free_x_130124;
    float free_x_130125;
    float free_defunc_0_f_res_130128;
    char *free_mem_130129;
    char *free_mem_130130;
};
static int futhark_mc_segmap_parloop_131807(void *args, int64_t start,
                                            int64_t end, int flat_tid_120583,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131806
    *futhark_mc_segmap_parloop_struct_131806 =
    (struct futhark_mc_segmap_parloop_struct_131806 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131806->ctx;
    uint64_t futhark_mc_segmap_parloop_131807_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131807_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131806->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131806->free_t_window_114537;
    int64_t gtid_120578 =
            futhark_mc_segmap_parloop_struct_131806->free_gtid_120578;
    int64_t x_120701 = futhark_mc_segmap_parloop_struct_131806->free_x_120701;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131806->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131806->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_130124 = futhark_mc_segmap_parloop_struct_131806->free_x_130124;
    float x_130125 = futhark_mc_segmap_parloop_struct_131806->free_x_130125;
    float defunc_0_f_res_130128 =
          futhark_mc_segmap_parloop_struct_131806->free_defunc_0_f_res_130128;
    struct memblock mem_130129 = {.desc ="mem_130129", .mem =
                                  futhark_mc_segmap_parloop_struct_131806->free_mem_130129,
                                  .size =0, .references =NULL};
    struct memblock mem_130130 = {.desc ="mem_130130", .mem =
                                  futhark_mc_segmap_parloop_struct_131806->free_mem_130130,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_130499 = start;
    
    for (; iter_130499 < end; iter_130499++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130505 = t_window_114537;
        int64_t gtid_120584 = iter_130499;
        int64_t remnant_130506 = iter_130499 - gtid_120584;
        bool cond_130433 = sle64(x_120701, gtid_120584);
        float defunc_0_f_res_130434;
        
        if (cond_130433) {
            defunc_0_f_res_130434 = 0.0F;
        } else {
            int64_t i_130500 = add64(gtid_120584, x_130124);
            float x_130501 = ((float *) mem_122004.mem)[gtid_120578 * n_114534 +
                                                        i_130500];
            float defunc_0_f_res_f_res_130502 = 1.0F + x_130501;
            
            defunc_0_f_res_130434 = defunc_0_f_res_f_res_130502;
        }
        
        float defunc_0_f_res_130438;
        
        if (cond_130433) {
            defunc_0_f_res_130438 = 0.0F;
        } else {
            int64_t i_130503 = add64(gtid_120584, x_130124);
            float x_130504 = ((float *) mem_122430.mem)[gtid_120578 * n_114534 +
                                                        i_130503];
            
            defunc_0_f_res_130438 = x_130504;
        }
        
        float x_j_130441 = defunc_0_f_res_130434 - defunc_0_f_res_130128;
        float abs_res_130442 = (float) fabs(x_j_130441);
        float tmp1_130443 = abs_res_130442 / x_130125;
        float x_130444 = tmp1_130443 * tmp1_130443;
        float y_130445 = tmp1_130443 * x_130444;
        float tmp2_130446 = 1.0F - y_130445;
        float x_130447 = tmp2_130446 * tmp2_130446;
        float tmp3_130448 = tmp2_130446 * x_130447;
        float tmp4_130449 = defunc_0_f_res_130438 * tmp3_130448;
        
        ((float *) mem_130129.mem)[gtid_120584] = x_j_130441;
        ((float *) mem_130130.mem)[gtid_120584] = tmp4_130449;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131807_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131807_end -
                 futhark_mc_segmap_parloop_131807_start;
        
        ctx->futhark_mc_segmap_parloop_131807_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131807_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131807_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131805(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120583 = tid;
    int num_tasks_130498 = info.nsubtasks;
    struct futhark_mc_task_131804 *futhark_mc_task_131804 =
                                  (struct futhark_mc_task_131804 *) args;
    struct futhark_context *ctx = futhark_mc_task_131804->ctx;
    uint64_t futhark_mc_segmap_task_131805_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131805_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131804->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131804->free_t_window_114537;
    int64_t gtid_120578 = futhark_mc_task_131804->free_gtid_120578;
    int64_t x_120701 = futhark_mc_task_131804->free_x_120701;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131804->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131804->free_mem_122430,
                                  .size =0, .references =NULL};
    int64_t x_130124 = futhark_mc_task_131804->free_x_130124;
    float x_130125 = futhark_mc_task_131804->free_x_130125;
    float defunc_0_f_res_130128 =
          futhark_mc_task_131804->free_defunc_0_f_res_130128;
    struct memblock mem_130129 = {.desc ="mem_130129", .mem =
                                  futhark_mc_task_131804->free_mem_130129,
                                  .size =0, .references =NULL};
    struct memblock mem_130130 = {.desc ="mem_130130", .mem =
                                  futhark_mc_task_131804->free_mem_130130,
                                  .size =0, .references =NULL};
    int64_t iter_130499;
    struct futhark_mc_segmap_parloop_struct_131806
    futhark_mc_segmap_parloop_struct_131806;
    
    futhark_mc_segmap_parloop_struct_131806.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131806.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131806.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131806.free_gtid_120578 = gtid_120578;
    futhark_mc_segmap_parloop_struct_131806.free_x_120701 = x_120701;
    futhark_mc_segmap_parloop_struct_131806.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131806.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131806.free_x_130124 = x_130124;
    futhark_mc_segmap_parloop_struct_131806.free_x_130125 = x_130125;
    futhark_mc_segmap_parloop_struct_131806.free_defunc_0_f_res_130128 =
        defunc_0_f_res_130128;
    futhark_mc_segmap_parloop_struct_131806.free_mem_130129 = mem_130129.mem;
    futhark_mc_segmap_parloop_struct_131806.free_mem_130130 = mem_130130.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131807_task;
    
    futhark_mc_segmap_parloop_131807_task.name =
        "futhark_mc_segmap_parloop_131807";
    futhark_mc_segmap_parloop_131807_task.fn = futhark_mc_segmap_parloop_131807;
    futhark_mc_segmap_parloop_131807_task.args =
        &futhark_mc_segmap_parloop_struct_131806;
    futhark_mc_segmap_parloop_131807_task.iterations = iterations;
    futhark_mc_segmap_parloop_131807_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131807_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131807_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131807_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131807_task);
    
    if (futhark_mc_segmap_parloop_131807_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131807_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131807_total_end -
                 futhark_mc_segmap_parloop_131807_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131807_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131807_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131807_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131805_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131805_end -
                 futhark_mc_segmap_task_131805_start;
        
        ctx->futhark_mc_segmap_task_131805_runs[tid]++;
        ctx->futhark_mc_segmap_task_131805_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131805_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131808 {
    struct futhark_context *ctx;
    char *free_mem_130129;
    char *free_mem_130130;
    float *retval_defunc_2_reduce_res_130152;
    float *retval_defunc_2_reduce_res_130153;
    float *retval_defunc_2_reduce_res_130154;
    float *retval_defunc_2_reduce_res_130155;
    float *retval_defunc_2_reduce_res_130156;
    char *retval_mem_130150;
    char *retval_mem_130151;
};
struct futhark_mc_segred_stage_1_parloop_struct_131815 {
    struct futhark_context *ctx;
    char *free_mem_130129;
    char *free_mem_130130;
    char *free_mem_130150;
    char *free_mem_130151;
    char *free_reduce_stage_1_tid_res_arr_mem_130508;
    char *free_reduce_stage_1_tid_res_arr_mem_130510;
    char *free_reduce_stage_1_tid_res_arr_mem_130512;
    char *free_reduce_stage_1_tid_res_arr_mem_130514;
    char *free_reduce_stage_1_tid_res_arr_mem_130516;
};
static int futhark_mc_segred_stage_1_parloop_131816(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_120585,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131815
    *futhark_mc_segred_stage_1_parloop_struct_131815 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131815 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131815->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131816_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131816_start = get_wall_time();
    
    struct memblock mem_130129 = {.desc ="mem_130129", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131815->free_mem_130129,
                                  .size =0, .references =NULL};
    struct memblock mem_130130 = {.desc ="mem_130130", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131815->free_mem_130130,
                                  .size =0, .references =NULL};
    struct memblock mem_130150 = {.desc ="mem_130150", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131815->free_mem_130150,
                                  .size =0, .references =NULL};
    struct memblock mem_130151 = {.desc ="mem_130151", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131815->free_mem_130151,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_130508 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_130508",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131815->free_reduce_stage_1_tid_res_arr_mem_130508,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_130510 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_130510",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131815->free_reduce_stage_1_tid_res_arr_mem_130510,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_130512 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_130512",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131815->free_reduce_stage_1_tid_res_arr_mem_130512,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_130514 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_130514",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131815->free_reduce_stage_1_tid_res_arr_mem_130514,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_130516 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_130516",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131815->free_reduce_stage_1_tid_res_arr_mem_130516,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_130518 = start;
    float x_130450;
    float x_130451;
    float x_130453;
    float x_130454;
    float x_130456;
    float x_130457;
    float x_130459;
    float x_130460;
    float x_130462;
    float x_130463;
    float local_acc_130519 = 0.0F;
    float local_acc_130520 = 0.0F;
    float local_acc_130521 = 0.0F;
    float local_acc_130522 = 0.0F;
    float local_acc_130523 = 0.0F;
    
    for (; iter_130518 < end; iter_130518++) {
        int64_t gtid_120586 = iter_130518;
        float x_130465 = ((float *) mem_130129.mem)[gtid_120586];
        float x_130466 = ((float *) mem_130130.mem)[gtid_120586];
        float defunc_1_f_res_130467 = x_130465 * x_130466;
        float defunc_1_f_res_130468 = x_130465 * defunc_1_f_res_130467;
        float defunc_1_f_res_130469 = x_130465 * defunc_1_f_res_130468;
        float defunc_1_f_res_130470 = x_130465 * defunc_1_f_res_130469;
        
        // save map-out results
        {
            ((float *) mem_130150.mem)[gtid_120586] = defunc_1_f_res_130468;
            ((float *) mem_130151.mem)[gtid_120586] = defunc_1_f_res_130467;
        }
        // Load accum params
        {
            x_130450 = local_acc_130519;
        }
        // Load next params
        {
            x_130451 = x_130466;
        }
        // Red body
        {
            float defunc_1_op_res_130452 = x_130450 + x_130451;
            
            local_acc_130519 = defunc_1_op_res_130452;
        }
        // Load accum params
        {
            x_130453 = local_acc_130520;
        }
        // Load next params
        {
            x_130454 = defunc_1_f_res_130467;
        }
        // Red body
        {
            float defunc_1_op_res_130455 = x_130453 + x_130454;
            
            local_acc_130520 = defunc_1_op_res_130455;
        }
        // Load accum params
        {
            x_130456 = local_acc_130521;
        }
        // Load next params
        {
            x_130457 = defunc_1_f_res_130468;
        }
        // Red body
        {
            float defunc_1_op_res_130458 = x_130456 + x_130457;
            
            local_acc_130521 = defunc_1_op_res_130458;
        }
        // Load accum params
        {
            x_130459 = local_acc_130522;
        }
        // Load next params
        {
            x_130460 = defunc_1_f_res_130469;
        }
        // Red body
        {
            float defunc_1_op_res_130461 = x_130459 + x_130460;
            
            local_acc_130522 = defunc_1_op_res_130461;
        }
        // Load accum params
        {
            x_130462 = local_acc_130523;
        }
        // Load next params
        {
            x_130463 = defunc_1_f_res_130470;
        }
        // Red body
        {
            float defunc_1_op_res_130464 = x_130462 + x_130463;
            
            local_acc_130523 = defunc_1_op_res_130464;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_130508.mem)[flat_tid_120585] =
        local_acc_130519;
    ((float *) reduce_stage_1_tid_res_arr_mem_130510.mem)[flat_tid_120585] =
        local_acc_130520;
    ((float *) reduce_stage_1_tid_res_arr_mem_130512.mem)[flat_tid_120585] =
        local_acc_130521;
    ((float *) reduce_stage_1_tid_res_arr_mem_130514.mem)[flat_tid_120585] =
        local_acc_130522;
    ((float *) reduce_stage_1_tid_res_arr_mem_130516.mem)[flat_tid_120585] =
        local_acc_130523;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131816_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131816_end -
                 futhark_mc_segred_stage_1_parloop_131816_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131816_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131816_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131816_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131809(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120585 = tid;
    int num_tasks_130507 = info.nsubtasks;
    struct futhark_mc_task_131808 *futhark_mc_task_131808 =
                                  (struct futhark_mc_task_131808 *) args;
    struct futhark_context *ctx = futhark_mc_task_131808->ctx;
    uint64_t futhark_mc_segred_task_131809_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131809_start = get_wall_time();
    
    struct memblock mem_130129 = {.desc ="mem_130129", .mem =
                                  futhark_mc_task_131808->free_mem_130129,
                                  .size =0, .references =NULL};
    struct memblock mem_130130 = {.desc ="mem_130130", .mem =
                                  futhark_mc_task_131808->free_mem_130130,
                                  .size =0, .references =NULL};
    float defunc_2_reduce_res_130152 =
          *futhark_mc_task_131808->retval_defunc_2_reduce_res_130152;
    float defunc_2_reduce_res_130153 =
          *futhark_mc_task_131808->retval_defunc_2_reduce_res_130153;
    float defunc_2_reduce_res_130154 =
          *futhark_mc_task_131808->retval_defunc_2_reduce_res_130154;
    float defunc_2_reduce_res_130155 =
          *futhark_mc_task_131808->retval_defunc_2_reduce_res_130155;
    float defunc_2_reduce_res_130156 =
          *futhark_mc_task_131808->retval_defunc_2_reduce_res_130156;
    struct memblock mem_130150 = {.desc ="mem_130150", .mem =
                                  futhark_mc_task_131808->retval_mem_130150,
                                  .size =0, .references =NULL};
    struct memblock mem_130151 = {.desc ="mem_130151", .mem =
                                  futhark_mc_task_131808->retval_mem_130151,
                                  .size =0, .references =NULL};
    size_t reduce_stage_1_tid_res_arr_mem_130508_cached_sizze_131810 = 0;
    char *reduce_stage_1_tid_res_arr_mem_130508 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_130510_cached_sizze_131811 = 0;
    char *reduce_stage_1_tid_res_arr_mem_130510 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_130512_cached_sizze_131812 = 0;
    char *reduce_stage_1_tid_res_arr_mem_130512 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_130514_cached_sizze_131813 = 0;
    char *reduce_stage_1_tid_res_arr_mem_130514 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_130516_cached_sizze_131814 = 0;
    char *reduce_stage_1_tid_res_arr_mem_130516 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_130508_cached_sizze_131810 <
        (size_t) ((int64_t) 4 * num_tasks_130507)) {
        reduce_stage_1_tid_res_arr_mem_130508 =
            realloc(reduce_stage_1_tid_res_arr_mem_130508, (int64_t) 4 *
                    num_tasks_130507);
        reduce_stage_1_tid_res_arr_mem_130508_cached_sizze_131810 =
            (int64_t) 4 * num_tasks_130507;
    }
    if (reduce_stage_1_tid_res_arr_mem_130510_cached_sizze_131811 <
        (size_t) ((int64_t) 4 * num_tasks_130507)) {
        reduce_stage_1_tid_res_arr_mem_130510 =
            realloc(reduce_stage_1_tid_res_arr_mem_130510, (int64_t) 4 *
                    num_tasks_130507);
        reduce_stage_1_tid_res_arr_mem_130510_cached_sizze_131811 =
            (int64_t) 4 * num_tasks_130507;
    }
    if (reduce_stage_1_tid_res_arr_mem_130512_cached_sizze_131812 <
        (size_t) ((int64_t) 4 * num_tasks_130507)) {
        reduce_stage_1_tid_res_arr_mem_130512 =
            realloc(reduce_stage_1_tid_res_arr_mem_130512, (int64_t) 4 *
                    num_tasks_130507);
        reduce_stage_1_tid_res_arr_mem_130512_cached_sizze_131812 =
            (int64_t) 4 * num_tasks_130507;
    }
    if (reduce_stage_1_tid_res_arr_mem_130514_cached_sizze_131813 <
        (size_t) ((int64_t) 4 * num_tasks_130507)) {
        reduce_stage_1_tid_res_arr_mem_130514 =
            realloc(reduce_stage_1_tid_res_arr_mem_130514, (int64_t) 4 *
                    num_tasks_130507);
        reduce_stage_1_tid_res_arr_mem_130514_cached_sizze_131813 =
            (int64_t) 4 * num_tasks_130507;
    }
    if (reduce_stage_1_tid_res_arr_mem_130516_cached_sizze_131814 <
        (size_t) ((int64_t) 4 * num_tasks_130507)) {
        reduce_stage_1_tid_res_arr_mem_130516 =
            realloc(reduce_stage_1_tid_res_arr_mem_130516, (int64_t) 4 *
                    num_tasks_130507);
        reduce_stage_1_tid_res_arr_mem_130516_cached_sizze_131814 =
            (int64_t) 4 * num_tasks_130507;
    }
    
    int64_t iter_130518;
    struct futhark_mc_segred_stage_1_parloop_struct_131815
    futhark_mc_segred_stage_1_parloop_struct_131815;
    
    futhark_mc_segred_stage_1_parloop_struct_131815.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131815.free_mem_130129 =
        mem_130129.mem;
    futhark_mc_segred_stage_1_parloop_struct_131815.free_mem_130130 =
        mem_130130.mem;
    futhark_mc_segred_stage_1_parloop_struct_131815.free_mem_130150 =
        mem_130150.mem;
    futhark_mc_segred_stage_1_parloop_struct_131815.free_mem_130151 =
        mem_130151.mem;
    futhark_mc_segred_stage_1_parloop_struct_131815.free_reduce_stage_1_tid_res_arr_mem_130508 =
        reduce_stage_1_tid_res_arr_mem_130508;
    futhark_mc_segred_stage_1_parloop_struct_131815.free_reduce_stage_1_tid_res_arr_mem_130510 =
        reduce_stage_1_tid_res_arr_mem_130510;
    futhark_mc_segred_stage_1_parloop_struct_131815.free_reduce_stage_1_tid_res_arr_mem_130512 =
        reduce_stage_1_tid_res_arr_mem_130512;
    futhark_mc_segred_stage_1_parloop_struct_131815.free_reduce_stage_1_tid_res_arr_mem_130514 =
        reduce_stage_1_tid_res_arr_mem_130514;
    futhark_mc_segred_stage_1_parloop_struct_131815.free_reduce_stage_1_tid_res_arr_mem_130516 =
        reduce_stage_1_tid_res_arr_mem_130516;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131816_task;
    
    futhark_mc_segred_stage_1_parloop_131816_task.name =
        "futhark_mc_segred_stage_1_parloop_131816";
    futhark_mc_segred_stage_1_parloop_131816_task.fn =
        futhark_mc_segred_stage_1_parloop_131816;
    futhark_mc_segred_stage_1_parloop_131816_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131815;
    futhark_mc_segred_stage_1_parloop_131816_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131816_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131816_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131816_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131816_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131816_task);
    
    if (futhark_mc_segred_stage_1_parloop_131816_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131816_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131816_total_end -
                 futhark_mc_segred_stage_1_parloop_131816_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131816_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131816_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131816_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_130152 = 0.0F;
        defunc_2_reduce_res_130153 = 0.0F;
        defunc_2_reduce_res_130154 = 0.0F;
        defunc_2_reduce_res_130155 = 0.0F;
        defunc_2_reduce_res_130156 = 0.0F;
    }
    
    float x_130524;
    float x_130525;
    float x_130527;
    float x_130528;
    float x_130530;
    float x_130531;
    float x_130533;
    float x_130534;
    float x_130536;
    float x_130537;
    
    for (int32_t i_130539 = 0; i_130539 < num_tasks_130507; i_130539++) {
        flat_tid_120585 = i_130539;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_130524 = defunc_2_reduce_res_130152;
            }
            // load next params
            {
                x_130525 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_130508)[flat_tid_120585];
            }
            // red body
            {
                float defunc_1_op_res_130526 = x_130524 + x_130525;
                
                defunc_2_reduce_res_130152 = defunc_1_op_res_130526;
            }
            // load acc params
            {
                x_130527 = defunc_2_reduce_res_130153;
            }
            // load next params
            {
                x_130528 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_130510)[flat_tid_120585];
            }
            // red body
            {
                float defunc_1_op_res_130529 = x_130527 + x_130528;
                
                defunc_2_reduce_res_130153 = defunc_1_op_res_130529;
            }
            // load acc params
            {
                x_130530 = defunc_2_reduce_res_130154;
            }
            // load next params
            {
                x_130531 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_130512)[flat_tid_120585];
            }
            // red body
            {
                float defunc_1_op_res_130532 = x_130530 + x_130531;
                
                defunc_2_reduce_res_130154 = defunc_1_op_res_130532;
            }
            // load acc params
            {
                x_130533 = defunc_2_reduce_res_130155;
            }
            // load next params
            {
                x_130534 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_130514)[flat_tid_120585];
            }
            // red body
            {
                float defunc_1_op_res_130535 = x_130533 + x_130534;
                
                defunc_2_reduce_res_130155 = defunc_1_op_res_130535;
            }
            // load acc params
            {
                x_130536 = defunc_2_reduce_res_130156;
            }
            // load next params
            {
                x_130537 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_130516)[flat_tid_120585];
            }
            // red body
            {
                float defunc_1_op_res_130538 = x_130536 + x_130537;
                
                defunc_2_reduce_res_130156 = defunc_1_op_res_130538;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_130508);
    free(reduce_stage_1_tid_res_arr_mem_130510);
    free(reduce_stage_1_tid_res_arr_mem_130512);
    free(reduce_stage_1_tid_res_arr_mem_130514);
    free(reduce_stage_1_tid_res_arr_mem_130516);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131809_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131809_end -
                 futhark_mc_segred_task_131809_start;
        
        ctx->futhark_mc_segred_task_131809_runs[tid]++;
        ctx->futhark_mc_segred_task_131809_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131809_iter[tid] += iterations;
    }
    *futhark_mc_task_131808->retval_defunc_2_reduce_res_130152 =
        defunc_2_reduce_res_130152;
    *futhark_mc_task_131808->retval_defunc_2_reduce_res_130153 =
        defunc_2_reduce_res_130153;
    *futhark_mc_task_131808->retval_defunc_2_reduce_res_130154 =
        defunc_2_reduce_res_130154;
    *futhark_mc_task_131808->retval_defunc_2_reduce_res_130155 =
        defunc_2_reduce_res_130155;
    *futhark_mc_task_131808->retval_defunc_2_reduce_res_130156 =
        defunc_2_reduce_res_130156;
    futhark_mc_task_131808->retval_mem_130150 = mem_130150.mem;
    futhark_mc_task_131808->retval_mem_130151 = mem_130151.mem;
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131817 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120578;
    int64_t free_x_120701;
    char *free_mem_122985;
    int64_t free_x_130124;
    char *free_mem_130130;
    char *free_mem_130150;
    char *free_mem_130151;
    float free_a12_130200;
    float free_b12_130201;
    float free_c12_130202;
    float free_b2_130203;
    float free_c2_130204;
    float *retval_defunc_2_reduce_res_130205;
    float *retval_defunc_2_reduce_res_130206;
};
struct futhark_mc_segred_stage_1_parloop_struct_131821 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120578;
    int64_t free_x_120701;
    char *free_mem_122985;
    int64_t free_x_130124;
    char *free_mem_130130;
    char *free_mem_130150;
    char *free_mem_130151;
    float free_a12_130200;
    float free_b12_130201;
    float free_c12_130202;
    float free_b2_130203;
    float free_c2_130204;
    char *free_reduce_stage_1_tid_res_arr_mem_130541;
    char *free_reduce_stage_1_tid_res_arr_mem_130543;
};
static int futhark_mc_segred_stage_1_parloop_131822(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_120587,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131821
    *futhark_mc_segred_stage_1_parloop_struct_131821 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131821 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131821->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131822_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131822_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131821->free_n_114534;
    int64_t gtid_120578 =
            futhark_mc_segred_stage_1_parloop_struct_131821->free_gtid_120578;
    int64_t x_120701 =
            futhark_mc_segred_stage_1_parloop_struct_131821->free_x_120701;
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131821->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t x_130124 =
            futhark_mc_segred_stage_1_parloop_struct_131821->free_x_130124;
    struct memblock mem_130130 = {.desc ="mem_130130", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131821->free_mem_130130,
                                  .size =0, .references =NULL};
    struct memblock mem_130150 = {.desc ="mem_130150", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131821->free_mem_130150,
                                  .size =0, .references =NULL};
    struct memblock mem_130151 = {.desc ="mem_130151", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131821->free_mem_130151,
                                  .size =0, .references =NULL};
    float a12_130200 =
          futhark_mc_segred_stage_1_parloop_struct_131821->free_a12_130200;
    float b12_130201 =
          futhark_mc_segred_stage_1_parloop_struct_131821->free_b12_130201;
    float c12_130202 =
          futhark_mc_segred_stage_1_parloop_struct_131821->free_c12_130202;
    float b2_130203 =
          futhark_mc_segred_stage_1_parloop_struct_131821->free_b2_130203;
    float c2_130204 =
          futhark_mc_segred_stage_1_parloop_struct_131821->free_c2_130204;
    struct memblock reduce_stage_1_tid_res_arr_mem_130541 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_130541",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131821->free_reduce_stage_1_tid_res_arr_mem_130541,
                                                             .size =0,
                                                             .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_130543 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_130543",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131821->free_reduce_stage_1_tid_res_arr_mem_130543,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_130545 = start;
    float x_130471;
    float x_130472;
    float x_130474;
    float x_130475;
    float local_acc_130546 = 0.0F;
    float local_acc_130547 = 0.0F;
    
    for (; iter_130545 < end; iter_130545++) {
        int64_t gtid_120588 = iter_130545;
        float x_130477 = ((float *) mem_130130.mem)[gtid_120588];
        float x_130478 = ((float *) mem_130151.mem)[gtid_120588];
        float x_130479 = ((float *) mem_130150.mem)[gtid_120588];
        bool cond_130480 = sle64(x_120701, gtid_120588);
        float defunc_0_f_res_130481;
        
        if (cond_130480) {
            defunc_0_f_res_130481 = 0.0F;
        } else {
            int64_t i_130482 = add64(gtid_120588, x_130124);
            float x_130483 = ((float *) mem_122985.mem)[gtid_120578 * n_114534 +
                                                        i_130482];
            
            defunc_0_f_res_130481 = x_130483;
        }
        
        float x_130484 = a12_130200 * x_130477;
        float y_130485 = b12_130201 * x_130478;
        float x_130486 = x_130484 + y_130485;
        float y_130487 = c12_130202 * x_130479;
        float x_130488 = x_130486 + y_130487;
        float defunc_9_fit_fun_res_130489 = defunc_0_f_res_130481 * x_130488;
        float x_130490 = b12_130201 * x_130477;
        float y_130491 = b2_130203 * x_130478;
        float x_130492 = x_130490 + y_130491;
        float y_130493 = c2_130204 * x_130479;
        float x_130494 = x_130492 + y_130493;
        float defunc_9_slope_fun_res_130495 = defunc_0_f_res_130481 * x_130494;
        
        // save map-out results
        { }
        // Load accum params
        {
            x_130471 = local_acc_130546;
        }
        // Load next params
        {
            x_130472 = defunc_9_fit_fun_res_130489;
        }
        // Red body
        {
            float defunc_1_op_res_130473 = x_130471 + x_130472;
            
            local_acc_130546 = defunc_1_op_res_130473;
        }
        // Load accum params
        {
            x_130474 = local_acc_130547;
        }
        // Load next params
        {
            x_130475 = defunc_9_slope_fun_res_130495;
        }
        // Red body
        {
            float defunc_1_op_res_130476 = x_130474 + x_130475;
            
            local_acc_130547 = defunc_1_op_res_130476;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_130541.mem)[flat_tid_120587] =
        local_acc_130546;
    ((float *) reduce_stage_1_tid_res_arr_mem_130543.mem)[flat_tid_120587] =
        local_acc_130547;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131822_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131822_end -
                 futhark_mc_segred_stage_1_parloop_131822_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131822_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131822_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131822_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131818(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120587 = tid;
    int num_tasks_130540 = info.nsubtasks;
    struct futhark_mc_task_131817 *futhark_mc_task_131817 =
                                  (struct futhark_mc_task_131817 *) args;
    struct futhark_context *ctx = futhark_mc_task_131817->ctx;
    uint64_t futhark_mc_segred_task_131818_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131818_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131817->free_n_114534;
    int64_t gtid_120578 = futhark_mc_task_131817->free_gtid_120578;
    int64_t x_120701 = futhark_mc_task_131817->free_x_120701;
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131817->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t x_130124 = futhark_mc_task_131817->free_x_130124;
    struct memblock mem_130130 = {.desc ="mem_130130", .mem =
                                  futhark_mc_task_131817->free_mem_130130,
                                  .size =0, .references =NULL};
    struct memblock mem_130150 = {.desc ="mem_130150", .mem =
                                  futhark_mc_task_131817->free_mem_130150,
                                  .size =0, .references =NULL};
    struct memblock mem_130151 = {.desc ="mem_130151", .mem =
                                  futhark_mc_task_131817->free_mem_130151,
                                  .size =0, .references =NULL};
    float a12_130200 = futhark_mc_task_131817->free_a12_130200;
    float b12_130201 = futhark_mc_task_131817->free_b12_130201;
    float c12_130202 = futhark_mc_task_131817->free_c12_130202;
    float b2_130203 = futhark_mc_task_131817->free_b2_130203;
    float c2_130204 = futhark_mc_task_131817->free_c2_130204;
    float defunc_2_reduce_res_130205 =
          *futhark_mc_task_131817->retval_defunc_2_reduce_res_130205;
    float defunc_2_reduce_res_130206 =
          *futhark_mc_task_131817->retval_defunc_2_reduce_res_130206;
    size_t reduce_stage_1_tid_res_arr_mem_130541_cached_sizze_131819 = 0;
    char *reduce_stage_1_tid_res_arr_mem_130541 = NULL;
    size_t reduce_stage_1_tid_res_arr_mem_130543_cached_sizze_131820 = 0;
    char *reduce_stage_1_tid_res_arr_mem_130543 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_130541_cached_sizze_131819 <
        (size_t) ((int64_t) 4 * num_tasks_130540)) {
        reduce_stage_1_tid_res_arr_mem_130541 =
            realloc(reduce_stage_1_tid_res_arr_mem_130541, (int64_t) 4 *
                    num_tasks_130540);
        reduce_stage_1_tid_res_arr_mem_130541_cached_sizze_131819 =
            (int64_t) 4 * num_tasks_130540;
    }
    if (reduce_stage_1_tid_res_arr_mem_130543_cached_sizze_131820 <
        (size_t) ((int64_t) 4 * num_tasks_130540)) {
        reduce_stage_1_tid_res_arr_mem_130543 =
            realloc(reduce_stage_1_tid_res_arr_mem_130543, (int64_t) 4 *
                    num_tasks_130540);
        reduce_stage_1_tid_res_arr_mem_130543_cached_sizze_131820 =
            (int64_t) 4 * num_tasks_130540;
    }
    
    int64_t iter_130545;
    struct futhark_mc_segred_stage_1_parloop_struct_131821
    futhark_mc_segred_stage_1_parloop_struct_131821;
    
    futhark_mc_segred_stage_1_parloop_struct_131821.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_gtid_120578 =
        gtid_120578;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_x_120701 = x_120701;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_mem_122985 =
        mem_122985.mem;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_x_130124 = x_130124;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_mem_130130 =
        mem_130130.mem;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_mem_130150 =
        mem_130150.mem;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_mem_130151 =
        mem_130151.mem;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_a12_130200 =
        a12_130200;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_b12_130201 =
        b12_130201;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_c12_130202 =
        c12_130202;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_b2_130203 = b2_130203;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_c2_130204 = c2_130204;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_reduce_stage_1_tid_res_arr_mem_130541 =
        reduce_stage_1_tid_res_arr_mem_130541;
    futhark_mc_segred_stage_1_parloop_struct_131821.free_reduce_stage_1_tid_res_arr_mem_130543 =
        reduce_stage_1_tid_res_arr_mem_130543;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131822_task;
    
    futhark_mc_segred_stage_1_parloop_131822_task.name =
        "futhark_mc_segred_stage_1_parloop_131822";
    futhark_mc_segred_stage_1_parloop_131822_task.fn =
        futhark_mc_segred_stage_1_parloop_131822;
    futhark_mc_segred_stage_1_parloop_131822_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131821;
    futhark_mc_segred_stage_1_parloop_131822_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131822_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131822_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131822_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131822_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131822_task);
    
    if (futhark_mc_segred_stage_1_parloop_131822_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131822_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131822_total_end -
                 futhark_mc_segred_stage_1_parloop_131822_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131822_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131822_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131822_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_130205 = 0.0F;
        defunc_2_reduce_res_130206 = 0.0F;
    }
    
    float x_130548;
    float x_130549;
    float x_130551;
    float x_130552;
    
    for (int32_t i_130554 = 0; i_130554 < num_tasks_130540; i_130554++) {
        flat_tid_120587 = i_130554;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_130548 = defunc_2_reduce_res_130205;
            }
            // load next params
            {
                x_130549 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_130541)[flat_tid_120587];
            }
            // red body
            {
                float defunc_1_op_res_130550 = x_130548 + x_130549;
                
                defunc_2_reduce_res_130205 = defunc_1_op_res_130550;
            }
            // load acc params
            {
                x_130551 = defunc_2_reduce_res_130206;
            }
            // load next params
            {
                x_130552 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_130543)[flat_tid_120587];
            }
            // red body
            {
                float defunc_1_op_res_130553 = x_130551 + x_130552;
                
                defunc_2_reduce_res_130206 = defunc_1_op_res_130553;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_130541);
    free(reduce_stage_1_tid_res_arr_mem_130543);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131818_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131818_end -
                 futhark_mc_segred_task_131818_start;
        
        ctx->futhark_mc_segred_task_131818_runs[tid]++;
        ctx->futhark_mc_segred_task_131818_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131818_iter[tid] += iterations;
    }
    *futhark_mc_task_131817->retval_defunc_2_reduce_res_130205 =
        defunc_2_reduce_res_130205;
    *futhark_mc_task_131817->retval_defunc_2_reduce_res_130206 =
        defunc_2_reduce_res_130206;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131799(void *args, int64_t start,
                                            int64_t end, int flat_tid_120581,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131798
    *futhark_mc_segmap_parloop_struct_131798 =
    (struct futhark_mc_segmap_parloop_struct_131798 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131798->ctx;
    uint64_t futhark_mc_segmap_parloop_131799_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131799_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131798->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131798->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131798->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131798->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131798->free_i_114610;
    int64_t gtid_120578 =
            futhark_mc_segmap_parloop_struct_131798->free_gtid_120578;
    int64_t x_120701 = futhark_mc_segmap_parloop_struct_131798->free_x_120701;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131798->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131798->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131798->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131798->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131798->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123273 =
            futhark_mc_segmap_parloop_struct_131798->free_bytes_123273;
    struct memblock mem_123347 = {.desc ="mem_123347", .mem =
                                  futhark_mc_segmap_parloop_struct_131798->free_mem_123347,
                                  .size =0, .references =NULL};
    struct memblock mem_123350 = {.desc ="mem_123350", .mem =
                                  futhark_mc_segmap_parloop_struct_131798->free_mem_123350,
                                  .size =0, .references =NULL};
    size_t mem_130129_cached_sizze_131800 = 0;
    char *mem_130129 = NULL;
    size_t mem_130130_cached_sizze_131801 = 0;
    char *mem_130130 = NULL;
    size_t mem_130150_cached_sizze_131802 = 0;
    char *mem_130150 = NULL;
    size_t mem_130151_cached_sizze_131803 = 0;
    char *mem_130151 = NULL;
    int64_t iterations = end - start;
    int64_t iter_130432 = start;
    
    if (mem_130129_cached_sizze_131800 < (size_t) bytes_123273) {
        mem_130129 = realloc(mem_130129, bytes_123273);
        mem_130129_cached_sizze_131800 = bytes_123273;
    }
    if (mem_130130_cached_sizze_131801 < (size_t) bytes_123273) {
        mem_130130 = realloc(mem_130130, bytes_123273);
        mem_130130_cached_sizze_131801 = bytes_123273;
    }
    if (mem_130150_cached_sizze_131802 < (size_t) bytes_123273) {
        mem_130150 = realloc(mem_130150, bytes_123273);
        mem_130150_cached_sizze_131802 = bytes_123273;
    }
    if (mem_130151_cached_sizze_131803 < (size_t) bytes_123273) {
        mem_130151 = realloc(mem_130151, bytes_123273);
        mem_130151_cached_sizze_131803 = bytes_123273;
    }
    for (; iter_130432 < end; iter_130432++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130496 = t_n_m_114591;
        int64_t gtid_120582 = iter_130432;
        int64_t remnant_130497 = iter_130432 - gtid_120582;
        int64_t x_130124 = ((int64_t *) mem_122204.mem)[gtid_120578 *
                                                        t_n_m_114591 +
                                                        gtid_120582];
        float x_130125 = ((float *) mem_122208.mem)[gtid_120578 * t_n_m_114591 +
                                                    gtid_120582];
        int64_t min_arg_130126 = mul64(t_jump_114541, gtid_120582);
        int64_t min_res_130127 = smin64(i_114610, min_arg_130126);
        float defunc_0_f_res_130128 = sitofp_i64_f32(min_res_130127);
        int64_t flat_tid_120583 = (int64_t) 0;
        int32_t num_tasks_130498;
        struct futhark_mc_task_131804 futhark_mc_task_131804;
        
        futhark_mc_task_131804.ctx = ctx;
        futhark_mc_task_131804.free_n_114534 = n_114534;
        futhark_mc_task_131804.free_t_window_114537 = t_window_114537;
        futhark_mc_task_131804.free_gtid_120578 = gtid_120578;
        futhark_mc_task_131804.free_x_120701 = x_120701;
        futhark_mc_task_131804.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131804.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131804.free_x_130124 = x_130124;
        futhark_mc_task_131804.free_x_130125 = x_130125;
        futhark_mc_task_131804.free_defunc_0_f_res_130128 =
            defunc_0_f_res_130128;
        futhark_mc_task_131804.free_mem_130129 = mem_130129;
        futhark_mc_task_131804.free_mem_130130 = mem_130130;
        
        struct scheduler_segop futhark_mc_task_131804_task;
        
        futhark_mc_task_131804_task.args = &futhark_mc_task_131804;
        futhark_mc_task_131804_task.top_level_fn =
            futhark_mc_segmap_task_131805;
        futhark_mc_task_131804_task.name = "futhark_mc_segmap_task_131805";
        futhark_mc_task_131804_task.iterations = t_window_114537;
        futhark_mc_task_131804_task.task_time =
            &ctx->futhark_mc_segmap_task_131805_total_time;
        futhark_mc_task_131804_task.task_iter =
            &ctx->futhark_mc_segmap_task_131805_total_iter;
        futhark_mc_task_131804_task.sched = STATIC;
        futhark_mc_task_131804_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131805_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131804_task);
        
        if (futhark_mc_segmap_task_131805_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float defunc_2_reduce_res_130152;
        float defunc_2_reduce_res_130153;
        float defunc_2_reduce_res_130154;
        float defunc_2_reduce_res_130155;
        float defunc_2_reduce_res_130156;
        int64_t flat_tid_120585 = (int64_t) 0;
        int32_t num_tasks_130507;
        struct futhark_mc_task_131808 futhark_mc_task_131808;
        
        futhark_mc_task_131808.ctx = ctx;
        futhark_mc_task_131808.free_mem_130129 = mem_130129;
        futhark_mc_task_131808.free_mem_130130 = mem_130130;
        futhark_mc_task_131808.retval_defunc_2_reduce_res_130152 =
            &defunc_2_reduce_res_130152;
        futhark_mc_task_131808.retval_defunc_2_reduce_res_130153 =
            &defunc_2_reduce_res_130153;
        futhark_mc_task_131808.retval_defunc_2_reduce_res_130154 =
            &defunc_2_reduce_res_130154;
        futhark_mc_task_131808.retval_defunc_2_reduce_res_130155 =
            &defunc_2_reduce_res_130155;
        futhark_mc_task_131808.retval_defunc_2_reduce_res_130156 =
            &defunc_2_reduce_res_130156;
        futhark_mc_task_131808.retval_mem_130150 = mem_130150;
        futhark_mc_task_131808.retval_mem_130151 = mem_130151;
        
        struct scheduler_segop futhark_mc_task_131808_task;
        
        futhark_mc_task_131808_task.args = &futhark_mc_task_131808;
        futhark_mc_task_131808_task.top_level_fn =
            futhark_mc_segred_task_131809;
        futhark_mc_task_131808_task.name = "futhark_mc_segred_task_131809";
        futhark_mc_task_131808_task.iterations = t_window_114537;
        futhark_mc_task_131808_task.task_time =
            &ctx->futhark_mc_segred_task_131809_total_time;
        futhark_mc_task_131808_task.task_iter =
            &ctx->futhark_mc_segred_task_131809_total_iter;
        futhark_mc_task_131808_task.sched = STATIC;
        futhark_mc_task_131808_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131809_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131808_task);
        
        if (futhark_mc_segred_task_131809_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float x_130180 = defunc_2_reduce_res_130154 *
              defunc_2_reduce_res_130156;
        float y_130181 = defunc_2_reduce_res_130155 *
              defunc_2_reduce_res_130155;
        float a12_130182 = x_130180 - y_130181;
        float x_130183 = defunc_2_reduce_res_130154 *
              defunc_2_reduce_res_130155;
        float y_130184 = defunc_2_reduce_res_130153 *
              defunc_2_reduce_res_130156;
        float b12_130185 = x_130183 - y_130184;
        float x_130186 = defunc_2_reduce_res_130153 *
              defunc_2_reduce_res_130155;
        float y_130187 = defunc_2_reduce_res_130154 *
              defunc_2_reduce_res_130154;
        float c12_130188 = x_130186 - y_130187;
        float x_130189 = defunc_2_reduce_res_130152 *
              defunc_2_reduce_res_130156;
        float b2_130190 = x_130189 - y_130187;
        float x_130191 = defunc_2_reduce_res_130153 *
              defunc_2_reduce_res_130154;
        float y_130192 = defunc_2_reduce_res_130152 *
              defunc_2_reduce_res_130155;
        float c2_130193 = x_130191 - y_130192;
        float x_130194 = defunc_2_reduce_res_130152 * a12_130182;
        float y_130195 = defunc_2_reduce_res_130153 * b12_130185;
        float x_130196 = x_130194 + y_130195;
        float y_130197 = defunc_2_reduce_res_130154 * c12_130188;
        float y_130198 = x_130196 + y_130197;
        float det_130199 = 1.0F / y_130198;
        float a12_130200 = a12_130182 * det_130199;
        float b12_130201 = b12_130185 * det_130199;
        float c12_130202 = c12_130188 * det_130199;
        float b2_130203 = b2_130190 * det_130199;
        float c2_130204 = c2_130193 * det_130199;
        float defunc_2_reduce_res_130205;
        float defunc_2_reduce_res_130206;
        int64_t flat_tid_120587 = (int64_t) 0;
        int32_t num_tasks_130540;
        struct futhark_mc_task_131817 futhark_mc_task_131817;
        
        futhark_mc_task_131817.ctx = ctx;
        futhark_mc_task_131817.free_n_114534 = n_114534;
        futhark_mc_task_131817.free_gtid_120578 = gtid_120578;
        futhark_mc_task_131817.free_x_120701 = x_120701;
        futhark_mc_task_131817.free_mem_122985 = mem_122985.mem;
        futhark_mc_task_131817.free_x_130124 = x_130124;
        futhark_mc_task_131817.free_mem_130130 = mem_130130;
        futhark_mc_task_131817.free_mem_130150 = mem_130150;
        futhark_mc_task_131817.free_mem_130151 = mem_130151;
        futhark_mc_task_131817.free_a12_130200 = a12_130200;
        futhark_mc_task_131817.free_b12_130201 = b12_130201;
        futhark_mc_task_131817.free_c12_130202 = c12_130202;
        futhark_mc_task_131817.free_b2_130203 = b2_130203;
        futhark_mc_task_131817.free_c2_130204 = c2_130204;
        futhark_mc_task_131817.retval_defunc_2_reduce_res_130205 =
            &defunc_2_reduce_res_130205;
        futhark_mc_task_131817.retval_defunc_2_reduce_res_130206 =
            &defunc_2_reduce_res_130206;
        
        struct scheduler_segop futhark_mc_task_131817_task;
        
        futhark_mc_task_131817_task.args = &futhark_mc_task_131817;
        futhark_mc_task_131817_task.top_level_fn =
            futhark_mc_segred_task_131818;
        futhark_mc_task_131817_task.name = "futhark_mc_segred_task_131818";
        futhark_mc_task_131817_task.iterations = t_window_114537;
        futhark_mc_task_131817_task.task_time =
            &ctx->futhark_mc_segred_task_131818_total_time;
        futhark_mc_task_131817_task.task_iter =
            &ctx->futhark_mc_segred_task_131818_total_iter;
        futhark_mc_task_131817_task.sched = STATIC;
        futhark_mc_task_131817_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131818_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131817_task);
        
        if (futhark_mc_segred_task_131818_err != 0) {
            err = 1;
            goto cleanup;
        }
        ((float *) mem_123347.mem)[gtid_120582] = defunc_2_reduce_res_130205;
        ((float *) mem_123350.mem)[gtid_120582] = defunc_2_reduce_res_130206;
    }
    
  cleanup:
    { }
    free(mem_130129);
    free(mem_130130);
    free(mem_130150);
    free(mem_130151);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131799_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131799_end -
                 futhark_mc_segmap_parloop_131799_start;
        
        ctx->futhark_mc_segmap_parloop_131799_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131799_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131799_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131797(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120581 = tid;
    int num_tasks_130350 = info.nsubtasks;
    struct futhark_mc_task_131789 *futhark_mc_task_131789 =
                                  (struct futhark_mc_task_131789 *) args;
    struct futhark_context *ctx = futhark_mc_task_131789->ctx;
    uint64_t futhark_mc_segmap_nested_task_131797_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131797_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131789->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131789->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131789->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131789->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131789->free_i_114610;
    int64_t gtid_120578 = futhark_mc_task_131789->free_gtid_120578;
    int64_t x_120701 = futhark_mc_task_131789->free_x_120701;
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131789->free_mem_122004,
                                  .size =0, .references =NULL};
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131789->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131789->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131789->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131789->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123273 = futhark_mc_task_131789->free_bytes_123273;
    struct memblock mem_123347 = {.desc ="mem_123347", .mem =
                                  futhark_mc_task_131789->free_mem_123347,
                                  .size =0, .references =NULL};
    struct memblock mem_123350 = {.desc ="mem_123350", .mem =
                                  futhark_mc_task_131789->free_mem_123350,
                                  .size =0, .references =NULL};
    int64_t iter_130432;
    struct futhark_mc_segmap_parloop_struct_131798
    futhark_mc_segmap_parloop_struct_131798;
    
    futhark_mc_segmap_parloop_struct_131798.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131798.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131798.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131798.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131798.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131798.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131798.free_gtid_120578 = gtid_120578;
    futhark_mc_segmap_parloop_struct_131798.free_x_120701 = x_120701;
    futhark_mc_segmap_parloop_struct_131798.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131798.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131798.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131798.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131798.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131798.free_bytes_123273 = bytes_123273;
    futhark_mc_segmap_parloop_struct_131798.free_mem_123347 = mem_123347.mem;
    futhark_mc_segmap_parloop_struct_131798.free_mem_123350 = mem_123350.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131799_task;
    
    futhark_mc_segmap_parloop_131799_task.name =
        "futhark_mc_segmap_parloop_131799";
    futhark_mc_segmap_parloop_131799_task.fn = futhark_mc_segmap_parloop_131799;
    futhark_mc_segmap_parloop_131799_task.args =
        &futhark_mc_segmap_parloop_struct_131798;
    futhark_mc_segmap_parloop_131799_task.iterations = iterations;
    futhark_mc_segmap_parloop_131799_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131799_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131799_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131799_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131799_task);
    
    if (futhark_mc_segmap_parloop_131799_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131799_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131799_total_end -
                 futhark_mc_segmap_parloop_131799_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131799_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131799_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131799_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131797_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131797_end -
                 futhark_mc_segmap_nested_task_131797_start;
        
        ctx->futhark_mc_segmap_nested_task_131797_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131797_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131797_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131786(void *args, int64_t start,
                                            int64_t end, int flat_tid_120577,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131785
    *futhark_mc_segmap_parloop_struct_131785 =
    (struct futhark_mc_segmap_parloop_struct_131785 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131785->ctx;
    uint64_t futhark_mc_segmap_parloop_131786_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131786_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131785->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131785->free_n_114534;
    int64_t t_window_114537 =
            futhark_mc_segmap_parloop_struct_131785->free_t_window_114537;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131785->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131785->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131785->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_segmap_parloop_struct_131785->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_segmap_parloop_struct_131785->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 =
            futhark_mc_segmap_parloop_struct_131785->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_segmap_parloop_struct_131785->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_segmap_parloop_struct_131785->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_segmap_parloop_struct_131785->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_segmap_parloop_struct_131785->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123273 =
            futhark_mc_segmap_parloop_struct_131785->free_bytes_123273;
    struct memblock mem_123444 = {.desc ="mem_123444", .mem =
                                  futhark_mc_segmap_parloop_struct_131785->free_mem_123444,
                                  .size =0, .references =NULL};
    struct memblock mem_123448 = {.desc ="mem_123448", .mem =
                                  futhark_mc_segmap_parloop_struct_131785->free_mem_123448,
                                  .size =0, .references =NULL};
    size_t mem_123347_cached_sizze_131787 = 0;
    char *mem_123347 = NULL;
    size_t mem_123350_cached_sizze_131788 = 0;
    char *mem_123350 = NULL;
    int64_t iterations = end - start;
    int64_t iter_130123 = start;
    
    if (mem_123347_cached_sizze_131787 < (size_t) bytes_122135) {
        mem_123347 = realloc(mem_123347, bytes_122135);
        mem_123347_cached_sizze_131787 = bytes_122135;
    }
    if (mem_123350_cached_sizze_131788 < (size_t) bytes_122135) {
        mem_123350 = realloc(mem_123350, bytes_122135);
        mem_123350_cached_sizze_131788 = bytes_122135;
    }
    for (; iter_130123 < end; iter_130123++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130348 = m_114533;
        int64_t gtid_120578 = iter_130123;
        int64_t remnant_130349 = iter_130123 - gtid_120578;
        int64_t x_120701 = ((int64_t *) mem_121982.mem)[gtid_120578];
        int64_t flat_tid_120579 = (int64_t) 0;
        int32_t num_tasks_130350;
        int64_t flat_tid_120581 = (int64_t) 0;
        struct futhark_mc_task_131789 futhark_mc_task_131789;
        
        futhark_mc_task_131789.ctx = ctx;
        futhark_mc_task_131789.free_n_114534 = n_114534;
        futhark_mc_task_131789.free_t_window_114537 = t_window_114537;
        futhark_mc_task_131789.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131789.free_t_n_m_114591 = t_n_m_114591;
        futhark_mc_task_131789.free_i_114610 = i_114610;
        futhark_mc_task_131789.free_gtid_120578 = gtid_120578;
        futhark_mc_task_131789.free_x_120701 = x_120701;
        futhark_mc_task_131789.free_mem_122004 = mem_122004.mem;
        futhark_mc_task_131789.free_mem_122204 = mem_122204.mem;
        futhark_mc_task_131789.free_mem_122208 = mem_122208.mem;
        futhark_mc_task_131789.free_mem_122430 = mem_122430.mem;
        futhark_mc_task_131789.free_mem_122985 = mem_122985.mem;
        futhark_mc_task_131789.free_bytes_123273 = bytes_123273;
        futhark_mc_task_131789.free_mem_123347 = mem_123347;
        futhark_mc_task_131789.free_mem_123350 = mem_123350;
        
        struct scheduler_segop futhark_mc_task_131789_task;
        
        futhark_mc_task_131789_task.args = &futhark_mc_task_131789;
        futhark_mc_task_131789_task.top_level_fn =
            futhark_mc_segmap_task_131790;
        futhark_mc_task_131789_task.name = "futhark_mc_segmap_task_131790";
        futhark_mc_task_131789_task.iterations = t_n_m_114591;
        futhark_mc_task_131789_task.task_time =
            &ctx->futhark_mc_segmap_task_131790_total_time;
        futhark_mc_task_131789_task.task_iter =
            &ctx->futhark_mc_segmap_task_131790_total_iter;
        futhark_mc_task_131789_task.sched = STATIC;
        futhark_mc_task_131789_task.nested_fn =
            futhark_mc_segmap_nested_task_131797;
        
        int futhark_mc_segmap_task_131790_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131789_task);
        
        if (futhark_mc_segmap_task_131790_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_123444.mem + gtid_120578 * t_n_m_114591 * (int64_t) 4,
                mem_123347 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
        memmove(mem_123448.mem + gtid_120578 * t_n_m_114591 * (int64_t) 4,
                mem_123350 + (int64_t) 0, t_n_m_114591 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123347);
    free(mem_123350);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131786_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131786_end -
                 futhark_mc_segmap_parloop_131786_start;
        
        ctx->futhark_mc_segmap_parloop_131786_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131786_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131786_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131784(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120577 = tid;
    int num_tasks_129989 = info.nsubtasks;
    struct futhark_mc_task_131774 *futhark_mc_task_131774 =
                                  (struct futhark_mc_task_131774 *) args;
    struct futhark_context *ctx = futhark_mc_task_131774->ctx;
    uint64_t futhark_mc_segmap_nested_task_131784_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131784_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131774->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131774->free_n_114534;
    int64_t t_window_114537 = futhark_mc_task_131774->free_t_window_114537;
    int64_t t_jump_114541 = futhark_mc_task_131774->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131774->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131774->free_i_114610;
    struct memblock mem_121982 = {.desc ="mem_121982", .mem =
                                  futhark_mc_task_131774->free_mem_121982,
                                  .size =0, .references =NULL};
    struct memblock mem_122004 = {.desc ="mem_122004", .mem =
                                  futhark_mc_task_131774->free_mem_122004,
                                  .size =0, .references =NULL};
    int64_t bytes_122135 = futhark_mc_task_131774->free_bytes_122135;
    struct memblock mem_122204 = {.desc ="mem_122204", .mem =
                                  futhark_mc_task_131774->free_mem_122204,
                                  .size =0, .references =NULL};
    struct memblock mem_122208 = {.desc ="mem_122208", .mem =
                                  futhark_mc_task_131774->free_mem_122208,
                                  .size =0, .references =NULL};
    struct memblock mem_122430 = {.desc ="mem_122430", .mem =
                                  futhark_mc_task_131774->free_mem_122430,
                                  .size =0, .references =NULL};
    struct memblock mem_122985 = {.desc ="mem_122985", .mem =
                                  futhark_mc_task_131774->free_mem_122985,
                                  .size =0, .references =NULL};
    int64_t bytes_123273 = futhark_mc_task_131774->free_bytes_123273;
    struct memblock mem_123444 = {.desc ="mem_123444", .mem =
                                  futhark_mc_task_131774->free_mem_123444,
                                  .size =0, .references =NULL};
    struct memblock mem_123448 = {.desc ="mem_123448", .mem =
                                  futhark_mc_task_131774->free_mem_123448,
                                  .size =0, .references =NULL};
    int64_t iter_130123;
    struct futhark_mc_segmap_parloop_struct_131785
    futhark_mc_segmap_parloop_struct_131785;
    
    futhark_mc_segmap_parloop_struct_131785.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131785.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131785.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131785.free_t_window_114537 =
        t_window_114537;
    futhark_mc_segmap_parloop_struct_131785.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131785.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131785.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131785.free_mem_121982 = mem_121982.mem;
    futhark_mc_segmap_parloop_struct_131785.free_mem_122004 = mem_122004.mem;
    futhark_mc_segmap_parloop_struct_131785.free_bytes_122135 = bytes_122135;
    futhark_mc_segmap_parloop_struct_131785.free_mem_122204 = mem_122204.mem;
    futhark_mc_segmap_parloop_struct_131785.free_mem_122208 = mem_122208.mem;
    futhark_mc_segmap_parloop_struct_131785.free_mem_122430 = mem_122430.mem;
    futhark_mc_segmap_parloop_struct_131785.free_mem_122985 = mem_122985.mem;
    futhark_mc_segmap_parloop_struct_131785.free_bytes_123273 = bytes_123273;
    futhark_mc_segmap_parloop_struct_131785.free_mem_123444 = mem_123444.mem;
    futhark_mc_segmap_parloop_struct_131785.free_mem_123448 = mem_123448.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131786_task;
    
    futhark_mc_segmap_parloop_131786_task.name =
        "futhark_mc_segmap_parloop_131786";
    futhark_mc_segmap_parloop_131786_task.fn = futhark_mc_segmap_parloop_131786;
    futhark_mc_segmap_parloop_131786_task.args =
        &futhark_mc_segmap_parloop_struct_131785;
    futhark_mc_segmap_parloop_131786_task.iterations = iterations;
    futhark_mc_segmap_parloop_131786_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131786_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131786_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131786_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131786_task);
    
    if (futhark_mc_segmap_parloop_131786_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131786_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131786_total_end -
                 futhark_mc_segmap_parloop_131786_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131786_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131786_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131786_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131784_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131784_end -
                 futhark_mc_segmap_nested_task_131784_start;
        
        ctx->futhark_mc_segmap_nested_task_131784_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131784_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131784_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131823 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_y_116486;
    int64_t free_bytes_121983;
    char *free_defunc_11_loess_l_res_mem_123453;
    char *free_defunc_11_loess_l_res_mem_123454;
    char *free_mem_123476;
};
struct futhark_mc_segmap_parloop_struct_131825 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_y_116486;
    int64_t free_bytes_121983;
    char *free_defunc_11_loess_l_res_mem_123453;
    char *free_defunc_11_loess_l_res_mem_123454;
    char *free_mem_123476;
};
static int futhark_mc_segmap_parloop_131826(void *args, int64_t start,
                                            int64_t end, int flat_tid_120918,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131825
    *futhark_mc_segmap_parloop_struct_131825 =
    (struct futhark_mc_segmap_parloop_struct_131825 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131825->ctx;
    uint64_t futhark_mc_segmap_parloop_131826_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131826_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131825->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131825->free_n_114534;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131825->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131825->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131825->free_i_114610;
    int64_t y_116486 = futhark_mc_segmap_parloop_struct_131825->free_y_116486;
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131825->free_bytes_121983;
    struct memblock defunc_11_loess_l_res_mem_123453 = {.desc =
                                                        "defunc_11_loess_l_res_mem_123453",
                                                        .mem =
                                                        futhark_mc_segmap_parloop_struct_131825->free_defunc_11_loess_l_res_mem_123453,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock defunc_11_loess_l_res_mem_123454 = {.desc =
                                                        "defunc_11_loess_l_res_mem_123454",
                                                        .mem =
                                                        futhark_mc_segmap_parloop_struct_131825->free_defunc_11_loess_l_res_mem_123454,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock mem_123476 = {.desc ="mem_123476", .mem =
                                  futhark_mc_segmap_parloop_struct_131825->free_mem_123476,
                                  .size =0, .references =NULL};
    size_t mem_123460_cached_sizze_131827 = 0;
    char *mem_123460 = NULL;
    int64_t iterations = end - start;
    int64_t iter_130556 = start;
    
    if (mem_123460_cached_sizze_131827 < (size_t) bytes_121983) {
        mem_123460 = realloc(mem_123460, bytes_121983);
        mem_123460_cached_sizze_131827 = bytes_121983;
    }
    for (; iter_130556 < end; iter_130556++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130606 = m_114533;
        int64_t gtid_120919 = iter_130556;
        int64_t remnant_130607 = iter_130556 - gtid_120919;
        
        for (int64_t i_130557 = 0; i_130557 < n_114534; i_130557++) {
            int64_t m_v_130559 = sdiv64(i_130557, t_jump_114541);
            bool cond_130560 = m_v_130559 == y_116486;
            int64_t j_130561;
            
            if (cond_130560) {
                int64_t j_t_res_130562 = sub64(m_v_130559, (int64_t) 1);
                
                j_130561 = j_t_res_130562;
            } else {
                j_130561 = m_v_130559;
            }
            
            int64_t min_arg_130563 = mul64(t_jump_114541, j_130561);
            int64_t min_res_130564 = smin64(i_114610, min_arg_130563);
            int64_t defunc_0_m_fun_arg_130565 = add64((int64_t) 1, j_130561);
            int64_t min_arg_130566 = mul64(t_jump_114541,
                                           defunc_0_m_fun_arg_130565);
            int64_t min_res_130567 = smin64(i_114610, min_arg_130566);
            int64_t i64_arg_130568 = sub64(min_res_130567, min_res_130564);
            float i64_res_130569 = sitofp_i64_f32(i64_arg_130568);
            int64_t i64_arg_130570 = sub64(i_130557, min_res_130564);
            float i64_res_130571 = sitofp_i64_f32(i64_arg_130570);
            float u_130572 = i64_res_130571 / i64_res_130569;
            float u2_130573 = u_130572 * u_130572;
            float u3_130574 = u_130572 * u2_130573;
            float x_130575 = 2.0F * u3_130574;
            float y_130576 = 3.0F * u2_130573;
            float x_130577 = x_130575 - y_130576;
            float x_130578 = 1.0F + x_130577;
            bool x_130579 = sle64((int64_t) 0, j_130561);
            bool y_130580 = slt64(j_130561, t_n_m_114591);
            bool bounds_check_130581 = x_130579 && y_130580;
            bool index_certs_130582;
            
            if (!bounds_check_130581) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", j_130561,
                              "] out of bounds for array of shape [",
                              t_n_m_114591, "].",
                              "-> #0  stl.fut:63:41-47\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:54:3-67:14\n   #4  stl.fut:300:23-69\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:299:15-301:43\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                return 1;
            }
            
            float y_130583 =
                  ((float *) defunc_11_loess_l_res_mem_123453.mem)[gtid_120919 *
                                                                   t_n_m_114591 +
                                                                   j_130561];
            float x_130584 = x_130578 * y_130583;
            float x_130585 = y_130576 - x_130575;
            bool x_130586 = sle64((int64_t) 0, defunc_0_m_fun_arg_130565);
            bool y_130587 = slt64(defunc_0_m_fun_arg_130565, t_n_m_114591);
            bool bounds_check_130588 = x_130586 && y_130587;
            bool index_certs_130589;
            
            if (!bounds_check_130588) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", defunc_0_m_fun_arg_130565,
                              "] out of bounds for array of shape [",
                              t_n_m_114591, "].",
                              "-> #0  stl.fut:64:41-51\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:54:3-67:14\n   #4  stl.fut:300:23-69\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:299:15-301:43\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                return 1;
            }
            
            float y_130590 =
                  ((float *) defunc_11_loess_l_res_mem_123453.mem)[gtid_120919 *
                                                                   t_n_m_114591 +
                                                                   defunc_0_m_fun_arg_130565];
            float y_130591 = x_130585 * y_130590;
            float x_130592 = x_130584 + y_130591;
            float y_130593 = 2.0F * u2_130573;
            float x_130594 = u3_130574 - y_130593;
            float x_130595 = u_130572 + x_130594;
            float y_130596 =
                  ((float *) defunc_11_loess_l_res_mem_123454.mem)[gtid_120919 *
                                                                   t_n_m_114591 +
                                                                   j_130561];
            float x_130597 = x_130595 * y_130596;
            float y_130598 = i64_res_130569 * x_130597;
            float x_130599 = x_130592 + y_130598;
            float x_130600 = u3_130574 - u2_130573;
            float y_130601 =
                  ((float *) defunc_11_loess_l_res_mem_123454.mem)[gtid_120919 *
                                                                   t_n_m_114591 +
                                                                   defunc_0_m_fun_arg_130565];
            float x_130602 = x_130600 * y_130601;
            float y_130603 = i64_res_130569 * x_130602;
            float defunc_0_f_res_130604 = x_130599 + y_130603;
            
            ((float *) mem_123460)[i_130557] = defunc_0_f_res_130604;
        }
        memmove(mem_123476.mem + gtid_120919 * n_114534 * (int64_t) 4,
                mem_123460 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123460);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131826_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131826_end -
                 futhark_mc_segmap_parloop_131826_start;
        
        ctx->futhark_mc_segmap_parloop_131826_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131826_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131826_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131824(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120918 = tid;
    int num_tasks_130555 = info.nsubtasks;
    struct futhark_mc_task_131823 *futhark_mc_task_131823 =
                                  (struct futhark_mc_task_131823 *) args;
    struct futhark_context *ctx = futhark_mc_task_131823->ctx;
    uint64_t futhark_mc_segmap_task_131824_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131824_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131823->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131823->free_n_114534;
    int64_t t_jump_114541 = futhark_mc_task_131823->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131823->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131823->free_i_114610;
    int64_t y_116486 = futhark_mc_task_131823->free_y_116486;
    int64_t bytes_121983 = futhark_mc_task_131823->free_bytes_121983;
    struct memblock defunc_11_loess_l_res_mem_123453 = {.desc =
                                                        "defunc_11_loess_l_res_mem_123453",
                                                        .mem =
                                                        futhark_mc_task_131823->free_defunc_11_loess_l_res_mem_123453,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock defunc_11_loess_l_res_mem_123454 = {.desc =
                                                        "defunc_11_loess_l_res_mem_123454",
                                                        .mem =
                                                        futhark_mc_task_131823->free_defunc_11_loess_l_res_mem_123454,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock mem_123476 = {.desc ="mem_123476", .mem =
                                  futhark_mc_task_131823->free_mem_123476,
                                  .size =0, .references =NULL};
    int64_t iter_130556;
    struct futhark_mc_segmap_parloop_struct_131825
    futhark_mc_segmap_parloop_struct_131825;
    
    futhark_mc_segmap_parloop_struct_131825.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131825.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131825.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131825.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131825.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131825.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131825.free_y_116486 = y_116486;
    futhark_mc_segmap_parloop_struct_131825.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131825.free_defunc_11_loess_l_res_mem_123453 =
        defunc_11_loess_l_res_mem_123453.mem;
    futhark_mc_segmap_parloop_struct_131825.free_defunc_11_loess_l_res_mem_123454 =
        defunc_11_loess_l_res_mem_123454.mem;
    futhark_mc_segmap_parloop_struct_131825.free_mem_123476 = mem_123476.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131826_task;
    
    futhark_mc_segmap_parloop_131826_task.name =
        "futhark_mc_segmap_parloop_131826";
    futhark_mc_segmap_parloop_131826_task.fn = futhark_mc_segmap_parloop_131826;
    futhark_mc_segmap_parloop_131826_task.args =
        &futhark_mc_segmap_parloop_struct_131825;
    futhark_mc_segmap_parloop_131826_task.iterations = iterations;
    futhark_mc_segmap_parloop_131826_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131826_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131826_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131826_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131826_task);
    
    if (futhark_mc_segmap_parloop_131826_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131826_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131826_total_end -
                 futhark_mc_segmap_parloop_131826_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131826_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131826_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131826_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131824_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131824_end -
                 futhark_mc_segmap_task_131824_start;
        
        ctx->futhark_mc_segmap_task_131824_runs[tid]++;
        ctx->futhark_mc_segmap_task_131824_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131824_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131829 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_y_116486;
    int64_t free_bytes_121983;
    char *free_defunc_11_loess_l_res_mem_123453;
    char *free_defunc_11_loess_l_res_mem_123454;
    char *free_mem_123476;
};
struct futhark_mc_task_131832 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_y_116486;
    int64_t free_gtid_120921;
    char *free_defunc_11_loess_l_res_mem_123453;
    char *free_defunc_11_loess_l_res_mem_123454;
    char *free_mem_123457;
};
struct futhark_mc_segmap_parloop_struct_131834 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_t_jump_114541;
    int64_t free_t_n_m_114591;
    int64_t free_i_114610;
    int64_t free_y_116486;
    int64_t free_gtid_120921;
    char *free_defunc_11_loess_l_res_mem_123453;
    char *free_defunc_11_loess_l_res_mem_123454;
    char *free_mem_123457;
};
static int futhark_mc_segmap_parloop_131835(void *args, int64_t start,
                                            int64_t end, int flat_tid_120922,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131834
    *futhark_mc_segmap_parloop_struct_131834 =
    (struct futhark_mc_segmap_parloop_struct_131834 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131834->ctx;
    uint64_t futhark_mc_segmap_parloop_131835_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131835_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131834->free_n_114534;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131834->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131834->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131834->free_i_114610;
    int64_t y_116486 = futhark_mc_segmap_parloop_struct_131834->free_y_116486;
    int64_t gtid_120921 =
            futhark_mc_segmap_parloop_struct_131834->free_gtid_120921;
    struct memblock defunc_11_loess_l_res_mem_123453 = {.desc =
                                                        "defunc_11_loess_l_res_mem_123453",
                                                        .mem =
                                                        futhark_mc_segmap_parloop_struct_131834->free_defunc_11_loess_l_res_mem_123453,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock defunc_11_loess_l_res_mem_123454 = {.desc =
                                                        "defunc_11_loess_l_res_mem_123454",
                                                        .mem =
                                                        futhark_mc_segmap_parloop_struct_131834->free_defunc_11_loess_l_res_mem_123454,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock mem_123457 = {.desc ="mem_123457", .mem =
                                  futhark_mc_segmap_parloop_struct_131834->free_mem_123457,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_130659 = start;
    
    for (; iter_130659 < end; iter_130659++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130661 = n_114534;
        int64_t gtid_120923 = iter_130659;
        int64_t remnant_130662 = iter_130659 - gtid_120923;
        int64_t m_v_130610 = sdiv64(gtid_120923, t_jump_114541);
        bool cond_130611 = m_v_130610 == y_116486;
        int64_t j_130612;
        
        if (cond_130611) {
            int64_t j_t_res_130660 = sub64(m_v_130610, (int64_t) 1);
            
            j_130612 = j_t_res_130660;
        } else {
            j_130612 = m_v_130610;
        }
        
        int64_t min_arg_130614 = mul64(t_jump_114541, j_130612);
        int64_t min_res_130615 = smin64(i_114610, min_arg_130614);
        int64_t defunc_0_m_fun_arg_130616 = add64((int64_t) 1, j_130612);
        int64_t min_arg_130617 = mul64(t_jump_114541,
                                       defunc_0_m_fun_arg_130616);
        int64_t min_res_130618 = smin64(i_114610, min_arg_130617);
        int64_t i64_arg_130619 = sub64(min_res_130618, min_res_130615);
        float i64_res_130620 = sitofp_i64_f32(i64_arg_130619);
        int64_t i64_arg_130621 = sub64(gtid_120923, min_res_130615);
        float i64_res_130622 = sitofp_i64_f32(i64_arg_130621);
        float u_130623 = i64_res_130622 / i64_res_130620;
        float u2_130624 = u_130623 * u_130623;
        float u3_130625 = u_130623 * u2_130624;
        float x_130626 = 2.0F * u3_130625;
        float y_130627 = 3.0F * u2_130624;
        float x_130628 = x_130626 - y_130627;
        float x_130629 = 1.0F + x_130628;
        bool x_130630 = sle64((int64_t) 0, j_130612);
        bool y_130631 = slt64(j_130612, t_n_m_114591);
        bool bounds_check_130632 = x_130630 && y_130631;
        bool index_certs_130633;
        
        if (!bounds_check_130632) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", j_130612,
                                   "] out of bounds for array of shape [",
                                   t_n_m_114591, "].",
                                   "-> #0  stl.fut:63:41-47\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:54:3-67:14\n   #4  stl.fut:300:23-69\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:299:15-301:43\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
            return 1;
        }
        
        float y_130634 =
              ((float *) defunc_11_loess_l_res_mem_123453.mem)[gtid_120921 *
                                                               t_n_m_114591 +
                                                               j_130612];
        float x_130635 = x_130629 * y_130634;
        float x_130636 = y_130627 - x_130626;
        bool x_130637 = sle64((int64_t) 0, defunc_0_m_fun_arg_130616);
        bool y_130638 = slt64(defunc_0_m_fun_arg_130616, t_n_m_114591);
        bool bounds_check_130639 = x_130637 && y_130638;
        bool index_certs_130640;
        
        if (!bounds_check_130639) {
            ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                   "Index [", defunc_0_m_fun_arg_130616,
                                   "] out of bounds for array of shape [",
                                   t_n_m_114591, "].",
                                   "-> #0  stl.fut:64:41-51\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:54:3-67:14\n   #4  stl.fut:300:23-69\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:299:15-301:43\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
            return 1;
        }
        
        float y_130641 =
              ((float *) defunc_11_loess_l_res_mem_123453.mem)[gtid_120921 *
                                                               t_n_m_114591 +
                                                               defunc_0_m_fun_arg_130616];
        float y_130642 = x_130636 * y_130641;
        float x_130643 = x_130635 + y_130642;
        float y_130644 = 2.0F * u2_130624;
        float x_130645 = u3_130625 - y_130644;
        float x_130646 = u_130623 + x_130645;
        float y_130647 =
              ((float *) defunc_11_loess_l_res_mem_123454.mem)[gtid_120921 *
                                                               t_n_m_114591 +
                                                               j_130612];
        float x_130648 = x_130646 * y_130647;
        float y_130649 = i64_res_130620 * x_130648;
        float x_130650 = x_130643 + y_130649;
        float x_130651 = u3_130625 - u2_130624;
        float y_130652 =
              ((float *) defunc_11_loess_l_res_mem_123454.mem)[gtid_120921 *
                                                               t_n_m_114591 +
                                                               defunc_0_m_fun_arg_130616];
        float x_130653 = x_130651 * y_130652;
        float y_130654 = i64_res_130620 * x_130653;
        float defunc_0_f_res_130655 = x_130650 + y_130654;
        
        ((float *) mem_123457.mem)[gtid_120923] = defunc_0_f_res_130655;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131835_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131835_end -
                 futhark_mc_segmap_parloop_131835_start;
        
        ctx->futhark_mc_segmap_parloop_131835_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131835_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131835_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131833(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120922 = tid;
    int num_tasks_130658 = info.nsubtasks;
    struct futhark_mc_task_131832 *futhark_mc_task_131832 =
                                  (struct futhark_mc_task_131832 *) args;
    struct futhark_context *ctx = futhark_mc_task_131832->ctx;
    uint64_t futhark_mc_segmap_task_131833_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131833_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131832->free_n_114534;
    int64_t t_jump_114541 = futhark_mc_task_131832->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131832->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131832->free_i_114610;
    int64_t y_116486 = futhark_mc_task_131832->free_y_116486;
    int64_t gtid_120921 = futhark_mc_task_131832->free_gtid_120921;
    struct memblock defunc_11_loess_l_res_mem_123453 = {.desc =
                                                        "defunc_11_loess_l_res_mem_123453",
                                                        .mem =
                                                        futhark_mc_task_131832->free_defunc_11_loess_l_res_mem_123453,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock defunc_11_loess_l_res_mem_123454 = {.desc =
                                                        "defunc_11_loess_l_res_mem_123454",
                                                        .mem =
                                                        futhark_mc_task_131832->free_defunc_11_loess_l_res_mem_123454,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock mem_123457 = {.desc ="mem_123457", .mem =
                                  futhark_mc_task_131832->free_mem_123457,
                                  .size =0, .references =NULL};
    int64_t iter_130659;
    struct futhark_mc_segmap_parloop_struct_131834
    futhark_mc_segmap_parloop_struct_131834;
    
    futhark_mc_segmap_parloop_struct_131834.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131834.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131834.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131834.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131834.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131834.free_y_116486 = y_116486;
    futhark_mc_segmap_parloop_struct_131834.free_gtid_120921 = gtid_120921;
    futhark_mc_segmap_parloop_struct_131834.free_defunc_11_loess_l_res_mem_123453 =
        defunc_11_loess_l_res_mem_123453.mem;
    futhark_mc_segmap_parloop_struct_131834.free_defunc_11_loess_l_res_mem_123454 =
        defunc_11_loess_l_res_mem_123454.mem;
    futhark_mc_segmap_parloop_struct_131834.free_mem_123457 = mem_123457.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131835_task;
    
    futhark_mc_segmap_parloop_131835_task.name =
        "futhark_mc_segmap_parloop_131835";
    futhark_mc_segmap_parloop_131835_task.fn = futhark_mc_segmap_parloop_131835;
    futhark_mc_segmap_parloop_131835_task.args =
        &futhark_mc_segmap_parloop_struct_131834;
    futhark_mc_segmap_parloop_131835_task.iterations = iterations;
    futhark_mc_segmap_parloop_131835_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131835_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131835_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131835_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131835_task);
    
    if (futhark_mc_segmap_parloop_131835_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131835_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131835_total_end -
                 futhark_mc_segmap_parloop_131835_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131835_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131835_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131835_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131833_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131833_end -
                 futhark_mc_segmap_task_131833_start;
        
        ctx->futhark_mc_segmap_task_131833_runs[tid]++;
        ctx->futhark_mc_segmap_task_131833_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131833_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131830(void *args, int64_t start,
                                            int64_t end, int flat_tid_120920,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131829
    *futhark_mc_segmap_parloop_struct_131829 =
    (struct futhark_mc_segmap_parloop_struct_131829 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131829->ctx;
    uint64_t futhark_mc_segmap_parloop_131830_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131830_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131829->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131829->free_n_114534;
    int64_t t_jump_114541 =
            futhark_mc_segmap_parloop_struct_131829->free_t_jump_114541;
    int64_t t_n_m_114591 =
            futhark_mc_segmap_parloop_struct_131829->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131829->free_i_114610;
    int64_t y_116486 = futhark_mc_segmap_parloop_struct_131829->free_y_116486;
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131829->free_bytes_121983;
    struct memblock defunc_11_loess_l_res_mem_123453 = {.desc =
                                                        "defunc_11_loess_l_res_mem_123453",
                                                        .mem =
                                                        futhark_mc_segmap_parloop_struct_131829->free_defunc_11_loess_l_res_mem_123453,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock defunc_11_loess_l_res_mem_123454 = {.desc =
                                                        "defunc_11_loess_l_res_mem_123454",
                                                        .mem =
                                                        futhark_mc_segmap_parloop_struct_131829->free_defunc_11_loess_l_res_mem_123454,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock mem_123476 = {.desc ="mem_123476", .mem =
                                  futhark_mc_segmap_parloop_struct_131829->free_mem_123476,
                                  .size =0, .references =NULL};
    size_t mem_123457_cached_sizze_131831 = 0;
    char *mem_123457 = NULL;
    int64_t iterations = end - start;
    int64_t iter_130609 = start;
    
    if (mem_123457_cached_sizze_131831 < (size_t) bytes_121983) {
        mem_123457 = realloc(mem_123457, bytes_121983);
        mem_123457_cached_sizze_131831 = bytes_121983;
    }
    for (; iter_130609 < end; iter_130609++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130656 = m_114533;
        int64_t gtid_120921 = iter_130609;
        int64_t remnant_130657 = iter_130609 - gtid_120921;
        int64_t flat_tid_120922 = (int64_t) 0;
        int32_t num_tasks_130658;
        struct futhark_mc_task_131832 futhark_mc_task_131832;
        
        futhark_mc_task_131832.ctx = ctx;
        futhark_mc_task_131832.free_n_114534 = n_114534;
        futhark_mc_task_131832.free_t_jump_114541 = t_jump_114541;
        futhark_mc_task_131832.free_t_n_m_114591 = t_n_m_114591;
        futhark_mc_task_131832.free_i_114610 = i_114610;
        futhark_mc_task_131832.free_y_116486 = y_116486;
        futhark_mc_task_131832.free_gtid_120921 = gtid_120921;
        futhark_mc_task_131832.free_defunc_11_loess_l_res_mem_123453 =
            defunc_11_loess_l_res_mem_123453.mem;
        futhark_mc_task_131832.free_defunc_11_loess_l_res_mem_123454 =
            defunc_11_loess_l_res_mem_123454.mem;
        futhark_mc_task_131832.free_mem_123457 = mem_123457;
        
        struct scheduler_segop futhark_mc_task_131832_task;
        
        futhark_mc_task_131832_task.args = &futhark_mc_task_131832;
        futhark_mc_task_131832_task.top_level_fn =
            futhark_mc_segmap_task_131833;
        futhark_mc_task_131832_task.name = "futhark_mc_segmap_task_131833";
        futhark_mc_task_131832_task.iterations = n_114534;
        futhark_mc_task_131832_task.task_time =
            &ctx->futhark_mc_segmap_task_131833_total_time;
        futhark_mc_task_131832_task.task_iter =
            &ctx->futhark_mc_segmap_task_131833_total_iter;
        futhark_mc_task_131832_task.sched = STATIC;
        futhark_mc_task_131832_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131833_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131832_task);
        
        if (futhark_mc_segmap_task_131833_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_123476.mem + gtid_120921 * n_114534 * (int64_t) 4,
                mem_123457 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123457);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131830_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131830_end -
                 futhark_mc_segmap_parloop_131830_start;
        
        ctx->futhark_mc_segmap_parloop_131830_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131830_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131830_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131828(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120920 = tid;
    int num_tasks_130555 = info.nsubtasks;
    struct futhark_mc_task_131823 *futhark_mc_task_131823 =
                                  (struct futhark_mc_task_131823 *) args;
    struct futhark_context *ctx = futhark_mc_task_131823->ctx;
    uint64_t futhark_mc_segmap_nested_task_131828_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131828_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131823->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131823->free_n_114534;
    int64_t t_jump_114541 = futhark_mc_task_131823->free_t_jump_114541;
    int64_t t_n_m_114591 = futhark_mc_task_131823->free_t_n_m_114591;
    int64_t i_114610 = futhark_mc_task_131823->free_i_114610;
    int64_t y_116486 = futhark_mc_task_131823->free_y_116486;
    int64_t bytes_121983 = futhark_mc_task_131823->free_bytes_121983;
    struct memblock defunc_11_loess_l_res_mem_123453 = {.desc =
                                                        "defunc_11_loess_l_res_mem_123453",
                                                        .mem =
                                                        futhark_mc_task_131823->free_defunc_11_loess_l_res_mem_123453,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock defunc_11_loess_l_res_mem_123454 = {.desc =
                                                        "defunc_11_loess_l_res_mem_123454",
                                                        .mem =
                                                        futhark_mc_task_131823->free_defunc_11_loess_l_res_mem_123454,
                                                        .size =0, .references =
                                                        NULL};
    struct memblock mem_123476 = {.desc ="mem_123476", .mem =
                                  futhark_mc_task_131823->free_mem_123476,
                                  .size =0, .references =NULL};
    int64_t iter_130609;
    struct futhark_mc_segmap_parloop_struct_131829
    futhark_mc_segmap_parloop_struct_131829;
    
    futhark_mc_segmap_parloop_struct_131829.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131829.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131829.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131829.free_t_jump_114541 = t_jump_114541;
    futhark_mc_segmap_parloop_struct_131829.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_segmap_parloop_struct_131829.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131829.free_y_116486 = y_116486;
    futhark_mc_segmap_parloop_struct_131829.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131829.free_defunc_11_loess_l_res_mem_123453 =
        defunc_11_loess_l_res_mem_123453.mem;
    futhark_mc_segmap_parloop_struct_131829.free_defunc_11_loess_l_res_mem_123454 =
        defunc_11_loess_l_res_mem_123454.mem;
    futhark_mc_segmap_parloop_struct_131829.free_mem_123476 = mem_123476.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131830_task;
    
    futhark_mc_segmap_parloop_131830_task.name =
        "futhark_mc_segmap_parloop_131830";
    futhark_mc_segmap_parloop_131830_task.fn = futhark_mc_segmap_parloop_131830;
    futhark_mc_segmap_parloop_131830_task.args =
        &futhark_mc_segmap_parloop_struct_131829;
    futhark_mc_segmap_parloop_131830_task.iterations = iterations;
    futhark_mc_segmap_parloop_131830_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131830_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131830_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131830_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131830_task);
    
    if (futhark_mc_segmap_parloop_131830_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131830_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131830_total_end -
                 futhark_mc_segmap_parloop_131830_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131830_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131830_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131830_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131828_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131828_end -
                 futhark_mc_segmap_nested_task_131828_start;
        
        ctx->futhark_mc_segmap_nested_task_131828_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131828_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131828_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131836 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_Y_mem_121939;
    int64_t free_bytes_121983;
    char *free_loopres_mem_123490;
    int64_t free_loopres_ixfn_123494;
    char *free_loopres_mem_123498;
    char *free_mem_123520;
};
struct futhark_mc_segmap_parloop_struct_131838 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_Y_mem_121939;
    int64_t free_bytes_121983;
    char *free_loopres_mem_123490;
    int64_t free_loopres_ixfn_123494;
    char *free_loopres_mem_123498;
    char *free_mem_123520;
};
static int futhark_mc_segmap_parloop_131839(void *args, int64_t start,
                                            int64_t end, int flat_tid_120974,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131838
    *futhark_mc_segmap_parloop_struct_131838 =
    (struct futhark_mc_segmap_parloop_struct_131838 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131838->ctx;
    uint64_t futhark_mc_segmap_parloop_131839_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131839_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131838->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131838->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131838->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131838->free_bytes_121983;
    struct memblock loopres_mem_123490 = {.desc ="loopres_mem_123490", .mem =
                                          futhark_mc_segmap_parloop_struct_131838->free_loopres_mem_123490,
                                          .size =0, .references =NULL};
    int64_t loopres_ixfn_123494 =
            futhark_mc_segmap_parloop_struct_131838->free_loopres_ixfn_123494;
    struct memblock loopres_mem_123498 = {.desc ="loopres_mem_123498", .mem =
                                          futhark_mc_segmap_parloop_struct_131838->free_loopres_mem_123498,
                                          .size =0, .references =NULL};
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_segmap_parloop_struct_131838->free_mem_123520,
                                  .size =0, .references =NULL};
    size_t mem_123504_cached_sizze_131840 = 0;
    char *mem_123504 = NULL;
    int64_t iterations = end - start;
    int64_t iter_130664 = start;
    
    if (mem_123504_cached_sizze_131840 < (size_t) bytes_121983) {
        mem_123504 = realloc(mem_123504, bytes_121983);
        mem_123504_cached_sizze_131840 = bytes_121983;
    }
    for (; iter_130664 < end; iter_130664++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130676 = m_114533;
        int64_t gtid_120975 = iter_130664;
        int64_t remnant_130677 = iter_130664 - gtid_120975;
        
        for (int64_t i_130665 = 0; i_130665 < n_114534; i_130665++) {
            float x_130667 = ((float *) Y_mem_121939.mem)[gtid_120975 *
                                                          n_114534 + i_130665];
            float x_130668 = ((float *) loopres_mem_123490.mem)[gtid_120975 *
                                                                n_114534 +
                                                                i_130665];
            float x_130669 = ((float *) loopres_mem_123498.mem)[gtid_120975 *
                                                                loopres_ixfn_123494 +
                                                                i_130665];
            float x_130670 = x_130667 - x_130668;
            float defunc_2_f_res_130671 = x_130670 - x_130669;
            bool isnan_res_130672;
            
            isnan_res_130672 = futrts_isnan32(defunc_2_f_res_130671);
            
            float defunc_0_f_res_130673;
            
            if (isnan_res_130672) {
                defunc_0_f_res_130673 = NAN;
            } else {
                float abs_res_130674 = (float) fabs(defunc_2_f_res_130671);
                
                defunc_0_f_res_130673 = abs_res_130674;
            }
            ((float *) mem_123504)[i_130665] = defunc_0_f_res_130673;
        }
        memmove(mem_123520.mem + gtid_120975 * n_114534 * (int64_t) 4,
                mem_123504 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123504);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131839_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131839_end -
                 futhark_mc_segmap_parloop_131839_start;
        
        ctx->futhark_mc_segmap_parloop_131839_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131839_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131839_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131837(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120974 = tid;
    int num_tasks_130663 = info.nsubtasks;
    struct futhark_mc_task_131836 *futhark_mc_task_131836 =
                                  (struct futhark_mc_task_131836 *) args;
    struct futhark_context *ctx = futhark_mc_task_131836->ctx;
    uint64_t futhark_mc_segmap_task_131837_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131837_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131836->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131836->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131836->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131836->free_bytes_121983;
    struct memblock loopres_mem_123490 = {.desc ="loopres_mem_123490", .mem =
                                          futhark_mc_task_131836->free_loopres_mem_123490,
                                          .size =0, .references =NULL};
    int64_t loopres_ixfn_123494 =
            futhark_mc_task_131836->free_loopres_ixfn_123494;
    struct memblock loopres_mem_123498 = {.desc ="loopres_mem_123498", .mem =
                                          futhark_mc_task_131836->free_loopres_mem_123498,
                                          .size =0, .references =NULL};
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_task_131836->free_mem_123520,
                                  .size =0, .references =NULL};
    int64_t iter_130664;
    struct futhark_mc_segmap_parloop_struct_131838
    futhark_mc_segmap_parloop_struct_131838;
    
    futhark_mc_segmap_parloop_struct_131838.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131838.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131838.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131838.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131838.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131838.free_loopres_mem_123490 =
        loopres_mem_123490.mem;
    futhark_mc_segmap_parloop_struct_131838.free_loopres_ixfn_123494 =
        loopres_ixfn_123494;
    futhark_mc_segmap_parloop_struct_131838.free_loopres_mem_123498 =
        loopres_mem_123498.mem;
    futhark_mc_segmap_parloop_struct_131838.free_mem_123520 = mem_123520.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131839_task;
    
    futhark_mc_segmap_parloop_131839_task.name =
        "futhark_mc_segmap_parloop_131839";
    futhark_mc_segmap_parloop_131839_task.fn = futhark_mc_segmap_parloop_131839;
    futhark_mc_segmap_parloop_131839_task.args =
        &futhark_mc_segmap_parloop_struct_131838;
    futhark_mc_segmap_parloop_131839_task.iterations = iterations;
    futhark_mc_segmap_parloop_131839_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131839_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131839_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131839_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131839_task);
    
    if (futhark_mc_segmap_parloop_131839_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131839_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131839_total_end -
                 futhark_mc_segmap_parloop_131839_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131839_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131839_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131839_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131837_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131837_end -
                 futhark_mc_segmap_task_131837_start;
        
        ctx->futhark_mc_segmap_task_131837_runs[tid]++;
        ctx->futhark_mc_segmap_task_131837_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131837_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131842 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_Y_mem_121939;
    int64_t free_bytes_121983;
    char *free_loopres_mem_123490;
    int64_t free_loopres_ixfn_123494;
    char *free_loopres_mem_123498;
    char *free_mem_123520;
};
struct futhark_mc_task_131845 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120977;
    char *free_Y_mem_121939;
    char *free_loopres_mem_123490;
    int64_t free_loopres_ixfn_123494;
    char *free_loopres_mem_123498;
    char *free_mem_123501;
};
struct futhark_mc_segmap_parloop_struct_131847 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120977;
    char *free_Y_mem_121939;
    char *free_loopres_mem_123490;
    int64_t free_loopres_ixfn_123494;
    char *free_loopres_mem_123498;
    char *free_mem_123501;
};
static int futhark_mc_segmap_parloop_131848(void *args, int64_t start,
                                            int64_t end, int flat_tid_120978,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131847
    *futhark_mc_segmap_parloop_struct_131847 =
    (struct futhark_mc_segmap_parloop_struct_131847 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131847->ctx;
    uint64_t futhark_mc_segmap_parloop_131848_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131848_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131847->free_n_114534;
    int64_t gtid_120977 =
            futhark_mc_segmap_parloop_struct_131847->free_gtid_120977;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131847->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock loopres_mem_123490 = {.desc ="loopres_mem_123490", .mem =
                                          futhark_mc_segmap_parloop_struct_131847->free_loopres_mem_123490,
                                          .size =0, .references =NULL};
    int64_t loopres_ixfn_123494 =
            futhark_mc_segmap_parloop_struct_131847->free_loopres_ixfn_123494;
    struct memblock loopres_mem_123498 = {.desc ="loopres_mem_123498", .mem =
                                          futhark_mc_segmap_parloop_struct_131847->free_loopres_mem_123498,
                                          .size =0, .references =NULL};
    struct memblock mem_123501 = {.desc ="mem_123501", .mem =
                                  futhark_mc_segmap_parloop_struct_131847->free_mem_123501,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_130691 = start;
    
    for (; iter_130691 < end; iter_130691++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130693 = n_114534;
        int64_t gtid_120979 = iter_130691;
        int64_t remnant_130694 = iter_130691 - gtid_120979;
        float x_130680 = ((float *) Y_mem_121939.mem)[gtid_120977 * n_114534 +
                                                      gtid_120979];
        float x_130681 = ((float *) loopres_mem_123490.mem)[gtid_120977 *
                                                            n_114534 +
                                                            gtid_120979];
        float x_130682 = ((float *) loopres_mem_123498.mem)[gtid_120977 *
                                                            loopres_ixfn_123494 +
                                                            gtid_120979];
        float x_130683 = x_130680 - x_130681;
        float defunc_2_f_res_130684 = x_130683 - x_130682;
        bool isnan_res_130685;
        
        isnan_res_130685 = futrts_isnan32(defunc_2_f_res_130684);
        
        float defunc_0_f_res_130686;
        
        if (isnan_res_130685) {
            defunc_0_f_res_130686 = NAN;
        } else {
            float abs_res_130692 = (float) fabs(defunc_2_f_res_130684);
            
            defunc_0_f_res_130686 = abs_res_130692;
        }
        ((float *) mem_123501.mem)[gtid_120979] = defunc_0_f_res_130686;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131848_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131848_end -
                 futhark_mc_segmap_parloop_131848_start;
        
        ctx->futhark_mc_segmap_parloop_131848_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131848_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131848_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131846(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120978 = tid;
    int num_tasks_130690 = info.nsubtasks;
    struct futhark_mc_task_131845 *futhark_mc_task_131845 =
                                  (struct futhark_mc_task_131845 *) args;
    struct futhark_context *ctx = futhark_mc_task_131845->ctx;
    uint64_t futhark_mc_segmap_task_131846_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131846_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131845->free_n_114534;
    int64_t gtid_120977 = futhark_mc_task_131845->free_gtid_120977;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131845->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock loopres_mem_123490 = {.desc ="loopres_mem_123490", .mem =
                                          futhark_mc_task_131845->free_loopres_mem_123490,
                                          .size =0, .references =NULL};
    int64_t loopres_ixfn_123494 =
            futhark_mc_task_131845->free_loopres_ixfn_123494;
    struct memblock loopres_mem_123498 = {.desc ="loopres_mem_123498", .mem =
                                          futhark_mc_task_131845->free_loopres_mem_123498,
                                          .size =0, .references =NULL};
    struct memblock mem_123501 = {.desc ="mem_123501", .mem =
                                  futhark_mc_task_131845->free_mem_123501,
                                  .size =0, .references =NULL};
    int64_t iter_130691;
    struct futhark_mc_segmap_parloop_struct_131847
    futhark_mc_segmap_parloop_struct_131847;
    
    futhark_mc_segmap_parloop_struct_131847.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131847.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131847.free_gtid_120977 = gtid_120977;
    futhark_mc_segmap_parloop_struct_131847.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131847.free_loopres_mem_123490 =
        loopres_mem_123490.mem;
    futhark_mc_segmap_parloop_struct_131847.free_loopres_ixfn_123494 =
        loopres_ixfn_123494;
    futhark_mc_segmap_parloop_struct_131847.free_loopres_mem_123498 =
        loopres_mem_123498.mem;
    futhark_mc_segmap_parloop_struct_131847.free_mem_123501 = mem_123501.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131848_task;
    
    futhark_mc_segmap_parloop_131848_task.name =
        "futhark_mc_segmap_parloop_131848";
    futhark_mc_segmap_parloop_131848_task.fn = futhark_mc_segmap_parloop_131848;
    futhark_mc_segmap_parloop_131848_task.args =
        &futhark_mc_segmap_parloop_struct_131847;
    futhark_mc_segmap_parloop_131848_task.iterations = iterations;
    futhark_mc_segmap_parloop_131848_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131848_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131848_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131848_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131848_task);
    
    if (futhark_mc_segmap_parloop_131848_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131848_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131848_total_end -
                 futhark_mc_segmap_parloop_131848_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131848_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131848_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131848_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131846_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131846_end -
                 futhark_mc_segmap_task_131846_start;
        
        ctx->futhark_mc_segmap_task_131846_runs[tid]++;
        ctx->futhark_mc_segmap_task_131846_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131846_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131843(void *args, int64_t start,
                                            int64_t end, int flat_tid_120976,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131842
    *futhark_mc_segmap_parloop_struct_131842 =
    (struct futhark_mc_segmap_parloop_struct_131842 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131842->ctx;
    uint64_t futhark_mc_segmap_parloop_131843_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131843_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131842->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131842->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131842->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131842->free_bytes_121983;
    struct memblock loopres_mem_123490 = {.desc ="loopres_mem_123490", .mem =
                                          futhark_mc_segmap_parloop_struct_131842->free_loopres_mem_123490,
                                          .size =0, .references =NULL};
    int64_t loopres_ixfn_123494 =
            futhark_mc_segmap_parloop_struct_131842->free_loopres_ixfn_123494;
    struct memblock loopres_mem_123498 = {.desc ="loopres_mem_123498", .mem =
                                          futhark_mc_segmap_parloop_struct_131842->free_loopres_mem_123498,
                                          .size =0, .references =NULL};
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_segmap_parloop_struct_131842->free_mem_123520,
                                  .size =0, .references =NULL};
    size_t mem_123501_cached_sizze_131844 = 0;
    char *mem_123501 = NULL;
    int64_t iterations = end - start;
    int64_t iter_130679 = start;
    
    if (mem_123501_cached_sizze_131844 < (size_t) bytes_121983) {
        mem_123501 = realloc(mem_123501, bytes_121983);
        mem_123501_cached_sizze_131844 = bytes_121983;
    }
    for (; iter_130679 < end; iter_130679++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130688 = m_114533;
        int64_t gtid_120977 = iter_130679;
        int64_t remnant_130689 = iter_130679 - gtid_120977;
        int64_t flat_tid_120978 = (int64_t) 0;
        int32_t num_tasks_130690;
        struct futhark_mc_task_131845 futhark_mc_task_131845;
        
        futhark_mc_task_131845.ctx = ctx;
        futhark_mc_task_131845.free_n_114534 = n_114534;
        futhark_mc_task_131845.free_gtid_120977 = gtid_120977;
        futhark_mc_task_131845.free_Y_mem_121939 = Y_mem_121939.mem;
        futhark_mc_task_131845.free_loopres_mem_123490 = loopres_mem_123490.mem;
        futhark_mc_task_131845.free_loopres_ixfn_123494 = loopres_ixfn_123494;
        futhark_mc_task_131845.free_loopres_mem_123498 = loopres_mem_123498.mem;
        futhark_mc_task_131845.free_mem_123501 = mem_123501;
        
        struct scheduler_segop futhark_mc_task_131845_task;
        
        futhark_mc_task_131845_task.args = &futhark_mc_task_131845;
        futhark_mc_task_131845_task.top_level_fn =
            futhark_mc_segmap_task_131846;
        futhark_mc_task_131845_task.name = "futhark_mc_segmap_task_131846";
        futhark_mc_task_131845_task.iterations = n_114534;
        futhark_mc_task_131845_task.task_time =
            &ctx->futhark_mc_segmap_task_131846_total_time;
        futhark_mc_task_131845_task.task_iter =
            &ctx->futhark_mc_segmap_task_131846_total_iter;
        futhark_mc_task_131845_task.sched = STATIC;
        futhark_mc_task_131845_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131846_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131845_task);
        
        if (futhark_mc_segmap_task_131846_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_123520.mem + gtid_120977 * n_114534 * (int64_t) 4,
                mem_123501 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123501);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131843_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131843_end -
                 futhark_mc_segmap_parloop_131843_start;
        
        ctx->futhark_mc_segmap_parloop_131843_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131843_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131843_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131841(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120976 = tid;
    int num_tasks_130663 = info.nsubtasks;
    struct futhark_mc_task_131836 *futhark_mc_task_131836 =
                                  (struct futhark_mc_task_131836 *) args;
    struct futhark_context *ctx = futhark_mc_task_131836->ctx;
    uint64_t futhark_mc_segmap_nested_task_131841_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131841_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131836->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131836->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131836->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131836->free_bytes_121983;
    struct memblock loopres_mem_123490 = {.desc ="loopres_mem_123490", .mem =
                                          futhark_mc_task_131836->free_loopres_mem_123490,
                                          .size =0, .references =NULL};
    int64_t loopres_ixfn_123494 =
            futhark_mc_task_131836->free_loopres_ixfn_123494;
    struct memblock loopres_mem_123498 = {.desc ="loopres_mem_123498", .mem =
                                          futhark_mc_task_131836->free_loopres_mem_123498,
                                          .size =0, .references =NULL};
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_task_131836->free_mem_123520,
                                  .size =0, .references =NULL};
    int64_t iter_130679;
    struct futhark_mc_segmap_parloop_struct_131842
    futhark_mc_segmap_parloop_struct_131842;
    
    futhark_mc_segmap_parloop_struct_131842.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131842.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131842.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131842.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131842.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131842.free_loopres_mem_123490 =
        loopres_mem_123490.mem;
    futhark_mc_segmap_parloop_struct_131842.free_loopres_ixfn_123494 =
        loopres_ixfn_123494;
    futhark_mc_segmap_parloop_struct_131842.free_loopres_mem_123498 =
        loopres_mem_123498.mem;
    futhark_mc_segmap_parloop_struct_131842.free_mem_123520 = mem_123520.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131843_task;
    
    futhark_mc_segmap_parloop_131843_task.name =
        "futhark_mc_segmap_parloop_131843";
    futhark_mc_segmap_parloop_131843_task.fn = futhark_mc_segmap_parloop_131843;
    futhark_mc_segmap_parloop_131843_task.args =
        &futhark_mc_segmap_parloop_struct_131842;
    futhark_mc_segmap_parloop_131843_task.iterations = iterations;
    futhark_mc_segmap_parloop_131843_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131843_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131843_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131843_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131843_task);
    
    if (futhark_mc_segmap_parloop_131843_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131843_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131843_total_end -
                 futhark_mc_segmap_parloop_131843_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131843_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131843_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131843_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131841_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131841_end -
                 futhark_mc_segmap_nested_task_131841_start;
        
        ctx->futhark_mc_segmap_nested_task_131841_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131841_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131841_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131849 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_mem_121979;
    int64_t free_bytes_121983;
    char *free_mem_123520;
    char *free_mem_123542;
};
struct futhark_mc_segmap_parloop_struct_131851 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_mem_121979;
    int64_t free_bytes_121983;
    char *free_mem_123520;
    char *free_mem_123542;
};
static int futhark_mc_segmap_parloop_131852(void *args, int64_t start,
                                            int64_t end, int flat_tid_120992,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131851
    *futhark_mc_segmap_parloop_struct_131851 =
    (struct futhark_mc_segmap_parloop_struct_131851 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131851->ctx;
    uint64_t futhark_mc_segmap_parloop_131852_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131852_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131851->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131851->free_n_114534;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131851->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131851->free_bytes_121983;
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_segmap_parloop_struct_131851->free_mem_123520,
                                  .size =0, .references =NULL};
    struct memblock mem_123542 = {.desc ="mem_123542", .mem =
                                  futhark_mc_segmap_parloop_struct_131851->free_mem_123542,
                                  .size =0, .references =NULL};
    size_t mem_123526_cached_sizze_131853 = 0;
    char *mem_123526 = NULL;
    int64_t iterations = end - start;
    int64_t iter_130696 = start;
    
    if (mem_123526_cached_sizze_131853 < (size_t) bytes_121983) {
        mem_123526 = realloc(mem_123526, bytes_121983);
        mem_123526_cached_sizze_131853 = bytes_121983;
    }
    for (; iter_130696 < end; iter_130696++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130707 = m_114533;
        int64_t gtid_120993 = iter_130696;
        int64_t remnant_130708 = iter_130696 - gtid_120993;
        
        for (int64_t i_130697 = 0; i_130697 < n_114534; i_130697++) {
            int64_t x_130699 = ((int64_t *) mem_121979.mem)[gtid_120993 *
                                                            n_114534 +
                                                            i_130697];
            bool cond_130700 = sle64((int64_t) 0, x_130699);
            float defunc_0_f_res_130701;
            
            if (cond_130700) {
                bool y_130702 = slt64(x_130699, n_114534);
                bool bounds_check_130703 = cond_130700 && y_130702;
                bool index_certs_130704;
                
                if (!bounds_check_130703) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Index [", x_130699,
                                  "] out of bounds for array of shape [",
                                  n_114534, "].",
                                  "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:330:21-49\n   #3  /prelude/soacs.fut:67:19-23\n   #4  /prelude/soacs.fut:67:3-37\n   #5  stl.fut:328:13-331:35\n   #6  stl.fut:394:3-405:33\n   #7  stl.fut:381:1-405:33\n");
                    return 1;
                }
                
                float defunc_0_f_res_t_res_130705 =
                      ((float *) mem_123520.mem)[gtid_120993 * n_114534 +
                                                 x_130699];
                
                defunc_0_f_res_130701 = defunc_0_f_res_t_res_130705;
            } else {
                defunc_0_f_res_130701 = INFINITY;
            }
            ((float *) mem_123526)[i_130697] = defunc_0_f_res_130701;
        }
        memmove(mem_123542.mem + gtid_120993 * n_114534 * (int64_t) 4,
                mem_123526 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123526);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131852_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131852_end -
                 futhark_mc_segmap_parloop_131852_start;
        
        ctx->futhark_mc_segmap_parloop_131852_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131852_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131852_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131850(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120992 = tid;
    int num_tasks_130695 = info.nsubtasks;
    struct futhark_mc_task_131849 *futhark_mc_task_131849 =
                                  (struct futhark_mc_task_131849 *) args;
    struct futhark_context *ctx = futhark_mc_task_131849->ctx;
    uint64_t futhark_mc_segmap_task_131850_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131850_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131849->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131849->free_n_114534;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131849->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131849->free_bytes_121983;
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_task_131849->free_mem_123520,
                                  .size =0, .references =NULL};
    struct memblock mem_123542 = {.desc ="mem_123542", .mem =
                                  futhark_mc_task_131849->free_mem_123542,
                                  .size =0, .references =NULL};
    int64_t iter_130696;
    struct futhark_mc_segmap_parloop_struct_131851
    futhark_mc_segmap_parloop_struct_131851;
    
    futhark_mc_segmap_parloop_struct_131851.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131851.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131851.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131851.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131851.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131851.free_mem_123520 = mem_123520.mem;
    futhark_mc_segmap_parloop_struct_131851.free_mem_123542 = mem_123542.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131852_task;
    
    futhark_mc_segmap_parloop_131852_task.name =
        "futhark_mc_segmap_parloop_131852";
    futhark_mc_segmap_parloop_131852_task.fn = futhark_mc_segmap_parloop_131852;
    futhark_mc_segmap_parloop_131852_task.args =
        &futhark_mc_segmap_parloop_struct_131851;
    futhark_mc_segmap_parloop_131852_task.iterations = iterations;
    futhark_mc_segmap_parloop_131852_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131852_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131852_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131852_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131852_task);
    
    if (futhark_mc_segmap_parloop_131852_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131852_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131852_total_end -
                 futhark_mc_segmap_parloop_131852_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131852_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131852_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131852_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131850_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131850_end -
                 futhark_mc_segmap_task_131850_start;
        
        ctx->futhark_mc_segmap_task_131850_runs[tid]++;
        ctx->futhark_mc_segmap_task_131850_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131850_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131855 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_mem_121979;
    int64_t free_bytes_121983;
    char *free_mem_123520;
    char *free_mem_123542;
};
struct futhark_mc_task_131858 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120995;
    char *free_mem_121979;
    char *free_mem_123520;
    char *free_mem_123523;
};
struct futhark_mc_segmap_parloop_struct_131860 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_120995;
    char *free_mem_121979;
    char *free_mem_123520;
    char *free_mem_123523;
};
static int futhark_mc_segmap_parloop_131861(void *args, int64_t start,
                                            int64_t end, int flat_tid_120996,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131860
    *futhark_mc_segmap_parloop_struct_131860 =
    (struct futhark_mc_segmap_parloop_struct_131860 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131860->ctx;
    uint64_t futhark_mc_segmap_parloop_131861_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131861_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131860->free_n_114534;
    int64_t gtid_120995 =
            futhark_mc_segmap_parloop_struct_131860->free_gtid_120995;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131860->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_segmap_parloop_struct_131860->free_mem_123520,
                                  .size =0, .references =NULL};
    struct memblock mem_123523 = {.desc ="mem_123523", .mem =
                                  futhark_mc_segmap_parloop_struct_131860->free_mem_123523,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_130721 = start;
    
    for (; iter_130721 < end; iter_130721++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130726 = n_114534;
        int64_t gtid_120997 = iter_130721;
        int64_t remnant_130727 = iter_130721 - gtid_120997;
        int64_t x_130711 = ((int64_t *) mem_121979.mem)[gtid_120995 * n_114534 +
                                                        gtid_120997];
        bool cond_130712 = sle64((int64_t) 0, x_130711);
        float defunc_0_f_res_130713;
        
        if (cond_130712) {
            bool y_130722 = slt64(x_130711, n_114534);
            bool bounds_check_130723 = cond_130712 && y_130722;
            bool index_certs_130724;
            
            if (!bounds_check_130723) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", x_130711,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  utils.fut:18:29-33\n   #1  utils.fut:18:3-49\n   #2  stl.fut:330:21-49\n   #3  /prelude/soacs.fut:67:19-23\n   #4  /prelude/soacs.fut:67:3-37\n   #5  stl.fut:328:13-331:35\n   #6  stl.fut:394:3-405:33\n   #7  stl.fut:381:1-405:33\n");
                return 1;
            }
            
            float defunc_0_f_res_t_res_130725 =
                  ((float *) mem_123520.mem)[gtid_120995 * n_114534 + x_130711];
            
            defunc_0_f_res_130713 = defunc_0_f_res_t_res_130725;
        } else {
            defunc_0_f_res_130713 = INFINITY;
        }
        ((float *) mem_123523.mem)[gtid_120997] = defunc_0_f_res_130713;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131861_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131861_end -
                 futhark_mc_segmap_parloop_131861_start;
        
        ctx->futhark_mc_segmap_parloop_131861_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131861_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131861_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131859(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120996 = tid;
    int num_tasks_130720 = info.nsubtasks;
    struct futhark_mc_task_131858 *futhark_mc_task_131858 =
                                  (struct futhark_mc_task_131858 *) args;
    struct futhark_context *ctx = futhark_mc_task_131858->ctx;
    uint64_t futhark_mc_segmap_task_131859_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131859_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131858->free_n_114534;
    int64_t gtid_120995 = futhark_mc_task_131858->free_gtid_120995;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131858->free_mem_121979,
                                  .size =0, .references =NULL};
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_task_131858->free_mem_123520,
                                  .size =0, .references =NULL};
    struct memblock mem_123523 = {.desc ="mem_123523", .mem =
                                  futhark_mc_task_131858->free_mem_123523,
                                  .size =0, .references =NULL};
    int64_t iter_130721;
    struct futhark_mc_segmap_parloop_struct_131860
    futhark_mc_segmap_parloop_struct_131860;
    
    futhark_mc_segmap_parloop_struct_131860.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131860.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131860.free_gtid_120995 = gtid_120995;
    futhark_mc_segmap_parloop_struct_131860.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131860.free_mem_123520 = mem_123520.mem;
    futhark_mc_segmap_parloop_struct_131860.free_mem_123523 = mem_123523.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131861_task;
    
    futhark_mc_segmap_parloop_131861_task.name =
        "futhark_mc_segmap_parloop_131861";
    futhark_mc_segmap_parloop_131861_task.fn = futhark_mc_segmap_parloop_131861;
    futhark_mc_segmap_parloop_131861_task.args =
        &futhark_mc_segmap_parloop_struct_131860;
    futhark_mc_segmap_parloop_131861_task.iterations = iterations;
    futhark_mc_segmap_parloop_131861_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131861_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131861_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131861_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131861_task);
    
    if (futhark_mc_segmap_parloop_131861_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131861_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131861_total_end -
                 futhark_mc_segmap_parloop_131861_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131861_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131861_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131861_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131859_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131859_end -
                 futhark_mc_segmap_task_131859_start;
        
        ctx->futhark_mc_segmap_task_131859_runs[tid]++;
        ctx->futhark_mc_segmap_task_131859_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131859_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131856(void *args, int64_t start,
                                            int64_t end, int flat_tid_120994,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131855
    *futhark_mc_segmap_parloop_struct_131855 =
    (struct futhark_mc_segmap_parloop_struct_131855 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131855->ctx;
    uint64_t futhark_mc_segmap_parloop_131856_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131856_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131855->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131855->free_n_114534;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_segmap_parloop_struct_131855->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131855->free_bytes_121983;
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_segmap_parloop_struct_131855->free_mem_123520,
                                  .size =0, .references =NULL};
    struct memblock mem_123542 = {.desc ="mem_123542", .mem =
                                  futhark_mc_segmap_parloop_struct_131855->free_mem_123542,
                                  .size =0, .references =NULL};
    size_t mem_123523_cached_sizze_131857 = 0;
    char *mem_123523 = NULL;
    int64_t iterations = end - start;
    int64_t iter_130710 = start;
    
    if (mem_123523_cached_sizze_131857 < (size_t) bytes_121983) {
        mem_123523 = realloc(mem_123523, bytes_121983);
        mem_123523_cached_sizze_131857 = bytes_121983;
    }
    for (; iter_130710 < end; iter_130710++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130718 = m_114533;
        int64_t gtid_120995 = iter_130710;
        int64_t remnant_130719 = iter_130710 - gtid_120995;
        int64_t flat_tid_120996 = (int64_t) 0;
        int32_t num_tasks_130720;
        struct futhark_mc_task_131858 futhark_mc_task_131858;
        
        futhark_mc_task_131858.ctx = ctx;
        futhark_mc_task_131858.free_n_114534 = n_114534;
        futhark_mc_task_131858.free_gtid_120995 = gtid_120995;
        futhark_mc_task_131858.free_mem_121979 = mem_121979.mem;
        futhark_mc_task_131858.free_mem_123520 = mem_123520.mem;
        futhark_mc_task_131858.free_mem_123523 = mem_123523;
        
        struct scheduler_segop futhark_mc_task_131858_task;
        
        futhark_mc_task_131858_task.args = &futhark_mc_task_131858;
        futhark_mc_task_131858_task.top_level_fn =
            futhark_mc_segmap_task_131859;
        futhark_mc_task_131858_task.name = "futhark_mc_segmap_task_131859";
        futhark_mc_task_131858_task.iterations = n_114534;
        futhark_mc_task_131858_task.task_time =
            &ctx->futhark_mc_segmap_task_131859_total_time;
        futhark_mc_task_131858_task.task_iter =
            &ctx->futhark_mc_segmap_task_131859_total_iter;
        futhark_mc_task_131858_task.sched = STATIC;
        futhark_mc_task_131858_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131859_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131858_task);
        
        if (futhark_mc_segmap_task_131859_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_123542.mem + gtid_120995 * n_114534 * (int64_t) 4,
                mem_123523 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123523);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131856_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131856_end -
                 futhark_mc_segmap_parloop_131856_start;
        
        ctx->futhark_mc_segmap_parloop_131856_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131856_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131856_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131854(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_120994 = tid;
    int num_tasks_130695 = info.nsubtasks;
    struct futhark_mc_task_131849 *futhark_mc_task_131849 =
                                  (struct futhark_mc_task_131849 *) args;
    struct futhark_context *ctx = futhark_mc_task_131849->ctx;
    uint64_t futhark_mc_segmap_nested_task_131854_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131854_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131849->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131849->free_n_114534;
    struct memblock mem_121979 = {.desc ="mem_121979", .mem =
                                  futhark_mc_task_131849->free_mem_121979,
                                  .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131849->free_bytes_121983;
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_task_131849->free_mem_123520,
                                  .size =0, .references =NULL};
    struct memblock mem_123542 = {.desc ="mem_123542", .mem =
                                  futhark_mc_task_131849->free_mem_123542,
                                  .size =0, .references =NULL};
    int64_t iter_130710;
    struct futhark_mc_segmap_parloop_struct_131855
    futhark_mc_segmap_parloop_struct_131855;
    
    futhark_mc_segmap_parloop_struct_131855.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131855.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131855.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131855.free_mem_121979 = mem_121979.mem;
    futhark_mc_segmap_parloop_struct_131855.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131855.free_mem_123520 = mem_123520.mem;
    futhark_mc_segmap_parloop_struct_131855.free_mem_123542 = mem_123542.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131856_task;
    
    futhark_mc_segmap_parloop_131856_task.name =
        "futhark_mc_segmap_parloop_131856";
    futhark_mc_segmap_parloop_131856_task.fn = futhark_mc_segmap_parloop_131856;
    futhark_mc_segmap_parloop_131856_task.args =
        &futhark_mc_segmap_parloop_struct_131855;
    futhark_mc_segmap_parloop_131856_task.iterations = iterations;
    futhark_mc_segmap_parloop_131856_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131856_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131856_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131856_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131856_task);
    
    if (futhark_mc_segmap_parloop_131856_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131856_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131856_total_end -
                 futhark_mc_segmap_parloop_131856_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131856_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131856_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131856_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131854_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131854_end -
                 futhark_mc_segmap_nested_task_131854_start;
        
        ctx->futhark_mc_segmap_nested_task_131854_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131854_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131854_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131862 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_i_114610;
    int32_t free_iters_116571;
    int64_t free_bytes_121940;
    int64_t free_bytes_121983;
    char *free_mem_123542;
    char *free_mem_123696;
    int64_t free_double_buffer_sizze_123840;
    int64_t free_double_buffer_sizze_123844;
};
struct futhark_mc_segmap_parloop_struct_131864 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_i_114610;
    int32_t free_iters_116571;
    int64_t free_bytes_121940;
    int64_t free_bytes_121983;
    char *free_mem_123542;
    char *free_mem_123696;
    int64_t free_double_buffer_sizze_123844;
};
static int futhark_mc_segmap_parloop_131865(void *args, int64_t start,
                                            int64_t end, int flat_tid_121008,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131864
    *futhark_mc_segmap_parloop_struct_131864 =
    (struct futhark_mc_segmap_parloop_struct_131864 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131864->ctx;
    uint64_t futhark_mc_segmap_parloop_131865_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131865_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131864->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131864->free_n_114534;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131864->free_i_114610;
    int32_t iters_116571 =
            futhark_mc_segmap_parloop_struct_131864->free_iters_116571;
    int64_t bytes_121940 =
            futhark_mc_segmap_parloop_struct_131864->free_bytes_121940;
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131864->free_bytes_121983;
    struct memblock mem_123542 = {.desc ="mem_123542", .mem =
                                  futhark_mc_segmap_parloop_struct_131864->free_mem_123542,
                                  .size =0, .references =NULL};
    struct memblock mem_123696 = {.desc ="mem_123696", .mem =
                                  futhark_mc_segmap_parloop_struct_131864->free_mem_123696,
                                  .size =0, .references =NULL};
    int64_t double_buffer_sizze_123844 =
            futhark_mc_segmap_parloop_struct_131864->free_double_buffer_sizze_123844;
    size_t mem_123600_cached_sizze_131866 = 0;
    char *mem_123600 = NULL;
    size_t mem_123603_cached_sizze_131867 = 0;
    char *mem_123603 = NULL;
    size_t mem_123606_cached_sizze_131868 = 0;
    char *mem_123606 = NULL;
    size_t mem_123609_cached_sizze_131869 = 0;
    char *mem_123609 = NULL;
    size_t mem_123612_cached_sizze_131870 = 0;
    char *mem_123612 = NULL;
    size_t mem_123675_cached_sizze_131871 = 0;
    char *mem_123675 = NULL;
    size_t double_buffer_mem_123842_cached_sizze_131872 = 0;
    char *double_buffer_mem_123842 = NULL;
    int64_t iterations = end - start;
    int64_t iter_130729 = start;
    
    if (mem_123600_cached_sizze_131866 < (size_t) bytes_121940) {
        mem_123600 = realloc(mem_123600, bytes_121940);
        mem_123600_cached_sizze_131866 = bytes_121940;
    }
    if (mem_123603_cached_sizze_131867 < (size_t) bytes_121940) {
        mem_123603 = realloc(mem_123603, bytes_121940);
        mem_123603_cached_sizze_131867 = bytes_121940;
    }
    if (mem_123606_cached_sizze_131868 < (size_t) bytes_121940) {
        mem_123606 = realloc(mem_123606, bytes_121940);
        mem_123606_cached_sizze_131868 = bytes_121940;
    }
    if (mem_123609_cached_sizze_131869 < (size_t) bytes_121940) {
        mem_123609 = realloc(mem_123609, bytes_121940);
        mem_123609_cached_sizze_131869 = bytes_121940;
    }
    if (mem_123612_cached_sizze_131870 < (size_t) bytes_121983) {
        mem_123612 = realloc(mem_123612, bytes_121983);
        mem_123612_cached_sizze_131870 = bytes_121983;
    }
    if (double_buffer_mem_123842_cached_sizze_131872 <
        (size_t) double_buffer_sizze_123844) {
        double_buffer_mem_123842 = realloc(double_buffer_mem_123842,
                                           double_buffer_sizze_123844);
        double_buffer_mem_123842_cached_sizze_131872 =
            double_buffer_sizze_123844;
    }
    if (mem_123675_cached_sizze_131871 < (size_t) bytes_121983) {
        mem_123675 = realloc(mem_123675, bytes_121983);
        mem_123675_cached_sizze_131871 = bytes_121983;
    }
    for (; iter_130729 < end; iter_130729++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130833 = m_114533;
        int64_t gtid_121009 = iter_130729;
        int64_t remnant_130834 = iter_130729 - gtid_121009;
        
        memmove(double_buffer_mem_123842 + (int64_t) 0, mem_123542.mem +
                gtid_121009 * n_114534 * (int64_t) 4, n_114534 * (int64_t) 4);
        for (int32_t i_130730 = 0; i_130730 < iters_116571; i_130730++) {
            int32_t defunc_2_radix_sort_step_arg_130732 = mul32(2, i_130730);
            int32_t defunc_0_get_bit_arg_130733 = add32(1,
                                                        defunc_2_radix_sort_step_arg_130732);
            bool cond_f_res_130734 = defunc_0_get_bit_arg_130733 == 31;
            bool cond_f_res_130735 = defunc_2_radix_sort_step_arg_130732 == 31;
            int64_t discard_130741;
            int64_t discard_130742;
            int64_t discard_130743;
            int64_t discard_130744;
            int64_t scanacc_130751;
            int64_t scanacc_130752;
            int64_t scanacc_130753;
            int64_t scanacc_130754;
            
            scanacc_130751 = (int64_t) 0;
            scanacc_130752 = (int64_t) 0;
            scanacc_130753 = (int64_t) 0;
            scanacc_130754 = (int64_t) 0;
            for (int64_t i_130750 = 0; i_130750 < n_114534; i_130750++) {
                float x_130760 = ((float *) double_buffer_mem_123842)[i_130750];
                int32_t i32_arg_130761;
                
                i32_arg_130761 = futrts_to_bits32(x_130760);
                
                int32_t unsign_arg_130762 = ashr32(i32_arg_130761,
                                                   defunc_0_get_bit_arg_130733);
                int32_t unsign_arg_130763 = 1 & unsign_arg_130762;
                int32_t unsign_arg_130764 = ashr32(i32_arg_130761, 31);
                int32_t unsign_arg_130765 = 1 & unsign_arg_130764;
                bool cond_130766 = unsign_arg_130765 == 1;
                bool x_130767 = !cond_130766;
                bool y_130768 = cond_f_res_130734 && x_130767;
                bool cond_130769 = cond_130766 || y_130768;
                int32_t defunc_1_get_bit_res_130770;
                
                if (cond_130769) {
                    int32_t defunc_1_get_bit_res_t_res_130771 = 1 ^
                            unsign_arg_130763;
                    
                    defunc_1_get_bit_res_130770 =
                        defunc_1_get_bit_res_t_res_130771;
                } else {
                    defunc_1_get_bit_res_130770 = unsign_arg_130763;
                }
                
                int32_t x_130772 = mul32(2, defunc_1_get_bit_res_130770);
                int32_t unsign_arg_130773 = ashr32(i32_arg_130761,
                                                   defunc_2_radix_sort_step_arg_130732);
                int32_t unsign_arg_130774 = 1 & unsign_arg_130773;
                bool y_130775 = cond_f_res_130735 && x_130767;
                bool cond_130776 = cond_130766 || y_130775;
                int32_t defunc_1_get_bit_res_130777;
                
                if (cond_130776) {
                    int32_t defunc_1_get_bit_res_t_res_130778 = 1 ^
                            unsign_arg_130774;
                    
                    defunc_1_get_bit_res_130777 =
                        defunc_1_get_bit_res_t_res_130778;
                } else {
                    defunc_1_get_bit_res_130777 = unsign_arg_130774;
                }
                
                int32_t defunc_0_f_res_130779 = add32(x_130772,
                                                      defunc_1_get_bit_res_130777);
                bool cond_130780 = defunc_0_f_res_130779 == 0;
                int64_t defunc_0_f_res_130781 = btoi_bool_i64(cond_130780);
                int64_t defunc_0_f_res_130782;
                int64_t defunc_0_f_res_130783;
                int64_t defunc_0_f_res_130784;
                
                if (cond_130780) {
                    defunc_0_f_res_130782 = (int64_t) 0;
                    defunc_0_f_res_130783 = (int64_t) 0;
                    defunc_0_f_res_130784 = (int64_t) 0;
                } else {
                    bool cond_130785 = defunc_0_f_res_130779 == 1;
                    int64_t defunc_0_f_res_f_res_130786 =
                            btoi_bool_i64(cond_130785);
                    int64_t defunc_0_f_res_f_res_130787;
                    int64_t defunc_0_f_res_f_res_130788;
                    
                    if (cond_130785) {
                        defunc_0_f_res_f_res_130787 = (int64_t) 0;
                        defunc_0_f_res_f_res_130788 = (int64_t) 0;
                    } else {
                        bool cond_130789 = defunc_0_f_res_130779 == 2;
                        int64_t defunc_0_f_res_f_res_f_res_130790 =
                                btoi_bool_i64(cond_130789);
                        bool cond_neg_130791 = !cond_130789;
                        int64_t defunc_0_f_res_f_res_f_res_130792 =
                                btoi_bool_i64(cond_neg_130791);
                        
                        defunc_0_f_res_f_res_130787 =
                            defunc_0_f_res_f_res_f_res_130790;
                        defunc_0_f_res_f_res_130788 =
                            defunc_0_f_res_f_res_f_res_130792;
                    }
                    defunc_0_f_res_130782 = defunc_0_f_res_f_res_130786;
                    defunc_0_f_res_130783 = defunc_0_f_res_f_res_130787;
                    defunc_0_f_res_130784 = defunc_0_f_res_f_res_130788;
                }
                
                int64_t defunc_1_op_res_130793 = add64(defunc_0_f_res_130781,
                                                       scanacc_130751);
                int64_t defunc_1_op_res_130794 = add64(defunc_0_f_res_130782,
                                                       scanacc_130752);
                int64_t defunc_1_op_res_130795 = add64(defunc_0_f_res_130783,
                                                       scanacc_130753);
                int64_t defunc_1_op_res_130796 = add64(defunc_0_f_res_130784,
                                                       scanacc_130754);
                
                ((int64_t *) mem_123600)[i_130750] = defunc_1_op_res_130793;
                ((int64_t *) mem_123603)[i_130750] = defunc_1_op_res_130794;
                ((int64_t *) mem_123606)[i_130750] = defunc_1_op_res_130795;
                ((int64_t *) mem_123609)[i_130750] = defunc_1_op_res_130796;
                ((int32_t *) mem_123612)[i_130750] = defunc_0_f_res_130779;
                
                int64_t scanacc_tmp_130836 = defunc_1_op_res_130793;
                int64_t scanacc_tmp_130837 = defunc_1_op_res_130794;
                int64_t scanacc_tmp_130838 = defunc_1_op_res_130795;
                int64_t scanacc_tmp_130839 = defunc_1_op_res_130796;
                
                scanacc_130751 = scanacc_tmp_130836;
                scanacc_130752 = scanacc_tmp_130837;
                scanacc_130753 = scanacc_tmp_130838;
                scanacc_130754 = scanacc_tmp_130839;
            }
            discard_130741 = scanacc_130751;
            discard_130742 = scanacc_130752;
            discard_130743 = scanacc_130753;
            discard_130744 = scanacc_130754;
            
            int64_t last_res_130802 = ((int64_t *) mem_123600)[i_114610];
            int64_t last_res_130803 = ((int64_t *) mem_123603)[i_114610];
            int64_t last_res_130804 = ((int64_t *) mem_123606)[i_114610];
            
            memmove(mem_123675 + (int64_t) 0, double_buffer_mem_123842 +
                    (int64_t) 0, n_114534 * (int64_t) 4);
            for (int64_t write_iter_130807 = 0; write_iter_130807 < n_114534;
                 write_iter_130807++) {
                int32_t write_iv_130809 =
                        ((int32_t *) mem_123612)[write_iter_130807];
                bool match_lit_130810 = 0 == write_iv_130809;
                int64_t defunc_1_f_res_130811;
                
                if (match_lit_130810) {
                    int64_t write_iv_130812 =
                            ((int64_t *) mem_123600)[write_iter_130807];
                    int64_t case_res_130813 = sub64(write_iv_130812,
                                                    (int64_t) 1);
                    
                    defunc_1_f_res_130811 = case_res_130813;
                } else {
                    bool match_lit_130814 = 1 == write_iv_130809;
                    int64_t x_130815;
                    
                    if (match_lit_130814) {
                        int64_t write_iv_130816 =
                                ((int64_t *) mem_123603)[write_iter_130807];
                        int64_t x_130817 = add64(last_res_130802,
                                                 write_iv_130816);
                        int64_t case_res_130818 = sub64(x_130817, (int64_t) 1);
                        
                        x_130815 = case_res_130818;
                    } else {
                        bool match_lit_130819 = 2 == write_iv_130809;
                        int64_t x_130820;
                        
                        if (match_lit_130819) {
                            int64_t write_iv_130821 =
                                    ((int64_t *) mem_123606)[write_iter_130807];
                            int64_t x_130822 = add64(last_res_130802,
                                                     last_res_130803);
                            int64_t x_130823 = add64(x_130822, write_iv_130821);
                            int64_t case_res_130824 = sub64(x_130823,
                                                            (int64_t) 1);
                            
                            x_130820 = case_res_130824;
                        } else {
                            int64_t write_iv_130825 =
                                    ((int64_t *) mem_123609)[write_iter_130807];
                            int64_t x_130826 = add64(last_res_130802,
                                                     last_res_130803);
                            int64_t x_130827 = add64(last_res_130804, x_130826);
                            int64_t x_130828 = add64(x_130827, write_iv_130825);
                            int64_t defunc_1_f_res_res_130829 = sub64(x_130828,
                                                                      (int64_t) 1);
                            
                            x_130820 = defunc_1_f_res_res_130829;
                        }
                        x_130815 = x_130820;
                    }
                    defunc_1_f_res_130811 = x_130815;
                }
                if (sle64((int64_t) 0, defunc_1_f_res_130811) &&
                    slt64(defunc_1_f_res_130811, n_114534)) {
                    memmove(mem_123675 + defunc_1_f_res_130811 * (int64_t) 4,
                            double_buffer_mem_123842 + write_iter_130807 *
                            (int64_t) 4, (int64_t) 4);
                }
            }
            memmove(double_buffer_mem_123842 + (int64_t) 0, mem_123675 +
                    (int64_t) 0, n_114534 * (int64_t) 4);
        }
        memmove(mem_123696.mem + gtid_121009 * n_114534 * (int64_t) 4,
                double_buffer_mem_123842 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123600);
    free(mem_123603);
    free(mem_123606);
    free(mem_123609);
    free(mem_123612);
    free(mem_123675);
    free(double_buffer_mem_123842);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131865_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131865_end -
                 futhark_mc_segmap_parloop_131865_start;
        
        ctx->futhark_mc_segmap_parloop_131865_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131865_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131865_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131863(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_121008 = tid;
    int num_tasks_130728 = info.nsubtasks;
    struct futhark_mc_task_131862 *futhark_mc_task_131862 =
                                  (struct futhark_mc_task_131862 *) args;
    struct futhark_context *ctx = futhark_mc_task_131862->ctx;
    uint64_t futhark_mc_segmap_task_131863_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131863_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131862->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131862->free_n_114534;
    int64_t i_114610 = futhark_mc_task_131862->free_i_114610;
    int32_t iters_116571 = futhark_mc_task_131862->free_iters_116571;
    int64_t bytes_121940 = futhark_mc_task_131862->free_bytes_121940;
    int64_t bytes_121983 = futhark_mc_task_131862->free_bytes_121983;
    struct memblock mem_123542 = {.desc ="mem_123542", .mem =
                                  futhark_mc_task_131862->free_mem_123542,
                                  .size =0, .references =NULL};
    struct memblock mem_123696 = {.desc ="mem_123696", .mem =
                                  futhark_mc_task_131862->free_mem_123696,
                                  .size =0, .references =NULL};
    int64_t double_buffer_sizze_123840 =
            futhark_mc_task_131862->free_double_buffer_sizze_123840;
    int64_t double_buffer_sizze_123844 =
            futhark_mc_task_131862->free_double_buffer_sizze_123844;
    int64_t iter_130729;
    struct futhark_mc_segmap_parloop_struct_131864
    futhark_mc_segmap_parloop_struct_131864;
    
    futhark_mc_segmap_parloop_struct_131864.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131864.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131864.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131864.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131864.free_iters_116571 = iters_116571;
    futhark_mc_segmap_parloop_struct_131864.free_bytes_121940 = bytes_121940;
    futhark_mc_segmap_parloop_struct_131864.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131864.free_mem_123542 = mem_123542.mem;
    futhark_mc_segmap_parloop_struct_131864.free_mem_123696 = mem_123696.mem;
    futhark_mc_segmap_parloop_struct_131864.free_double_buffer_sizze_123844 =
        double_buffer_sizze_123844;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131865_task;
    
    futhark_mc_segmap_parloop_131865_task.name =
        "futhark_mc_segmap_parloop_131865";
    futhark_mc_segmap_parloop_131865_task.fn = futhark_mc_segmap_parloop_131865;
    futhark_mc_segmap_parloop_131865_task.args =
        &futhark_mc_segmap_parloop_struct_131864;
    futhark_mc_segmap_parloop_131865_task.iterations = iterations;
    futhark_mc_segmap_parloop_131865_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131865_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131865_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131865_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131865_task);
    
    if (futhark_mc_segmap_parloop_131865_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131865_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131865_total_end -
                 futhark_mc_segmap_parloop_131865_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131865_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131865_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131865_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131863_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131863_end -
                 futhark_mc_segmap_task_131863_start;
        
        ctx->futhark_mc_segmap_task_131863_runs[tid]++;
        ctx->futhark_mc_segmap_task_131863_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131863_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131874 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_i_114610;
    int32_t free_iters_116571;
    int64_t free_bytes_121940;
    int64_t free_bytes_121983;
    char *free_mem_123542;
    char *free_mem_123696;
    int64_t free_double_buffer_sizze_123840;
};
struct futhark_mc_task_131883 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    char *free_mem_123560;
    char *free_mem_123563;
    char *free_mem_123566;
    char *free_mem_123569;
    char *free_mem_123572;
    char *free_double_buffer_mem_123838;
    int32_t free_defunc_2_radix_sort_step_arg_130849;
    int32_t free_defunc_0_get_bit_arg_130850;
    bool free_cond_f_res_130851;
    bool free_cond_f_res_130852;
};
struct futhark_mc_scan_stage_1_parloop_struct_131889 {
    struct futhark_context *ctx;
    char *free_mem_123560;
    char *free_mem_123563;
    char *free_mem_123566;
    char *free_mem_123569;
    char *free_mem_123572;
    char *free_double_buffer_mem_123838;
    int32_t free_defunc_2_radix_sort_step_arg_130849;
    int32_t free_defunc_0_get_bit_arg_130850;
    bool free_cond_f_res_130851;
    bool free_cond_f_res_130852;
};
static int futhark_mc_scan_stage_1_parloop_131890(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_121012, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_1_parloop_struct_131889
    *futhark_mc_scan_stage_1_parloop_struct_131889 =
    (struct futhark_mc_scan_stage_1_parloop_struct_131889 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_1_parloop_struct_131889->ctx;
    uint64_t futhark_mc_scan_stage_1_parloop_131890_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_131890_start = get_wall_time();
    
    struct memblock mem_123560 = {.desc ="mem_123560", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_131889->free_mem_123560,
                                  .size =0, .references =NULL};
    struct memblock mem_123563 = {.desc ="mem_123563", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_131889->free_mem_123563,
                                  .size =0, .references =NULL};
    struct memblock mem_123566 = {.desc ="mem_123566", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_131889->free_mem_123566,
                                  .size =0, .references =NULL};
    struct memblock mem_123569 = {.desc ="mem_123569", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_131889->free_mem_123569,
                                  .size =0, .references =NULL};
    struct memblock mem_123572 = {.desc ="mem_123572", .mem =
                                  futhark_mc_scan_stage_1_parloop_struct_131889->free_mem_123572,
                                  .size =0, .references =NULL};
    struct memblock double_buffer_mem_123838 = {.desc =
                                                "double_buffer_mem_123838",
                                                .mem =
                                                futhark_mc_scan_stage_1_parloop_struct_131889->free_double_buffer_mem_123838,
                                                .size =0, .references =NULL};
    int32_t defunc_2_radix_sort_step_arg_130849 =
            futhark_mc_scan_stage_1_parloop_struct_131889->free_defunc_2_radix_sort_step_arg_130849;
    int32_t defunc_0_get_bit_arg_130850 =
            futhark_mc_scan_stage_1_parloop_struct_131889->free_defunc_0_get_bit_arg_130850;
    bool cond_f_res_130851 =
         futhark_mc_scan_stage_1_parloop_struct_131889->free_cond_f_res_130851;
    bool cond_f_res_130852 =
         futhark_mc_scan_stage_1_parloop_struct_131889->free_cond_f_res_130852;
    int64_t iterations = end - start;
    int64_t iter_130935 = start;
    int64_t x_130858;
    int64_t x_130859;
    int64_t x_130860;
    int64_t x_130861;
    int64_t x_130862;
    int64_t x_130863;
    int64_t x_130864;
    int64_t x_130865;
    
    x_130858 = (int64_t) 0;
    x_130859 = (int64_t) 0;
    x_130860 = (int64_t) 0;
    x_130861 = (int64_t) 0;
    for (; iter_130935 < end; iter_130935++) {
        int64_t gtid_121013 = iter_130935;
        
        // stage 1 scan body
        {
            float x_130870 =
                  ((float *) double_buffer_mem_123838.mem)[gtid_121013];
            int32_t i32_arg_130871;
            
            i32_arg_130871 = futrts_to_bits32(x_130870);
            
            int32_t unsign_arg_130872 = ashr32(i32_arg_130871,
                                               defunc_0_get_bit_arg_130850);
            int32_t unsign_arg_130873 = 1 & unsign_arg_130872;
            int32_t unsign_arg_130874 = ashr32(i32_arg_130871, 31);
            int32_t unsign_arg_130875 = 1 & unsign_arg_130874;
            bool cond_130876 = unsign_arg_130875 == 1;
            bool x_130877 = !cond_130876;
            bool y_130878 = cond_f_res_130851 && x_130877;
            bool cond_130879 = cond_130876 || y_130878;
            int32_t defunc_1_get_bit_res_130880;
            
            if (cond_130879) {
                int32_t defunc_1_get_bit_res_t_res_130881 = 1 ^
                        unsign_arg_130873;
                
                defunc_1_get_bit_res_130880 = defunc_1_get_bit_res_t_res_130881;
            } else {
                defunc_1_get_bit_res_130880 = unsign_arg_130873;
            }
            
            int32_t x_130882 = mul32(2, defunc_1_get_bit_res_130880);
            int32_t unsign_arg_130883 = ashr32(i32_arg_130871,
                                               defunc_2_radix_sort_step_arg_130849);
            int32_t unsign_arg_130884 = 1 & unsign_arg_130883;
            bool y_130885 = cond_f_res_130852 && x_130877;
            bool cond_130886 = cond_130876 || y_130885;
            int32_t defunc_1_get_bit_res_130887;
            
            if (cond_130886) {
                int32_t defunc_1_get_bit_res_t_res_130888 = 1 ^
                        unsign_arg_130884;
                
                defunc_1_get_bit_res_130887 = defunc_1_get_bit_res_t_res_130888;
            } else {
                defunc_1_get_bit_res_130887 = unsign_arg_130884;
            }
            
            int32_t defunc_0_f_res_130889 = add32(x_130882,
                                                  defunc_1_get_bit_res_130887);
            bool cond_130890 = defunc_0_f_res_130889 == 0;
            int64_t defunc_0_f_res_130891 = btoi_bool_i64(cond_130890);
            int64_t defunc_0_f_res_130892;
            int64_t defunc_0_f_res_130893;
            int64_t defunc_0_f_res_130894;
            
            if (cond_130890) {
                defunc_0_f_res_130892 = (int64_t) 0;
                defunc_0_f_res_130893 = (int64_t) 0;
                defunc_0_f_res_130894 = (int64_t) 0;
            } else {
                bool cond_130895 = defunc_0_f_res_130889 == 1;
                int64_t defunc_0_f_res_f_res_130896 =
                        btoi_bool_i64(cond_130895);
                int64_t defunc_0_f_res_f_res_130897;
                int64_t defunc_0_f_res_f_res_130898;
                
                if (cond_130895) {
                    defunc_0_f_res_f_res_130897 = (int64_t) 0;
                    defunc_0_f_res_f_res_130898 = (int64_t) 0;
                } else {
                    bool cond_130899 = defunc_0_f_res_130889 == 2;
                    int64_t defunc_0_f_res_f_res_f_res_130900 =
                            btoi_bool_i64(cond_130899);
                    bool cond_neg_130901 = !cond_130899;
                    int64_t defunc_0_f_res_f_res_f_res_130902 =
                            btoi_bool_i64(cond_neg_130901);
                    
                    defunc_0_f_res_f_res_130897 =
                        defunc_0_f_res_f_res_f_res_130900;
                    defunc_0_f_res_f_res_130898 =
                        defunc_0_f_res_f_res_f_res_130902;
                }
                defunc_0_f_res_130892 = defunc_0_f_res_f_res_130896;
                defunc_0_f_res_130893 = defunc_0_f_res_f_res_130897;
                defunc_0_f_res_130894 = defunc_0_f_res_f_res_130898;
            }
            // write mapped values results to memory
            {
                ((int32_t *) mem_123572.mem)[gtid_121013] =
                    defunc_0_f_res_130889;
            }
            x_130858 = x_130858;
            x_130859 = x_130859;
            x_130860 = x_130860;
            x_130861 = x_130861;
            // Read next values
            {
                x_130862 = defunc_0_f_res_130891;
                x_130863 = defunc_0_f_res_130892;
                x_130864 = defunc_0_f_res_130893;
                x_130865 = defunc_0_f_res_130894;
            }
            
            int64_t defunc_1_op_res_130866 = add64(x_130858, x_130862);
            int64_t defunc_1_op_res_130867 = add64(x_130859, x_130863);
            int64_t defunc_1_op_res_130868 = add64(x_130860, x_130864);
            int64_t defunc_1_op_res_130869 = add64(x_130861, x_130865);
            
            ((int64_t *) mem_123560.mem)[gtid_121013] = defunc_1_op_res_130866;
            x_130858 = defunc_1_op_res_130866;
            ((int64_t *) mem_123563.mem)[gtid_121013] = defunc_1_op_res_130867;
            x_130859 = defunc_1_op_res_130867;
            ((int64_t *) mem_123566.mem)[gtid_121013] = defunc_1_op_res_130868;
            x_130860 = defunc_1_op_res_130868;
            ((int64_t *) mem_123569.mem)[gtid_121013] = defunc_1_op_res_130869;
            x_130861 = defunc_1_op_res_130869;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_131890_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_131890_end -
                 futhark_mc_scan_stage_1_parloop_131890_start;
        
        ctx->futhark_mc_scan_stage_1_parloop_131890_runs[tid]++;
        ctx->futhark_mc_scan_stage_1_parloop_131890_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_1_parloop_131890_iter[tid] += iterations;
    }
    return err;
}
struct futhark_mc_scan_stage_3_parloop_struct_131891 {
    struct futhark_context *ctx;
    char *free_mem_123560;
    char *free_mem_123563;
    char *free_mem_123566;
    char *free_mem_123569;
    char *free_double_buffer_mem_123838;
    int32_t free_defunc_2_radix_sort_step_arg_130849;
    int32_t free_defunc_0_get_bit_arg_130850;
    bool free_cond_f_res_130851;
    bool free_cond_f_res_130852;
};
static int futhark_mc_scan_stage_3_parloop_131892(void *args, int64_t start,
                                                  int64_t end,
                                                  int flat_tid_121012, int tid)
{
    int err = 0;
    struct futhark_mc_scan_stage_3_parloop_struct_131891
    *futhark_mc_scan_stage_3_parloop_struct_131891 =
    (struct futhark_mc_scan_stage_3_parloop_struct_131891 *) args;
    struct futhark_context *ctx =
                           futhark_mc_scan_stage_3_parloop_struct_131891->ctx;
    uint64_t futhark_mc_scan_stage_3_parloop_131892_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_3_parloop_131892_start = get_wall_time();
    
    struct memblock mem_123560 = {.desc ="mem_123560", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_131891->free_mem_123560,
                                  .size =0, .references =NULL};
    struct memblock mem_123563 = {.desc ="mem_123563", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_131891->free_mem_123563,
                                  .size =0, .references =NULL};
    struct memblock mem_123566 = {.desc ="mem_123566", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_131891->free_mem_123566,
                                  .size =0, .references =NULL};
    struct memblock mem_123569 = {.desc ="mem_123569", .mem =
                                  futhark_mc_scan_stage_3_parloop_struct_131891->free_mem_123569,
                                  .size =0, .references =NULL};
    struct memblock double_buffer_mem_123838 = {.desc =
                                                "double_buffer_mem_123838",
                                                .mem =
                                                futhark_mc_scan_stage_3_parloop_struct_131891->free_double_buffer_mem_123838,
                                                .size =0, .references =NULL};
    int32_t defunc_2_radix_sort_step_arg_130849 =
            futhark_mc_scan_stage_3_parloop_struct_131891->free_defunc_2_radix_sort_step_arg_130849;
    int32_t defunc_0_get_bit_arg_130850 =
            futhark_mc_scan_stage_3_parloop_struct_131891->free_defunc_0_get_bit_arg_130850;
    bool cond_f_res_130851 =
         futhark_mc_scan_stage_3_parloop_struct_131891->free_cond_f_res_130851;
    bool cond_f_res_130852 =
         futhark_mc_scan_stage_3_parloop_struct_131891->free_cond_f_res_130852;
    int64_t iterations = end - start;
    int64_t iter_130971 = start;
    int64_t x_130959;
    int64_t x_130960;
    int64_t x_130961;
    int64_t x_130962;
    int64_t x_130963;
    int64_t x_130964;
    int64_t x_130965;
    int64_t x_130966;
    
    if (iter_130971 == (int64_t) 0) {
        x_130959 = (int64_t) 0;
    } else {
        x_130959 = ((int64_t *) mem_123560.mem)[iter_130971 - (int64_t) 1];
    }
    if (iter_130971 == (int64_t) 0) {
        x_130960 = (int64_t) 0;
    } else {
        x_130960 = ((int64_t *) mem_123563.mem)[iter_130971 - (int64_t) 1];
    }
    if (iter_130971 == (int64_t) 0) {
        x_130961 = (int64_t) 0;
    } else {
        x_130961 = ((int64_t *) mem_123566.mem)[iter_130971 - (int64_t) 1];
    }
    if (iter_130971 == (int64_t) 0) {
        x_130962 = (int64_t) 0;
    } else {
        x_130962 = ((int64_t *) mem_123569.mem)[iter_130971 - (int64_t) 1];
    }
    for (; iter_130971 < end; iter_130971++) {
        int64_t gtid_121013 = iter_130971;
        
        // stage 3 scan body
        {
            float x_130870 =
                  ((float *) double_buffer_mem_123838.mem)[gtid_121013];
            int32_t i32_arg_130871;
            
            i32_arg_130871 = futrts_to_bits32(x_130870);
            
            int32_t unsign_arg_130872 = ashr32(i32_arg_130871,
                                               defunc_0_get_bit_arg_130850);
            int32_t unsign_arg_130873 = 1 & unsign_arg_130872;
            int32_t unsign_arg_130874 = ashr32(i32_arg_130871, 31);
            int32_t unsign_arg_130875 = 1 & unsign_arg_130874;
            bool cond_130876 = unsign_arg_130875 == 1;
            bool x_130877 = !cond_130876;
            bool y_130878 = cond_f_res_130851 && x_130877;
            bool cond_130879 = cond_130876 || y_130878;
            int32_t defunc_1_get_bit_res_130880;
            
            if (cond_130879) {
                int32_t defunc_1_get_bit_res_t_res_130881 = 1 ^
                        unsign_arg_130873;
                
                defunc_1_get_bit_res_130880 = defunc_1_get_bit_res_t_res_130881;
            } else {
                defunc_1_get_bit_res_130880 = unsign_arg_130873;
            }
            
            int32_t x_130882 = mul32(2, defunc_1_get_bit_res_130880);
            int32_t unsign_arg_130883 = ashr32(i32_arg_130871,
                                               defunc_2_radix_sort_step_arg_130849);
            int32_t unsign_arg_130884 = 1 & unsign_arg_130883;
            bool y_130885 = cond_f_res_130852 && x_130877;
            bool cond_130886 = cond_130876 || y_130885;
            int32_t defunc_1_get_bit_res_130887;
            
            if (cond_130886) {
                int32_t defunc_1_get_bit_res_t_res_130888 = 1 ^
                        unsign_arg_130884;
                
                defunc_1_get_bit_res_130887 = defunc_1_get_bit_res_t_res_130888;
            } else {
                defunc_1_get_bit_res_130887 = unsign_arg_130884;
            }
            
            int32_t defunc_0_f_res_130889 = add32(x_130882,
                                                  defunc_1_get_bit_res_130887);
            bool cond_130890 = defunc_0_f_res_130889 == 0;
            int64_t defunc_0_f_res_130891 = btoi_bool_i64(cond_130890);
            int64_t defunc_0_f_res_130892;
            int64_t defunc_0_f_res_130893;
            int64_t defunc_0_f_res_130894;
            
            if (cond_130890) {
                defunc_0_f_res_130892 = (int64_t) 0;
                defunc_0_f_res_130893 = (int64_t) 0;
                defunc_0_f_res_130894 = (int64_t) 0;
            } else {
                bool cond_130895 = defunc_0_f_res_130889 == 1;
                int64_t defunc_0_f_res_f_res_130896 =
                        btoi_bool_i64(cond_130895);
                int64_t defunc_0_f_res_f_res_130897;
                int64_t defunc_0_f_res_f_res_130898;
                
                if (cond_130895) {
                    defunc_0_f_res_f_res_130897 = (int64_t) 0;
                    defunc_0_f_res_f_res_130898 = (int64_t) 0;
                } else {
                    bool cond_130899 = defunc_0_f_res_130889 == 2;
                    int64_t defunc_0_f_res_f_res_f_res_130900 =
                            btoi_bool_i64(cond_130899);
                    bool cond_neg_130901 = !cond_130899;
                    int64_t defunc_0_f_res_f_res_f_res_130902 =
                            btoi_bool_i64(cond_neg_130901);
                    
                    defunc_0_f_res_f_res_130897 =
                        defunc_0_f_res_f_res_f_res_130900;
                    defunc_0_f_res_f_res_130898 =
                        defunc_0_f_res_f_res_f_res_130902;
                }
                defunc_0_f_res_130892 = defunc_0_f_res_f_res_130896;
                defunc_0_f_res_130893 = defunc_0_f_res_f_res_130897;
                defunc_0_f_res_130894 = defunc_0_f_res_f_res_130898;
            }
            x_130959 = x_130959;
            x_130960 = x_130960;
            x_130961 = x_130961;
            x_130962 = x_130962;
            x_130963 = defunc_0_f_res_130891;
            x_130964 = defunc_0_f_res_130892;
            x_130965 = defunc_0_f_res_130893;
            x_130966 = defunc_0_f_res_130894;
            
            int64_t defunc_1_op_res_130967 = add64(x_130959, x_130963);
            int64_t defunc_1_op_res_130968 = add64(x_130960, x_130964);
            int64_t defunc_1_op_res_130969 = add64(x_130961, x_130965);
            int64_t defunc_1_op_res_130970 = add64(x_130962, x_130966);
            
            ((int64_t *) mem_123560.mem)[gtid_121013] = defunc_1_op_res_130967;
            x_130959 = defunc_1_op_res_130967;
            ((int64_t *) mem_123563.mem)[gtid_121013] = defunc_1_op_res_130968;
            x_130960 = defunc_1_op_res_130968;
            ((int64_t *) mem_123566.mem)[gtid_121013] = defunc_1_op_res_130969;
            x_130961 = defunc_1_op_res_130969;
            ((int64_t *) mem_123569.mem)[gtid_121013] = defunc_1_op_res_130970;
            x_130962 = defunc_1_op_res_130970;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_3_parloop_131892_end = get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_3_parloop_131892_end -
                 futhark_mc_scan_stage_3_parloop_131892_start;
        
        ctx->futhark_mc_scan_stage_3_parloop_131892_runs[tid]++;
        ctx->futhark_mc_scan_stage_3_parloop_131892_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_scan_stage_3_parloop_131892_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segscan_task_131884(void *args, int64_t iterations, int tid,
                                   struct scheduler_info info)
{
    int err = 0;
    int flat_tid_121012 = tid;
    int num_tasks_130934 = info.nsubtasks;
    struct futhark_mc_task_131883 *futhark_mc_task_131883 =
                                  (struct futhark_mc_task_131883 *) args;
    struct futhark_context *ctx = futhark_mc_task_131883->ctx;
    uint64_t futhark_mc_segscan_task_131884_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segscan_task_131884_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131883->free_n_114534;
    struct memblock mem_123560 = {.desc ="mem_123560", .mem =
                                  futhark_mc_task_131883->free_mem_123560,
                                  .size =0, .references =NULL};
    struct memblock mem_123563 = {.desc ="mem_123563", .mem =
                                  futhark_mc_task_131883->free_mem_123563,
                                  .size =0, .references =NULL};
    struct memblock mem_123566 = {.desc ="mem_123566", .mem =
                                  futhark_mc_task_131883->free_mem_123566,
                                  .size =0, .references =NULL};
    struct memblock mem_123569 = {.desc ="mem_123569", .mem =
                                  futhark_mc_task_131883->free_mem_123569,
                                  .size =0, .references =NULL};
    struct memblock mem_123572 = {.desc ="mem_123572", .mem =
                                  futhark_mc_task_131883->free_mem_123572,
                                  .size =0, .references =NULL};
    struct memblock double_buffer_mem_123838 = {.desc =
                                                "double_buffer_mem_123838",
                                                .mem =
                                                futhark_mc_task_131883->free_double_buffer_mem_123838,
                                                .size =0, .references =NULL};
    int32_t defunc_2_radix_sort_step_arg_130849 =
            futhark_mc_task_131883->free_defunc_2_radix_sort_step_arg_130849;
    int32_t defunc_0_get_bit_arg_130850 =
            futhark_mc_task_131883->free_defunc_0_get_bit_arg_130850;
    bool cond_f_res_130851 = futhark_mc_task_131883->free_cond_f_res_130851;
    bool cond_f_res_130852 = futhark_mc_task_131883->free_cond_f_res_130852;
    size_t scan_stage_2_accum_mem_130950_cached_sizze_131885 = 0;
    char *scan_stage_2_accum_mem_130950 = NULL;
    size_t scan_stage_2_accum_mem_130952_cached_sizze_131886 = 0;
    char *scan_stage_2_accum_mem_130952 = NULL;
    size_t scan_stage_2_accum_mem_130954_cached_sizze_131887 = 0;
    char *scan_stage_2_accum_mem_130954 = NULL;
    size_t scan_stage_2_accum_mem_130956_cached_sizze_131888 = 0;
    char *scan_stage_2_accum_mem_130956 = NULL;
    int64_t iter_130935;
    struct futhark_mc_scan_stage_1_parloop_struct_131889
    futhark_mc_scan_stage_1_parloop_struct_131889;
    
    futhark_mc_scan_stage_1_parloop_struct_131889.ctx = ctx;
    futhark_mc_scan_stage_1_parloop_struct_131889.free_mem_123560 =
        mem_123560.mem;
    futhark_mc_scan_stage_1_parloop_struct_131889.free_mem_123563 =
        mem_123563.mem;
    futhark_mc_scan_stage_1_parloop_struct_131889.free_mem_123566 =
        mem_123566.mem;
    futhark_mc_scan_stage_1_parloop_struct_131889.free_mem_123569 =
        mem_123569.mem;
    futhark_mc_scan_stage_1_parloop_struct_131889.free_mem_123572 =
        mem_123572.mem;
    futhark_mc_scan_stage_1_parloop_struct_131889.free_double_buffer_mem_123838 =
        double_buffer_mem_123838.mem;
    futhark_mc_scan_stage_1_parloop_struct_131889.free_defunc_2_radix_sort_step_arg_130849 =
        defunc_2_radix_sort_step_arg_130849;
    futhark_mc_scan_stage_1_parloop_struct_131889.free_defunc_0_get_bit_arg_130850 =
        defunc_0_get_bit_arg_130850;
    futhark_mc_scan_stage_1_parloop_struct_131889.free_cond_f_res_130851 =
        cond_f_res_130851;
    futhark_mc_scan_stage_1_parloop_struct_131889.free_cond_f_res_130852 =
        cond_f_res_130852;
    
    struct scheduler_parloop futhark_mc_scan_stage_1_parloop_131890_task;
    
    futhark_mc_scan_stage_1_parloop_131890_task.name =
        "futhark_mc_scan_stage_1_parloop_131890";
    futhark_mc_scan_stage_1_parloop_131890_task.fn =
        futhark_mc_scan_stage_1_parloop_131890;
    futhark_mc_scan_stage_1_parloop_131890_task.args =
        &futhark_mc_scan_stage_1_parloop_struct_131889;
    futhark_mc_scan_stage_1_parloop_131890_task.iterations = iterations;
    futhark_mc_scan_stage_1_parloop_131890_task.info = info;
    
    uint64_t futhark_mc_scan_stage_1_parloop_131890_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_scan_stage_1_parloop_131890_total_start = get_wall_time();
    
    int futhark_mc_scan_stage_1_parloop_131890_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_scan_stage_1_parloop_131890_task);
    
    if (futhark_mc_scan_stage_1_parloop_131890_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_scan_stage_1_parloop_131890_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_scan_stage_1_parloop_131890_total_end -
                 futhark_mc_scan_stage_1_parloop_131890_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131890_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131890_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_scan_stage_1_parloop_131890_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (slt32(1, num_tasks_130934)) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "nonsegmentedScan stage 2");
        
        int64_t x_130936;
        int64_t x_130937;
        int64_t x_130938;
        int64_t x_130939;
        int64_t x_130940;
        int64_t x_130941;
        int64_t x_130942;
        int64_t x_130943;
        int64_t offset_130948 = (int64_t) 0;
        int64_t offset_index_130949 = (int64_t) 0;
        
        if (scan_stage_2_accum_mem_130950_cached_sizze_131885 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_130950 =
                realloc(scan_stage_2_accum_mem_130950, (int64_t) 8);
            scan_stage_2_accum_mem_130950_cached_sizze_131885 = (int64_t) 8;
        }
        if (scan_stage_2_accum_mem_130952_cached_sizze_131886 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_130952 =
                realloc(scan_stage_2_accum_mem_130952, (int64_t) 8);
            scan_stage_2_accum_mem_130952_cached_sizze_131886 = (int64_t) 8;
        }
        if (scan_stage_2_accum_mem_130954_cached_sizze_131887 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_130954 =
                realloc(scan_stage_2_accum_mem_130954, (int64_t) 8);
            scan_stage_2_accum_mem_130954_cached_sizze_131887 = (int64_t) 8;
        }
        if (scan_stage_2_accum_mem_130956_cached_sizze_131888 <
            (size_t) (int64_t) 8) {
            scan_stage_2_accum_mem_130956 =
                realloc(scan_stage_2_accum_mem_130956, (int64_t) 8);
            scan_stage_2_accum_mem_130956_cached_sizze_131888 = (int64_t) 8;
        }
        ((int64_t *) scan_stage_2_accum_mem_130950)[(int64_t) 0] = (int64_t) 0;
        ((int64_t *) scan_stage_2_accum_mem_130952)[(int64_t) 0] = (int64_t) 0;
        ((int64_t *) scan_stage_2_accum_mem_130954)[(int64_t) 0] = (int64_t) 0;
        ((int64_t *) scan_stage_2_accum_mem_130956)[(int64_t) 0] = (int64_t) 0;
        for (int32_t i_130958 = 0; i_130958 < num_tasks_130934 - 1;
             i_130958++) {
            offset_130948 = squot64(n_114534, sext_i32_i64(num_tasks_130934));
            if (slt64(sext_i32_i64(i_130958), srem64(n_114534,
                                                     sext_i32_i64(num_tasks_130934)))) {
                offset_130948 += (int64_t) 1;
            }
            offset_index_130949 += offset_130948;
            
            int64_t gtid_121013 = offset_index_130949;
            float x_130870 =
                  ((float *) double_buffer_mem_123838.mem)[gtid_121013];
            int32_t i32_arg_130871;
            
            i32_arg_130871 = futrts_to_bits32(x_130870);
            
            int32_t unsign_arg_130872 = ashr32(i32_arg_130871,
                                               defunc_0_get_bit_arg_130850);
            int32_t unsign_arg_130873 = 1 & unsign_arg_130872;
            int32_t unsign_arg_130874 = ashr32(i32_arg_130871, 31);
            int32_t unsign_arg_130875 = 1 & unsign_arg_130874;
            bool cond_130876 = unsign_arg_130875 == 1;
            bool x_130877 = !cond_130876;
            bool y_130878 = cond_f_res_130851 && x_130877;
            bool cond_130879 = cond_130876 || y_130878;
            int32_t defunc_1_get_bit_res_130880;
            
            if (cond_130879) {
                int32_t defunc_1_get_bit_res_t_res_130881 = 1 ^
                        unsign_arg_130873;
                
                defunc_1_get_bit_res_130880 = defunc_1_get_bit_res_t_res_130881;
            } else {
                defunc_1_get_bit_res_130880 = unsign_arg_130873;
            }
            
            int32_t x_130882 = mul32(2, defunc_1_get_bit_res_130880);
            int32_t unsign_arg_130883 = ashr32(i32_arg_130871,
                                               defunc_2_radix_sort_step_arg_130849);
            int32_t unsign_arg_130884 = 1 & unsign_arg_130883;
            bool y_130885 = cond_f_res_130852 && x_130877;
            bool cond_130886 = cond_130876 || y_130885;
            int32_t defunc_1_get_bit_res_130887;
            
            if (cond_130886) {
                int32_t defunc_1_get_bit_res_t_res_130888 = 1 ^
                        unsign_arg_130884;
                
                defunc_1_get_bit_res_130887 = defunc_1_get_bit_res_t_res_130888;
            } else {
                defunc_1_get_bit_res_130887 = unsign_arg_130884;
            }
            
            int32_t defunc_0_f_res_130889 = add32(x_130882,
                                                  defunc_1_get_bit_res_130887);
            bool cond_130890 = defunc_0_f_res_130889 == 0;
            int64_t defunc_0_f_res_130891 = btoi_bool_i64(cond_130890);
            int64_t defunc_0_f_res_130892;
            int64_t defunc_0_f_res_130893;
            int64_t defunc_0_f_res_130894;
            
            if (cond_130890) {
                defunc_0_f_res_130892 = (int64_t) 0;
                defunc_0_f_res_130893 = (int64_t) 0;
                defunc_0_f_res_130894 = (int64_t) 0;
            } else {
                bool cond_130895 = defunc_0_f_res_130889 == 1;
                int64_t defunc_0_f_res_f_res_130896 =
                        btoi_bool_i64(cond_130895);
                int64_t defunc_0_f_res_f_res_130897;
                int64_t defunc_0_f_res_f_res_130898;
                
                if (cond_130895) {
                    defunc_0_f_res_f_res_130897 = (int64_t) 0;
                    defunc_0_f_res_f_res_130898 = (int64_t) 0;
                } else {
                    bool cond_130899 = defunc_0_f_res_130889 == 2;
                    int64_t defunc_0_f_res_f_res_f_res_130900 =
                            btoi_bool_i64(cond_130899);
                    bool cond_neg_130901 = !cond_130899;
                    int64_t defunc_0_f_res_f_res_f_res_130902 =
                            btoi_bool_i64(cond_neg_130901);
                    
                    defunc_0_f_res_f_res_130897 =
                        defunc_0_f_res_f_res_f_res_130900;
                    defunc_0_f_res_f_res_130898 =
                        defunc_0_f_res_f_res_f_res_130902;
                }
                defunc_0_f_res_130892 = defunc_0_f_res_f_res_130896;
                defunc_0_f_res_130893 = defunc_0_f_res_f_res_130897;
                defunc_0_f_res_130894 = defunc_0_f_res_f_res_130898;
            }
            // Read carry in
            {
                x_130936 =
                    ((int64_t *) scan_stage_2_accum_mem_130950)[(int64_t) 0];
                x_130937 =
                    ((int64_t *) scan_stage_2_accum_mem_130952)[(int64_t) 0];
                x_130938 =
                    ((int64_t *) scan_stage_2_accum_mem_130954)[(int64_t) 0];
                x_130939 =
                    ((int64_t *) scan_stage_2_accum_mem_130956)[(int64_t) 0];
            }
            // Read next values
            {
                x_130940 = ((int64_t *) mem_123560.mem)[offset_index_130949 -
                                                        (int64_t) 1];
                x_130941 = ((int64_t *) mem_123563.mem)[offset_index_130949 -
                                                        (int64_t) 1];
                x_130942 = ((int64_t *) mem_123566.mem)[offset_index_130949 -
                                                        (int64_t) 1];
                x_130943 = ((int64_t *) mem_123569.mem)[offset_index_130949 -
                                                        (int64_t) 1];
            }
            
            int64_t defunc_1_op_res_130944 = add64(x_130936, x_130940);
            int64_t defunc_1_op_res_130945 = add64(x_130937, x_130941);
            int64_t defunc_1_op_res_130946 = add64(x_130938, x_130942);
            int64_t defunc_1_op_res_130947 = add64(x_130939, x_130943);
            
            ((int64_t *) mem_123560.mem)[offset_index_130949 - (int64_t) 1] =
                defunc_1_op_res_130944;
            ((int64_t *) scan_stage_2_accum_mem_130950)[(int64_t) 0] =
                defunc_1_op_res_130944;
            ((int64_t *) mem_123563.mem)[offset_index_130949 - (int64_t) 1] =
                defunc_1_op_res_130945;
            ((int64_t *) scan_stage_2_accum_mem_130952)[(int64_t) 0] =
                defunc_1_op_res_130945;
            ((int64_t *) mem_123566.mem)[offset_index_130949 - (int64_t) 1] =
                defunc_1_op_res_130946;
            ((int64_t *) scan_stage_2_accum_mem_130954)[(int64_t) 0] =
                defunc_1_op_res_130946;
            ((int64_t *) mem_123569.mem)[offset_index_130949 - (int64_t) 1] =
                defunc_1_op_res_130947;
            ((int64_t *) scan_stage_2_accum_mem_130956)[(int64_t) 0] =
                defunc_1_op_res_130947;
        }
        
        int64_t iter_130971 = (int64_t) 0;
        struct futhark_mc_scan_stage_3_parloop_struct_131891
        futhark_mc_scan_stage_3_parloop_struct_131891;
        
        futhark_mc_scan_stage_3_parloop_struct_131891.ctx = ctx;
        futhark_mc_scan_stage_3_parloop_struct_131891.free_mem_123560 =
            mem_123560.mem;
        futhark_mc_scan_stage_3_parloop_struct_131891.free_mem_123563 =
            mem_123563.mem;
        futhark_mc_scan_stage_3_parloop_struct_131891.free_mem_123566 =
            mem_123566.mem;
        futhark_mc_scan_stage_3_parloop_struct_131891.free_mem_123569 =
            mem_123569.mem;
        futhark_mc_scan_stage_3_parloop_struct_131891.free_double_buffer_mem_123838 =
            double_buffer_mem_123838.mem;
        futhark_mc_scan_stage_3_parloop_struct_131891.free_defunc_2_radix_sort_step_arg_130849 =
            defunc_2_radix_sort_step_arg_130849;
        futhark_mc_scan_stage_3_parloop_struct_131891.free_defunc_0_get_bit_arg_130850 =
            defunc_0_get_bit_arg_130850;
        futhark_mc_scan_stage_3_parloop_struct_131891.free_cond_f_res_130851 =
            cond_f_res_130851;
        futhark_mc_scan_stage_3_parloop_struct_131891.free_cond_f_res_130852 =
            cond_f_res_130852;
        
        struct scheduler_parloop futhark_mc_scan_stage_3_parloop_131892_task;
        
        futhark_mc_scan_stage_3_parloop_131892_task.name =
            "futhark_mc_scan_stage_3_parloop_131892";
        futhark_mc_scan_stage_3_parloop_131892_task.fn =
            futhark_mc_scan_stage_3_parloop_131892;
        futhark_mc_scan_stage_3_parloop_131892_task.args =
            &futhark_mc_scan_stage_3_parloop_struct_131891;
        futhark_mc_scan_stage_3_parloop_131892_task.iterations = iterations;
        futhark_mc_scan_stage_3_parloop_131892_task.info = info;
        
        uint64_t futhark_mc_scan_stage_3_parloop_131892_total_start = 0;
        
        if (ctx->profiling && !ctx->profiling_paused)
            futhark_mc_scan_stage_3_parloop_131892_total_start =
                get_wall_time();
        
        int futhark_mc_scan_stage_3_parloop_131892_err =
            scheduler_execute_task(&ctx->scheduler,
                                   &futhark_mc_scan_stage_3_parloop_131892_task);
        
        if (futhark_mc_scan_stage_3_parloop_131892_err != 0) {
            err = 1;
            goto cleanup;
        }
        if (ctx->profiling && !ctx->profiling_paused) {
            uint64_t futhark_mc_scan_stage_3_parloop_131892_total_end =
                     get_wall_time();
            uint64_t elapsed =
                     futhark_mc_scan_stage_3_parloop_131892_total_end -
                     futhark_mc_scan_stage_3_parloop_131892_total_start;
            
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131892_total_runs,
                               1, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131892_total_total_runtime,
                               elapsed, __ATOMIC_RELAXED);
            __atomic_fetch_add(&ctx->futhark_mc_scan_stage_3_parloop_131892_total_iter,
                               iterations, __ATOMIC_RELAXED);
        }
    }
    free(scan_stage_2_accum_mem_130950);
    free(scan_stage_2_accum_mem_130952);
    free(scan_stage_2_accum_mem_130954);
    free(scan_stage_2_accum_mem_130956);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segscan_task_131884_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segscan_task_131884_end -
                 futhark_mc_segscan_task_131884_start;
        
        ctx->futhark_mc_segscan_task_131884_runs[tid]++;
        ctx->futhark_mc_segscan_task_131884_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segscan_task_131884_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131893 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    char *free_mem_123560;
    char *free_mem_123563;
    char *free_mem_123566;
    char *free_mem_123569;
    char *free_mem_123572;
    char *free_mem_123575;
    char *free_double_buffer_mem_123838;
    int64_t free_last_res_130903;
    int64_t free_last_res_130904;
    int64_t free_last_res_130905;
};
struct futhark_mc_segmap_parloop_struct_131895 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    char *free_mem_123560;
    char *free_mem_123563;
    char *free_mem_123566;
    char *free_mem_123569;
    char *free_mem_123572;
    char *free_mem_123575;
    char *free_double_buffer_mem_123838;
    int64_t free_last_res_130903;
    int64_t free_last_res_130904;
    int64_t free_last_res_130905;
};
static int futhark_mc_segmap_parloop_131896(void *args, int64_t start,
                                            int64_t end, int flat_tid_121014,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131895
    *futhark_mc_segmap_parloop_struct_131895 =
    (struct futhark_mc_segmap_parloop_struct_131895 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131895->ctx;
    uint64_t futhark_mc_segmap_parloop_131896_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131896_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131895->free_n_114534;
    struct memblock mem_123560 = {.desc ="mem_123560", .mem =
                                  futhark_mc_segmap_parloop_struct_131895->free_mem_123560,
                                  .size =0, .references =NULL};
    struct memblock mem_123563 = {.desc ="mem_123563", .mem =
                                  futhark_mc_segmap_parloop_struct_131895->free_mem_123563,
                                  .size =0, .references =NULL};
    struct memblock mem_123566 = {.desc ="mem_123566", .mem =
                                  futhark_mc_segmap_parloop_struct_131895->free_mem_123566,
                                  .size =0, .references =NULL};
    struct memblock mem_123569 = {.desc ="mem_123569", .mem =
                                  futhark_mc_segmap_parloop_struct_131895->free_mem_123569,
                                  .size =0, .references =NULL};
    struct memblock mem_123572 = {.desc ="mem_123572", .mem =
                                  futhark_mc_segmap_parloop_struct_131895->free_mem_123572,
                                  .size =0, .references =NULL};
    struct memblock mem_123575 = {.desc ="mem_123575", .mem =
                                  futhark_mc_segmap_parloop_struct_131895->free_mem_123575,
                                  .size =0, .references =NULL};
    struct memblock double_buffer_mem_123838 = {.desc =
                                                "double_buffer_mem_123838",
                                                .mem =
                                                futhark_mc_segmap_parloop_struct_131895->free_double_buffer_mem_123838,
                                                .size =0, .references =NULL};
    int64_t last_res_130903 =
            futhark_mc_segmap_parloop_struct_131895->free_last_res_130903;
    int64_t last_res_130904 =
            futhark_mc_segmap_parloop_struct_131895->free_last_res_130904;
    int64_t last_res_130905 =
            futhark_mc_segmap_parloop_struct_131895->free_last_res_130905;
    int64_t iterations = end - start;
    int64_t iter_130973 = start;
    
    for (; iter_130973 < end; iter_130973++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130992 = n_114534;
        int64_t gtid_121015 = iter_130973;
        int64_t remnant_130993 = iter_130973 - gtid_121015;
        int32_t x_130908 = ((int32_t *) mem_123572.mem)[gtid_121015];
        float write_value_130909 =
              ((float *) double_buffer_mem_123838.mem)[gtid_121015];
        bool match_lit_130910 = 0 == x_130908;
        int64_t defunc_1_f_res_130911;
        
        if (match_lit_130910) {
            int64_t x_130974 = ((int64_t *) mem_123560.mem)[gtid_121015];
            int64_t case_res_130975 = sub64(x_130974, (int64_t) 1);
            
            defunc_1_f_res_130911 = case_res_130975;
        } else {
            bool match_lit_130976 = 1 == x_130908;
            int64_t x_130977;
            
            if (match_lit_130976) {
                int64_t x_130978 = ((int64_t *) mem_123563.mem)[gtid_121015];
                int64_t x_130979 = add64(last_res_130903, x_130978);
                int64_t case_res_130980 = sub64(x_130979, (int64_t) 1);
                
                x_130977 = case_res_130980;
            } else {
                bool match_lit_130981 = 2 == x_130908;
                int64_t x_130982;
                
                if (match_lit_130981) {
                    int64_t x_130983 =
                            ((int64_t *) mem_123566.mem)[gtid_121015];
                    int64_t x_130984 = add64(last_res_130903, last_res_130904);
                    int64_t x_130985 = add64(x_130983, x_130984);
                    int64_t case_res_130986 = sub64(x_130985, (int64_t) 1);
                    
                    x_130982 = case_res_130986;
                } else {
                    int64_t x_130987 =
                            ((int64_t *) mem_123569.mem)[gtid_121015];
                    int64_t x_130988 = add64(last_res_130903, last_res_130904);
                    int64_t x_130989 = add64(last_res_130905, x_130988);
                    int64_t x_130990 = add64(x_130987, x_130989);
                    int64_t defunc_1_f_res_res_130991 = sub64(x_130990,
                                                              (int64_t) 1);
                    
                    x_130982 = defunc_1_f_res_res_130991;
                }
                x_130977 = x_130982;
            }
            defunc_1_f_res_130911 = x_130977;
        }
        if (sle64((int64_t) 0, defunc_1_f_res_130911) &&
            slt64(defunc_1_f_res_130911, n_114534)) {
            ((float *) mem_123575.mem)[defunc_1_f_res_130911] =
                write_value_130909;
        }
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131896_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131896_end -
                 futhark_mc_segmap_parloop_131896_start;
        
        ctx->futhark_mc_segmap_parloop_131896_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131896_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131896_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131894(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_121014 = tid;
    int num_tasks_130972 = info.nsubtasks;
    struct futhark_mc_task_131893 *futhark_mc_task_131893 =
                                  (struct futhark_mc_task_131893 *) args;
    struct futhark_context *ctx = futhark_mc_task_131893->ctx;
    uint64_t futhark_mc_segmap_task_131894_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131894_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131893->free_n_114534;
    struct memblock mem_123560 = {.desc ="mem_123560", .mem =
                                  futhark_mc_task_131893->free_mem_123560,
                                  .size =0, .references =NULL};
    struct memblock mem_123563 = {.desc ="mem_123563", .mem =
                                  futhark_mc_task_131893->free_mem_123563,
                                  .size =0, .references =NULL};
    struct memblock mem_123566 = {.desc ="mem_123566", .mem =
                                  futhark_mc_task_131893->free_mem_123566,
                                  .size =0, .references =NULL};
    struct memblock mem_123569 = {.desc ="mem_123569", .mem =
                                  futhark_mc_task_131893->free_mem_123569,
                                  .size =0, .references =NULL};
    struct memblock mem_123572 = {.desc ="mem_123572", .mem =
                                  futhark_mc_task_131893->free_mem_123572,
                                  .size =0, .references =NULL};
    struct memblock mem_123575 = {.desc ="mem_123575", .mem =
                                  futhark_mc_task_131893->free_mem_123575,
                                  .size =0, .references =NULL};
    struct memblock double_buffer_mem_123838 = {.desc =
                                                "double_buffer_mem_123838",
                                                .mem =
                                                futhark_mc_task_131893->free_double_buffer_mem_123838,
                                                .size =0, .references =NULL};
    int64_t last_res_130903 = futhark_mc_task_131893->free_last_res_130903;
    int64_t last_res_130904 = futhark_mc_task_131893->free_last_res_130904;
    int64_t last_res_130905 = futhark_mc_task_131893->free_last_res_130905;
    int64_t iter_130973;
    struct futhark_mc_segmap_parloop_struct_131895
    futhark_mc_segmap_parloop_struct_131895;
    
    futhark_mc_segmap_parloop_struct_131895.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131895.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131895.free_mem_123560 = mem_123560.mem;
    futhark_mc_segmap_parloop_struct_131895.free_mem_123563 = mem_123563.mem;
    futhark_mc_segmap_parloop_struct_131895.free_mem_123566 = mem_123566.mem;
    futhark_mc_segmap_parloop_struct_131895.free_mem_123569 = mem_123569.mem;
    futhark_mc_segmap_parloop_struct_131895.free_mem_123572 = mem_123572.mem;
    futhark_mc_segmap_parloop_struct_131895.free_mem_123575 = mem_123575.mem;
    futhark_mc_segmap_parloop_struct_131895.free_double_buffer_mem_123838 =
        double_buffer_mem_123838.mem;
    futhark_mc_segmap_parloop_struct_131895.free_last_res_130903 =
        last_res_130903;
    futhark_mc_segmap_parloop_struct_131895.free_last_res_130904 =
        last_res_130904;
    futhark_mc_segmap_parloop_struct_131895.free_last_res_130905 =
        last_res_130905;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131896_task;
    
    futhark_mc_segmap_parloop_131896_task.name =
        "futhark_mc_segmap_parloop_131896";
    futhark_mc_segmap_parloop_131896_task.fn = futhark_mc_segmap_parloop_131896;
    futhark_mc_segmap_parloop_131896_task.args =
        &futhark_mc_segmap_parloop_struct_131895;
    futhark_mc_segmap_parloop_131896_task.iterations = iterations;
    futhark_mc_segmap_parloop_131896_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131896_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131896_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131896_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131896_task);
    
    if (futhark_mc_segmap_parloop_131896_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131896_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131896_total_end -
                 futhark_mc_segmap_parloop_131896_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131896_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131896_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131896_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131894_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131894_end -
                 futhark_mc_segmap_task_131894_start;
        
        ctx->futhark_mc_segmap_task_131894_runs[tid]++;
        ctx->futhark_mc_segmap_task_131894_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131894_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131875(void *args, int64_t start,
                                            int64_t end, int flat_tid_121010,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131874
    *futhark_mc_segmap_parloop_struct_131874 =
    (struct futhark_mc_segmap_parloop_struct_131874 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131874->ctx;
    uint64_t futhark_mc_segmap_parloop_131875_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131875_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131874->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131874->free_n_114534;
    int64_t i_114610 = futhark_mc_segmap_parloop_struct_131874->free_i_114610;
    int32_t iters_116571 =
            futhark_mc_segmap_parloop_struct_131874->free_iters_116571;
    int64_t bytes_121940 =
            futhark_mc_segmap_parloop_struct_131874->free_bytes_121940;
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131874->free_bytes_121983;
    struct memblock mem_123542 = {.desc ="mem_123542", .mem =
                                  futhark_mc_segmap_parloop_struct_131874->free_mem_123542,
                                  .size =0, .references =NULL};
    struct memblock mem_123696 = {.desc ="mem_123696", .mem =
                                  futhark_mc_segmap_parloop_struct_131874->free_mem_123696,
                                  .size =0, .references =NULL};
    int64_t double_buffer_sizze_123840 =
            futhark_mc_segmap_parloop_struct_131874->free_double_buffer_sizze_123840;
    size_t mem_123560_cached_sizze_131876 = 0;
    char *mem_123560 = NULL;
    size_t mem_123563_cached_sizze_131877 = 0;
    char *mem_123563 = NULL;
    size_t mem_123566_cached_sizze_131878 = 0;
    char *mem_123566 = NULL;
    size_t mem_123569_cached_sizze_131879 = 0;
    char *mem_123569 = NULL;
    size_t mem_123572_cached_sizze_131880 = 0;
    char *mem_123572 = NULL;
    size_t mem_123575_cached_sizze_131881 = 0;
    char *mem_123575 = NULL;
    size_t double_buffer_mem_123838_cached_sizze_131882 = 0;
    char *double_buffer_mem_123838 = NULL;
    int64_t iterations = end - start;
    int64_t iter_130846 = start;
    
    if (mem_123560_cached_sizze_131876 < (size_t) bytes_121940) {
        mem_123560 = realloc(mem_123560, bytes_121940);
        mem_123560_cached_sizze_131876 = bytes_121940;
    }
    if (mem_123563_cached_sizze_131877 < (size_t) bytes_121940) {
        mem_123563 = realloc(mem_123563, bytes_121940);
        mem_123563_cached_sizze_131877 = bytes_121940;
    }
    if (mem_123566_cached_sizze_131878 < (size_t) bytes_121940) {
        mem_123566 = realloc(mem_123566, bytes_121940);
        mem_123566_cached_sizze_131878 = bytes_121940;
    }
    if (mem_123569_cached_sizze_131879 < (size_t) bytes_121940) {
        mem_123569 = realloc(mem_123569, bytes_121940);
        mem_123569_cached_sizze_131879 = bytes_121940;
    }
    if (mem_123572_cached_sizze_131880 < (size_t) bytes_121983) {
        mem_123572 = realloc(mem_123572, bytes_121983);
        mem_123572_cached_sizze_131880 = bytes_121983;
    }
    if (double_buffer_mem_123838_cached_sizze_131882 <
        (size_t) double_buffer_sizze_123840) {
        double_buffer_mem_123838 = realloc(double_buffer_mem_123838,
                                           double_buffer_sizze_123840);
        double_buffer_mem_123838_cached_sizze_131882 =
            double_buffer_sizze_123840;
    }
    if (mem_123575_cached_sizze_131881 < (size_t) bytes_121983) {
        mem_123575 = realloc(mem_123575, bytes_121983);
        mem_123575_cached_sizze_131881 = bytes_121983;
    }
    for (; iter_130846 < end; iter_130846++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_130931 = m_114533;
        int64_t gtid_121011 = iter_130846;
        int64_t remnant_130932 = iter_130846 - gtid_121011;
        
        memmove(double_buffer_mem_123838 + (int64_t) 0, mem_123542.mem +
                gtid_121011 * n_114534 * (int64_t) 4, n_114534 * (int64_t) 4);
        for (int32_t i_130847 = 0; i_130847 < iters_116571; i_130847++) {
            int32_t defunc_2_radix_sort_step_arg_130849 = mul32(2, i_130847);
            int32_t defunc_0_get_bit_arg_130850 = add32(1,
                                                        defunc_2_radix_sort_step_arg_130849);
            bool cond_f_res_130851 = defunc_0_get_bit_arg_130850 == 31;
            bool cond_f_res_130852 = defunc_2_radix_sort_step_arg_130849 == 31;
            int64_t flat_tid_121012 = (int64_t) 0;
            int32_t num_tasks_130934;
            
            if (ctx->debugging)
                fprintf(ctx->log, "%s\n", "nonsegmented segScan");
            
            struct futhark_mc_task_131883 futhark_mc_task_131883;
            
            futhark_mc_task_131883.ctx = ctx;
            futhark_mc_task_131883.free_n_114534 = n_114534;
            futhark_mc_task_131883.free_mem_123560 = mem_123560;
            futhark_mc_task_131883.free_mem_123563 = mem_123563;
            futhark_mc_task_131883.free_mem_123566 = mem_123566;
            futhark_mc_task_131883.free_mem_123569 = mem_123569;
            futhark_mc_task_131883.free_mem_123572 = mem_123572;
            futhark_mc_task_131883.free_double_buffer_mem_123838 =
                double_buffer_mem_123838;
            futhark_mc_task_131883.free_defunc_2_radix_sort_step_arg_130849 =
                defunc_2_radix_sort_step_arg_130849;
            futhark_mc_task_131883.free_defunc_0_get_bit_arg_130850 =
                defunc_0_get_bit_arg_130850;
            futhark_mc_task_131883.free_cond_f_res_130851 = cond_f_res_130851;
            futhark_mc_task_131883.free_cond_f_res_130852 = cond_f_res_130852;
            
            struct scheduler_segop futhark_mc_task_131883_task;
            
            futhark_mc_task_131883_task.args = &futhark_mc_task_131883;
            futhark_mc_task_131883_task.top_level_fn =
                futhark_mc_segscan_task_131884;
            futhark_mc_task_131883_task.name = "futhark_mc_segscan_task_131884";
            futhark_mc_task_131883_task.iterations = n_114534;
            futhark_mc_task_131883_task.task_time =
                &ctx->futhark_mc_segscan_task_131884_total_time;
            futhark_mc_task_131883_task.task_iter =
                &ctx->futhark_mc_segscan_task_131884_total_iter;
            futhark_mc_task_131883_task.sched = STATIC;
            futhark_mc_task_131883_task.nested_fn = NULL;
            
            int futhark_mc_segscan_task_131884_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131883_task);
            
            if (futhark_mc_segscan_task_131884_err != 0) {
                err = 1;
                goto cleanup;
            }
            
            int64_t last_res_130903 = ((int64_t *) mem_123560)[i_114610];
            int64_t last_res_130904 = ((int64_t *) mem_123563)[i_114610];
            int64_t last_res_130905 = ((int64_t *) mem_123566)[i_114610];
            
            memmove(mem_123575 + (int64_t) 0, double_buffer_mem_123838 +
                    (int64_t) 0, n_114534 * (int64_t) 4);
            
            int64_t flat_tid_121014 = (int64_t) 0;
            int32_t num_tasks_130972;
            struct futhark_mc_task_131893 futhark_mc_task_131893;
            
            futhark_mc_task_131893.ctx = ctx;
            futhark_mc_task_131893.free_n_114534 = n_114534;
            futhark_mc_task_131893.free_mem_123560 = mem_123560;
            futhark_mc_task_131893.free_mem_123563 = mem_123563;
            futhark_mc_task_131893.free_mem_123566 = mem_123566;
            futhark_mc_task_131893.free_mem_123569 = mem_123569;
            futhark_mc_task_131893.free_mem_123572 = mem_123572;
            futhark_mc_task_131893.free_mem_123575 = mem_123575;
            futhark_mc_task_131893.free_double_buffer_mem_123838 =
                double_buffer_mem_123838;
            futhark_mc_task_131893.free_last_res_130903 = last_res_130903;
            futhark_mc_task_131893.free_last_res_130904 = last_res_130904;
            futhark_mc_task_131893.free_last_res_130905 = last_res_130905;
            
            struct scheduler_segop futhark_mc_task_131893_task;
            
            futhark_mc_task_131893_task.args = &futhark_mc_task_131893;
            futhark_mc_task_131893_task.top_level_fn =
                futhark_mc_segmap_task_131894;
            futhark_mc_task_131893_task.name = "futhark_mc_segmap_task_131894";
            futhark_mc_task_131893_task.iterations = n_114534;
            futhark_mc_task_131893_task.task_time =
                &ctx->futhark_mc_segmap_task_131894_total_time;
            futhark_mc_task_131893_task.task_iter =
                &ctx->futhark_mc_segmap_task_131894_total_iter;
            futhark_mc_task_131893_task.sched = STATIC;
            futhark_mc_task_131893_task.nested_fn = NULL;
            
            int futhark_mc_segmap_task_131894_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131893_task);
            
            if (futhark_mc_segmap_task_131894_err != 0) {
                err = 1;
                goto cleanup;
            }
            memmove(double_buffer_mem_123838 + (int64_t) 0, mem_123575 +
                    (int64_t) 0, n_114534 * (int64_t) 4);
        }
        memmove(mem_123696.mem + gtid_121011 * n_114534 * (int64_t) 4,
                double_buffer_mem_123838 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123560);
    free(mem_123563);
    free(mem_123566);
    free(mem_123569);
    free(mem_123572);
    free(mem_123575);
    free(double_buffer_mem_123838);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131875_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131875_end -
                 futhark_mc_segmap_parloop_131875_start;
        
        ctx->futhark_mc_segmap_parloop_131875_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131875_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131875_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131873(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_121010 = tid;
    int num_tasks_130728 = info.nsubtasks;
    struct futhark_mc_task_131862 *futhark_mc_task_131862 =
                                  (struct futhark_mc_task_131862 *) args;
    struct futhark_context *ctx = futhark_mc_task_131862->ctx;
    uint64_t futhark_mc_segmap_nested_task_131873_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131873_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131862->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131862->free_n_114534;
    int64_t i_114610 = futhark_mc_task_131862->free_i_114610;
    int32_t iters_116571 = futhark_mc_task_131862->free_iters_116571;
    int64_t bytes_121940 = futhark_mc_task_131862->free_bytes_121940;
    int64_t bytes_121983 = futhark_mc_task_131862->free_bytes_121983;
    struct memblock mem_123542 = {.desc ="mem_123542", .mem =
                                  futhark_mc_task_131862->free_mem_123542,
                                  .size =0, .references =NULL};
    struct memblock mem_123696 = {.desc ="mem_123696", .mem =
                                  futhark_mc_task_131862->free_mem_123696,
                                  .size =0, .references =NULL};
    int64_t double_buffer_sizze_123840 =
            futhark_mc_task_131862->free_double_buffer_sizze_123840;
    int64_t double_buffer_sizze_123844 =
            futhark_mc_task_131862->free_double_buffer_sizze_123844;
    int64_t iter_130846;
    struct futhark_mc_segmap_parloop_struct_131874
    futhark_mc_segmap_parloop_struct_131874;
    
    futhark_mc_segmap_parloop_struct_131874.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131874.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131874.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131874.free_i_114610 = i_114610;
    futhark_mc_segmap_parloop_struct_131874.free_iters_116571 = iters_116571;
    futhark_mc_segmap_parloop_struct_131874.free_bytes_121940 = bytes_121940;
    futhark_mc_segmap_parloop_struct_131874.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131874.free_mem_123542 = mem_123542.mem;
    futhark_mc_segmap_parloop_struct_131874.free_mem_123696 = mem_123696.mem;
    futhark_mc_segmap_parloop_struct_131874.free_double_buffer_sizze_123840 =
        double_buffer_sizze_123840;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131875_task;
    
    futhark_mc_segmap_parloop_131875_task.name =
        "futhark_mc_segmap_parloop_131875";
    futhark_mc_segmap_parloop_131875_task.fn = futhark_mc_segmap_parloop_131875;
    futhark_mc_segmap_parloop_131875_task.args =
        &futhark_mc_segmap_parloop_struct_131874;
    futhark_mc_segmap_parloop_131875_task.iterations = iterations;
    futhark_mc_segmap_parloop_131875_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131875_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131875_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131875_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131875_task);
    
    if (futhark_mc_segmap_parloop_131875_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131875_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131875_total_end -
                 futhark_mc_segmap_parloop_131875_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131875_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131875_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131875_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131873_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131873_end -
                 futhark_mc_segmap_nested_task_131873_start;
        
        ctx->futhark_mc_segmap_nested_task_131873_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131873_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131873_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131897 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_stl_res_114604;
    int64_t free_j_m_i_115007;
    char *free_mem_123696;
    char *free_mem_123699;
    char *free_mem_123702;
    char *free_mem_123705;
};
struct futhark_mc_segmap_parloop_struct_131899 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_stl_res_114604;
    int64_t free_j_m_i_115007;
    char *free_mem_123696;
    char *free_mem_123699;
    char *free_mem_123702;
    char *free_mem_123705;
};
static int futhark_mc_segmap_parloop_131900(void *args, int64_t start,
                                            int64_t end, int flat_tid_121101,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131899
    *futhark_mc_segmap_parloop_struct_131899 =
    (struct futhark_mc_segmap_parloop_struct_131899 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131899->ctx;
    uint64_t futhark_mc_segmap_parloop_131900_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131900_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131899->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131899->free_n_114534;
    int64_t stl_res_114604 =
            futhark_mc_segmap_parloop_struct_131899->free_stl_res_114604;
    int64_t j_m_i_115007 =
            futhark_mc_segmap_parloop_struct_131899->free_j_m_i_115007;
    struct memblock mem_123696 = {.desc ="mem_123696", .mem =
                                  futhark_mc_segmap_parloop_struct_131899->free_mem_123696,
                                  .size =0, .references =NULL};
    struct memblock mem_123699 = {.desc ="mem_123699", .mem =
                                  futhark_mc_segmap_parloop_struct_131899->free_mem_123699,
                                  .size =0, .references =NULL};
    struct memblock mem_123702 = {.desc ="mem_123702", .mem =
                                  futhark_mc_segmap_parloop_struct_131899->free_mem_123702,
                                  .size =0, .references =NULL};
    struct memblock mem_123705 = {.desc ="mem_123705", .mem =
                                  futhark_mc_segmap_parloop_struct_131899->free_mem_123705,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_130995 = start;
    
    for (; iter_130995 < end; iter_130995++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_131001 = m_114533;
        int64_t gtid_121102 = iter_130995;
        int64_t remnant_131002 = iter_130995 - gtid_121102;
        float defunc_2_reduce_res_116707;
        float redout_130997 = 0.0F;
        
        for (int64_t i_130996 = 0; i_130996 < j_m_i_115007; i_130996++) {
            int64_t slice_130998 = stl_res_114604 + i_130996;
            float x_130999 = ((float *) mem_123696.mem)[gtid_121102 * n_114534 +
                                                        slice_130998];
            float defunc_1_op_res_131000 = x_130999 + redout_130997;
            float redout_tmp_131003 = defunc_1_op_res_131000;
            
            redout_130997 = redout_tmp_131003;
        }
        defunc_2_reduce_res_116707 = redout_130997;
        
        float h_116712 = 3.0F * defunc_2_reduce_res_116707;
        float h9_116713 = 0.999F * h_116712;
        float h1_116714 = 1.0e-3F * h_116712;
        
        ((float *) mem_123699.mem)[gtid_121102] = h_116712;
        ((float *) mem_123702.mem)[gtid_121102] = h9_116713;
        ((float *) mem_123705.mem)[gtid_121102] = h1_116714;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131900_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131900_end -
                 futhark_mc_segmap_parloop_131900_start;
        
        ctx->futhark_mc_segmap_parloop_131900_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131900_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131900_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131898(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_121101 = tid;
    int num_tasks_130994 = info.nsubtasks;
    struct futhark_mc_task_131897 *futhark_mc_task_131897 =
                                  (struct futhark_mc_task_131897 *) args;
    struct futhark_context *ctx = futhark_mc_task_131897->ctx;
    uint64_t futhark_mc_segmap_task_131898_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131898_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131897->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131897->free_n_114534;
    int64_t stl_res_114604 = futhark_mc_task_131897->free_stl_res_114604;
    int64_t j_m_i_115007 = futhark_mc_task_131897->free_j_m_i_115007;
    struct memblock mem_123696 = {.desc ="mem_123696", .mem =
                                  futhark_mc_task_131897->free_mem_123696,
                                  .size =0, .references =NULL};
    struct memblock mem_123699 = {.desc ="mem_123699", .mem =
                                  futhark_mc_task_131897->free_mem_123699,
                                  .size =0, .references =NULL};
    struct memblock mem_123702 = {.desc ="mem_123702", .mem =
                                  futhark_mc_task_131897->free_mem_123702,
                                  .size =0, .references =NULL};
    struct memblock mem_123705 = {.desc ="mem_123705", .mem =
                                  futhark_mc_task_131897->free_mem_123705,
                                  .size =0, .references =NULL};
    int64_t iter_130995;
    struct futhark_mc_segmap_parloop_struct_131899
    futhark_mc_segmap_parloop_struct_131899;
    
    futhark_mc_segmap_parloop_struct_131899.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131899.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131899.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131899.free_stl_res_114604 =
        stl_res_114604;
    futhark_mc_segmap_parloop_struct_131899.free_j_m_i_115007 = j_m_i_115007;
    futhark_mc_segmap_parloop_struct_131899.free_mem_123696 = mem_123696.mem;
    futhark_mc_segmap_parloop_struct_131899.free_mem_123699 = mem_123699.mem;
    futhark_mc_segmap_parloop_struct_131899.free_mem_123702 = mem_123702.mem;
    futhark_mc_segmap_parloop_struct_131899.free_mem_123705 = mem_123705.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131900_task;
    
    futhark_mc_segmap_parloop_131900_task.name =
        "futhark_mc_segmap_parloop_131900";
    futhark_mc_segmap_parloop_131900_task.fn = futhark_mc_segmap_parloop_131900;
    futhark_mc_segmap_parloop_131900_task.args =
        &futhark_mc_segmap_parloop_struct_131899;
    futhark_mc_segmap_parloop_131900_task.iterations = iterations;
    futhark_mc_segmap_parloop_131900_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131900_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131900_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131900_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131900_task);
    
    if (futhark_mc_segmap_parloop_131900_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131900_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131900_total_end -
                 futhark_mc_segmap_parloop_131900_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131900_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131900_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131900_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131898_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131898_end -
                 futhark_mc_segmap_task_131898_start;
        
        ctx->futhark_mc_segmap_task_131898_runs[tid]++;
        ctx->futhark_mc_segmap_task_131898_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131898_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131902 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_stl_res_114604;
    int64_t free_j_m_i_115007;
    char *free_mem_123696;
    char *free_mem_123699;
    char *free_mem_123702;
    char *free_mem_123705;
};
struct futhark_mc_task_131904 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_stl_res_114604;
    int64_t free_gtid_121104;
    char *free_mem_123696;
    float *retval_defunc_2_reduce_res_121108;
};
struct futhark_mc_segred_stage_1_parloop_struct_131907 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_stl_res_114604;
    int64_t free_gtid_121104;
    char *free_mem_123696;
    char *free_reduce_stage_1_tid_res_arr_mem_131013;
};
static int futhark_mc_segred_stage_1_parloop_131908(void *args, int64_t start,
                                                    int64_t end,
                                                    int flat_tid_121105,
                                                    int tid)
{
    int err = 0;
    struct futhark_mc_segred_stage_1_parloop_struct_131907
    *futhark_mc_segred_stage_1_parloop_struct_131907 =
    (struct futhark_mc_segred_stage_1_parloop_struct_131907 *) args;
    struct futhark_context *ctx =
                           futhark_mc_segred_stage_1_parloop_struct_131907->ctx;
    uint64_t futhark_mc_segred_stage_1_parloop_131908_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131908_start = get_wall_time();
    
    int64_t n_114534 =
            futhark_mc_segred_stage_1_parloop_struct_131907->free_n_114534;
    int64_t stl_res_114604 =
            futhark_mc_segred_stage_1_parloop_struct_131907->free_stl_res_114604;
    int64_t gtid_121104 =
            futhark_mc_segred_stage_1_parloop_struct_131907->free_gtid_121104;
    struct memblock mem_123696 = {.desc ="mem_123696", .mem =
                                  futhark_mc_segred_stage_1_parloop_struct_131907->free_mem_123696,
                                  .size =0, .references =NULL};
    struct memblock reduce_stage_1_tid_res_arr_mem_131013 = {.desc =
                                                             "reduce_stage_1_tid_res_arr_mem_131013",
                                                             .mem =
                                                             futhark_mc_segred_stage_1_parloop_struct_131907->free_reduce_stage_1_tid_res_arr_mem_131013,
                                                             .size =0,
                                                             .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_131015 = start;
    float x_131005;
    float x_131006;
    float local_acc_131016 = 0.0F;
    
    for (; iter_131015 < end; iter_131015++) {
        int64_t gtid_121106 = iter_131015;
        int64_t slice_131008 = stl_res_114604 + gtid_121106;
        float x_131009 = ((float *) mem_123696.mem)[gtid_121104 * n_114534 +
                                                    slice_131008];
        
        // save map-out results
        { }
        // Load accum params
        {
            x_131005 = local_acc_131016;
        }
        // Load next params
        {
            x_131006 = x_131009;
        }
        // Red body
        {
            float defunc_1_op_res_131007 = x_131005 + x_131006;
            
            local_acc_131016 = defunc_1_op_res_131007;
        }
    }
    ((float *) reduce_stage_1_tid_res_arr_mem_131013.mem)[flat_tid_121105] =
        local_acc_131016;
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131908_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131908_end -
                 futhark_mc_segred_stage_1_parloop_131908_start;
        
        ctx->futhark_mc_segred_stage_1_parloop_131908_runs[tid]++;
        ctx->futhark_mc_segred_stage_1_parloop_131908_total_runtime[tid] +=
            elapsed;
        ctx->futhark_mc_segred_stage_1_parloop_131908_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segred_task_131905(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_121105 = tid;
    int num_tasks_131012 = info.nsubtasks;
    struct futhark_mc_task_131904 *futhark_mc_task_131904 =
                                  (struct futhark_mc_task_131904 *) args;
    struct futhark_context *ctx = futhark_mc_task_131904->ctx;
    uint64_t futhark_mc_segred_task_131905_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_task_131905_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131904->free_n_114534;
    int64_t stl_res_114604 = futhark_mc_task_131904->free_stl_res_114604;
    int64_t gtid_121104 = futhark_mc_task_131904->free_gtid_121104;
    struct memblock mem_123696 = {.desc ="mem_123696", .mem =
                                  futhark_mc_task_131904->free_mem_123696,
                                  .size =0, .references =NULL};
    float defunc_2_reduce_res_121108 =
          *futhark_mc_task_131904->retval_defunc_2_reduce_res_121108;
    size_t reduce_stage_1_tid_res_arr_mem_131013_cached_sizze_131906 = 0;
    char *reduce_stage_1_tid_res_arr_mem_131013 = NULL;
    
    if (reduce_stage_1_tid_res_arr_mem_131013_cached_sizze_131906 <
        (size_t) ((int64_t) 4 * num_tasks_131012)) {
        reduce_stage_1_tid_res_arr_mem_131013 =
            realloc(reduce_stage_1_tid_res_arr_mem_131013, (int64_t) 4 *
                    num_tasks_131012);
        reduce_stage_1_tid_res_arr_mem_131013_cached_sizze_131906 =
            (int64_t) 4 * num_tasks_131012;
    }
    
    int64_t iter_131015;
    struct futhark_mc_segred_stage_1_parloop_struct_131907
    futhark_mc_segred_stage_1_parloop_struct_131907;
    
    futhark_mc_segred_stage_1_parloop_struct_131907.ctx = ctx;
    futhark_mc_segred_stage_1_parloop_struct_131907.free_n_114534 = n_114534;
    futhark_mc_segred_stage_1_parloop_struct_131907.free_stl_res_114604 =
        stl_res_114604;
    futhark_mc_segred_stage_1_parloop_struct_131907.free_gtid_121104 =
        gtid_121104;
    futhark_mc_segred_stage_1_parloop_struct_131907.free_mem_123696 =
        mem_123696.mem;
    futhark_mc_segred_stage_1_parloop_struct_131907.free_reduce_stage_1_tid_res_arr_mem_131013 =
        reduce_stage_1_tid_res_arr_mem_131013;
    
    struct scheduler_parloop futhark_mc_segred_stage_1_parloop_131908_task;
    
    futhark_mc_segred_stage_1_parloop_131908_task.name =
        "futhark_mc_segred_stage_1_parloop_131908";
    futhark_mc_segred_stage_1_parloop_131908_task.fn =
        futhark_mc_segred_stage_1_parloop_131908;
    futhark_mc_segred_stage_1_parloop_131908_task.args =
        &futhark_mc_segred_stage_1_parloop_struct_131907;
    futhark_mc_segred_stage_1_parloop_131908_task.iterations = iterations;
    futhark_mc_segred_stage_1_parloop_131908_task.info = info;
    
    uint64_t futhark_mc_segred_stage_1_parloop_131908_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segred_stage_1_parloop_131908_total_start = get_wall_time();
    
    int futhark_mc_segred_stage_1_parloop_131908_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segred_stage_1_parloop_131908_task);
    
    if (futhark_mc_segred_stage_1_parloop_131908_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_stage_1_parloop_131908_total_end =
                 get_wall_time();
        uint64_t elapsed = futhark_mc_segred_stage_1_parloop_131908_total_end -
                 futhark_mc_segred_stage_1_parloop_131908_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131908_total_runs,
                           1, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131908_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segred_stage_1_parloop_131908_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    // neutral-initialise the output
    {
        defunc_2_reduce_res_121108 = 0.0F;
    }
    
    float x_131017;
    float x_131018;
    
    for (int32_t i_131020 = 0; i_131020 < num_tasks_131012; i_131020++) {
        flat_tid_121105 = i_131020;
        // Apply main thread reduction
        {
            // load acc params
            {
                x_131017 = defunc_2_reduce_res_121108;
            }
            // load next params
            {
                x_131018 =
                    ((float *) reduce_stage_1_tid_res_arr_mem_131013)[flat_tid_121105];
            }
            // red body
            {
                float defunc_1_op_res_131019 = x_131017 + x_131018;
                
                defunc_2_reduce_res_121108 = defunc_1_op_res_131019;
            }
        }
    }
    free(reduce_stage_1_tid_res_arr_mem_131013);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segred_task_131905_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segred_task_131905_end -
                 futhark_mc_segred_task_131905_start;
        
        ctx->futhark_mc_segred_task_131905_runs[tid]++;
        ctx->futhark_mc_segred_task_131905_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segred_task_131905_iter[tid] += iterations;
    }
    *futhark_mc_task_131904->retval_defunc_2_reduce_res_121108 =
        defunc_2_reduce_res_121108;
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131903(void *args, int64_t start,
                                            int64_t end, int flat_tid_121103,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131902
    *futhark_mc_segmap_parloop_struct_131902 =
    (struct futhark_mc_segmap_parloop_struct_131902 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131902->ctx;
    uint64_t futhark_mc_segmap_parloop_131903_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131903_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131902->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131902->free_n_114534;
    int64_t stl_res_114604 =
            futhark_mc_segmap_parloop_struct_131902->free_stl_res_114604;
    int64_t j_m_i_115007 =
            futhark_mc_segmap_parloop_struct_131902->free_j_m_i_115007;
    struct memblock mem_123696 = {.desc ="mem_123696", .mem =
                                  futhark_mc_segmap_parloop_struct_131902->free_mem_123696,
                                  .size =0, .references =NULL};
    struct memblock mem_123699 = {.desc ="mem_123699", .mem =
                                  futhark_mc_segmap_parloop_struct_131902->free_mem_123699,
                                  .size =0, .references =NULL};
    struct memblock mem_123702 = {.desc ="mem_123702", .mem =
                                  futhark_mc_segmap_parloop_struct_131902->free_mem_123702,
                                  .size =0, .references =NULL};
    struct memblock mem_123705 = {.desc ="mem_123705", .mem =
                                  futhark_mc_segmap_parloop_struct_131902->free_mem_123705,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_131004 = start;
    
    for (; iter_131004 < end; iter_131004++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_131010 = m_114533;
        int64_t gtid_121104 = iter_131004;
        int64_t remnant_131011 = iter_131004 - gtid_121104;
        float defunc_2_reduce_res_121108;
        int64_t flat_tid_121105 = (int64_t) 0;
        int32_t num_tasks_131012;
        struct futhark_mc_task_131904 futhark_mc_task_131904;
        
        futhark_mc_task_131904.ctx = ctx;
        futhark_mc_task_131904.free_n_114534 = n_114534;
        futhark_mc_task_131904.free_stl_res_114604 = stl_res_114604;
        futhark_mc_task_131904.free_gtid_121104 = gtid_121104;
        futhark_mc_task_131904.free_mem_123696 = mem_123696.mem;
        futhark_mc_task_131904.retval_defunc_2_reduce_res_121108 =
            &defunc_2_reduce_res_121108;
        
        struct scheduler_segop futhark_mc_task_131904_task;
        
        futhark_mc_task_131904_task.args = &futhark_mc_task_131904;
        futhark_mc_task_131904_task.top_level_fn =
            futhark_mc_segred_task_131905;
        futhark_mc_task_131904_task.name = "futhark_mc_segred_task_131905";
        futhark_mc_task_131904_task.iterations = j_m_i_115007;
        futhark_mc_task_131904_task.task_time =
            &ctx->futhark_mc_segred_task_131905_total_time;
        futhark_mc_task_131904_task.task_iter =
            &ctx->futhark_mc_segred_task_131905_total_iter;
        futhark_mc_task_131904_task.sched = STATIC;
        futhark_mc_task_131904_task.nested_fn = NULL;
        
        int futhark_mc_segred_task_131905_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131904_task);
        
        if (futhark_mc_segred_task_131905_err != 0) {
            err = 1;
            goto cleanup;
        }
        
        float h_121113 = 3.0F * defunc_2_reduce_res_121108;
        float h9_121114 = 0.999F * h_121113;
        float h1_121115 = 1.0e-3F * h_121113;
        
        ((float *) mem_123699.mem)[gtid_121104] = h_121113;
        ((float *) mem_123702.mem)[gtid_121104] = h9_121114;
        ((float *) mem_123705.mem)[gtid_121104] = h1_121115;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131903_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131903_end -
                 futhark_mc_segmap_parloop_131903_start;
        
        ctx->futhark_mc_segmap_parloop_131903_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131903_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131903_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131901(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_121103 = tid;
    int num_tasks_130994 = info.nsubtasks;
    struct futhark_mc_task_131897 *futhark_mc_task_131897 =
                                  (struct futhark_mc_task_131897 *) args;
    struct futhark_context *ctx = futhark_mc_task_131897->ctx;
    uint64_t futhark_mc_segmap_nested_task_131901_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131901_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131897->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131897->free_n_114534;
    int64_t stl_res_114604 = futhark_mc_task_131897->free_stl_res_114604;
    int64_t j_m_i_115007 = futhark_mc_task_131897->free_j_m_i_115007;
    struct memblock mem_123696 = {.desc ="mem_123696", .mem =
                                  futhark_mc_task_131897->free_mem_123696,
                                  .size =0, .references =NULL};
    struct memblock mem_123699 = {.desc ="mem_123699", .mem =
                                  futhark_mc_task_131897->free_mem_123699,
                                  .size =0, .references =NULL};
    struct memblock mem_123702 = {.desc ="mem_123702", .mem =
                                  futhark_mc_task_131897->free_mem_123702,
                                  .size =0, .references =NULL};
    struct memblock mem_123705 = {.desc ="mem_123705", .mem =
                                  futhark_mc_task_131897->free_mem_123705,
                                  .size =0, .references =NULL};
    int64_t iter_131004;
    struct futhark_mc_segmap_parloop_struct_131902
    futhark_mc_segmap_parloop_struct_131902;
    
    futhark_mc_segmap_parloop_struct_131902.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131902.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131902.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131902.free_stl_res_114604 =
        stl_res_114604;
    futhark_mc_segmap_parloop_struct_131902.free_j_m_i_115007 = j_m_i_115007;
    futhark_mc_segmap_parloop_struct_131902.free_mem_123696 = mem_123696.mem;
    futhark_mc_segmap_parloop_struct_131902.free_mem_123699 = mem_123699.mem;
    futhark_mc_segmap_parloop_struct_131902.free_mem_123702 = mem_123702.mem;
    futhark_mc_segmap_parloop_struct_131902.free_mem_123705 = mem_123705.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131903_task;
    
    futhark_mc_segmap_parloop_131903_task.name =
        "futhark_mc_segmap_parloop_131903";
    futhark_mc_segmap_parloop_131903_task.fn = futhark_mc_segmap_parloop_131903;
    futhark_mc_segmap_parloop_131903_task.args =
        &futhark_mc_segmap_parloop_struct_131902;
    futhark_mc_segmap_parloop_131903_task.iterations = iterations;
    futhark_mc_segmap_parloop_131903_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131903_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131903_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131903_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131903_task);
    
    if (futhark_mc_segmap_parloop_131903_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131903_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131903_total_end -
                 futhark_mc_segmap_parloop_131903_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131903_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131903_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131903_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131901_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131901_end -
                 futhark_mc_segmap_nested_task_131901_start;
        
        ctx->futhark_mc_segmap_nested_task_131901_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131901_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131901_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131909 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_bytes_121983;
    char *free_mem_123520;
    char *free_mem_123699;
    char *free_mem_123702;
    char *free_mem_123705;
    char *free_mem_123727;
};
struct futhark_mc_segmap_parloop_struct_131911 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_bytes_121983;
    char *free_mem_123520;
    char *free_mem_123699;
    char *free_mem_123702;
    char *free_mem_123705;
    char *free_mem_123727;
};
static int futhark_mc_segmap_parloop_131912(void *args, int64_t start,
                                            int64_t end, int flat_tid_121116,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131911
    *futhark_mc_segmap_parloop_struct_131911 =
    (struct futhark_mc_segmap_parloop_struct_131911 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131911->ctx;
    uint64_t futhark_mc_segmap_parloop_131912_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131912_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131911->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131911->free_n_114534;
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131911->free_bytes_121983;
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_segmap_parloop_struct_131911->free_mem_123520,
                                  .size =0, .references =NULL};
    struct memblock mem_123699 = {.desc ="mem_123699", .mem =
                                  futhark_mc_segmap_parloop_struct_131911->free_mem_123699,
                                  .size =0, .references =NULL};
    struct memblock mem_123702 = {.desc ="mem_123702", .mem =
                                  futhark_mc_segmap_parloop_struct_131911->free_mem_123702,
                                  .size =0, .references =NULL};
    struct memblock mem_123705 = {.desc ="mem_123705", .mem =
                                  futhark_mc_segmap_parloop_struct_131911->free_mem_123705,
                                  .size =0, .references =NULL};
    struct memblock mem_123727 = {.desc ="mem_123727", .mem =
                                  futhark_mc_segmap_parloop_struct_131911->free_mem_123727,
                                  .size =0, .references =NULL};
    size_t mem_123711_cached_sizze_131913 = 0;
    char *mem_123711 = NULL;
    int64_t iterations = end - start;
    int64_t iter_131022 = start;
    
    if (mem_123711_cached_sizze_131913 < (size_t) bytes_121983) {
        mem_123711 = realloc(mem_123711, bytes_121983);
        mem_123711_cached_sizze_131913 = bytes_121983;
    }
    for (; iter_131022 < end; iter_131022++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_131043 = m_114533;
        int64_t gtid_121117 = iter_131022;
        int64_t remnant_131044 = iter_131022 - gtid_121117;
        float x_116720 = ((float *) mem_123699.mem)[gtid_121117];
        float x_116721 = ((float *) mem_123702.mem)[gtid_121117];
        float x_116722 = ((float *) mem_123705.mem)[gtid_121117];
        
        for (int64_t i_131023 = 0; i_131023 < n_114534; i_131023++) {
            float x_131025 = ((float *) mem_123520.mem)[gtid_121117 * n_114534 +
                                                        i_131023];
            float x_131026 = x_131025 / x_116720;
            float y_131027 = fpow32(x_131026, 2.0F);
            float x_131028 = 1.0F - y_131027;
            float bicube_131029 = fpow32(x_131028, 2.0F);
            bool isnan_res_131030;
            
            isnan_res_131030 = futrts_isnan32(x_131025);
            
            bool cond_f_res_131031 = x_131025 <= x_116722;
            bool x_131032 = !isnan_res_131030;
            bool y_131033 = cond_f_res_131031 && x_131032;
            bool cond_131034 = isnan_res_131030 || y_131033;
            float defunc_0_f_res_131035;
            
            if (cond_131034) {
                defunc_0_f_res_131035 = 1.0F;
            } else {
                bool cond_131036 = x_116721 <= x_131025;
                bool cond_f_res_131037 = x_131025 <= 1.0e-6F;
                bool x_131038 = !cond_131036;
                bool y_131039 = cond_f_res_131037 && x_131038;
                bool cond_131040 = cond_131036 || y_131039;
                float defunc_0_f_res_f_res_131041;
                
                if (cond_131040) {
                    defunc_0_f_res_f_res_131041 = 1.0e-6F;
                } else {
                    defunc_0_f_res_f_res_131041 = bicube_131029;
                }
                defunc_0_f_res_131035 = defunc_0_f_res_f_res_131041;
            }
            ((float *) mem_123711)[i_131023] = defunc_0_f_res_131035;
        }
        memmove(mem_123727.mem + gtid_121117 * n_114534 * (int64_t) 4,
                mem_123711 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123711);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131912_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131912_end -
                 futhark_mc_segmap_parloop_131912_start;
        
        ctx->futhark_mc_segmap_parloop_131912_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131912_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131912_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131910(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_121116 = tid;
    int num_tasks_131021 = info.nsubtasks;
    struct futhark_mc_task_131909 *futhark_mc_task_131909 =
                                  (struct futhark_mc_task_131909 *) args;
    struct futhark_context *ctx = futhark_mc_task_131909->ctx;
    uint64_t futhark_mc_segmap_task_131910_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131910_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131909->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131909->free_n_114534;
    int64_t bytes_121983 = futhark_mc_task_131909->free_bytes_121983;
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_task_131909->free_mem_123520,
                                  .size =0, .references =NULL};
    struct memblock mem_123699 = {.desc ="mem_123699", .mem =
                                  futhark_mc_task_131909->free_mem_123699,
                                  .size =0, .references =NULL};
    struct memblock mem_123702 = {.desc ="mem_123702", .mem =
                                  futhark_mc_task_131909->free_mem_123702,
                                  .size =0, .references =NULL};
    struct memblock mem_123705 = {.desc ="mem_123705", .mem =
                                  futhark_mc_task_131909->free_mem_123705,
                                  .size =0, .references =NULL};
    struct memblock mem_123727 = {.desc ="mem_123727", .mem =
                                  futhark_mc_task_131909->free_mem_123727,
                                  .size =0, .references =NULL};
    int64_t iter_131022;
    struct futhark_mc_segmap_parloop_struct_131911
    futhark_mc_segmap_parloop_struct_131911;
    
    futhark_mc_segmap_parloop_struct_131911.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131911.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131911.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131911.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131911.free_mem_123520 = mem_123520.mem;
    futhark_mc_segmap_parloop_struct_131911.free_mem_123699 = mem_123699.mem;
    futhark_mc_segmap_parloop_struct_131911.free_mem_123702 = mem_123702.mem;
    futhark_mc_segmap_parloop_struct_131911.free_mem_123705 = mem_123705.mem;
    futhark_mc_segmap_parloop_struct_131911.free_mem_123727 = mem_123727.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131912_task;
    
    futhark_mc_segmap_parloop_131912_task.name =
        "futhark_mc_segmap_parloop_131912";
    futhark_mc_segmap_parloop_131912_task.fn = futhark_mc_segmap_parloop_131912;
    futhark_mc_segmap_parloop_131912_task.args =
        &futhark_mc_segmap_parloop_struct_131911;
    futhark_mc_segmap_parloop_131912_task.iterations = iterations;
    futhark_mc_segmap_parloop_131912_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131912_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131912_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131912_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131912_task);
    
    if (futhark_mc_segmap_parloop_131912_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131912_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131912_total_end -
                 futhark_mc_segmap_parloop_131912_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131912_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131912_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131912_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131910_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131910_end -
                 futhark_mc_segmap_task_131910_start;
        
        ctx->futhark_mc_segmap_task_131910_runs[tid]++;
        ctx->futhark_mc_segmap_task_131910_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131910_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131915 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    int64_t free_bytes_121983;
    char *free_mem_123520;
    char *free_mem_123699;
    char *free_mem_123702;
    char *free_mem_123705;
    char *free_mem_123727;
};
struct futhark_mc_task_131918 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_121119;
    float free_x_121123;
    float free_x_121124;
    float free_x_121125;
    char *free_mem_123520;
    char *free_mem_123708;
};
struct futhark_mc_segmap_parloop_struct_131920 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_121119;
    float free_x_121123;
    float free_x_121124;
    float free_x_121125;
    char *free_mem_123520;
    char *free_mem_123708;
};
static int futhark_mc_segmap_parloop_131921(void *args, int64_t start,
                                            int64_t end, int flat_tid_121120,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131920
    *futhark_mc_segmap_parloop_struct_131920 =
    (struct futhark_mc_segmap_parloop_struct_131920 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131920->ctx;
    uint64_t futhark_mc_segmap_parloop_131921_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131921_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131920->free_n_114534;
    int64_t gtid_121119 =
            futhark_mc_segmap_parloop_struct_131920->free_gtid_121119;
    float x_121123 = futhark_mc_segmap_parloop_struct_131920->free_x_121123;
    float x_121124 = futhark_mc_segmap_parloop_struct_131920->free_x_121124;
    float x_121125 = futhark_mc_segmap_parloop_struct_131920->free_x_121125;
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_segmap_parloop_struct_131920->free_mem_123520,
                                  .size =0, .references =NULL};
    struct memblock mem_123708 = {.desc ="mem_123708", .mem =
                                  futhark_mc_segmap_parloop_struct_131920->free_mem_123708,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_131067 = start;
    
    for (; iter_131067 < end; iter_131067++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_131074 = n_114534;
        int64_t gtid_121121 = iter_131067;
        int64_t remnant_131075 = iter_131067 - gtid_121121;
        float x_131047 = ((float *) mem_123520.mem)[gtid_121119 * n_114534 +
                                                    gtid_121121];
        float x_131048 = x_131047 / x_121123;
        float y_131049 = fpow32(x_131048, 2.0F);
        float x_131050 = 1.0F - y_131049;
        float bicube_131051 = fpow32(x_131050, 2.0F);
        bool isnan_res_131052;
        
        isnan_res_131052 = futrts_isnan32(x_131047);
        
        bool cond_f_res_131053 = x_131047 <= x_121125;
        bool x_131054 = !isnan_res_131052;
        bool y_131055 = cond_f_res_131053 && x_131054;
        bool cond_131056 = isnan_res_131052 || y_131055;
        float defunc_0_f_res_131057;
        
        if (cond_131056) {
            defunc_0_f_res_131057 = 1.0F;
        } else {
            bool cond_131068 = x_121124 <= x_131047;
            bool cond_f_res_131069 = x_131047 <= 1.0e-6F;
            bool x_131070 = !cond_131068;
            bool y_131071 = cond_f_res_131069 && x_131070;
            bool cond_131072 = cond_131068 || y_131071;
            float defunc_0_f_res_f_res_131073;
            
            if (cond_131072) {
                defunc_0_f_res_f_res_131073 = 1.0e-6F;
            } else {
                defunc_0_f_res_f_res_131073 = bicube_131051;
            }
            defunc_0_f_res_131057 = defunc_0_f_res_f_res_131073;
        }
        ((float *) mem_123708.mem)[gtid_121121] = defunc_0_f_res_131057;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131921_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131921_end -
                 futhark_mc_segmap_parloop_131921_start;
        
        ctx->futhark_mc_segmap_parloop_131921_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131921_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131921_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131919(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_121120 = tid;
    int num_tasks_131066 = info.nsubtasks;
    struct futhark_mc_task_131918 *futhark_mc_task_131918 =
                                  (struct futhark_mc_task_131918 *) args;
    struct futhark_context *ctx = futhark_mc_task_131918->ctx;
    uint64_t futhark_mc_segmap_task_131919_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131919_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131918->free_n_114534;
    int64_t gtid_121119 = futhark_mc_task_131918->free_gtid_121119;
    float x_121123 = futhark_mc_task_131918->free_x_121123;
    float x_121124 = futhark_mc_task_131918->free_x_121124;
    float x_121125 = futhark_mc_task_131918->free_x_121125;
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_task_131918->free_mem_123520,
                                  .size =0, .references =NULL};
    struct memblock mem_123708 = {.desc ="mem_123708", .mem =
                                  futhark_mc_task_131918->free_mem_123708,
                                  .size =0, .references =NULL};
    int64_t iter_131067;
    struct futhark_mc_segmap_parloop_struct_131920
    futhark_mc_segmap_parloop_struct_131920;
    
    futhark_mc_segmap_parloop_struct_131920.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131920.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131920.free_gtid_121119 = gtid_121119;
    futhark_mc_segmap_parloop_struct_131920.free_x_121123 = x_121123;
    futhark_mc_segmap_parloop_struct_131920.free_x_121124 = x_121124;
    futhark_mc_segmap_parloop_struct_131920.free_x_121125 = x_121125;
    futhark_mc_segmap_parloop_struct_131920.free_mem_123520 = mem_123520.mem;
    futhark_mc_segmap_parloop_struct_131920.free_mem_123708 = mem_123708.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131921_task;
    
    futhark_mc_segmap_parloop_131921_task.name =
        "futhark_mc_segmap_parloop_131921";
    futhark_mc_segmap_parloop_131921_task.fn = futhark_mc_segmap_parloop_131921;
    futhark_mc_segmap_parloop_131921_task.args =
        &futhark_mc_segmap_parloop_struct_131920;
    futhark_mc_segmap_parloop_131921_task.iterations = iterations;
    futhark_mc_segmap_parloop_131921_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131921_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131921_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131921_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131921_task);
    
    if (futhark_mc_segmap_parloop_131921_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131921_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131921_total_end -
                 futhark_mc_segmap_parloop_131921_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131921_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131921_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131921_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131919_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131919_end -
                 futhark_mc_segmap_task_131919_start;
        
        ctx->futhark_mc_segmap_task_131919_runs[tid]++;
        ctx->futhark_mc_segmap_task_131919_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131919_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131916(void *args, int64_t start,
                                            int64_t end, int flat_tid_121118,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131915
    *futhark_mc_segmap_parloop_struct_131915 =
    (struct futhark_mc_segmap_parloop_struct_131915 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131915->ctx;
    uint64_t futhark_mc_segmap_parloop_131916_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131916_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131915->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131915->free_n_114534;
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131915->free_bytes_121983;
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_segmap_parloop_struct_131915->free_mem_123520,
                                  .size =0, .references =NULL};
    struct memblock mem_123699 = {.desc ="mem_123699", .mem =
                                  futhark_mc_segmap_parloop_struct_131915->free_mem_123699,
                                  .size =0, .references =NULL};
    struct memblock mem_123702 = {.desc ="mem_123702", .mem =
                                  futhark_mc_segmap_parloop_struct_131915->free_mem_123702,
                                  .size =0, .references =NULL};
    struct memblock mem_123705 = {.desc ="mem_123705", .mem =
                                  futhark_mc_segmap_parloop_struct_131915->free_mem_123705,
                                  .size =0, .references =NULL};
    struct memblock mem_123727 = {.desc ="mem_123727", .mem =
                                  futhark_mc_segmap_parloop_struct_131915->free_mem_123727,
                                  .size =0, .references =NULL};
    size_t mem_123708_cached_sizze_131917 = 0;
    char *mem_123708 = NULL;
    int64_t iterations = end - start;
    int64_t iter_131046 = start;
    
    if (mem_123708_cached_sizze_131917 < (size_t) bytes_121983) {
        mem_123708 = realloc(mem_123708, bytes_121983);
        mem_123708_cached_sizze_131917 = bytes_121983;
    }
    for (; iter_131046 < end; iter_131046++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_131064 = m_114533;
        int64_t gtid_121119 = iter_131046;
        int64_t remnant_131065 = iter_131046 - gtid_121119;
        float x_121123 = ((float *) mem_123699.mem)[gtid_121119];
        float x_121124 = ((float *) mem_123702.mem)[gtid_121119];
        float x_121125 = ((float *) mem_123705.mem)[gtid_121119];
        int64_t flat_tid_121120 = (int64_t) 0;
        int32_t num_tasks_131066;
        struct futhark_mc_task_131918 futhark_mc_task_131918;
        
        futhark_mc_task_131918.ctx = ctx;
        futhark_mc_task_131918.free_n_114534 = n_114534;
        futhark_mc_task_131918.free_gtid_121119 = gtid_121119;
        futhark_mc_task_131918.free_x_121123 = x_121123;
        futhark_mc_task_131918.free_x_121124 = x_121124;
        futhark_mc_task_131918.free_x_121125 = x_121125;
        futhark_mc_task_131918.free_mem_123520 = mem_123520.mem;
        futhark_mc_task_131918.free_mem_123708 = mem_123708;
        
        struct scheduler_segop futhark_mc_task_131918_task;
        
        futhark_mc_task_131918_task.args = &futhark_mc_task_131918;
        futhark_mc_task_131918_task.top_level_fn =
            futhark_mc_segmap_task_131919;
        futhark_mc_task_131918_task.name = "futhark_mc_segmap_task_131919";
        futhark_mc_task_131918_task.iterations = n_114534;
        futhark_mc_task_131918_task.task_time =
            &ctx->futhark_mc_segmap_task_131919_total_time;
        futhark_mc_task_131918_task.task_iter =
            &ctx->futhark_mc_segmap_task_131919_total_iter;
        futhark_mc_task_131918_task.sched = STATIC;
        futhark_mc_task_131918_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131919_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131918_task);
        
        if (futhark_mc_segmap_task_131919_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_123727.mem + gtid_121119 * n_114534 * (int64_t) 4,
                mem_123708 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123708);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131916_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131916_end -
                 futhark_mc_segmap_parloop_131916_start;
        
        ctx->futhark_mc_segmap_parloop_131916_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131916_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131916_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131914(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_121118 = tid;
    int num_tasks_131021 = info.nsubtasks;
    struct futhark_mc_task_131909 *futhark_mc_task_131909 =
                                  (struct futhark_mc_task_131909 *) args;
    struct futhark_context *ctx = futhark_mc_task_131909->ctx;
    uint64_t futhark_mc_segmap_nested_task_131914_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131914_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131909->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131909->free_n_114534;
    int64_t bytes_121983 = futhark_mc_task_131909->free_bytes_121983;
    struct memblock mem_123520 = {.desc ="mem_123520", .mem =
                                  futhark_mc_task_131909->free_mem_123520,
                                  .size =0, .references =NULL};
    struct memblock mem_123699 = {.desc ="mem_123699", .mem =
                                  futhark_mc_task_131909->free_mem_123699,
                                  .size =0, .references =NULL};
    struct memblock mem_123702 = {.desc ="mem_123702", .mem =
                                  futhark_mc_task_131909->free_mem_123702,
                                  .size =0, .references =NULL};
    struct memblock mem_123705 = {.desc ="mem_123705", .mem =
                                  futhark_mc_task_131909->free_mem_123705,
                                  .size =0, .references =NULL};
    struct memblock mem_123727 = {.desc ="mem_123727", .mem =
                                  futhark_mc_task_131909->free_mem_123727,
                                  .size =0, .references =NULL};
    int64_t iter_131046;
    struct futhark_mc_segmap_parloop_struct_131915
    futhark_mc_segmap_parloop_struct_131915;
    
    futhark_mc_segmap_parloop_struct_131915.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131915.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131915.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131915.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131915.free_mem_123520 = mem_123520.mem;
    futhark_mc_segmap_parloop_struct_131915.free_mem_123699 = mem_123699.mem;
    futhark_mc_segmap_parloop_struct_131915.free_mem_123702 = mem_123702.mem;
    futhark_mc_segmap_parloop_struct_131915.free_mem_123705 = mem_123705.mem;
    futhark_mc_segmap_parloop_struct_131915.free_mem_123727 = mem_123727.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131916_task;
    
    futhark_mc_segmap_parloop_131916_task.name =
        "futhark_mc_segmap_parloop_131916";
    futhark_mc_segmap_parloop_131916_task.fn = futhark_mc_segmap_parloop_131916;
    futhark_mc_segmap_parloop_131916_task.args =
        &futhark_mc_segmap_parloop_struct_131915;
    futhark_mc_segmap_parloop_131916_task.iterations = iterations;
    futhark_mc_segmap_parloop_131916_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131916_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131916_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131916_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131916_task);
    
    if (futhark_mc_segmap_parloop_131916_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131916_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131916_total_end -
                 futhark_mc_segmap_parloop_131916_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131916_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131916_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131916_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131914_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131914_end -
                 futhark_mc_segmap_nested_task_131914_start;
        
        ctx->futhark_mc_segmap_nested_task_131914_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131914_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131914_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_task_131922 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_Y_mem_121939;
    int64_t free_bytes_121983;
    char *free_stl_res_mem_123741;
    int64_t free_stl_res_ixfn_123745;
    char *free_stl_res_mem_123749;
    char *free_mem_123779;
};
struct futhark_mc_segmap_parloop_struct_131924 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_Y_mem_121939;
    int64_t free_bytes_121983;
    char *free_stl_res_mem_123741;
    int64_t free_stl_res_ixfn_123745;
    char *free_stl_res_mem_123749;
    char *free_mem_123779;
};
static int futhark_mc_segmap_parloop_131925(void *args, int64_t start,
                                            int64_t end, int flat_tid_121144,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131924
    *futhark_mc_segmap_parloop_struct_131924 =
    (struct futhark_mc_segmap_parloop_struct_131924 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131924->ctx;
    uint64_t futhark_mc_segmap_parloop_131925_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131925_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131924->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131924->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131924->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131924->free_bytes_121983;
    struct memblock stl_res_mem_123741 = {.desc ="stl_res_mem_123741", .mem =
                                          futhark_mc_segmap_parloop_struct_131924->free_stl_res_mem_123741,
                                          .size =0, .references =NULL};
    int64_t stl_res_ixfn_123745 =
            futhark_mc_segmap_parloop_struct_131924->free_stl_res_ixfn_123745;
    struct memblock stl_res_mem_123749 = {.desc ="stl_res_mem_123749", .mem =
                                          futhark_mc_segmap_parloop_struct_131924->free_stl_res_mem_123749,
                                          .size =0, .references =NULL};
    struct memblock mem_123779 = {.desc ="mem_123779", .mem =
                                  futhark_mc_segmap_parloop_struct_131924->free_mem_123779,
                                  .size =0, .references =NULL};
    size_t mem_123763_cached_sizze_131926 = 0;
    char *mem_123763 = NULL;
    int64_t iterations = end - start;
    int64_t iter_131077 = start;
    
    if (mem_123763_cached_sizze_131926 < (size_t) bytes_121983) {
        mem_123763 = realloc(mem_123763, bytes_121983);
        mem_123763_cached_sizze_131926 = bytes_121983;
    }
    for (; iter_131077 < end; iter_131077++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_131086 = m_114533;
        int64_t gtid_121145 = iter_131077;
        int64_t remnant_131087 = iter_131077 - gtid_121145;
        
        for (int64_t i_131078 = 0; i_131078 < n_114534; i_131078++) {
            float x_131080 = ((float *) Y_mem_121939.mem)[gtid_121145 *
                                                          n_114534 + i_131078];
            float x_131081 = ((float *) stl_res_mem_123741.mem)[gtid_121145 *
                                                                n_114534 +
                                                                i_131078];
            float x_131082 = ((float *) stl_res_mem_123749.mem)[gtid_121145 *
                                                                stl_res_ixfn_123745 +
                                                                i_131078];
            float x_131083 = x_131080 - x_131081;
            float defunc_2_f_res_131084 = x_131083 - x_131082;
            
            ((float *) mem_123763)[i_131078] = defunc_2_f_res_131084;
        }
        memmove(mem_123779.mem + gtid_121145 * n_114534 * (int64_t) 4,
                mem_123763 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123763);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131925_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131925_end -
                 futhark_mc_segmap_parloop_131925_start;
        
        ctx->futhark_mc_segmap_parloop_131925_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131925_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131925_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131923(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_121144 = tid;
    int num_tasks_131076 = info.nsubtasks;
    struct futhark_mc_task_131922 *futhark_mc_task_131922 =
                                  (struct futhark_mc_task_131922 *) args;
    struct futhark_context *ctx = futhark_mc_task_131922->ctx;
    uint64_t futhark_mc_segmap_task_131923_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131923_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131922->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131922->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131922->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131922->free_bytes_121983;
    struct memblock stl_res_mem_123741 = {.desc ="stl_res_mem_123741", .mem =
                                          futhark_mc_task_131922->free_stl_res_mem_123741,
                                          .size =0, .references =NULL};
    int64_t stl_res_ixfn_123745 =
            futhark_mc_task_131922->free_stl_res_ixfn_123745;
    struct memblock stl_res_mem_123749 = {.desc ="stl_res_mem_123749", .mem =
                                          futhark_mc_task_131922->free_stl_res_mem_123749,
                                          .size =0, .references =NULL};
    struct memblock mem_123779 = {.desc ="mem_123779", .mem =
                                  futhark_mc_task_131922->free_mem_123779,
                                  .size =0, .references =NULL};
    int64_t iter_131077;
    struct futhark_mc_segmap_parloop_struct_131924
    futhark_mc_segmap_parloop_struct_131924;
    
    futhark_mc_segmap_parloop_struct_131924.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131924.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131924.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131924.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131924.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131924.free_stl_res_mem_123741 =
        stl_res_mem_123741.mem;
    futhark_mc_segmap_parloop_struct_131924.free_stl_res_ixfn_123745 =
        stl_res_ixfn_123745;
    futhark_mc_segmap_parloop_struct_131924.free_stl_res_mem_123749 =
        stl_res_mem_123749.mem;
    futhark_mc_segmap_parloop_struct_131924.free_mem_123779 = mem_123779.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131925_task;
    
    futhark_mc_segmap_parloop_131925_task.name =
        "futhark_mc_segmap_parloop_131925";
    futhark_mc_segmap_parloop_131925_task.fn = futhark_mc_segmap_parloop_131925;
    futhark_mc_segmap_parloop_131925_task.args =
        &futhark_mc_segmap_parloop_struct_131924;
    futhark_mc_segmap_parloop_131925_task.iterations = iterations;
    futhark_mc_segmap_parloop_131925_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131925_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131925_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131925_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131925_task);
    
    if (futhark_mc_segmap_parloop_131925_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131925_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131925_total_end -
                 futhark_mc_segmap_parloop_131925_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131925_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131925_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131925_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131923_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131923_end -
                 futhark_mc_segmap_task_131923_start;
        
        ctx->futhark_mc_segmap_task_131923_runs[tid]++;
        ctx->futhark_mc_segmap_task_131923_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131923_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_mc_segmap_parloop_struct_131928 {
    struct futhark_context *ctx;
    int64_t free_m_114533;
    int64_t free_n_114534;
    char *free_Y_mem_121939;
    int64_t free_bytes_121983;
    char *free_stl_res_mem_123741;
    int64_t free_stl_res_ixfn_123745;
    char *free_stl_res_mem_123749;
    char *free_mem_123779;
};
struct futhark_mc_task_131931 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_121147;
    char *free_Y_mem_121939;
    char *free_stl_res_mem_123741;
    int64_t free_stl_res_ixfn_123745;
    char *free_stl_res_mem_123749;
    char *free_mem_123760;
};
struct futhark_mc_segmap_parloop_struct_131933 {
    struct futhark_context *ctx;
    int64_t free_n_114534;
    int64_t free_gtid_121147;
    char *free_Y_mem_121939;
    char *free_stl_res_mem_123741;
    int64_t free_stl_res_ixfn_123745;
    char *free_stl_res_mem_123749;
    char *free_mem_123760;
};
static int futhark_mc_segmap_parloop_131934(void *args, int64_t start,
                                            int64_t end, int flat_tid_121148,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131933
    *futhark_mc_segmap_parloop_struct_131933 =
    (struct futhark_mc_segmap_parloop_struct_131933 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131933->ctx;
    uint64_t futhark_mc_segmap_parloop_131934_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131934_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131933->free_n_114534;
    int64_t gtid_121147 =
            futhark_mc_segmap_parloop_struct_131933->free_gtid_121147;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131933->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock stl_res_mem_123741 = {.desc ="stl_res_mem_123741", .mem =
                                          futhark_mc_segmap_parloop_struct_131933->free_stl_res_mem_123741,
                                          .size =0, .references =NULL};
    int64_t stl_res_ixfn_123745 =
            futhark_mc_segmap_parloop_struct_131933->free_stl_res_ixfn_123745;
    struct memblock stl_res_mem_123749 = {.desc ="stl_res_mem_123749", .mem =
                                          futhark_mc_segmap_parloop_struct_131933->free_stl_res_mem_123749,
                                          .size =0, .references =NULL};
    struct memblock mem_123760 = {.desc ="mem_123760", .mem =
                                  futhark_mc_segmap_parloop_struct_131933->free_mem_123760,
                                  .size =0, .references =NULL};
    int64_t iterations = end - start;
    int64_t iter_131098 = start;
    
    for (; iter_131098 < end; iter_131098++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_131099 = n_114534;
        int64_t gtid_121149 = iter_131098;
        int64_t remnant_131100 = iter_131098 - gtid_121149;
        float x_131090 = ((float *) Y_mem_121939.mem)[gtid_121147 * n_114534 +
                                                      gtid_121149];
        float x_131091 = ((float *) stl_res_mem_123741.mem)[gtid_121147 *
                                                            n_114534 +
                                                            gtid_121149];
        float x_131092 = ((float *) stl_res_mem_123749.mem)[gtid_121147 *
                                                            stl_res_ixfn_123745 +
                                                            gtid_121149];
        float x_131093 = x_131090 - x_131091;
        float defunc_2_f_res_131094 = x_131093 - x_131092;
        
        ((float *) mem_123760.mem)[gtid_121149] = defunc_2_f_res_131094;
    }
    
  cleanup:
    { }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131934_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131934_end -
                 futhark_mc_segmap_parloop_131934_start;
        
        ctx->futhark_mc_segmap_parloop_131934_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131934_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131934_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_task_131932(void *args, int64_t iterations, int tid,
                                  struct scheduler_info info)
{
    int err = 0;
    int flat_tid_121148 = tid;
    int num_tasks_131097 = info.nsubtasks;
    struct futhark_mc_task_131931 *futhark_mc_task_131931 =
                                  (struct futhark_mc_task_131931 *) args;
    struct futhark_context *ctx = futhark_mc_task_131931->ctx;
    uint64_t futhark_mc_segmap_task_131932_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_task_131932_start = get_wall_time();
    
    int64_t n_114534 = futhark_mc_task_131931->free_n_114534;
    int64_t gtid_121147 = futhark_mc_task_131931->free_gtid_121147;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131931->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    struct memblock stl_res_mem_123741 = {.desc ="stl_res_mem_123741", .mem =
                                          futhark_mc_task_131931->free_stl_res_mem_123741,
                                          .size =0, .references =NULL};
    int64_t stl_res_ixfn_123745 =
            futhark_mc_task_131931->free_stl_res_ixfn_123745;
    struct memblock stl_res_mem_123749 = {.desc ="stl_res_mem_123749", .mem =
                                          futhark_mc_task_131931->free_stl_res_mem_123749,
                                          .size =0, .references =NULL};
    struct memblock mem_123760 = {.desc ="mem_123760", .mem =
                                  futhark_mc_task_131931->free_mem_123760,
                                  .size =0, .references =NULL};
    int64_t iter_131098;
    struct futhark_mc_segmap_parloop_struct_131933
    futhark_mc_segmap_parloop_struct_131933;
    
    futhark_mc_segmap_parloop_struct_131933.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131933.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131933.free_gtid_121147 = gtid_121147;
    futhark_mc_segmap_parloop_struct_131933.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131933.free_stl_res_mem_123741 =
        stl_res_mem_123741.mem;
    futhark_mc_segmap_parloop_struct_131933.free_stl_res_ixfn_123745 =
        stl_res_ixfn_123745;
    futhark_mc_segmap_parloop_struct_131933.free_stl_res_mem_123749 =
        stl_res_mem_123749.mem;
    futhark_mc_segmap_parloop_struct_131933.free_mem_123760 = mem_123760.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131934_task;
    
    futhark_mc_segmap_parloop_131934_task.name =
        "futhark_mc_segmap_parloop_131934";
    futhark_mc_segmap_parloop_131934_task.fn = futhark_mc_segmap_parloop_131934;
    futhark_mc_segmap_parloop_131934_task.args =
        &futhark_mc_segmap_parloop_struct_131933;
    futhark_mc_segmap_parloop_131934_task.iterations = iterations;
    futhark_mc_segmap_parloop_131934_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131934_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131934_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131934_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131934_task);
    
    if (futhark_mc_segmap_parloop_131934_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131934_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131934_total_end -
                 futhark_mc_segmap_parloop_131934_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131934_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131934_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131934_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_task_131932_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_task_131932_end -
                 futhark_mc_segmap_task_131932_start;
        
        ctx->futhark_mc_segmap_task_131932_runs[tid]++;
        ctx->futhark_mc_segmap_task_131932_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_task_131932_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
static int futhark_mc_segmap_parloop_131929(void *args, int64_t start,
                                            int64_t end, int flat_tid_121146,
                                            int tid)
{
    int err = 0;
    struct futhark_mc_segmap_parloop_struct_131928
    *futhark_mc_segmap_parloop_struct_131928 =
    (struct futhark_mc_segmap_parloop_struct_131928 *) args;
    struct futhark_context *ctx = futhark_mc_segmap_parloop_struct_131928->ctx;
    uint64_t futhark_mc_segmap_parloop_131929_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131929_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_segmap_parloop_struct_131928->free_m_114533;
    int64_t n_114534 = futhark_mc_segmap_parloop_struct_131928->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_segmap_parloop_struct_131928->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121983 =
            futhark_mc_segmap_parloop_struct_131928->free_bytes_121983;
    struct memblock stl_res_mem_123741 = {.desc ="stl_res_mem_123741", .mem =
                                          futhark_mc_segmap_parloop_struct_131928->free_stl_res_mem_123741,
                                          .size =0, .references =NULL};
    int64_t stl_res_ixfn_123745 =
            futhark_mc_segmap_parloop_struct_131928->free_stl_res_ixfn_123745;
    struct memblock stl_res_mem_123749 = {.desc ="stl_res_mem_123749", .mem =
                                          futhark_mc_segmap_parloop_struct_131928->free_stl_res_mem_123749,
                                          .size =0, .references =NULL};
    struct memblock mem_123779 = {.desc ="mem_123779", .mem =
                                  futhark_mc_segmap_parloop_struct_131928->free_mem_123779,
                                  .size =0, .references =NULL};
    size_t mem_123760_cached_sizze_131930 = 0;
    char *mem_123760 = NULL;
    int64_t iterations = end - start;
    int64_t iter_131089 = start;
    
    if (mem_123760_cached_sizze_131930 < (size_t) bytes_121983) {
        mem_123760 = realloc(mem_123760, bytes_121983);
        mem_123760_cached_sizze_131930 = bytes_121983;
    }
    for (; iter_131089 < end; iter_131089++) {
        if (ctx->debugging)
            fprintf(ctx->log, "%s\n", "SegMap fbody");
        
        int64_t slice_131095 = m_114533;
        int64_t gtid_121147 = iter_131089;
        int64_t remnant_131096 = iter_131089 - gtid_121147;
        int64_t flat_tid_121148 = (int64_t) 0;
        int32_t num_tasks_131097;
        struct futhark_mc_task_131931 futhark_mc_task_131931;
        
        futhark_mc_task_131931.ctx = ctx;
        futhark_mc_task_131931.free_n_114534 = n_114534;
        futhark_mc_task_131931.free_gtid_121147 = gtid_121147;
        futhark_mc_task_131931.free_Y_mem_121939 = Y_mem_121939.mem;
        futhark_mc_task_131931.free_stl_res_mem_123741 = stl_res_mem_123741.mem;
        futhark_mc_task_131931.free_stl_res_ixfn_123745 = stl_res_ixfn_123745;
        futhark_mc_task_131931.free_stl_res_mem_123749 = stl_res_mem_123749.mem;
        futhark_mc_task_131931.free_mem_123760 = mem_123760;
        
        struct scheduler_segop futhark_mc_task_131931_task;
        
        futhark_mc_task_131931_task.args = &futhark_mc_task_131931;
        futhark_mc_task_131931_task.top_level_fn =
            futhark_mc_segmap_task_131932;
        futhark_mc_task_131931_task.name = "futhark_mc_segmap_task_131932";
        futhark_mc_task_131931_task.iterations = n_114534;
        futhark_mc_task_131931_task.task_time =
            &ctx->futhark_mc_segmap_task_131932_total_time;
        futhark_mc_task_131931_task.task_iter =
            &ctx->futhark_mc_segmap_task_131932_total_iter;
        futhark_mc_task_131931_task.sched = STATIC;
        futhark_mc_task_131931_task.nested_fn = NULL;
        
        int futhark_mc_segmap_task_131932_err =
            scheduler_prepare_task(&ctx->scheduler,
                                   &futhark_mc_task_131931_task);
        
        if (futhark_mc_segmap_task_131932_err != 0) {
            err = 1;
            goto cleanup;
        }
        memmove(mem_123779.mem + gtid_121147 * n_114534 * (int64_t) 4,
                mem_123760 + (int64_t) 0, n_114534 * (int64_t) 4);
    }
    
  cleanup:
    { }
    free(mem_123760);
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131929_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131929_end -
                 futhark_mc_segmap_parloop_131929_start;
        
        ctx->futhark_mc_segmap_parloop_131929_runs[tid]++;
        ctx->futhark_mc_segmap_parloop_131929_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_parloop_131929_iter[tid] += iterations;
    }
    return err;
}
int futhark_mc_segmap_nested_task_131927(void *args, int64_t iterations,
                                         int tid, struct scheduler_info info)
{
    int err = 0;
    int flat_tid_121146 = tid;
    int num_tasks_131076 = info.nsubtasks;
    struct futhark_mc_task_131922 *futhark_mc_task_131922 =
                                  (struct futhark_mc_task_131922 *) args;
    struct futhark_context *ctx = futhark_mc_task_131922->ctx;
    uint64_t futhark_mc_segmap_nested_task_131927_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_nested_task_131927_start = get_wall_time();
    
    int64_t m_114533 = futhark_mc_task_131922->free_m_114533;
    int64_t n_114534 = futhark_mc_task_131922->free_n_114534;
    struct memblock Y_mem_121939 = {.desc ="Y_mem_121939", .mem =
                                    futhark_mc_task_131922->free_Y_mem_121939,
                                    .size =0, .references =NULL};
    int64_t bytes_121983 = futhark_mc_task_131922->free_bytes_121983;
    struct memblock stl_res_mem_123741 = {.desc ="stl_res_mem_123741", .mem =
                                          futhark_mc_task_131922->free_stl_res_mem_123741,
                                          .size =0, .references =NULL};
    int64_t stl_res_ixfn_123745 =
            futhark_mc_task_131922->free_stl_res_ixfn_123745;
    struct memblock stl_res_mem_123749 = {.desc ="stl_res_mem_123749", .mem =
                                          futhark_mc_task_131922->free_stl_res_mem_123749,
                                          .size =0, .references =NULL};
    struct memblock mem_123779 = {.desc ="mem_123779", .mem =
                                  futhark_mc_task_131922->free_mem_123779,
                                  .size =0, .references =NULL};
    int64_t iter_131089;
    struct futhark_mc_segmap_parloop_struct_131928
    futhark_mc_segmap_parloop_struct_131928;
    
    futhark_mc_segmap_parloop_struct_131928.ctx = ctx;
    futhark_mc_segmap_parloop_struct_131928.free_m_114533 = m_114533;
    futhark_mc_segmap_parloop_struct_131928.free_n_114534 = n_114534;
    futhark_mc_segmap_parloop_struct_131928.free_Y_mem_121939 =
        Y_mem_121939.mem;
    futhark_mc_segmap_parloop_struct_131928.free_bytes_121983 = bytes_121983;
    futhark_mc_segmap_parloop_struct_131928.free_stl_res_mem_123741 =
        stl_res_mem_123741.mem;
    futhark_mc_segmap_parloop_struct_131928.free_stl_res_ixfn_123745 =
        stl_res_ixfn_123745;
    futhark_mc_segmap_parloop_struct_131928.free_stl_res_mem_123749 =
        stl_res_mem_123749.mem;
    futhark_mc_segmap_parloop_struct_131928.free_mem_123779 = mem_123779.mem;
    
    struct scheduler_parloop futhark_mc_segmap_parloop_131929_task;
    
    futhark_mc_segmap_parloop_131929_task.name =
        "futhark_mc_segmap_parloop_131929";
    futhark_mc_segmap_parloop_131929_task.fn = futhark_mc_segmap_parloop_131929;
    futhark_mc_segmap_parloop_131929_task.args =
        &futhark_mc_segmap_parloop_struct_131928;
    futhark_mc_segmap_parloop_131929_task.iterations = iterations;
    futhark_mc_segmap_parloop_131929_task.info = info;
    
    uint64_t futhark_mc_segmap_parloop_131929_total_start = 0;
    
    if (ctx->profiling && !ctx->profiling_paused)
        futhark_mc_segmap_parloop_131929_total_start = get_wall_time();
    
    int futhark_mc_segmap_parloop_131929_err =
        scheduler_execute_task(&ctx->scheduler,
                               &futhark_mc_segmap_parloop_131929_task);
    
    if (futhark_mc_segmap_parloop_131929_err != 0) {
        err = 1;
        goto cleanup;
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_parloop_131929_total_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_parloop_131929_total_end -
                 futhark_mc_segmap_parloop_131929_total_start;
        
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131929_total_runs, 1,
                           __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131929_total_total_runtime,
                           elapsed, __ATOMIC_RELAXED);
        __atomic_fetch_add(&ctx->futhark_mc_segmap_parloop_131929_total_iter,
                           iterations, __ATOMIC_RELAXED);
    }
    if (ctx->profiling && !ctx->profiling_paused) {
        uint64_t futhark_mc_segmap_nested_task_131927_end = get_wall_time();
        uint64_t elapsed = futhark_mc_segmap_nested_task_131927_end -
                 futhark_mc_segmap_nested_task_131927_start;
        
        ctx->futhark_mc_segmap_nested_task_131927_runs[tid]++;
        ctx->futhark_mc_segmap_nested_task_131927_total_runtime[tid] += elapsed;
        ctx->futhark_mc_segmap_nested_task_131927_iter[tid] += iterations;
    }
    
  cleanup:
    { }
    return err;
}
struct futhark_f32_2d {
    struct memblock mem;
    int64_t shape[2];
};
struct futhark_f32_2d *futhark_new_f32_2d(struct futhark_context *ctx, const
                                          float *data, int64_t dim0,
                                          int64_t dim1)
{
    struct futhark_f32_2d *bad = NULL;
    struct futhark_f32_2d *arr =
                          (struct futhark_f32_2d *) malloc(sizeof(struct futhark_f32_2d));
    
    if (arr == NULL)
        return bad;
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    arr->mem.references = NULL;
    if (memblock_alloc(ctx, &arr->mem, (size_t) (dim0 * dim1) * 4, "arr->mem"))
        return NULL;
    arr->shape[0] = dim0;
    arr->shape[1] = dim1;
    memmove(arr->mem.mem + 0, data + 0, (size_t) (dim0 * dim1) * 4);
    lock_unlock(&ctx->lock);
    return arr;
}
struct futhark_f32_2d *futhark_new_raw_f32_2d(struct futhark_context *ctx, const
                                              char *data, int offset,
                                              int64_t dim0, int64_t dim1)
{
    struct futhark_f32_2d *bad = NULL;
    struct futhark_f32_2d *arr =
                          (struct futhark_f32_2d *) malloc(sizeof(struct futhark_f32_2d));
    
    if (arr == NULL)
        return bad;
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    arr->mem.references = NULL;
    if (memblock_alloc(ctx, &arr->mem, (size_t) (dim0 * dim1) * 4, "arr->mem"))
        return NULL;
    arr->shape[0] = dim0;
    arr->shape[1] = dim1;
    memmove(arr->mem.mem + 0, data + offset, (size_t) (dim0 * dim1) * 4);
    lock_unlock(&ctx->lock);
    return arr;
}
int futhark_free_f32_2d(struct futhark_context *ctx, struct futhark_f32_2d *arr)
{
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    if (memblock_unref(ctx, &arr->mem, "arr->mem") != 0)
        return 1;
    lock_unlock(&ctx->lock);
    free(arr);
    return 0;
}
int futhark_values_f32_2d(struct futhark_context *ctx,
                          struct futhark_f32_2d *arr, float *data)
{
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    memmove(data + 0, arr->mem.mem + 0, (size_t) (arr->shape[0] *
                                                  arr->shape[1]) * 4);
    lock_unlock(&ctx->lock);
    return 0;
}
char *futhark_values_raw_f32_2d(struct futhark_context *ctx,
                                struct futhark_f32_2d *arr)
{
    (void) ctx;
    return arr->mem.mem;
}
const int64_t *futhark_shape_f32_2d(struct futhark_context *ctx,
                                    struct futhark_f32_2d *arr)
{
    (void) ctx;
    return arr->shape;
}
static int futrts_entry_main(struct futhark_context *ctx,
                             struct memblock *out_mem_p_131101,
                             struct memblock *out_mem_p_131102,
                             struct memblock *out_mem_p_131103,
                             struct memblock Y_mem_121939, int64_t m_114533,
                             int64_t n_114534, int64_t n_p_114536,
                             int64_t t_window_114537, int64_t l_window_114538,
                             int64_t t_degree_114539, int64_t l_degree_114540,
                             int64_t t_jump_114541, int64_t l_jump_114542,
                             int64_t inner_114543, int64_t outer_114544,
                             int64_t jump_threshold_114545,
                             int64_t max_group_sizze_114546)
{
    (void) ctx;
    
    int err = 0;
    size_t mem_121979_cached_sizze_131104 = 0;
    char *mem_121979 = NULL;
    size_t mem_121982_cached_sizze_131105 = 0;
    char *mem_121982 = NULL;
    size_t mem_122004_cached_sizze_131106 = 0;
    char *mem_122004 = NULL;
    size_t mem_122026_cached_sizze_131107 = 0;
    char *mem_122026 = NULL;
    size_t mem_122048_cached_sizze_131108 = 0;
    char *mem_122048 = NULL;
    size_t mem_122124_cached_sizze_131109 = 0;
    char *mem_122124 = NULL;
    size_t mem_122128_cached_sizze_131110 = 0;
    char *mem_122128 = NULL;
    size_t mem_122204_cached_sizze_131111 = 0;
    char *mem_122204 = NULL;
    size_t mem_122208_cached_sizze_131112 = 0;
    char *mem_122208 = NULL;
    size_t mem_122284_cached_sizze_131113 = 0;
    char *mem_122284 = NULL;
    size_t mem_122306_cached_sizze_131114 = 0;
    char *mem_122306 = NULL;
    size_t mem_122328_cached_sizze_131115 = 0;
    char *mem_122328 = NULL;
    size_t mem_122386_cached_sizze_131116 = 0;
    char *mem_122386 = NULL;
    size_t mem_122426_cached_sizze_131117 = 0;
    char *mem_122426 = NULL;
    size_t mem_122430_cached_sizze_131118 = 0;
    char *mem_122430 = NULL;
    size_t mem_122985_cached_sizze_131119 = 0;
    char *mem_122985 = NULL;
    size_t mem_123520_cached_sizze_131120 = 0;
    char *mem_123520 = NULL;
    size_t mem_123542_cached_sizze_131121 = 0;
    char *mem_123542 = NULL;
    size_t mem_123696_cached_sizze_131122 = 0;
    char *mem_123696 = NULL;
    size_t mem_123699_cached_sizze_131123 = 0;
    char *mem_123699 = NULL;
    size_t mem_123702_cached_sizze_131124 = 0;
    char *mem_123702 = NULL;
    size_t mem_123705_cached_sizze_131125 = 0;
    char *mem_123705 = NULL;
    struct memblock out_mem_123850;
    
    out_mem_123850.references = NULL;
    
    struct memblock out_mem_123851;
    
    out_mem_123851.references = NULL;
    
    struct memblock out_mem_123852;
    
    out_mem_123852.references = NULL;
    
    bool assert_cond_114547 = sle64((int64_t) 4, n_p_114536);
    bool assert_c_114548;
    
    if (!assert_cond_114547) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (n_p >= 4)",
                               "-> #0  stl.fut:90:13-33\n   #1  stl.fut:394:3-405:33\n   #2  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    int64_t x_114549 = smod64(t_window_114537, (int64_t) 2);
    bool assert_cond_114550 = x_114549 == (int64_t) 1;
    bool assert_c_114551;
    
    if (!assert_cond_114550) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x % 2 == 1)",
                               "-> #0  utils.fut:5:3-23\n   #1  /prelude/functional.fut:39:62-64\n   #2  stl.fut:92:18-35\n   #3  stl.fut:394:3-405:33\n   #4  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool assert_cond_114552 = slt64((int64_t) 0, t_window_114537);
    bool assert_c_114553;
    
    if (!assert_cond_114552) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x > 0)",
                               "-> #0  utils.fut:2:3-18\n   #1  /prelude/functional.fut:39:59-65\n   #2  stl.fut:92:18-35\n   #3  stl.fut:394:3-405:33\n   #4  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    int64_t x_114554 = smod64(l_window_114538, (int64_t) 2);
    bool assert_cond_114555 = x_114554 == (int64_t) 1;
    bool assert_c_114556;
    
    if (!assert_cond_114555) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x % 2 == 1)",
                               "-> #0  utils.fut:5:3-23\n   #1  /prelude/functional.fut:39:62-64\n   #2  stl.fut:93:18-35\n   #3  stl.fut:394:3-405:33\n   #4  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool assert_cond_114557 = slt64((int64_t) 0, l_window_114538);
    bool assert_c_114558;
    
    if (!assert_cond_114557) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x > 0)",
                               "-> #0  utils.fut:2:3-18\n   #1  /prelude/functional.fut:39:59-65\n   #2  stl.fut:93:18-35\n   #3  stl.fut:394:3-405:33\n   #4  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool cond_114559 = sle64((int64_t) 0, t_degree_114539);
    bool assert_cond_t_res_114560 = sle64(t_degree_114539, (int64_t) 2);
    bool x_114561 = cond_114559 && assert_cond_t_res_114560;
    bool assert_c_114562;
    
    if (!x_114561) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x >= 0 && x <= 2)",
                               "-> #0  utils.fut:8:3-29\n   #1  stl.fut:95:18-35\n   #2  stl.fut:394:3-405:33\n   #3  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool cond_114563 = sle64((int64_t) 0, l_degree_114540);
    bool assert_cond_t_res_114564 = sle64(l_degree_114540, (int64_t) 2);
    bool x_114565 = cond_114563 && assert_cond_t_res_114564;
    bool assert_c_114566;
    
    if (!x_114565) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x >= 0 && x <= 2)",
                               "-> #0  utils.fut:8:3-29\n   #1  stl.fut:96:18-35\n   #2  stl.fut:394:3-405:33\n   #3  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool assert_cond_114567 = sle64((int64_t) 0, t_jump_114541);
    bool assert_c_114568;
    
    if (!assert_cond_114567) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x >= 0)",
                               "-> #0  utils.fut:14:3-19\n   #1  stl.fut:98:16-34\n   #2  stl.fut:394:3-405:33\n   #3  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool assert_cond_114569 = sle64((int64_t) 0, l_jump_114542);
    bool assert_c_114570;
    
    if (!assert_cond_114569) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x >= 0)",
                               "-> #0  utils.fut:14:3-19\n   #1  stl.fut:99:16-34\n   #2  stl.fut:394:3-405:33\n   #3  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool assert_cond_114571 = slt64((int64_t) 0, inner_114543);
    bool assert_c_114572;
    
    if (!assert_cond_114571) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x > 0)",
                               "-> #0  utils.fut:2:3-18\n   #1  stl.fut:101:15-29\n   #2  stl.fut:394:3-405:33\n   #3  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool assert_cond_114573 = sle64((int64_t) 0, outer_114544);
    bool assert_c_114574;
    
    if (!assert_cond_114573) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "Assertion is false: (x >= 0)",
                               "-> #0  utils.fut:14:3-19\n   #1  stl.fut:102:15-32\n   #2  stl.fut:394:3-405:33\n   #3  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    float i64_res_114575 = sitofp_i64_f32(n_114534);
    float i64_res_114576 = sitofp_i64_f32(n_p_114536);
    float binop_p_114577 = i64_res_114575 / i64_res_114576;
    float defunc_0_f_res_114578;
    
    defunc_0_f_res_114578 = futrts_ceil32(binop_p_114577);
    
    int64_t defunc_0_f_res_114579 = fptosi_f32_i64(defunc_0_f_res_114578);
    int64_t css_chunk_len_114580 = add64((int64_t) 2, defunc_0_f_res_114579);
    int64_t y_114581 = mul64((int64_t) 2, n_p_114536);
    int64_t C_len_114582 = add64(n_114534, y_114581);
    bool cond_114583 = l_jump_114542 == (int64_t) 1;
    int64_t l_n_m_114584;
    
    if (cond_114583) {
        l_n_m_114584 = n_114534;
    } else {
        bool zzero_114585 = l_jump_114542 == (int64_t) 0;
        bool nonzzero_114586 = !zzero_114585;
        bool nonzzero_cert_114587;
        
        if (!nonzzero_114586) {
            ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                   "division by zero",
                                   "-> #0  stl.fut:110:42-51\n   #1  stl.fut:394:3-405:33\n   #2  stl.fut:381:1-405:33\n");
            if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
                return 1;
            if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
                return 1;
            if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
                return 1;
            return 1;
        }
        
        int64_t x_114588 = sdiv64(n_114534, l_jump_114542);
        int64_t l_n_m_f_res_114589 = add64((int64_t) 1, x_114588);
        
        l_n_m_114584 = l_n_m_f_res_114589;
    }
    
    bool cond_114590 = t_jump_114541 == (int64_t) 1;
    int64_t t_n_m_114591;
    
    if (cond_114590) {
        t_n_m_114591 = n_114534;
    } else {
        bool zzero_114592 = t_jump_114541 == (int64_t) 0;
        bool nonzzero_114593 = !zzero_114592;
        bool nonzzero_cert_114594;
        
        if (!nonzzero_114593) {
            ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                   "division by zero",
                                   "-> #0  stl.fut:114:42-51\n   #1  stl.fut:394:3-405:33\n   #2  stl.fut:381:1-405:33\n");
            if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
                return 1;
            if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
                return 1;
            if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
                return 1;
            return 1;
        }
        
        int64_t x_114595 = sdiv64(n_114534, t_jump_114541);
        int64_t t_n_m_f_res_114596 = add64((int64_t) 1, x_114595);
        
        t_n_m_114591 = t_n_m_f_res_114596;
    }
    
    float x_114597 = i64_res_114575 / 2.0F;
    float floor_arg_114598 = 1.0F + x_114597;
    float floor_res_114599;
    
    floor_res_114599 = futrts_floor32(floor_arg_114598);
    
    int64_t defunc_0_f_res_114600 = fptosi_f32_i64(floor_res_114599);
    int64_t x_114601 = sub64(n_114534, defunc_0_f_res_114600);
    int64_t mid2_114602 = add64((int64_t) 1, x_114601);
    bool cond_114603 = defunc_0_f_res_114600 == mid2_114602;
    int64_t stl_res_114604;
    int64_t stl_res_114605;
    
    if (cond_114603) {
        int64_t stl_res_t_res_114606 = sub64(defunc_0_f_res_114600,
                                             (int64_t) 1);
        
        stl_res_114604 = stl_res_t_res_114606;
        stl_res_114605 = defunc_0_f_res_114600;
    } else {
        int64_t min_res_114607 = smin64(defunc_0_f_res_114600, mid2_114602);
        int64_t stl_res_f_res_114608 = sub64(min_res_114607, (int64_t) 1);
        int64_t max_res_114609 = smax64(defunc_0_f_res_114600, mid2_114602);
        
        stl_res_114604 = stl_res_f_res_114608;
        stl_res_114605 = max_res_114609;
    }
    
    int64_t i_114610 = sub64(n_114534, (int64_t) 1);
    bool x_114611 = sle64((int64_t) 0, i_114610);
    bool y_114612 = slt64(i_114610, n_114534);
    bool bounds_check_114613 = x_114611 && y_114612;
    bool index_certs_114614;
    
    if (!bounds_check_114613) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [", i_114610,
                               "] out of bounds for array of shape [", n_114534,
                               "].",
                               "-> #0  /prelude/array.fut:26:29-34\n   #1  utils.fut:38:13-20\n   #2  stl.fut:128:31-49\n   #3  stl.fut:394:3-405:33\n   #4  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    int64_t binop_x_121977 = m_114533 * n_114534;
    int64_t binop_y_121978 = (int64_t) 8 * binop_x_121977;
    int64_t bytes_121976 = smax64((int64_t) 0, binop_y_121978);
    
    if (mem_121979_cached_sizze_131104 < (size_t) bytes_121976) {
        mem_121979 = realloc(mem_121979, bytes_121976);
        mem_121979_cached_sizze_131104 = bytes_121976;
    }
    
    int64_t binop_y_121981 = (int64_t) 8 * m_114533;
    int64_t bytes_121980 = smax64((int64_t) 0, binop_y_121981);
    
    if (mem_121982_cached_sizze_131105 < (size_t) bytes_121980) {
        mem_121982 = realloc(mem_121982, bytes_121980);
        mem_121982_cached_sizze_131105 = bytes_121980;
    }
    
    int64_t binop_y_121941 = (int64_t) 8 * n_114534;
    int64_t bytes_121940 = smax64((int64_t) 0, binop_y_121941);
    int64_t flat_tid_116755 = (int64_t) 0;
    int32_t num_tasks_123853;
    int64_t flat_tid_116757 = (int64_t) 0;
    struct futhark_mc_task_131126 futhark_mc_task_131126;
    
    futhark_mc_task_131126.ctx = ctx;
    futhark_mc_task_131126.free_m_114533 = m_114533;
    futhark_mc_task_131126.free_n_114534 = n_114534;
    futhark_mc_task_131126.free_i_114610 = i_114610;
    futhark_mc_task_131126.free_Y_mem_121939 = Y_mem_121939.mem;
    futhark_mc_task_131126.free_bytes_121940 = bytes_121940;
    futhark_mc_task_131126.free_mem_121979 = mem_121979;
    futhark_mc_task_131126.free_mem_121982 = mem_121982;
    
    struct scheduler_segop futhark_mc_task_131126_task;
    
    futhark_mc_task_131126_task.args = &futhark_mc_task_131126;
    futhark_mc_task_131126_task.top_level_fn = futhark_mc_segmap_task_131127;
    futhark_mc_task_131126_task.name = "futhark_mc_segmap_task_131127";
    futhark_mc_task_131126_task.iterations = m_114533;
    futhark_mc_task_131126_task.task_time =
        &ctx->futhark_mc_segmap_task_131127_total_time;
    futhark_mc_task_131126_task.task_iter =
        &ctx->futhark_mc_segmap_task_131127_total_iter;
    futhark_mc_task_131126_task.sched = STATIC;
    futhark_mc_task_131126_task.nested_fn =
        futhark_mc_segmap_nested_task_131132;
    
    int futhark_mc_segmap_task_131127_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_131126_task);
    
    if (futhark_mc_segmap_task_131127_err != 0) {
        err = 1;
        goto cleanup;
    }
    
    int64_t binop_y_122003 = (int64_t) 4 * binop_x_121977;
    int64_t bytes_122001 = smax64((int64_t) 0, binop_y_122003);
    
    if (mem_122004_cached_sizze_131106 < (size_t) bytes_122001) {
        mem_122004 = realloc(mem_122004, bytes_122001);
        mem_122004_cached_sizze_131106 = bytes_122001;
    }
    
    int64_t binop_y_121984 = (int64_t) 4 * n_114534;
    int64_t bytes_121983 = smax64((int64_t) 0, binop_y_121984);
    int64_t flat_tid_116782 = (int64_t) 0;
    int32_t num_tasks_123916;
    int64_t flat_tid_116784 = (int64_t) 0;
    struct futhark_mc_task_131148 futhark_mc_task_131148;
    
    futhark_mc_task_131148.ctx = ctx;
    futhark_mc_task_131148.free_m_114533 = m_114533;
    futhark_mc_task_131148.free_n_114534 = n_114534;
    futhark_mc_task_131148.free_mem_121979 = mem_121979;
    futhark_mc_task_131148.free_bytes_121983 = bytes_121983;
    futhark_mc_task_131148.free_mem_122004 = mem_122004;
    
    struct scheduler_segop futhark_mc_task_131148_task;
    
    futhark_mc_task_131148_task.args = &futhark_mc_task_131148;
    futhark_mc_task_131148_task.top_level_fn = futhark_mc_segmap_task_131149;
    futhark_mc_task_131148_task.name = "futhark_mc_segmap_task_131149";
    futhark_mc_task_131148_task.iterations = m_114533;
    futhark_mc_task_131148_task.task_time =
        &ctx->futhark_mc_segmap_task_131149_total_time;
    futhark_mc_task_131148_task.task_iter =
        &ctx->futhark_mc_segmap_task_131149_total_iter;
    futhark_mc_task_131148_task.sched = STATIC;
    futhark_mc_task_131148_task.nested_fn =
        futhark_mc_segmap_nested_task_131153;
    
    int futhark_mc_segmap_task_131149_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_131148_task);
    
    if (futhark_mc_segmap_task_131149_err != 0) {
        err = 1;
        goto cleanup;
    }
    
    bool bounds_invalid_upwards_114645 = slt64(n_p_114536, (int64_t) 0);
    bool valid_114646 = !bounds_invalid_upwards_114645;
    bool range_valid_c_114647;
    
    if (!valid_114646) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Range ", (int64_t) 0, "..", (int64_t) 1, "..<",
                               n_p_114536, " is invalid.",
                               "-> #0  /prelude/array.fut:90:3-10\n   #1  /prelude/array.fut:195:11-16\n   #2  stl.fut:134:5-144:14\n   #3  stl.fut:394:3-405:33\n   #4  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool bounds_invalid_upwards_114649 = slt64(css_chunk_len_114580,
                                               (int64_t) 0);
    bool valid_114650 = !bounds_invalid_upwards_114649;
    bool range_valid_c_114651;
    
    if (!valid_114650) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Range ", (int64_t) 0, "..", (int64_t) 1, "..<",
                               css_chunk_len_114580, " is invalid.",
                               "-> #0  /prelude/array.fut:90:3-10\n   #1  /prelude/array.fut:195:11-16\n   #2  stl.fut:137:16-143:39\n   #3  /prelude/soacs.fut:59:3-10\n   #4  /prelude/array.fut:195:3-17\n   #5  stl.fut:134:5-144:14\n   #6  stl.fut:394:3-405:33\n   #7  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    int64_t binop_x_122024 = n_p_114536 * css_chunk_len_114580;
    int64_t binop_y_122025 = (int64_t) 8 * binop_x_122024;
    int64_t bytes_122023 = smax64((int64_t) 0, binop_y_122025);
    
    if (mem_122026_cached_sizze_131107 < (size_t) bytes_122023) {
        mem_122026 = realloc(mem_122026, bytes_122023);
        mem_122026_cached_sizze_131107 = bytes_122023;
    }
    
    int64_t binop_y_122006 = (int64_t) 8 * css_chunk_len_114580;
    int64_t bytes_122005 = smax64((int64_t) 0, binop_y_122006);
    int64_t flat_tid_116792 = (int64_t) 0;
    int32_t num_tasks_123935;
    int64_t flat_tid_116794 = (int64_t) 0;
    struct futhark_mc_task_131161 futhark_mc_task_131161;
    
    futhark_mc_task_131161.ctx = ctx;
    futhark_mc_task_131161.free_n_p_114536 = n_p_114536;
    futhark_mc_task_131161.free_css_chunk_len_114580 = css_chunk_len_114580;
    futhark_mc_task_131161.free_i_114610 = i_114610;
    futhark_mc_task_131161.free_bytes_122005 = bytes_122005;
    futhark_mc_task_131161.free_mem_122026 = mem_122026;
    
    struct scheduler_segop futhark_mc_task_131161_task;
    
    futhark_mc_task_131161_task.args = &futhark_mc_task_131161;
    futhark_mc_task_131161_task.top_level_fn = futhark_mc_segmap_task_131162;
    futhark_mc_task_131161_task.name = "futhark_mc_segmap_task_131162";
    futhark_mc_task_131161_task.iterations = n_p_114536;
    futhark_mc_task_131161_task.task_time =
        &ctx->futhark_mc_segmap_task_131162_total_time;
    futhark_mc_task_131161_task.task_iter =
        &ctx->futhark_mc_segmap_task_131162_total_iter;
    futhark_mc_task_131161_task.sched = STATIC;
    futhark_mc_task_131161_task.nested_fn =
        futhark_mc_segmap_nested_task_131166;
    
    int futhark_mc_segmap_task_131162_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_131161_task);
    
    if (futhark_mc_segmap_task_131162_err != 0) {
        err = 1;
        goto cleanup;
    }
    
    int64_t binop_x_122046 = m_114533 * n_p_114536;
    int64_t binop_y_122047 = (int64_t) 4 * binop_x_122046;
    int64_t bytes_122045 = smax64((int64_t) 0, binop_y_122047);
    
    if (mem_122048_cached_sizze_131108 < (size_t) bytes_122045) {
        mem_122048 = realloc(mem_122048, bytes_122045);
        mem_122048_cached_sizze_131108 = bytes_122045;
    }
    
    int64_t binop_y_122028 = (int64_t) 4 * n_p_114536;
    int64_t bytes_122027 = smax64((int64_t) 0, binop_y_122028);
    int64_t flat_tid_116805 = (int64_t) 0;
    int32_t num_tasks_123958;
    int64_t flat_tid_116807 = (int64_t) 0;
    struct futhark_mc_task_131174 futhark_mc_task_131174;
    
    futhark_mc_task_131174.ctx = ctx;
    futhark_mc_task_131174.free_m_114533 = m_114533;
    futhark_mc_task_131174.free_n_114534 = n_114534;
    futhark_mc_task_131174.free_n_p_114536 = n_p_114536;
    futhark_mc_task_131174.free_css_chunk_len_114580 = css_chunk_len_114580;
    futhark_mc_task_131174.free_Y_mem_121939 = Y_mem_121939.mem;
    futhark_mc_task_131174.free_mem_122026 = mem_122026;
    futhark_mc_task_131174.free_bytes_122027 = bytes_122027;
    futhark_mc_task_131174.free_mem_122048 = mem_122048;
    
    struct scheduler_segop futhark_mc_task_131174_task;
    
    futhark_mc_task_131174_task.args = &futhark_mc_task_131174;
    futhark_mc_task_131174_task.top_level_fn = futhark_mc_segmap_task_131175;
    futhark_mc_task_131174_task.name = "futhark_mc_segmap_task_131175";
    futhark_mc_task_131174_task.iterations = m_114533;
    futhark_mc_task_131174_task.task_time =
        &ctx->futhark_mc_segmap_task_131175_total_time;
    futhark_mc_task_131174_task.task_iter =
        &ctx->futhark_mc_segmap_task_131175_total_iter;
    futhark_mc_task_131174_task.sched = STATIC;
    futhark_mc_task_131174_task.nested_fn =
        futhark_mc_segmap_nested_task_131179;
    
    int futhark_mc_segmap_task_131175_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_131174_task);
    
    if (futhark_mc_segmap_task_131175_err != 0) {
        err = 1;
        goto cleanup;
    }
    
    int64_t min_res_114683 = smin64(n_114534, l_window_114538);
    bool bounds_invalid_upwards_114684 = slt64(l_n_m_114584, (int64_t) 0);
    bool valid_114685 = !bounds_invalid_upwards_114684;
    bool range_valid_c_114686;
    
    if (!valid_114685) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Range ", (int64_t) 0, "..", (int64_t) 1, "..<",
                               l_n_m_114584, " is invalid.",
                               "-> #0  /prelude/array.fut:90:3-10\n   #1  /prelude/array.fut:195:11-16\n   #2  loess.fut:335:3-373:7\n   #3  loess.fut:400:15-58\n   #4  stl.fut:166:13-65\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:164:5-167:26\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool empty_slice_114688 = min_res_114683 == (int64_t) 0;
    int64_t m_114689 = sub64(min_res_114683, (int64_t) 1);
    float i64_res_114690 = sitofp_i64_f32(l_window_114538);
    int64_t binop_x_122122 = m_114533 * l_n_m_114584;
    int64_t binop_y_122123 = (int64_t) 8 * binop_x_122122;
    int64_t bytes_122121 = smax64((int64_t) 0, binop_y_122123);
    
    if (mem_122124_cached_sizze_131109 < (size_t) bytes_122121) {
        mem_122124 = realloc(mem_122124, bytes_122121);
        mem_122124_cached_sizze_131109 = bytes_122121;
    }
    
    int64_t binop_y_122127 = (int64_t) 4 * binop_x_122122;
    int64_t bytes_122125 = smax64((int64_t) 0, binop_y_122127);
    
    if (mem_122128_cached_sizze_131110 < (size_t) bytes_122125) {
        mem_122128 = realloc(mem_122128, bytes_122125);
        mem_122128_cached_sizze_131110 = bytes_122125;
    }
    
    int64_t binop_y_122056 = (int64_t) 4 * l_n_m_114584;
    int64_t bytes_122055 = smax64((int64_t) 0, binop_y_122056);
    int64_t binop_y_122059 = (int64_t) 8 * l_n_m_114584;
    int64_t bytes_122058 = smax64((int64_t) 0, binop_y_122059);
    int64_t flat_tid_116868 = (int64_t) 0;
    int32_t num_tasks_124058;
    int64_t flat_tid_116870 = (int64_t) 0;
    struct futhark_mc_task_131195 futhark_mc_task_131195;
    
    futhark_mc_task_131195.ctx = ctx;
    futhark_mc_task_131195.free_m_114533 = m_114533;
    futhark_mc_task_131195.free_n_114534 = n_114534;
    futhark_mc_task_131195.free_l_jump_114542 = l_jump_114542;
    futhark_mc_task_131195.free_l_n_m_114584 = l_n_m_114584;
    futhark_mc_task_131195.free_i_114610 = i_114610;
    futhark_mc_task_131195.free_x_114611 = x_114611;
    futhark_mc_task_131195.free_min_res_114683 = min_res_114683;
    futhark_mc_task_131195.free_empty_slice_114688 = empty_slice_114688;
    futhark_mc_task_131195.free_m_114689 = m_114689;
    futhark_mc_task_131195.free_i64_res_114690 = i64_res_114690;
    futhark_mc_task_131195.free_bytes_121940 = bytes_121940;
    futhark_mc_task_131195.free_mem_121979 = mem_121979;
    futhark_mc_task_131195.free_mem_121982 = mem_121982;
    futhark_mc_task_131195.free_bytes_122055 = bytes_122055;
    futhark_mc_task_131195.free_bytes_122058 = bytes_122058;
    futhark_mc_task_131195.free_mem_122124 = mem_122124;
    futhark_mc_task_131195.free_mem_122128 = mem_122128;
    
    struct scheduler_segop futhark_mc_task_131195_task;
    
    futhark_mc_task_131195_task.args = &futhark_mc_task_131195;
    futhark_mc_task_131195_task.top_level_fn = futhark_mc_segmap_task_131196;
    futhark_mc_task_131195_task.name = "futhark_mc_segmap_task_131196";
    futhark_mc_task_131195_task.iterations = m_114533;
    futhark_mc_task_131195_task.task_time =
        &ctx->futhark_mc_segmap_task_131196_total_time;
    futhark_mc_task_131195_task.task_iter =
        &ctx->futhark_mc_segmap_task_131196_total_iter;
    futhark_mc_task_131195_task.sched = DYNAMIC;
    futhark_mc_task_131195_task.nested_fn =
        futhark_mc_segmap_nested_task_131203;
    
    int futhark_mc_segmap_task_131196_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_131195_task);
    
    if (futhark_mc_segmap_task_131196_err != 0) {
        err = 1;
        goto cleanup;
    }
    
    int64_t min_res_114809 = smin64(n_114534, t_window_114537);
    bool bounds_invalid_upwards_114810 = slt64(t_n_m_114591, (int64_t) 0);
    bool valid_114811 = !bounds_invalid_upwards_114810;
    bool range_valid_c_114812;
    
    if (!valid_114811) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Range ", (int64_t) 0, "..", (int64_t) 1, "..<",
                               t_n_m_114591, " is invalid.",
                               "-> #0  /prelude/array.fut:90:3-10\n   #1  /prelude/array.fut:195:11-16\n   #2  loess.fut:335:3-373:7\n   #3  loess.fut:400:15-58\n   #4  stl.fut:173:13-65\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:171:5-174:26\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool empty_slice_114814 = min_res_114809 == (int64_t) 0;
    int64_t m_114815 = sub64(min_res_114809, (int64_t) 1);
    float i64_res_114816 = sitofp_i64_f32(t_window_114537);
    int64_t binop_x_122202 = m_114533 * t_n_m_114591;
    int64_t binop_y_122203 = (int64_t) 8 * binop_x_122202;
    int64_t bytes_122201 = smax64((int64_t) 0, binop_y_122203);
    
    if (mem_122204_cached_sizze_131111 < (size_t) bytes_122201) {
        mem_122204 = realloc(mem_122204, bytes_122201);
        mem_122204_cached_sizze_131111 = bytes_122201;
    }
    
    int64_t binop_y_122207 = (int64_t) 4 * binop_x_122202;
    int64_t bytes_122205 = smax64((int64_t) 0, binop_y_122207);
    
    if (mem_122208_cached_sizze_131112 < (size_t) bytes_122205) {
        mem_122208 = realloc(mem_122208, bytes_122205);
        mem_122208_cached_sizze_131112 = bytes_122205;
    }
    
    int64_t binop_y_122136 = (int64_t) 4 * t_n_m_114591;
    int64_t bytes_122135 = smax64((int64_t) 0, binop_y_122136);
    int64_t binop_y_122139 = (int64_t) 8 * t_n_m_114591;
    int64_t bytes_122138 = smax64((int64_t) 0, binop_y_122139);
    int64_t flat_tid_117192 = (int64_t) 0;
    int32_t num_tasks_124530;
    int64_t flat_tid_117194 = (int64_t) 0;
    struct futhark_mc_task_131226 futhark_mc_task_131226;
    
    futhark_mc_task_131226.ctx = ctx;
    futhark_mc_task_131226.free_m_114533 = m_114533;
    futhark_mc_task_131226.free_n_114534 = n_114534;
    futhark_mc_task_131226.free_t_jump_114541 = t_jump_114541;
    futhark_mc_task_131226.free_t_n_m_114591 = t_n_m_114591;
    futhark_mc_task_131226.free_i_114610 = i_114610;
    futhark_mc_task_131226.free_x_114611 = x_114611;
    futhark_mc_task_131226.free_min_res_114809 = min_res_114809;
    futhark_mc_task_131226.free_empty_slice_114814 = empty_slice_114814;
    futhark_mc_task_131226.free_m_114815 = m_114815;
    futhark_mc_task_131226.free_i64_res_114816 = i64_res_114816;
    futhark_mc_task_131226.free_bytes_121940 = bytes_121940;
    futhark_mc_task_131226.free_mem_121979 = mem_121979;
    futhark_mc_task_131226.free_mem_121982 = mem_121982;
    futhark_mc_task_131226.free_bytes_122135 = bytes_122135;
    futhark_mc_task_131226.free_bytes_122138 = bytes_122138;
    futhark_mc_task_131226.free_mem_122204 = mem_122204;
    futhark_mc_task_131226.free_mem_122208 = mem_122208;
    
    struct scheduler_segop futhark_mc_task_131226_task;
    
    futhark_mc_task_131226_task.args = &futhark_mc_task_131226;
    futhark_mc_task_131226_task.top_level_fn = futhark_mc_segmap_task_131227;
    futhark_mc_task_131226_task.name = "futhark_mc_segmap_task_131227";
    futhark_mc_task_131226_task.iterations = m_114533;
    futhark_mc_task_131226_task.task_time =
        &ctx->futhark_mc_segmap_task_131227_total_time;
    futhark_mc_task_131226_task.task_iter =
        &ctx->futhark_mc_segmap_task_131227_total_iter;
    futhark_mc_task_131226_task.sched = DYNAMIC;
    futhark_mc_task_131226_task.nested_fn =
        futhark_mc_segmap_nested_task_131234;
    
    int futhark_mc_segmap_task_131227_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_131226_task);
    
    if (futhark_mc_segmap_task_131227_err != 0) {
        err = 1;
        goto cleanup;
    }
    
    bool bounds_invalid_upwards_114936 = slt64(binop_x_121977, (int64_t) 0);
    bool valid_114937 = !bounds_invalid_upwards_114936;
    bool range_valid_c_114938;
    
    if (!valid_114937) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Range ", (int64_t) 0, "..", (int64_t) 1, "..<",
                               binop_x_121977, " is invalid.",
                               "-> #0  /prelude/array.fut:90:3-10\n   #1  /prelude/array.fut:108:18-23\n   #2  stl.fut:177:20-46\n   #3  stl.fut:394:3-405:33\n   #4  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    struct memblock mem_122212;
    
    mem_122212.references = NULL;
    if (memblock_alloc(ctx, &mem_122212, bytes_122001, "mem_122212")) {
        err = 1;
        goto cleanup;
    }
    for (int64_t i_125002 = 0; i_125002 < m_114533; i_125002++) {
        for (int64_t i_125003 = 0; i_125003 < n_114534; i_125003++) {
            ((float *) mem_122212.mem)[i_125002 * n_114534 + i_125003] = 0.0F;
        }
    }
    
    struct memblock mem_122216;
    
    mem_122216.references = NULL;
    if (memblock_alloc(ctx, &mem_122216, bytes_122001, "mem_122216")) {
        err = 1;
        goto cleanup;
    }
    for (int64_t i_125004 = 0; i_125004 < m_114533; i_125004++) {
        for (int64_t i_125005 = 0; i_125005 < n_114534; i_125005++) {
            ((float *) mem_122216.mem)[i_125004 * n_114534 + i_125005] = 1.0F;
        }
    }
    
    bool cond_114941 = slt64((int64_t) 1, l_jump_114542);
    bool cond_114942 = slt64((int64_t) 1, t_jump_114541);
    int64_t y_114943 = sub64(outer_114544, (int64_t) 1);
    bool loop_nonempty_114944 = slt64((int64_t) 0, outer_114544);
    bool bounds_invalid_upwards_114945 = slt64(C_len_114582, (int64_t) 0);
    bool valid_114946 = !bounds_invalid_upwards_114945;
    bool loop_not_taken_114947 = !assert_cond_114571;
    bool protect_assert_disj_114948 = valid_114946 || loop_not_taken_114947;
    bool loop_not_taken_114949 = !loop_nonempty_114944;
    bool protect_assert_disj_114950 = protect_assert_disj_114948 ||
         loop_not_taken_114949;
    bool range_valid_c_114951;
    
    if (!protect_assert_disj_114950) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Range ", (int64_t) 0, "..", (int64_t) 1, "..<",
                               C_len_114582, " is invalid.",
                               "-> #0  /prelude/array.fut:90:3-10\n   #1  /prelude/array.fut:195:11-16\n   #2  stl.fut:217:21-60\n   #3  stl.fut:215:13-218:24\n   #4  stl.fut:394:3-405:33\n   #5  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool zzero_114953 = n_p_114536 == (int64_t) 0;
    bool nonzzero_114954 = !zzero_114953;
    bool protect_assert_disj_114955 = loop_not_taken_114947 || nonzzero_114954;
    bool protect_assert_disj_114956 = loop_not_taken_114949 ||
         protect_assert_disj_114955;
    bool nonzzero_cert_114957;
    
    if (!protect_assert_disj_114956) {
        ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                               "division by zero",
                               "-> #0  stl.fut:217:52-58\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:217:21-60\n   #4  stl.fut:215:13-218:24\n   #5  stl.fut:394:3-405:33\n   #6  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    int64_t x_114958 = add64(n_114534, n_p_114536);
    int64_t lifted_single_ma_arg_114959 = add64((int64_t) 1, x_114958);
    int64_t m_114960 = sub64(n_p_114536, (int64_t) 1);
    bool zzero_leq_i_p_m_t_s_114961 = sle64((int64_t) 0, m_114960);
    bool i_p_m_t_s_leq_w_114962 = slt64(m_114960, C_len_114582);
    bool i_lte_j_114963 = sle64((int64_t) 0, n_p_114536);
    bool y_114964 = zzero_leq_i_p_m_t_s_114961 && i_p_m_t_s_leq_w_114962;
    bool y_114965 = i_lte_j_114963 && y_114964;
    bool ok_or_empty_114966 = zzero_114953 || y_114965;
    bool protect_assert_disj_114967 = loop_not_taken_114947 ||
         ok_or_empty_114966;
    bool protect_assert_disj_114968 = loop_not_taken_114949 ||
         protect_assert_disj_114967;
    bool index_certs_114969;
    
    if (!protect_assert_disj_114968) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [:", n_p_114536,
                               "] out of bounds for array of shape [",
                               C_len_114582, "].",
                               "-> #0  stl.fut:30:24-30\n   #1  stl.fut:43:3-32\n   #2  stl.fut:223:30-50\n   #3  stl.fut:222:23-224:31\n   #4  stl.fut:394:3-405:33\n   #5  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool bounds_invalid_upwards_114970 = slt64(lifted_single_ma_arg_114959,
                                               (int64_t) 0);
    bool valid_114971 = !bounds_invalid_upwards_114970;
    bool protect_assert_disj_114972 = loop_not_taken_114947 || valid_114971;
    bool protect_assert_disj_114973 = loop_not_taken_114949 ||
         protect_assert_disj_114972;
    bool range_valid_c_114974;
    
    if (!protect_assert_disj_114973) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Range ", (int64_t) 0, "..", (int64_t) 1, "..<",
                               lifted_single_ma_arg_114959, " is invalid.",
                               "-> #0  /prelude/array.fut:90:3-10\n   #1  /prelude/array.fut:195:11-16\n   #2  stl.fut:33:9-39:16\n   #3  stl.fut:43:3-32\n   #4  stl.fut:223:30-50\n   #5  stl.fut:222:23-224:31\n   #6  stl.fut:394:3-405:33\n   #7  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    int64_t lifted_single_ma_arg_114976 = add64((int64_t) 2, n_114534);
    bool i_p_m_t_s_leq_w_114977 = slt64(m_114960, lifted_single_ma_arg_114959);
    bool y_114978 = zzero_leq_i_p_m_t_s_114961 && i_p_m_t_s_leq_w_114977;
    bool y_114979 = i_lte_j_114963 && y_114978;
    bool ok_or_empty_114980 = zzero_114953 || y_114979;
    bool protect_assert_disj_114981 = loop_not_taken_114947 ||
         ok_or_empty_114980;
    bool protect_assert_disj_114982 = loop_not_taken_114949 ||
         protect_assert_disj_114981;
    bool index_certs_114983;
    
    if (!protect_assert_disj_114982) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [:", n_p_114536,
                               "] out of bounds for array of shape [",
                               lifted_single_ma_arg_114959, "].",
                               "-> #0  stl.fut:30:24-30\n   #1  /prelude/functional.fut:9:42-44\n   #2  stl.fut:43:3-58\n   #3  stl.fut:223:30-50\n   #4  stl.fut:222:23-224:31\n   #5  stl.fut:394:3-405:33\n   #6  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool bounds_invalid_upwards_114984 = slt64(lifted_single_ma_arg_114976,
                                               (int64_t) 0);
    bool valid_114985 = !bounds_invalid_upwards_114984;
    bool protect_assert_disj_114986 = loop_not_taken_114947 || valid_114985;
    bool protect_assert_disj_114987 = loop_not_taken_114949 ||
         protect_assert_disj_114986;
    bool range_valid_c_114988;
    
    if (!protect_assert_disj_114987) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Range ", (int64_t) 0, "..", (int64_t) 1, "..<",
                               lifted_single_ma_arg_114976, " is invalid.",
                               "-> #0  /prelude/array.fut:90:3-10\n   #1  /prelude/array.fut:195:11-16\n   #2  stl.fut:33:9-39:16\n   #3  /prelude/functional.fut:9:42-44\n   #4  stl.fut:43:3-58\n   #5  stl.fut:223:30-50\n   #6  stl.fut:222:23-224:31\n   #7  stl.fut:394:3-405:33\n   #8  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool i_p_m_t_s_leq_w_114990 = slt64((int64_t) 2,
                                        lifted_single_ma_arg_114976);
    bool protect_assert_disj_114991 = loop_not_taken_114947 ||
         i_p_m_t_s_leq_w_114990;
    bool protect_assert_disj_114992 = loop_not_taken_114949 ||
         protect_assert_disj_114991;
    bool index_certs_114993;
    
    if (!protect_assert_disj_114992) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [:", (int64_t) 3,
                               "] out of bounds for array of shape [",
                               lifted_single_ma_arg_114976, "].",
                               "-> #0  stl.fut:30:24-30\n   #1  /prelude/functional.fut:9:42-44\n   #2  stl.fut:43:3-76\n   #3  stl.fut:223:30-50\n   #4  stl.fut:222:23-224:31\n   #5  stl.fut:394:3-405:33\n   #6  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    bool empty_slice_114994 = n_114534 == (int64_t) 0;
    int64_t i_p_m_t_s_114995 = add64(n_p_114536, i_114610);
    bool zzero_leq_i_p_m_t_s_114996 = sle64((int64_t) 0, i_p_m_t_s_114995);
    bool i_p_m_t_s_leq_w_114997 = slt64(i_p_m_t_s_114995, C_len_114582);
    bool i_lte_j_114998 = sle64(n_p_114536, x_114958);
    bool y_114999 = i_lte_j_114963 && i_p_m_t_s_leq_w_114997;
    bool y_115000 = zzero_leq_i_p_m_t_s_114996 && y_114999;
    bool y_115001 = i_lte_j_114998 && y_115000;
    bool forwards_ok_115002 = i_lte_j_114963 && y_115001;
    bool ok_or_empty_115003 = empty_slice_114994 || forwards_ok_115002;
    bool protect_assert_disj_115004 = loop_not_taken_114947 ||
         ok_or_empty_115003;
    bool protect_assert_disj_115005 = loop_not_taken_114949 ||
         protect_assert_disj_115004;
    bool index_certs_115006;
    
    if (!protect_assert_disj_115005) {
        ctx->error = msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                               "Index [", n_p_114536, ":", x_114958,
                               "] out of bounds for array of shape [",
                               C_len_114582, "].",
                               "-> #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:394:3-405:33\n   #5  stl.fut:381:1-405:33\n");
        if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
            return 1;
        if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
            return 1;
        return 1;
    }
    
    int64_t j_m_i_115007 = sub64(stl_res_114605, stl_res_114604);
    bool cond_115008 = slt64(l_jump_114542, jump_threshold_114545);
    bool cond_f_res_115009 = slt64(max_group_sizze_114546, l_window_114538);
    bool x_115010 = !cond_115008;
    bool y_115011 = cond_f_res_115009 && x_115010;
    bool cond_115012 = cond_115008 || y_115011;
    bool cond_115013 = slt64(t_jump_114541, jump_threshold_114545);
    bool cond_f_res_115014 = slt64(max_group_sizze_114546, t_window_114537);
    bool x_115015 = !cond_115013;
    bool y_115016 = cond_f_res_115014 && x_115015;
    bool cond_115017 = cond_115013 || y_115016;
    
    if (mem_122284_cached_sizze_131113 < (size_t) bytes_122001) {
        mem_122284 = realloc(mem_122284, bytes_122001);
        mem_122284_cached_sizze_131113 = bytes_122001;
    }
    if (mem_122306_cached_sizze_131114 < (size_t) bytes_122045) {
        mem_122306 = realloc(mem_122306, bytes_122045);
        mem_122306_cached_sizze_131114 = bytes_122045;
    }
    
    int64_t binop_x_122326 = m_114533 * C_len_114582;
    int64_t binop_y_122327 = (int64_t) 4 * binop_x_122326;
    int64_t bytes_122325 = smax64((int64_t) 0, binop_y_122327);
    
    if (mem_122328_cached_sizze_131115 < (size_t) bytes_122325) {
        mem_122328 = realloc(mem_122328, bytes_122325);
        mem_122328_cached_sizze_131115 = bytes_122325;
    }
    
    int64_t binop_y_122308 = (int64_t) 4 * C_len_114582;
    int64_t bytes_122307 = smax64((int64_t) 0, binop_y_122308);
    
    if (mem_122386_cached_sizze_131116 < (size_t) bytes_122001) {
        mem_122386 = realloc(mem_122386, bytes_122001);
        mem_122386_cached_sizze_131116 = bytes_122001;
    }
    
    int64_t binop_y_122330 = (int64_t) 4 * lifted_single_ma_arg_114959;
    int64_t bytes_122329 = smax64((int64_t) 0, binop_y_122330);
    int64_t binop_y_122333 = (int64_t) 4 * lifted_single_ma_arg_114976;
    int64_t bytes_122332 = smax64((int64_t) 0, binop_y_122333);
    
    if (mem_122426_cached_sizze_131117 < (size_t) bytes_122001) {
        mem_122426 = realloc(mem_122426, bytes_122001);
        mem_122426_cached_sizze_131117 = bytes_122001;
    }
    if (mem_122430_cached_sizze_131118 < (size_t) bytes_122001) {
        mem_122430 = realloc(mem_122430, bytes_122001);
        mem_122430_cached_sizze_131118 = bytes_122001;
    }
    
    int64_t L_l_ixfn_122922;
    
    if (cond_114941) {
        L_l_ixfn_122922 = n_114534;
    } else {
        L_l_ixfn_122922 = l_n_m_114584;
    }
    if (mem_122985_cached_sizze_131119 < (size_t) bytes_122001) {
        mem_122985 = realloc(mem_122985, bytes_122001);
        mem_122985_cached_sizze_131119 = bytes_122001;
    }
    
    int64_t trend_l_ixfn_123477;
    
    if (cond_114942) {
        trend_l_ixfn_123477 = n_114534;
    } else {
        trend_l_ixfn_123477 = t_n_m_114591;
    }
    
    int64_t sizze_115018;
    int64_t stl_res_ixfn_123743;
    int64_t stl_res_ixfn_123745;
    int64_t stl_res_ixfn_123750;
    int64_t stl_res_ixfn_123751;
    int64_t stl_res_ixfn_123752;
    int64_t stl_res_ixfn_123753;
    int64_t stl_res_ixfn_123755;
    int64_t stl_res_ixfn_123756;
    struct memblock stl_res_mem_123741;
    
    stl_res_mem_123741.references = NULL;
    
    struct memblock stl_res_mem_123749;
    
    stl_res_mem_123749.references = NULL;
    
    struct memblock stl_res_mem_123757;
    
    stl_res_mem_123757.references = NULL;
    
    int64_t loopz2081Uz2085Uz2089U_115023;
    struct memblock mem_param_122224;
    
    mem_param_122224.references = NULL;
    
    int64_t ctx_param_ext_122226;
    int64_t ctx_param_ext_122228;
    struct memblock mem_param_122232;
    
    mem_param_122232.references = NULL;
    
    int64_t ctx_param_ext_122233;
    int64_t ctx_param_ext_122234;
    int64_t ctx_param_ext_122235;
    int64_t ctx_param_ext_122236;
    int64_t ctx_param_ext_122238;
    int64_t ctx_param_ext_122239;
    struct memblock mem_param_122240;
    
    mem_param_122240.references = NULL;
    loopz2081Uz2085Uz2089U_115023 = n_114534;
    ctx_param_ext_122226 = n_114534;
    ctx_param_ext_122228 = n_114534;
    ctx_param_ext_122233 = m_114533;
    ctx_param_ext_122234 = n_114534;
    ctx_param_ext_122235 = (int64_t) 0;
    ctx_param_ext_122236 = n_114534;
    ctx_param_ext_122238 = (int64_t) 1;
    ctx_param_ext_122239 = n_114534;
    if (memblock_set(ctx, &mem_param_122224, &mem_122212, "mem_122212") != 0)
        return 1;
    if (memblock_set(ctx, &mem_param_122232, &mem_122212, "mem_122212") != 0)
        return 1;
    if (memblock_set(ctx, &mem_param_122240, &mem_122216, "mem_122216") != 0)
        return 1;
    for (int64_t i_outer_115022 = 0; i_outer_115022 < outer_114544;
         i_outer_115022++) {
        int64_t loopres_ixfn_123492;
        int64_t loopres_ixfn_123494;
        struct memblock loopres_mem_123490;
        
        loopres_mem_123490.references = NULL;
        
        struct memblock loopres_mem_123498;
        
        loopres_mem_123498.references = NULL;
        
        struct memblock mem_param_122254;
        
        mem_param_122254.references = NULL;
        
        int64_t ctx_param_ext_122256;
        int64_t ctx_param_ext_122258;
        struct memblock mem_param_122262;
        
        mem_param_122262.references = NULL;
        ctx_param_ext_122256 = ctx_param_ext_122226;
        ctx_param_ext_122258 = ctx_param_ext_122228;
        if (memblock_set(ctx, &mem_param_122254, &mem_param_122224,
                         "mem_param_122224") != 0)
            return 1;
        if (memblock_set(ctx, &mem_param_122262, &mem_param_122232,
                         "mem_param_122232") != 0)
            return 1;
        for (int64_t _i_inner_115029 = 0; _i_inner_115029 < inner_114543;
             _i_inner_115029++) {
            int64_t flat_tid_117516 = (int64_t) 0;
            int32_t num_tasks_125027;
            int64_t flat_tid_117518 = (int64_t) 0;
            struct futhark_mc_task_131257 futhark_mc_task_131257;
            
            futhark_mc_task_131257.ctx = ctx;
            futhark_mc_task_131257.free_m_114533 = m_114533;
            futhark_mc_task_131257.free_n_114534 = n_114534;
            futhark_mc_task_131257.free_Y_mem_121939 = Y_mem_121939.mem;
            futhark_mc_task_131257.free_bytes_121983 = bytes_121983;
            futhark_mc_task_131257.free_ctx_param_ext_122258 =
                ctx_param_ext_122258;
            futhark_mc_task_131257.free_mem_param_122262 = mem_param_122262.mem;
            futhark_mc_task_131257.free_mem_122284 = mem_122284;
            
            struct scheduler_segop futhark_mc_task_131257_task;
            
            futhark_mc_task_131257_task.args = &futhark_mc_task_131257;
            futhark_mc_task_131257_task.top_level_fn =
                futhark_mc_segmap_task_131258;
            futhark_mc_task_131257_task.name = "futhark_mc_segmap_task_131258";
            futhark_mc_task_131257_task.iterations = m_114533;
            futhark_mc_task_131257_task.task_time =
                &ctx->futhark_mc_segmap_task_131258_total_time;
            futhark_mc_task_131257_task.task_iter =
                &ctx->futhark_mc_segmap_task_131258_total_iter;
            futhark_mc_task_131257_task.sched = STATIC;
            futhark_mc_task_131257_task.nested_fn =
                futhark_mc_segmap_nested_task_131262;
            
            int futhark_mc_segmap_task_131258_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131257_task);
            
            if (futhark_mc_segmap_task_131258_err != 0) {
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_117528 = (int64_t) 0;
            int32_t num_tasks_125048;
            int64_t flat_tid_117530 = (int64_t) 0;
            struct futhark_mc_task_131270 futhark_mc_task_131270;
            
            futhark_mc_task_131270.ctx = ctx;
            futhark_mc_task_131270.free_m_114533 = m_114533;
            futhark_mc_task_131270.free_n_114534 = n_114534;
            futhark_mc_task_131270.free_n_p_114536 = n_p_114536;
            futhark_mc_task_131270.free_css_chunk_len_114580 =
                css_chunk_len_114580;
            futhark_mc_task_131270.free_mem_122026 = mem_122026;
            futhark_mc_task_131270.free_bytes_122027 = bytes_122027;
            futhark_mc_task_131270.free_mem_122048 = mem_122048;
            futhark_mc_task_131270.free_mem_122284 = mem_122284;
            futhark_mc_task_131270.free_mem_122306 = mem_122306;
            
            struct scheduler_segop futhark_mc_task_131270_task;
            
            futhark_mc_task_131270_task.args = &futhark_mc_task_131270;
            futhark_mc_task_131270_task.top_level_fn =
                futhark_mc_segmap_task_131271;
            futhark_mc_task_131270_task.name = "futhark_mc_segmap_task_131271";
            futhark_mc_task_131270_task.iterations = m_114533;
            futhark_mc_task_131270_task.task_time =
                &ctx->futhark_mc_segmap_task_131271_total_time;
            futhark_mc_task_131270_task.task_iter =
                &ctx->futhark_mc_segmap_task_131271_total_iter;
            futhark_mc_task_131270_task.sched = STATIC;
            futhark_mc_task_131270_task.nested_fn =
                futhark_mc_segmap_nested_task_131275;
            
            int futhark_mc_segmap_task_131271_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131270_task);
            
            if (futhark_mc_segmap_task_131271_err != 0) {
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_117589 = (int64_t) 0;
            int32_t num_tasks_125146;
            int64_t flat_tid_117591 = (int64_t) 0;
            struct futhark_mc_task_131291 futhark_mc_task_131291;
            
            futhark_mc_task_131291.ctx = ctx;
            futhark_mc_task_131291.free_m_114533 = m_114533;
            futhark_mc_task_131291.free_n_p_114536 = n_p_114536;
            futhark_mc_task_131291.free_C_len_114582 = C_len_114582;
            futhark_mc_task_131291.free_mem_122306 = mem_122306;
            futhark_mc_task_131291.free_bytes_122307 = bytes_122307;
            futhark_mc_task_131291.free_mem_122328 = mem_122328;
            
            struct scheduler_segop futhark_mc_task_131291_task;
            
            futhark_mc_task_131291_task.args = &futhark_mc_task_131291;
            futhark_mc_task_131291_task.top_level_fn =
                futhark_mc_segmap_task_131292;
            futhark_mc_task_131291_task.name = "futhark_mc_segmap_task_131292";
            futhark_mc_task_131291_task.iterations = m_114533;
            futhark_mc_task_131291_task.task_time =
                &ctx->futhark_mc_segmap_task_131292_total_time;
            futhark_mc_task_131291_task.task_iter =
                &ctx->futhark_mc_segmap_task_131292_total_iter;
            futhark_mc_task_131291_task.sched = STATIC;
            futhark_mc_task_131291_task.nested_fn =
                futhark_mc_segmap_nested_task_131296;
            
            int futhark_mc_segmap_task_131292_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131291_task);
            
            if (futhark_mc_segmap_task_131292_err != 0) {
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_117604 = (int64_t) 0;
            int32_t num_tasks_125173;
            int64_t flat_tid_117606 = (int64_t) 0;
            struct futhark_mc_task_131304 futhark_mc_task_131304;
            
            futhark_mc_task_131304.ctx = ctx;
            futhark_mc_task_131304.free_m_114533 = m_114533;
            futhark_mc_task_131304.free_n_114534 = n_114534;
            futhark_mc_task_131304.free_n_p_114536 = n_p_114536;
            futhark_mc_task_131304.free_i64_res_114576 = i64_res_114576;
            futhark_mc_task_131304.free_C_len_114582 = C_len_114582;
            futhark_mc_task_131304.free_lifted_single_ma_arg_114959 =
                lifted_single_ma_arg_114959;
            futhark_mc_task_131304.free_lifted_single_ma_arg_114976 =
                lifted_single_ma_arg_114976;
            futhark_mc_task_131304.free_bytes_121983 = bytes_121983;
            futhark_mc_task_131304.free_mem_122328 = mem_122328;
            futhark_mc_task_131304.free_bytes_122329 = bytes_122329;
            futhark_mc_task_131304.free_bytes_122332 = bytes_122332;
            futhark_mc_task_131304.free_mem_122386 = mem_122386;
            
            struct scheduler_segop futhark_mc_task_131304_task;
            
            futhark_mc_task_131304_task.args = &futhark_mc_task_131304;
            futhark_mc_task_131304_task.top_level_fn =
                futhark_mc_segmap_task_131305;
            futhark_mc_task_131304_task.name = "futhark_mc_segmap_task_131305";
            futhark_mc_task_131304_task.iterations = m_114533;
            futhark_mc_task_131304_task.task_time =
                &ctx->futhark_mc_segmap_task_131305_total_time;
            futhark_mc_task_131304_task.task_iter =
                &ctx->futhark_mc_segmap_task_131305_total_iter;
            futhark_mc_task_131304_task.sched = STATIC;
            futhark_mc_task_131304_task.nested_fn =
                futhark_mc_segmap_nested_task_131311;
            
            int futhark_mc_segmap_task_131305_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131304_task);
            
            if (futhark_mc_segmap_task_131305_err != 0) {
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_117708 = (int64_t) 0;
            int32_t num_tasks_125415;
            int64_t flat_tid_117710 = (int64_t) 0;
            struct futhark_mc_task_131353 futhark_mc_task_131353;
            
            futhark_mc_task_131353.ctx = ctx;
            futhark_mc_task_131353.free_m_114533 = m_114533;
            futhark_mc_task_131353.free_n_114534 = n_114534;
            futhark_mc_task_131353.free_loopz2081Uz2085Uz2089U_115023 =
                loopz2081Uz2085Uz2089U_115023;
            futhark_mc_task_131353.free_mem_121979 = mem_121979;
            futhark_mc_task_131353.free_bytes_121983 = bytes_121983;
            futhark_mc_task_131353.free_ctx_param_ext_122235 =
                ctx_param_ext_122235;
            futhark_mc_task_131353.free_ctx_param_ext_122236 =
                ctx_param_ext_122236;
            futhark_mc_task_131353.free_ctx_param_ext_122238 =
                ctx_param_ext_122238;
            futhark_mc_task_131353.free_mem_param_122240 = mem_param_122240.mem;
            futhark_mc_task_131353.free_mem_122386 = mem_122386;
            futhark_mc_task_131353.free_mem_122426 = mem_122426;
            futhark_mc_task_131353.free_mem_122430 = mem_122430;
            
            struct scheduler_segop futhark_mc_task_131353_task;
            
            futhark_mc_task_131353_task.args = &futhark_mc_task_131353;
            futhark_mc_task_131353_task.top_level_fn =
                futhark_mc_segmap_task_131354;
            futhark_mc_task_131353_task.name = "futhark_mc_segmap_task_131354";
            futhark_mc_task_131353_task.iterations = m_114533;
            futhark_mc_task_131353_task.task_time =
                &ctx->futhark_mc_segmap_task_131354_total_time;
            futhark_mc_task_131353_task.task_iter =
                &ctx->futhark_mc_segmap_task_131354_total_iter;
            futhark_mc_task_131353_task.sched = STATIC;
            futhark_mc_task_131353_task.nested_fn =
                futhark_mc_segmap_nested_task_131359;
            
            int futhark_mc_segmap_task_131354_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131353_task);
            
            if (futhark_mc_segmap_task_131354_err != 0) {
                err = 1;
                goto cleanup;
            }
            
            struct memblock defunc_11_loess_l_res_mem_122898;
            
            defunc_11_loess_l_res_mem_122898.references = NULL;
            
            struct memblock defunc_11_loess_l_res_mem_122899;
            
            defunc_11_loess_l_res_mem_122899.references = NULL;
            if (cond_115012) {
                bool match_lit_115186 = (int64_t) 0 == l_degree_114540;
                struct memblock defunc_12_lifted_use_version_res_mem_122547;
                
                defunc_12_lifted_use_version_res_mem_122547.references = NULL;
                
                struct memblock defunc_12_lifted_use_version_res_mem_122548;
                
                defunc_12_lifted_use_version_res_mem_122548.references = NULL;
                if (match_lit_115186) {
                    struct memblock mem_122434;
                    
                    mem_122434.references = NULL;
                    if (memblock_alloc(ctx, &mem_122434, bytes_122125,
                                       "mem_122434")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_125465 = 0; i_125465 < m_114533;
                         i_125465++) {
                        for (int64_t i_125466 = 0; i_125466 < l_n_m_114584;
                             i_125466++) {
                            ((float *) mem_122434.mem)[i_125465 * l_n_m_114584 +
                                                       i_125466] = 0.0F;
                        }
                    }
                    
                    struct memblock mem_122456;
                    
                    mem_122456.references = NULL;
                    if (memblock_alloc(ctx, &mem_122456, bytes_122125,
                                       "mem_122456")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t flat_tid_117731 = (int64_t) 0;
                    int32_t num_tasks_125467;
                    int64_t flat_tid_117733 = (int64_t) 0;
                    struct futhark_mc_task_131368 futhark_mc_task_131368;
                    
                    futhark_mc_task_131368.ctx = ctx;
                    futhark_mc_task_131368.free_m_114533 = m_114533;
                    futhark_mc_task_131368.free_n_114534 = n_114534;
                    futhark_mc_task_131368.free_l_window_114538 =
                        l_window_114538;
                    futhark_mc_task_131368.free_t_jump_114541 = t_jump_114541;
                    futhark_mc_task_131368.free_l_n_m_114584 = l_n_m_114584;
                    futhark_mc_task_131368.free_i_114610 = i_114610;
                    futhark_mc_task_131368.free_mem_121982 = mem_121982;
                    futhark_mc_task_131368.free_mem_122004 = mem_122004;
                    futhark_mc_task_131368.free_bytes_122055 = bytes_122055;
                    futhark_mc_task_131368.free_mem_122124 = mem_122124;
                    futhark_mc_task_131368.free_mem_122128 = mem_122128;
                    futhark_mc_task_131368.free_mem_122426 = mem_122426;
                    futhark_mc_task_131368.free_mem_122430 = mem_122430;
                    futhark_mc_task_131368.free_mem_122456 = mem_122456.mem;
                    
                    struct scheduler_segop futhark_mc_task_131368_task;
                    
                    futhark_mc_task_131368_task.args = &futhark_mc_task_131368;
                    futhark_mc_task_131368_task.top_level_fn =
                        futhark_mc_segmap_task_131369;
                    futhark_mc_task_131368_task.name =
                        "futhark_mc_segmap_task_131369";
                    futhark_mc_task_131368_task.iterations = m_114533;
                    futhark_mc_task_131368_task.task_time =
                        &ctx->futhark_mc_segmap_task_131369_total_time;
                    futhark_mc_task_131368_task.task_iter =
                        &ctx->futhark_mc_segmap_task_131369_total_iter;
                    futhark_mc_task_131368_task.sched = STATIC;
                    futhark_mc_task_131368_task.nested_fn =
                        futhark_mc_segmap_nested_task_131373;
                    
                    int futhark_mc_segmap_task_131369_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_131368_task);
                    
                    if (futhark_mc_segmap_task_131369_err != 0) {
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_122547,
                                     &mem_122456, "mem_122456") != 0)
                        return 1;
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_122548,
                                     &mem_122434, "mem_122434") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122456, "mem_122456") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122434, "mem_122434") != 0)
                        return 1;
                } else {
                    bool match_lit_115257 = (int64_t) 1 == l_degree_114540;
                    struct memblock x_mem_122545;
                    
                    x_mem_122545.references = NULL;
                    
                    struct memblock x_mem_122546;
                    
                    x_mem_122546.references = NULL;
                    if (match_lit_115257) {
                        struct memblock mem_122496;
                        
                        mem_122496.references = NULL;
                        if (memblock_alloc(ctx, &mem_122496, bytes_122125,
                                           "mem_122496")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_122500;
                        
                        mem_122500.references = NULL;
                        if (memblock_alloc(ctx, &mem_122500, bytes_122125,
                                           "mem_122500")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_117918 = (int64_t) 0;
                        int32_t num_tasks_125756;
                        int64_t flat_tid_117920 = (int64_t) 0;
                        struct futhark_mc_task_131394 futhark_mc_task_131394;
                        
                        futhark_mc_task_131394.ctx = ctx;
                        futhark_mc_task_131394.free_m_114533 = m_114533;
                        futhark_mc_task_131394.free_n_114534 = n_114534;
                        futhark_mc_task_131394.free_l_window_114538 =
                            l_window_114538;
                        futhark_mc_task_131394.free_t_jump_114541 =
                            t_jump_114541;
                        futhark_mc_task_131394.free_l_n_m_114584 = l_n_m_114584;
                        futhark_mc_task_131394.free_i_114610 = i_114610;
                        futhark_mc_task_131394.free_mem_121982 = mem_121982;
                        futhark_mc_task_131394.free_mem_122004 = mem_122004;
                        futhark_mc_task_131394.free_bytes_122055 = bytes_122055;
                        futhark_mc_task_131394.free_mem_122124 = mem_122124;
                        futhark_mc_task_131394.free_mem_122128 = mem_122128;
                        futhark_mc_task_131394.free_mem_122426 = mem_122426;
                        futhark_mc_task_131394.free_mem_122430 = mem_122430;
                        futhark_mc_task_131394.free_mem_122496 = mem_122496.mem;
                        futhark_mc_task_131394.free_mem_122500 = mem_122500.mem;
                        
                        struct scheduler_segop futhark_mc_task_131394_task;
                        
                        futhark_mc_task_131394_task.args =
                            &futhark_mc_task_131394;
                        futhark_mc_task_131394_task.top_level_fn =
                            futhark_mc_segmap_task_131395;
                        futhark_mc_task_131394_task.name =
                            "futhark_mc_segmap_task_131395";
                        futhark_mc_task_131394_task.iterations = m_114533;
                        futhark_mc_task_131394_task.task_time =
                            &ctx->futhark_mc_segmap_task_131395_total_time;
                        futhark_mc_task_131394_task.task_iter =
                            &ctx->futhark_mc_segmap_task_131395_total_iter;
                        futhark_mc_task_131394_task.sched = STATIC;
                        futhark_mc_task_131394_task.nested_fn =
                            futhark_mc_segmap_nested_task_131400;
                        
                        int futhark_mc_segmap_task_131395_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_131394_task);
                        
                        if (futhark_mc_segmap_task_131395_err != 0) {
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &x_mem_122545, &mem_122496,
                                         "mem_122496") != 0)
                            return 1;
                        if (memblock_set(ctx, &x_mem_122546, &mem_122500,
                                         "mem_122500") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_122500, "mem_122500") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_122496, "mem_122496") != 0)
                            return 1;
                    } else {
                        struct memblock mem_122540;
                        
                        mem_122540.references = NULL;
                        if (memblock_alloc(ctx, &mem_122540, bytes_122125,
                                           "mem_122540")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_122544;
                        
                        mem_122544.references = NULL;
                        if (memblock_alloc(ctx, &mem_122544, bytes_122125,
                                           "mem_122544")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_118190 = (int64_t) 0;
                        int32_t num_tasks_126183;
                        int64_t flat_tid_118192 = (int64_t) 0;
                        struct futhark_mc_task_131425 futhark_mc_task_131425;
                        
                        futhark_mc_task_131425.ctx = ctx;
                        futhark_mc_task_131425.free_m_114533 = m_114533;
                        futhark_mc_task_131425.free_n_114534 = n_114534;
                        futhark_mc_task_131425.free_l_window_114538 =
                            l_window_114538;
                        futhark_mc_task_131425.free_t_jump_114541 =
                            t_jump_114541;
                        futhark_mc_task_131425.free_l_n_m_114584 = l_n_m_114584;
                        futhark_mc_task_131425.free_i_114610 = i_114610;
                        futhark_mc_task_131425.free_mem_121982 = mem_121982;
                        futhark_mc_task_131425.free_mem_122004 = mem_122004;
                        futhark_mc_task_131425.free_bytes_122055 = bytes_122055;
                        futhark_mc_task_131425.free_mem_122124 = mem_122124;
                        futhark_mc_task_131425.free_mem_122128 = mem_122128;
                        futhark_mc_task_131425.free_mem_122426 = mem_122426;
                        futhark_mc_task_131425.free_mem_122430 = mem_122430;
                        futhark_mc_task_131425.free_mem_122540 = mem_122540.mem;
                        futhark_mc_task_131425.free_mem_122544 = mem_122544.mem;
                        
                        struct scheduler_segop futhark_mc_task_131425_task;
                        
                        futhark_mc_task_131425_task.args =
                            &futhark_mc_task_131425;
                        futhark_mc_task_131425_task.top_level_fn =
                            futhark_mc_segmap_task_131426;
                        futhark_mc_task_131425_task.name =
                            "futhark_mc_segmap_task_131426";
                        futhark_mc_task_131425_task.iterations = m_114533;
                        futhark_mc_task_131425_task.task_time =
                            &ctx->futhark_mc_segmap_task_131426_total_time;
                        futhark_mc_task_131425_task.task_iter =
                            &ctx->futhark_mc_segmap_task_131426_total_iter;
                        futhark_mc_task_131425_task.sched = STATIC;
                        futhark_mc_task_131425_task.nested_fn =
                            futhark_mc_segmap_nested_task_131431;
                        
                        int futhark_mc_segmap_task_131426_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_131425_task);
                        
                        if (futhark_mc_segmap_task_131426_err != 0) {
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &x_mem_122545, &mem_122540,
                                         "mem_122540") != 0)
                            return 1;
                        if (memblock_set(ctx, &x_mem_122546, &mem_122544,
                                         "mem_122544") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_122544, "mem_122544") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_122540, "mem_122540") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_122547,
                                     &x_mem_122545, "x_mem_122545") != 0)
                        return 1;
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_122548,
                                     &x_mem_122546, "x_mem_122546") != 0)
                        return 1;
                    if (memblock_unref(ctx, &x_mem_122546, "x_mem_122546") != 0)
                        return 1;
                    if (memblock_unref(ctx, &x_mem_122545, "x_mem_122545") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &defunc_11_loess_l_res_mem_122898,
                                 &defunc_12_lifted_use_version_res_mem_122547,
                                 "defunc_12_lifted_use_version_res_mem_122547") !=
                    0)
                    return 1;
                if (memblock_set(ctx, &defunc_11_loess_l_res_mem_122899,
                                 &defunc_12_lifted_use_version_res_mem_122548,
                                 "defunc_12_lifted_use_version_res_mem_122548") !=
                    0)
                    return 1;
                if (memblock_unref(ctx,
                                   &defunc_12_lifted_use_version_res_mem_122548,
                                   "defunc_12_lifted_use_version_res_mem_122548") !=
                    0)
                    return 1;
                if (memblock_unref(ctx,
                                   &defunc_12_lifted_use_version_res_mem_122547,
                                   "defunc_12_lifted_use_version_res_mem_122547") !=
                    0)
                    return 1;
            } else {
                bool match_lit_115486 = (int64_t) 0 == l_degree_114540;
                struct memblock defunc_12_lifted_use_version_res_mem_122896;
                
                defunc_12_lifted_use_version_res_mem_122896.references = NULL;
                
                struct memblock defunc_12_lifted_use_version_res_mem_122897;
                
                defunc_12_lifted_use_version_res_mem_122897.references = NULL;
                if (match_lit_115486) {
                    struct memblock mem_122552;
                    
                    mem_122552.references = NULL;
                    if (memblock_alloc(ctx, &mem_122552, bytes_122125,
                                       "mem_122552")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_126742 = 0; i_126742 < m_114533;
                         i_126742++) {
                        for (int64_t i_126743 = 0; i_126743 < l_n_m_114584;
                             i_126743++) {
                            ((float *) mem_122552.mem)[i_126742 * l_n_m_114584 +
                                                       i_126743] = 0.0F;
                        }
                    }
                    
                    struct memblock mem_122607;
                    
                    mem_122607.references = NULL;
                    if (memblock_alloc(ctx, &mem_122607, bytes_122125,
                                       "mem_122607")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t binop_y_122554 = (int64_t) 4 * l_window_114538;
                    int64_t bytes_122553 = smax64((int64_t) 0, binop_y_122554);
                    int64_t flat_tid_118558 = (int64_t) 0;
                    int32_t num_tasks_126744;
                    int64_t flat_tid_118560 = (int64_t) 0;
                    struct futhark_mc_task_131458 futhark_mc_task_131458;
                    
                    futhark_mc_task_131458.ctx = ctx;
                    futhark_mc_task_131458.free_m_114533 = m_114533;
                    futhark_mc_task_131458.free_n_114534 = n_114534;
                    futhark_mc_task_131458.free_l_window_114538 =
                        l_window_114538;
                    futhark_mc_task_131458.free_t_jump_114541 = t_jump_114541;
                    futhark_mc_task_131458.free_l_n_m_114584 = l_n_m_114584;
                    futhark_mc_task_131458.free_i_114610 = i_114610;
                    futhark_mc_task_131458.free_mem_121982 = mem_121982;
                    futhark_mc_task_131458.free_mem_122004 = mem_122004;
                    futhark_mc_task_131458.free_bytes_122055 = bytes_122055;
                    futhark_mc_task_131458.free_mem_122124 = mem_122124;
                    futhark_mc_task_131458.free_mem_122128 = mem_122128;
                    futhark_mc_task_131458.free_mem_122426 = mem_122426;
                    futhark_mc_task_131458.free_mem_122430 = mem_122430;
                    futhark_mc_task_131458.free_bytes_122553 = bytes_122553;
                    futhark_mc_task_131458.free_mem_122607 = mem_122607.mem;
                    
                    struct scheduler_segop futhark_mc_task_131458_task;
                    
                    futhark_mc_task_131458_task.args = &futhark_mc_task_131458;
                    futhark_mc_task_131458_task.top_level_fn =
                        futhark_mc_segmap_task_131459;
                    futhark_mc_task_131458_task.name =
                        "futhark_mc_segmap_task_131459";
                    futhark_mc_task_131458_task.iterations = m_114533;
                    futhark_mc_task_131458_task.task_time =
                        &ctx->futhark_mc_segmap_task_131459_total_time;
                    futhark_mc_task_131458_task.task_iter =
                        &ctx->futhark_mc_segmap_task_131459_total_iter;
                    futhark_mc_task_131458_task.sched = STATIC;
                    futhark_mc_task_131458_task.nested_fn =
                        futhark_mc_segmap_nested_task_131464;
                    
                    int futhark_mc_segmap_task_131459_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_131458_task);
                    
                    if (futhark_mc_segmap_task_131459_err != 0) {
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_122896,
                                     &mem_122607, "mem_122607") != 0)
                        return 1;
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_122897,
                                     &mem_122552, "mem_122552") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122607, "mem_122607") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122552, "mem_122552") != 0)
                        return 1;
                } else {
                    bool match_lit_115543 = (int64_t) 1 == l_degree_114540;
                    struct memblock x_mem_122894;
                    
                    x_mem_122894.references = NULL;
                    
                    struct memblock x_mem_122895;
                    
                    x_mem_122895.references = NULL;
                    if (match_lit_115543) {
                        struct memblock mem_122713;
                        
                        mem_122713.references = NULL;
                        if (memblock_alloc(ctx, &mem_122713, bytes_122125,
                                           "mem_122713")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_122717;
                        
                        mem_122717.references = NULL;
                        if (memblock_alloc(ctx, &mem_122717, bytes_122125,
                                           "mem_122717")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_122609 = (int64_t) 4 * l_window_114538;
                        int64_t bytes_122608 = smax64((int64_t) 0,
                                                      binop_y_122609);
                        int64_t flat_tid_118703 = (int64_t) 0;
                        int32_t num_tasks_126973;
                        int64_t flat_tid_118705 = (int64_t) 0;
                        struct futhark_mc_task_131487 futhark_mc_task_131487;
                        
                        futhark_mc_task_131487.ctx = ctx;
                        futhark_mc_task_131487.free_m_114533 = m_114533;
                        futhark_mc_task_131487.free_n_114534 = n_114534;
                        futhark_mc_task_131487.free_l_window_114538 =
                            l_window_114538;
                        futhark_mc_task_131487.free_t_jump_114541 =
                            t_jump_114541;
                        futhark_mc_task_131487.free_l_n_m_114584 = l_n_m_114584;
                        futhark_mc_task_131487.free_i_114610 = i_114610;
                        futhark_mc_task_131487.free_mem_121982 = mem_121982;
                        futhark_mc_task_131487.free_mem_122004 = mem_122004;
                        futhark_mc_task_131487.free_bytes_122055 = bytes_122055;
                        futhark_mc_task_131487.free_mem_122124 = mem_122124;
                        futhark_mc_task_131487.free_mem_122128 = mem_122128;
                        futhark_mc_task_131487.free_mem_122426 = mem_122426;
                        futhark_mc_task_131487.free_mem_122430 = mem_122430;
                        futhark_mc_task_131487.free_bytes_122608 = bytes_122608;
                        futhark_mc_task_131487.free_mem_122713 = mem_122713.mem;
                        futhark_mc_task_131487.free_mem_122717 = mem_122717.mem;
                        
                        struct scheduler_segop futhark_mc_task_131487_task;
                        
                        futhark_mc_task_131487_task.args =
                            &futhark_mc_task_131487;
                        futhark_mc_task_131487_task.top_level_fn =
                            futhark_mc_segmap_task_131488;
                        futhark_mc_task_131487_task.name =
                            "futhark_mc_segmap_task_131488";
                        futhark_mc_task_131487_task.iterations = m_114533;
                        futhark_mc_task_131487_task.task_time =
                            &ctx->futhark_mc_segmap_task_131488_total_time;
                        futhark_mc_task_131487_task.task_iter =
                            &ctx->futhark_mc_segmap_task_131488_total_iter;
                        futhark_mc_task_131487_task.sched = STATIC;
                        futhark_mc_task_131487_task.nested_fn =
                            futhark_mc_segmap_nested_task_131495;
                        
                        int futhark_mc_segmap_task_131488_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_131487_task);
                        
                        if (futhark_mc_segmap_task_131488_err != 0) {
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &x_mem_122894, &mem_122713,
                                         "mem_122713") != 0)
                            return 1;
                        if (memblock_set(ctx, &x_mem_122895, &mem_122717,
                                         "mem_122717") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_122717, "mem_122717") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_122713, "mem_122713") != 0)
                            return 1;
                    } else {
                        struct memblock mem_122889;
                        
                        mem_122889.references = NULL;
                        if (memblock_alloc(ctx, &mem_122889, bytes_122125,
                                           "mem_122889")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_122893;
                        
                        mem_122893.references = NULL;
                        if (memblock_alloc(ctx, &mem_122893, bytes_122125,
                                           "mem_122893")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_122719 = (int64_t) 4 * l_window_114538;
                        int64_t bytes_122718 = smax64((int64_t) 0,
                                                      binop_y_122719);
                        int64_t flat_tid_118936 = (int64_t) 0;
                        int32_t num_tasks_127355;
                        int64_t flat_tid_118938 = (int64_t) 0;
                        struct futhark_mc_task_131524 futhark_mc_task_131524;
                        
                        futhark_mc_task_131524.ctx = ctx;
                        futhark_mc_task_131524.free_m_114533 = m_114533;
                        futhark_mc_task_131524.free_n_114534 = n_114534;
                        futhark_mc_task_131524.free_l_window_114538 =
                            l_window_114538;
                        futhark_mc_task_131524.free_t_jump_114541 =
                            t_jump_114541;
                        futhark_mc_task_131524.free_l_n_m_114584 = l_n_m_114584;
                        futhark_mc_task_131524.free_i_114610 = i_114610;
                        futhark_mc_task_131524.free_mem_121982 = mem_121982;
                        futhark_mc_task_131524.free_mem_122004 = mem_122004;
                        futhark_mc_task_131524.free_bytes_122055 = bytes_122055;
                        futhark_mc_task_131524.free_mem_122124 = mem_122124;
                        futhark_mc_task_131524.free_mem_122128 = mem_122128;
                        futhark_mc_task_131524.free_mem_122426 = mem_122426;
                        futhark_mc_task_131524.free_mem_122430 = mem_122430;
                        futhark_mc_task_131524.free_bytes_122718 = bytes_122718;
                        futhark_mc_task_131524.free_mem_122889 = mem_122889.mem;
                        futhark_mc_task_131524.free_mem_122893 = mem_122893.mem;
                        
                        struct scheduler_segop futhark_mc_task_131524_task;
                        
                        futhark_mc_task_131524_task.args =
                            &futhark_mc_task_131524;
                        futhark_mc_task_131524_task.top_level_fn =
                            futhark_mc_segmap_task_131525;
                        futhark_mc_task_131524_task.name =
                            "futhark_mc_segmap_task_131525";
                        futhark_mc_task_131524_task.iterations = m_114533;
                        futhark_mc_task_131524_task.task_time =
                            &ctx->futhark_mc_segmap_task_131525_total_time;
                        futhark_mc_task_131524_task.task_iter =
                            &ctx->futhark_mc_segmap_task_131525_total_iter;
                        futhark_mc_task_131524_task.sched = STATIC;
                        futhark_mc_task_131524_task.nested_fn =
                            futhark_mc_segmap_nested_task_131534;
                        
                        int futhark_mc_segmap_task_131525_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_131524_task);
                        
                        if (futhark_mc_segmap_task_131525_err != 0) {
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &x_mem_122894, &mem_122889,
                                         "mem_122889") != 0)
                            return 1;
                        if (memblock_set(ctx, &x_mem_122895, &mem_122893,
                                         "mem_122893") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_122893, "mem_122893") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_122889, "mem_122889") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_122896,
                                     &x_mem_122894, "x_mem_122894") != 0)
                        return 1;
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_122897,
                                     &x_mem_122895, "x_mem_122895") != 0)
                        return 1;
                    if (memblock_unref(ctx, &x_mem_122895, "x_mem_122895") != 0)
                        return 1;
                    if (memblock_unref(ctx, &x_mem_122894, "x_mem_122894") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &defunc_11_loess_l_res_mem_122898,
                                 &defunc_12_lifted_use_version_res_mem_122896,
                                 "defunc_12_lifted_use_version_res_mem_122896") !=
                    0)
                    return 1;
                if (memblock_set(ctx, &defunc_11_loess_l_res_mem_122899,
                                 &defunc_12_lifted_use_version_res_mem_122897,
                                 "defunc_12_lifted_use_version_res_mem_122897") !=
                    0)
                    return 1;
                if (memblock_unref(ctx,
                                   &defunc_12_lifted_use_version_res_mem_122897,
                                   "defunc_12_lifted_use_version_res_mem_122897") !=
                    0)
                    return 1;
                if (memblock_unref(ctx,
                                   &defunc_12_lifted_use_version_res_mem_122896,
                                   "defunc_12_lifted_use_version_res_mem_122896") !=
                    0)
                    return 1;
            }
            
            struct memblock L_l_mem_122923;
            
            L_l_mem_122923.references = NULL;
            if (cond_114941) {
                bool zzero_115791 = l_jump_114542 == (int64_t) 0;
                bool nonzzero_115792 = !zzero_115791;
                bool nonzzero_cert_115793;
                
                if (!nonzzero_115792) {
                    ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                           "division by zero",
                                           "-> #0  stl.fut:55:27-34\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:54:3-67:14\n   #4  stl.fut:252:21-67\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:250:15-253:43\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    if (memblock_unref(ctx, &L_l_mem_122923,
                                       "L_l_mem_122923") != 0)
                        return 1;
                    if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_122899,
                                       "defunc_11_loess_l_res_mem_122899") != 0)
                        return 1;
                    if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_122898,
                                       "defunc_11_loess_l_res_mem_122898") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122262,
                                       "mem_param_122262") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122254,
                                       "mem_param_122254") != 0)
                        return 1;
                    if (memblock_unref(ctx, &loopres_mem_123498,
                                       "loopres_mem_123498") != 0)
                        return 1;
                    if (memblock_unref(ctx, &loopres_mem_123490,
                                       "loopres_mem_123490") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122240,
                                       "mem_param_122240") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122232,
                                       "mem_param_122232") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122224,
                                       "mem_param_122224") != 0)
                        return 1;
                    if (memblock_unref(ctx, &stl_res_mem_123757,
                                       "stl_res_mem_123757") != 0)
                        return 1;
                    if (memblock_unref(ctx, &stl_res_mem_123749,
                                       "stl_res_mem_123749") != 0)
                        return 1;
                    if (memblock_unref(ctx, &stl_res_mem_123741,
                                       "stl_res_mem_123741") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
                        return 1;
                    if (memblock_unref(ctx, &out_mem_123852,
                                       "out_mem_123852") != 0)
                        return 1;
                    if (memblock_unref(ctx, &out_mem_123851,
                                       "out_mem_123851") != 0)
                        return 1;
                    if (memblock_unref(ctx, &out_mem_123850,
                                       "out_mem_123850") != 0)
                        return 1;
                    return 1;
                }
                
                int64_t y_115794 = sub64(l_n_m_114584, (int64_t) 1);
                struct memblock mem_122921;
                
                mem_122921.references = NULL;
                if (memblock_alloc(ctx, &mem_122921, bytes_122001,
                                   "mem_122921")) {
                    err = 1;
                    goto cleanup;
                }
                
                int64_t flat_tid_119279 = (int64_t) 0;
                int32_t num_tasks_127921;
                int64_t flat_tid_119281 = (int64_t) 0;
                struct futhark_mc_task_131573 futhark_mc_task_131573;
                
                futhark_mc_task_131573.ctx = ctx;
                futhark_mc_task_131573.free_m_114533 = m_114533;
                futhark_mc_task_131573.free_n_114534 = n_114534;
                futhark_mc_task_131573.free_l_jump_114542 = l_jump_114542;
                futhark_mc_task_131573.free_l_n_m_114584 = l_n_m_114584;
                futhark_mc_task_131573.free_i_114610 = i_114610;
                futhark_mc_task_131573.free_y_115794 = y_115794;
                futhark_mc_task_131573.free_bytes_121983 = bytes_121983;
                futhark_mc_task_131573.free_defunc_11_loess_l_res_mem_122898 =
                    defunc_11_loess_l_res_mem_122898.mem;
                futhark_mc_task_131573.free_defunc_11_loess_l_res_mem_122899 =
                    defunc_11_loess_l_res_mem_122899.mem;
                futhark_mc_task_131573.free_mem_122921 = mem_122921.mem;
                
                struct scheduler_segop futhark_mc_task_131573_task;
                
                futhark_mc_task_131573_task.args = &futhark_mc_task_131573;
                futhark_mc_task_131573_task.top_level_fn =
                    futhark_mc_segmap_task_131574;
                futhark_mc_task_131573_task.name =
                    "futhark_mc_segmap_task_131574";
                futhark_mc_task_131573_task.iterations = m_114533;
                futhark_mc_task_131573_task.task_time =
                    &ctx->futhark_mc_segmap_task_131574_total_time;
                futhark_mc_task_131573_task.task_iter =
                    &ctx->futhark_mc_segmap_task_131574_total_iter;
                futhark_mc_task_131573_task.sched = STATIC;
                futhark_mc_task_131573_task.nested_fn =
                    futhark_mc_segmap_nested_task_131578;
                
                int futhark_mc_segmap_task_131574_err =
                    scheduler_prepare_task(&ctx->scheduler,
                                           &futhark_mc_task_131573_task);
                
                if (futhark_mc_segmap_task_131574_err != 0) {
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &L_l_mem_122923, &mem_122921,
                                 "mem_122921") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_122921, "mem_122921") != 0)
                    return 1;
            } else {
                bool dim_match_115847 = n_114534 == l_n_m_114584;
                bool empty_or_match_cert_115848;
                
                if (!dim_match_115847) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Value of (core language) shape (", m_114533,
                                  ", ", l_n_m_114584,
                                  ") cannot match shape of type `[", m_114533,
                                  "][", n_114534, "]t`.",
                                  "-> #0  stl.fut:255:15-36\n   #1  stl.fut:394:3-405:33\n   #2  stl.fut:381:1-405:33\n");
                    if (memblock_unref(ctx, &L_l_mem_122923,
                                       "L_l_mem_122923") != 0)
                        return 1;
                    if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_122899,
                                       "defunc_11_loess_l_res_mem_122899") != 0)
                        return 1;
                    if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_122898,
                                       "defunc_11_loess_l_res_mem_122898") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122262,
                                       "mem_param_122262") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122254,
                                       "mem_param_122254") != 0)
                        return 1;
                    if (memblock_unref(ctx, &loopres_mem_123498,
                                       "loopres_mem_123498") != 0)
                        return 1;
                    if (memblock_unref(ctx, &loopres_mem_123490,
                                       "loopres_mem_123490") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122240,
                                       "mem_param_122240") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122232,
                                       "mem_param_122232") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122224,
                                       "mem_param_122224") != 0)
                        return 1;
                    if (memblock_unref(ctx, &stl_res_mem_123757,
                                       "stl_res_mem_123757") != 0)
                        return 1;
                    if (memblock_unref(ctx, &stl_res_mem_123749,
                                       "stl_res_mem_123749") != 0)
                        return 1;
                    if (memblock_unref(ctx, &stl_res_mem_123741,
                                       "stl_res_mem_123741") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
                        return 1;
                    if (memblock_unref(ctx, &out_mem_123852,
                                       "out_mem_123852") != 0)
                        return 1;
                    if (memblock_unref(ctx, &out_mem_123851,
                                       "out_mem_123851") != 0)
                        return 1;
                    if (memblock_unref(ctx, &out_mem_123850,
                                       "out_mem_123850") != 0)
                        return 1;
                    return 1;
                }
                if (memblock_set(ctx, &L_l_mem_122923,
                                 &defunc_11_loess_l_res_mem_122898,
                                 "defunc_11_loess_l_res_mem_122898") != 0)
                    return 1;
            }
            if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_122898,
                               "defunc_11_loess_l_res_mem_122898") != 0)
                return 1;
            if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_122899,
                               "defunc_11_loess_l_res_mem_122899") != 0)
                return 1;
            
            struct memblock mem_122945;
            
            mem_122945.references = NULL;
            if (memblock_alloc(ctx, &mem_122945, bytes_122001, "mem_122945")) {
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_119335 = (int64_t) 0;
            int32_t num_tasks_128029;
            int64_t flat_tid_119337 = (int64_t) 0;
            struct futhark_mc_task_131586 futhark_mc_task_131586;
            
            futhark_mc_task_131586.ctx = ctx;
            futhark_mc_task_131586.free_m_114533 = m_114533;
            futhark_mc_task_131586.free_n_114534 = n_114534;
            futhark_mc_task_131586.free_n_p_114536 = n_p_114536;
            futhark_mc_task_131586.free_C_len_114582 = C_len_114582;
            futhark_mc_task_131586.free_bytes_121983 = bytes_121983;
            futhark_mc_task_131586.free_mem_122328 = mem_122328;
            futhark_mc_task_131586.free_L_l_ixfn_122922 = L_l_ixfn_122922;
            futhark_mc_task_131586.free_L_l_mem_122923 = L_l_mem_122923.mem;
            futhark_mc_task_131586.free_mem_122945 = mem_122945.mem;
            
            struct scheduler_segop futhark_mc_task_131586_task;
            
            futhark_mc_task_131586_task.args = &futhark_mc_task_131586;
            futhark_mc_task_131586_task.top_level_fn =
                futhark_mc_segmap_task_131587;
            futhark_mc_task_131586_task.name = "futhark_mc_segmap_task_131587";
            futhark_mc_task_131586_task.iterations = m_114533;
            futhark_mc_task_131586_task.task_time =
                &ctx->futhark_mc_segmap_task_131587_total_time;
            futhark_mc_task_131586_task.task_iter =
                &ctx->futhark_mc_segmap_task_131587_total_iter;
            futhark_mc_task_131586_task.sched = STATIC;
            futhark_mc_task_131586_task.nested_fn =
                futhark_mc_segmap_nested_task_131591;
            
            int futhark_mc_segmap_task_131587_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131586_task);
            
            if (futhark_mc_segmap_task_131587_err != 0) {
                err = 1;
                goto cleanup;
            }
            if (memblock_unref(ctx, &L_l_mem_122923, "L_l_mem_122923") != 0)
                return 1;
            
            int64_t flat_tid_119347 = (int64_t) 0;
            int32_t num_tasks_128052;
            int64_t flat_tid_119349 = (int64_t) 0;
            struct futhark_mc_task_131599 futhark_mc_task_131599;
            
            futhark_mc_task_131599.ctx = ctx;
            futhark_mc_task_131599.free_m_114533 = m_114533;
            futhark_mc_task_131599.free_n_114534 = n_114534;
            futhark_mc_task_131599.free_Y_mem_121939 = Y_mem_121939.mem;
            futhark_mc_task_131599.free_mem_121979 = mem_121979;
            futhark_mc_task_131599.free_bytes_121983 = bytes_121983;
            futhark_mc_task_131599.free_mem_122945 = mem_122945.mem;
            futhark_mc_task_131599.free_mem_122985 = mem_122985;
            
            struct scheduler_segop futhark_mc_task_131599_task;
            
            futhark_mc_task_131599_task.args = &futhark_mc_task_131599;
            futhark_mc_task_131599_task.top_level_fn =
                futhark_mc_segmap_task_131600;
            futhark_mc_task_131599_task.name = "futhark_mc_segmap_task_131600";
            futhark_mc_task_131599_task.iterations = m_114533;
            futhark_mc_task_131599_task.task_time =
                &ctx->futhark_mc_segmap_task_131600_total_time;
            futhark_mc_task_131599_task.task_iter =
                &ctx->futhark_mc_segmap_task_131600_total_iter;
            futhark_mc_task_131599_task.sched = STATIC;
            futhark_mc_task_131599_task.nested_fn =
                futhark_mc_segmap_nested_task_131605;
            
            int futhark_mc_segmap_task_131600_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131599_task);
            
            if (futhark_mc_segmap_task_131600_err != 0) {
                err = 1;
                goto cleanup;
            }
            
            struct memblock defunc_11_loess_l_res_mem_123453;
            
            defunc_11_loess_l_res_mem_123453.references = NULL;
            
            struct memblock defunc_11_loess_l_res_mem_123454;
            
            defunc_11_loess_l_res_mem_123454.references = NULL;
            if (cond_115017) {
                bool match_lit_115878 = (int64_t) 0 == t_degree_114539;
                struct memblock defunc_12_lifted_use_version_res_mem_123102;
                
                defunc_12_lifted_use_version_res_mem_123102.references = NULL;
                
                struct memblock defunc_12_lifted_use_version_res_mem_123103;
                
                defunc_12_lifted_use_version_res_mem_123103.references = NULL;
                if (match_lit_115878) {
                    struct memblock mem_122989;
                    
                    mem_122989.references = NULL;
                    if (memblock_alloc(ctx, &mem_122989, bytes_122205,
                                       "mem_122989")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_128099 = 0; i_128099 < m_114533;
                         i_128099++) {
                        for (int64_t i_128100 = 0; i_128100 < t_n_m_114591;
                             i_128100++) {
                            ((float *) mem_122989.mem)[i_128099 * t_n_m_114591 +
                                                       i_128100] = 0.0F;
                        }
                    }
                    
                    struct memblock mem_123011;
                    
                    mem_123011.references = NULL;
                    if (memblock_alloc(ctx, &mem_123011, bytes_122205,
                                       "mem_123011")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t flat_tid_119370 = (int64_t) 0;
                    int32_t num_tasks_128101;
                    int64_t flat_tid_119372 = (int64_t) 0;
                    struct futhark_mc_task_131618 futhark_mc_task_131618;
                    
                    futhark_mc_task_131618.ctx = ctx;
                    futhark_mc_task_131618.free_m_114533 = m_114533;
                    futhark_mc_task_131618.free_n_114534 = n_114534;
                    futhark_mc_task_131618.free_t_window_114537 =
                        t_window_114537;
                    futhark_mc_task_131618.free_t_jump_114541 = t_jump_114541;
                    futhark_mc_task_131618.free_t_n_m_114591 = t_n_m_114591;
                    futhark_mc_task_131618.free_i_114610 = i_114610;
                    futhark_mc_task_131618.free_mem_121982 = mem_121982;
                    futhark_mc_task_131618.free_mem_122004 = mem_122004;
                    futhark_mc_task_131618.free_bytes_122135 = bytes_122135;
                    futhark_mc_task_131618.free_mem_122204 = mem_122204;
                    futhark_mc_task_131618.free_mem_122208 = mem_122208;
                    futhark_mc_task_131618.free_mem_122430 = mem_122430;
                    futhark_mc_task_131618.free_mem_122985 = mem_122985;
                    futhark_mc_task_131618.free_mem_123011 = mem_123011.mem;
                    
                    struct scheduler_segop futhark_mc_task_131618_task;
                    
                    futhark_mc_task_131618_task.args = &futhark_mc_task_131618;
                    futhark_mc_task_131618_task.top_level_fn =
                        futhark_mc_segmap_task_131619;
                    futhark_mc_task_131618_task.name =
                        "futhark_mc_segmap_task_131619";
                    futhark_mc_task_131618_task.iterations = m_114533;
                    futhark_mc_task_131618_task.task_time =
                        &ctx->futhark_mc_segmap_task_131619_total_time;
                    futhark_mc_task_131618_task.task_iter =
                        &ctx->futhark_mc_segmap_task_131619_total_iter;
                    futhark_mc_task_131618_task.sched = STATIC;
                    futhark_mc_task_131618_task.nested_fn =
                        futhark_mc_segmap_nested_task_131623;
                    
                    int futhark_mc_segmap_task_131619_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_131618_task);
                    
                    if (futhark_mc_segmap_task_131619_err != 0) {
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_123102,
                                     &mem_123011, "mem_123011") != 0)
                        return 1;
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_123103,
                                     &mem_122989, "mem_122989") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_123011, "mem_123011") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122989, "mem_122989") != 0)
                        return 1;
                } else {
                    bool match_lit_115949 = (int64_t) 1 == t_degree_114539;
                    struct memblock x_mem_123100;
                    
                    x_mem_123100.references = NULL;
                    
                    struct memblock x_mem_123101;
                    
                    x_mem_123101.references = NULL;
                    if (match_lit_115949) {
                        struct memblock mem_123051;
                        
                        mem_123051.references = NULL;
                        if (memblock_alloc(ctx, &mem_123051, bytes_122205,
                                           "mem_123051")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_123055;
                        
                        mem_123055.references = NULL;
                        if (memblock_alloc(ctx, &mem_123055, bytes_122205,
                                           "mem_123055")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_119557 = (int64_t) 0;
                        int32_t num_tasks_128390;
                        int64_t flat_tid_119559 = (int64_t) 0;
                        struct futhark_mc_task_131644 futhark_mc_task_131644;
                        
                        futhark_mc_task_131644.ctx = ctx;
                        futhark_mc_task_131644.free_m_114533 = m_114533;
                        futhark_mc_task_131644.free_n_114534 = n_114534;
                        futhark_mc_task_131644.free_t_window_114537 =
                            t_window_114537;
                        futhark_mc_task_131644.free_t_jump_114541 =
                            t_jump_114541;
                        futhark_mc_task_131644.free_t_n_m_114591 = t_n_m_114591;
                        futhark_mc_task_131644.free_i_114610 = i_114610;
                        futhark_mc_task_131644.free_mem_121982 = mem_121982;
                        futhark_mc_task_131644.free_mem_122004 = mem_122004;
                        futhark_mc_task_131644.free_bytes_122135 = bytes_122135;
                        futhark_mc_task_131644.free_mem_122204 = mem_122204;
                        futhark_mc_task_131644.free_mem_122208 = mem_122208;
                        futhark_mc_task_131644.free_mem_122430 = mem_122430;
                        futhark_mc_task_131644.free_mem_122985 = mem_122985;
                        futhark_mc_task_131644.free_mem_123051 = mem_123051.mem;
                        futhark_mc_task_131644.free_mem_123055 = mem_123055.mem;
                        
                        struct scheduler_segop futhark_mc_task_131644_task;
                        
                        futhark_mc_task_131644_task.args =
                            &futhark_mc_task_131644;
                        futhark_mc_task_131644_task.top_level_fn =
                            futhark_mc_segmap_task_131645;
                        futhark_mc_task_131644_task.name =
                            "futhark_mc_segmap_task_131645";
                        futhark_mc_task_131644_task.iterations = m_114533;
                        futhark_mc_task_131644_task.task_time =
                            &ctx->futhark_mc_segmap_task_131645_total_time;
                        futhark_mc_task_131644_task.task_iter =
                            &ctx->futhark_mc_segmap_task_131645_total_iter;
                        futhark_mc_task_131644_task.sched = STATIC;
                        futhark_mc_task_131644_task.nested_fn =
                            futhark_mc_segmap_nested_task_131650;
                        
                        int futhark_mc_segmap_task_131645_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_131644_task);
                        
                        if (futhark_mc_segmap_task_131645_err != 0) {
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &x_mem_123100, &mem_123051,
                                         "mem_123051") != 0)
                            return 1;
                        if (memblock_set(ctx, &x_mem_123101, &mem_123055,
                                         "mem_123055") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_123055, "mem_123055") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_123051, "mem_123051") != 0)
                            return 1;
                    } else {
                        struct memblock mem_123095;
                        
                        mem_123095.references = NULL;
                        if (memblock_alloc(ctx, &mem_123095, bytes_122205,
                                           "mem_123095")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_123099;
                        
                        mem_123099.references = NULL;
                        if (memblock_alloc(ctx, &mem_123099, bytes_122205,
                                           "mem_123099")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t flat_tid_119829 = (int64_t) 0;
                        int32_t num_tasks_128817;
                        int64_t flat_tid_119831 = (int64_t) 0;
                        struct futhark_mc_task_131675 futhark_mc_task_131675;
                        
                        futhark_mc_task_131675.ctx = ctx;
                        futhark_mc_task_131675.free_m_114533 = m_114533;
                        futhark_mc_task_131675.free_n_114534 = n_114534;
                        futhark_mc_task_131675.free_t_window_114537 =
                            t_window_114537;
                        futhark_mc_task_131675.free_t_jump_114541 =
                            t_jump_114541;
                        futhark_mc_task_131675.free_t_n_m_114591 = t_n_m_114591;
                        futhark_mc_task_131675.free_i_114610 = i_114610;
                        futhark_mc_task_131675.free_mem_121982 = mem_121982;
                        futhark_mc_task_131675.free_mem_122004 = mem_122004;
                        futhark_mc_task_131675.free_bytes_122135 = bytes_122135;
                        futhark_mc_task_131675.free_mem_122204 = mem_122204;
                        futhark_mc_task_131675.free_mem_122208 = mem_122208;
                        futhark_mc_task_131675.free_mem_122430 = mem_122430;
                        futhark_mc_task_131675.free_mem_122985 = mem_122985;
                        futhark_mc_task_131675.free_mem_123095 = mem_123095.mem;
                        futhark_mc_task_131675.free_mem_123099 = mem_123099.mem;
                        
                        struct scheduler_segop futhark_mc_task_131675_task;
                        
                        futhark_mc_task_131675_task.args =
                            &futhark_mc_task_131675;
                        futhark_mc_task_131675_task.top_level_fn =
                            futhark_mc_segmap_task_131676;
                        futhark_mc_task_131675_task.name =
                            "futhark_mc_segmap_task_131676";
                        futhark_mc_task_131675_task.iterations = m_114533;
                        futhark_mc_task_131675_task.task_time =
                            &ctx->futhark_mc_segmap_task_131676_total_time;
                        futhark_mc_task_131675_task.task_iter =
                            &ctx->futhark_mc_segmap_task_131676_total_iter;
                        futhark_mc_task_131675_task.sched = STATIC;
                        futhark_mc_task_131675_task.nested_fn =
                            futhark_mc_segmap_nested_task_131681;
                        
                        int futhark_mc_segmap_task_131676_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_131675_task);
                        
                        if (futhark_mc_segmap_task_131676_err != 0) {
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &x_mem_123100, &mem_123095,
                                         "mem_123095") != 0)
                            return 1;
                        if (memblock_set(ctx, &x_mem_123101, &mem_123099,
                                         "mem_123099") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_123099, "mem_123099") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_123095, "mem_123095") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_123102,
                                     &x_mem_123100, "x_mem_123100") != 0)
                        return 1;
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_123103,
                                     &x_mem_123101, "x_mem_123101") != 0)
                        return 1;
                    if (memblock_unref(ctx, &x_mem_123101, "x_mem_123101") != 0)
                        return 1;
                    if (memblock_unref(ctx, &x_mem_123100, "x_mem_123100") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &defunc_11_loess_l_res_mem_123453,
                                 &defunc_12_lifted_use_version_res_mem_123102,
                                 "defunc_12_lifted_use_version_res_mem_123102") !=
                    0)
                    return 1;
                if (memblock_set(ctx, &defunc_11_loess_l_res_mem_123454,
                                 &defunc_12_lifted_use_version_res_mem_123103,
                                 "defunc_12_lifted_use_version_res_mem_123103") !=
                    0)
                    return 1;
                if (memblock_unref(ctx,
                                   &defunc_12_lifted_use_version_res_mem_123103,
                                   "defunc_12_lifted_use_version_res_mem_123103") !=
                    0)
                    return 1;
                if (memblock_unref(ctx,
                                   &defunc_12_lifted_use_version_res_mem_123102,
                                   "defunc_12_lifted_use_version_res_mem_123102") !=
                    0)
                    return 1;
            } else {
                bool match_lit_116178 = (int64_t) 0 == t_degree_114539;
                struct memblock defunc_12_lifted_use_version_res_mem_123451;
                
                defunc_12_lifted_use_version_res_mem_123451.references = NULL;
                
                struct memblock defunc_12_lifted_use_version_res_mem_123452;
                
                defunc_12_lifted_use_version_res_mem_123452.references = NULL;
                if (match_lit_116178) {
                    struct memblock mem_123107;
                    
                    mem_123107.references = NULL;
                    if (memblock_alloc(ctx, &mem_123107, bytes_122205,
                                       "mem_123107")) {
                        err = 1;
                        goto cleanup;
                    }
                    for (int64_t i_129376 = 0; i_129376 < m_114533;
                         i_129376++) {
                        for (int64_t i_129377 = 0; i_129377 < t_n_m_114591;
                             i_129377++) {
                            ((float *) mem_123107.mem)[i_129376 * t_n_m_114591 +
                                                       i_129377] = 0.0F;
                        }
                    }
                    
                    struct memblock mem_123162;
                    
                    mem_123162.references = NULL;
                    if (memblock_alloc(ctx, &mem_123162, bytes_122205,
                                       "mem_123162")) {
                        err = 1;
                        goto cleanup;
                    }
                    
                    int64_t binop_y_123109 = (int64_t) 4 * t_window_114537;
                    int64_t bytes_123108 = smax64((int64_t) 0, binop_y_123109);
                    int64_t flat_tid_120197 = (int64_t) 0;
                    int32_t num_tasks_129378;
                    int64_t flat_tid_120199 = (int64_t) 0;
                    struct futhark_mc_task_131708 futhark_mc_task_131708;
                    
                    futhark_mc_task_131708.ctx = ctx;
                    futhark_mc_task_131708.free_m_114533 = m_114533;
                    futhark_mc_task_131708.free_n_114534 = n_114534;
                    futhark_mc_task_131708.free_t_window_114537 =
                        t_window_114537;
                    futhark_mc_task_131708.free_t_jump_114541 = t_jump_114541;
                    futhark_mc_task_131708.free_t_n_m_114591 = t_n_m_114591;
                    futhark_mc_task_131708.free_i_114610 = i_114610;
                    futhark_mc_task_131708.free_mem_121982 = mem_121982;
                    futhark_mc_task_131708.free_mem_122004 = mem_122004;
                    futhark_mc_task_131708.free_bytes_122135 = bytes_122135;
                    futhark_mc_task_131708.free_mem_122204 = mem_122204;
                    futhark_mc_task_131708.free_mem_122208 = mem_122208;
                    futhark_mc_task_131708.free_mem_122430 = mem_122430;
                    futhark_mc_task_131708.free_mem_122985 = mem_122985;
                    futhark_mc_task_131708.free_bytes_123108 = bytes_123108;
                    futhark_mc_task_131708.free_mem_123162 = mem_123162.mem;
                    
                    struct scheduler_segop futhark_mc_task_131708_task;
                    
                    futhark_mc_task_131708_task.args = &futhark_mc_task_131708;
                    futhark_mc_task_131708_task.top_level_fn =
                        futhark_mc_segmap_task_131709;
                    futhark_mc_task_131708_task.name =
                        "futhark_mc_segmap_task_131709";
                    futhark_mc_task_131708_task.iterations = m_114533;
                    futhark_mc_task_131708_task.task_time =
                        &ctx->futhark_mc_segmap_task_131709_total_time;
                    futhark_mc_task_131708_task.task_iter =
                        &ctx->futhark_mc_segmap_task_131709_total_iter;
                    futhark_mc_task_131708_task.sched = STATIC;
                    futhark_mc_task_131708_task.nested_fn =
                        futhark_mc_segmap_nested_task_131714;
                    
                    int futhark_mc_segmap_task_131709_err =
                        scheduler_prepare_task(&ctx->scheduler,
                                               &futhark_mc_task_131708_task);
                    
                    if (futhark_mc_segmap_task_131709_err != 0) {
                        err = 1;
                        goto cleanup;
                    }
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_123451,
                                     &mem_123162, "mem_123162") != 0)
                        return 1;
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_123452,
                                     &mem_123107, "mem_123107") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_123162, "mem_123162") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_123107, "mem_123107") != 0)
                        return 1;
                } else {
                    bool match_lit_116235 = (int64_t) 1 == t_degree_114539;
                    struct memblock x_mem_123449;
                    
                    x_mem_123449.references = NULL;
                    
                    struct memblock x_mem_123450;
                    
                    x_mem_123450.references = NULL;
                    if (match_lit_116235) {
                        struct memblock mem_123268;
                        
                        mem_123268.references = NULL;
                        if (memblock_alloc(ctx, &mem_123268, bytes_122205,
                                           "mem_123268")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_123272;
                        
                        mem_123272.references = NULL;
                        if (memblock_alloc(ctx, &mem_123272, bytes_122205,
                                           "mem_123272")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_123164 = (int64_t) 4 * t_window_114537;
                        int64_t bytes_123163 = smax64((int64_t) 0,
                                                      binop_y_123164);
                        int64_t flat_tid_120342 = (int64_t) 0;
                        int32_t num_tasks_129607;
                        int64_t flat_tid_120344 = (int64_t) 0;
                        struct futhark_mc_task_131737 futhark_mc_task_131737;
                        
                        futhark_mc_task_131737.ctx = ctx;
                        futhark_mc_task_131737.free_m_114533 = m_114533;
                        futhark_mc_task_131737.free_n_114534 = n_114534;
                        futhark_mc_task_131737.free_t_window_114537 =
                            t_window_114537;
                        futhark_mc_task_131737.free_t_jump_114541 =
                            t_jump_114541;
                        futhark_mc_task_131737.free_t_n_m_114591 = t_n_m_114591;
                        futhark_mc_task_131737.free_i_114610 = i_114610;
                        futhark_mc_task_131737.free_mem_121982 = mem_121982;
                        futhark_mc_task_131737.free_mem_122004 = mem_122004;
                        futhark_mc_task_131737.free_bytes_122135 = bytes_122135;
                        futhark_mc_task_131737.free_mem_122204 = mem_122204;
                        futhark_mc_task_131737.free_mem_122208 = mem_122208;
                        futhark_mc_task_131737.free_mem_122430 = mem_122430;
                        futhark_mc_task_131737.free_mem_122985 = mem_122985;
                        futhark_mc_task_131737.free_bytes_123163 = bytes_123163;
                        futhark_mc_task_131737.free_mem_123268 = mem_123268.mem;
                        futhark_mc_task_131737.free_mem_123272 = mem_123272.mem;
                        
                        struct scheduler_segop futhark_mc_task_131737_task;
                        
                        futhark_mc_task_131737_task.args =
                            &futhark_mc_task_131737;
                        futhark_mc_task_131737_task.top_level_fn =
                            futhark_mc_segmap_task_131738;
                        futhark_mc_task_131737_task.name =
                            "futhark_mc_segmap_task_131738";
                        futhark_mc_task_131737_task.iterations = m_114533;
                        futhark_mc_task_131737_task.task_time =
                            &ctx->futhark_mc_segmap_task_131738_total_time;
                        futhark_mc_task_131737_task.task_iter =
                            &ctx->futhark_mc_segmap_task_131738_total_iter;
                        futhark_mc_task_131737_task.sched = STATIC;
                        futhark_mc_task_131737_task.nested_fn =
                            futhark_mc_segmap_nested_task_131745;
                        
                        int futhark_mc_segmap_task_131738_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_131737_task);
                        
                        if (futhark_mc_segmap_task_131738_err != 0) {
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &x_mem_123449, &mem_123268,
                                         "mem_123268") != 0)
                            return 1;
                        if (memblock_set(ctx, &x_mem_123450, &mem_123272,
                                         "mem_123272") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_123272, "mem_123272") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_123268, "mem_123268") != 0)
                            return 1;
                    } else {
                        struct memblock mem_123444;
                        
                        mem_123444.references = NULL;
                        if (memblock_alloc(ctx, &mem_123444, bytes_122205,
                                           "mem_123444")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        struct memblock mem_123448;
                        
                        mem_123448.references = NULL;
                        if (memblock_alloc(ctx, &mem_123448, bytes_122205,
                                           "mem_123448")) {
                            err = 1;
                            goto cleanup;
                        }
                        
                        int64_t binop_y_123274 = (int64_t) 4 * t_window_114537;
                        int64_t bytes_123273 = smax64((int64_t) 0,
                                                      binop_y_123274);
                        int64_t flat_tid_120575 = (int64_t) 0;
                        int32_t num_tasks_129989;
                        int64_t flat_tid_120577 = (int64_t) 0;
                        struct futhark_mc_task_131774 futhark_mc_task_131774;
                        
                        futhark_mc_task_131774.ctx = ctx;
                        futhark_mc_task_131774.free_m_114533 = m_114533;
                        futhark_mc_task_131774.free_n_114534 = n_114534;
                        futhark_mc_task_131774.free_t_window_114537 =
                            t_window_114537;
                        futhark_mc_task_131774.free_t_jump_114541 =
                            t_jump_114541;
                        futhark_mc_task_131774.free_t_n_m_114591 = t_n_m_114591;
                        futhark_mc_task_131774.free_i_114610 = i_114610;
                        futhark_mc_task_131774.free_mem_121982 = mem_121982;
                        futhark_mc_task_131774.free_mem_122004 = mem_122004;
                        futhark_mc_task_131774.free_bytes_122135 = bytes_122135;
                        futhark_mc_task_131774.free_mem_122204 = mem_122204;
                        futhark_mc_task_131774.free_mem_122208 = mem_122208;
                        futhark_mc_task_131774.free_mem_122430 = mem_122430;
                        futhark_mc_task_131774.free_mem_122985 = mem_122985;
                        futhark_mc_task_131774.free_bytes_123273 = bytes_123273;
                        futhark_mc_task_131774.free_mem_123444 = mem_123444.mem;
                        futhark_mc_task_131774.free_mem_123448 = mem_123448.mem;
                        
                        struct scheduler_segop futhark_mc_task_131774_task;
                        
                        futhark_mc_task_131774_task.args =
                            &futhark_mc_task_131774;
                        futhark_mc_task_131774_task.top_level_fn =
                            futhark_mc_segmap_task_131775;
                        futhark_mc_task_131774_task.name =
                            "futhark_mc_segmap_task_131775";
                        futhark_mc_task_131774_task.iterations = m_114533;
                        futhark_mc_task_131774_task.task_time =
                            &ctx->futhark_mc_segmap_task_131775_total_time;
                        futhark_mc_task_131774_task.task_iter =
                            &ctx->futhark_mc_segmap_task_131775_total_iter;
                        futhark_mc_task_131774_task.sched = STATIC;
                        futhark_mc_task_131774_task.nested_fn =
                            futhark_mc_segmap_nested_task_131784;
                        
                        int futhark_mc_segmap_task_131775_err =
                            scheduler_prepare_task(&ctx->scheduler,
                                                   &futhark_mc_task_131774_task);
                        
                        if (futhark_mc_segmap_task_131775_err != 0) {
                            err = 1;
                            goto cleanup;
                        }
                        if (memblock_set(ctx, &x_mem_123449, &mem_123444,
                                         "mem_123444") != 0)
                            return 1;
                        if (memblock_set(ctx, &x_mem_123450, &mem_123448,
                                         "mem_123448") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_123448, "mem_123448") != 0)
                            return 1;
                        if (memblock_unref(ctx, &mem_123444, "mem_123444") != 0)
                            return 1;
                    }
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_123451,
                                     &x_mem_123449, "x_mem_123449") != 0)
                        return 1;
                    if (memblock_set(ctx,
                                     &defunc_12_lifted_use_version_res_mem_123452,
                                     &x_mem_123450, "x_mem_123450") != 0)
                        return 1;
                    if (memblock_unref(ctx, &x_mem_123450, "x_mem_123450") != 0)
                        return 1;
                    if (memblock_unref(ctx, &x_mem_123449, "x_mem_123449") != 0)
                        return 1;
                }
                if (memblock_set(ctx, &defunc_11_loess_l_res_mem_123453,
                                 &defunc_12_lifted_use_version_res_mem_123451,
                                 "defunc_12_lifted_use_version_res_mem_123451") !=
                    0)
                    return 1;
                if (memblock_set(ctx, &defunc_11_loess_l_res_mem_123454,
                                 &defunc_12_lifted_use_version_res_mem_123452,
                                 "defunc_12_lifted_use_version_res_mem_123452") !=
                    0)
                    return 1;
                if (memblock_unref(ctx,
                                   &defunc_12_lifted_use_version_res_mem_123452,
                                   "defunc_12_lifted_use_version_res_mem_123452") !=
                    0)
                    return 1;
                if (memblock_unref(ctx,
                                   &defunc_12_lifted_use_version_res_mem_123451,
                                   "defunc_12_lifted_use_version_res_mem_123451") !=
                    0)
                    return 1;
            }
            
            struct memblock trend_l_mem_123478;
            
            trend_l_mem_123478.references = NULL;
            if (cond_114942) {
                bool zzero_116483 = t_jump_114541 == (int64_t) 0;
                bool nonzzero_116484 = !zzero_116483;
                bool nonzzero_cert_116485;
                
                if (!nonzzero_116484) {
                    ctx->error = msgprintf("Error: %s\n\nBacktrace:\n%s",
                                           "division by zero",
                                           "-> #0  stl.fut:55:27-34\n   #1  /prelude/soacs.fut:59:3-10\n   #2  /prelude/array.fut:195:3-17\n   #3  stl.fut:54:3-67:14\n   #4  stl.fut:300:23-69\n   #5  /prelude/soacs.fut:67:19-23\n   #6  /prelude/soacs.fut:67:3-37\n   #7  stl.fut:299:15-301:43\n   #8  stl.fut:394:3-405:33\n   #9  stl.fut:381:1-405:33\n");
                    if (memblock_unref(ctx, &trend_l_mem_123478,
                                       "trend_l_mem_123478") != 0)
                        return 1;
                    if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_123454,
                                       "defunc_11_loess_l_res_mem_123454") != 0)
                        return 1;
                    if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_123453,
                                       "defunc_11_loess_l_res_mem_123453") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122945, "mem_122945") != 0)
                        return 1;
                    if (memblock_unref(ctx, &L_l_mem_122923,
                                       "L_l_mem_122923") != 0)
                        return 1;
                    if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_122899,
                                       "defunc_11_loess_l_res_mem_122899") != 0)
                        return 1;
                    if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_122898,
                                       "defunc_11_loess_l_res_mem_122898") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122262,
                                       "mem_param_122262") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122254,
                                       "mem_param_122254") != 0)
                        return 1;
                    if (memblock_unref(ctx, &loopres_mem_123498,
                                       "loopres_mem_123498") != 0)
                        return 1;
                    if (memblock_unref(ctx, &loopres_mem_123490,
                                       "loopres_mem_123490") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122240,
                                       "mem_param_122240") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122232,
                                       "mem_param_122232") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122224,
                                       "mem_param_122224") != 0)
                        return 1;
                    if (memblock_unref(ctx, &stl_res_mem_123757,
                                       "stl_res_mem_123757") != 0)
                        return 1;
                    if (memblock_unref(ctx, &stl_res_mem_123749,
                                       "stl_res_mem_123749") != 0)
                        return 1;
                    if (memblock_unref(ctx, &stl_res_mem_123741,
                                       "stl_res_mem_123741") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
                        return 1;
                    if (memblock_unref(ctx, &out_mem_123852,
                                       "out_mem_123852") != 0)
                        return 1;
                    if (memblock_unref(ctx, &out_mem_123851,
                                       "out_mem_123851") != 0)
                        return 1;
                    if (memblock_unref(ctx, &out_mem_123850,
                                       "out_mem_123850") != 0)
                        return 1;
                    return 1;
                }
                
                int64_t y_116486 = sub64(t_n_m_114591, (int64_t) 1);
                struct memblock mem_123476;
                
                mem_123476.references = NULL;
                if (memblock_alloc(ctx, &mem_123476, bytes_122001,
                                   "mem_123476")) {
                    err = 1;
                    goto cleanup;
                }
                
                int64_t flat_tid_120918 = (int64_t) 0;
                int32_t num_tasks_130555;
                int64_t flat_tid_120920 = (int64_t) 0;
                struct futhark_mc_task_131823 futhark_mc_task_131823;
                
                futhark_mc_task_131823.ctx = ctx;
                futhark_mc_task_131823.free_m_114533 = m_114533;
                futhark_mc_task_131823.free_n_114534 = n_114534;
                futhark_mc_task_131823.free_t_jump_114541 = t_jump_114541;
                futhark_mc_task_131823.free_t_n_m_114591 = t_n_m_114591;
                futhark_mc_task_131823.free_i_114610 = i_114610;
                futhark_mc_task_131823.free_y_116486 = y_116486;
                futhark_mc_task_131823.free_bytes_121983 = bytes_121983;
                futhark_mc_task_131823.free_defunc_11_loess_l_res_mem_123453 =
                    defunc_11_loess_l_res_mem_123453.mem;
                futhark_mc_task_131823.free_defunc_11_loess_l_res_mem_123454 =
                    defunc_11_loess_l_res_mem_123454.mem;
                futhark_mc_task_131823.free_mem_123476 = mem_123476.mem;
                
                struct scheduler_segop futhark_mc_task_131823_task;
                
                futhark_mc_task_131823_task.args = &futhark_mc_task_131823;
                futhark_mc_task_131823_task.top_level_fn =
                    futhark_mc_segmap_task_131824;
                futhark_mc_task_131823_task.name =
                    "futhark_mc_segmap_task_131824";
                futhark_mc_task_131823_task.iterations = m_114533;
                futhark_mc_task_131823_task.task_time =
                    &ctx->futhark_mc_segmap_task_131824_total_time;
                futhark_mc_task_131823_task.task_iter =
                    &ctx->futhark_mc_segmap_task_131824_total_iter;
                futhark_mc_task_131823_task.sched = STATIC;
                futhark_mc_task_131823_task.nested_fn =
                    futhark_mc_segmap_nested_task_131828;
                
                int futhark_mc_segmap_task_131824_err =
                    scheduler_prepare_task(&ctx->scheduler,
                                           &futhark_mc_task_131823_task);
                
                if (futhark_mc_segmap_task_131824_err != 0) {
                    err = 1;
                    goto cleanup;
                }
                if (memblock_set(ctx, &trend_l_mem_123478, &mem_123476,
                                 "mem_123476") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_123476, "mem_123476") != 0)
                    return 1;
            } else {
                bool dim_match_116539 = n_114534 == t_n_m_114591;
                bool empty_or_match_cert_116540;
                
                if (!dim_match_116539) {
                    ctx->error =
                        msgprintf("Error: %s%lld%s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                                  "Value of (core language) shape (", m_114533,
                                  ", ", t_n_m_114591,
                                  ") cannot match shape of type `[", m_114533,
                                  "][", n_114534, "]t`.",
                                  "-> #0  stl.fut:303:15-36\n   #1  stl.fut:394:3-405:33\n   #2  stl.fut:381:1-405:33\n");
                    if (memblock_unref(ctx, &trend_l_mem_123478,
                                       "trend_l_mem_123478") != 0)
                        return 1;
                    if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_123454,
                                       "defunc_11_loess_l_res_mem_123454") != 0)
                        return 1;
                    if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_123453,
                                       "defunc_11_loess_l_res_mem_123453") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122945, "mem_122945") != 0)
                        return 1;
                    if (memblock_unref(ctx, &L_l_mem_122923,
                                       "L_l_mem_122923") != 0)
                        return 1;
                    if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_122899,
                                       "defunc_11_loess_l_res_mem_122899") != 0)
                        return 1;
                    if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_122898,
                                       "defunc_11_loess_l_res_mem_122898") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122262,
                                       "mem_param_122262") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122254,
                                       "mem_param_122254") != 0)
                        return 1;
                    if (memblock_unref(ctx, &loopres_mem_123498,
                                       "loopres_mem_123498") != 0)
                        return 1;
                    if (memblock_unref(ctx, &loopres_mem_123490,
                                       "loopres_mem_123490") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122240,
                                       "mem_param_122240") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122232,
                                       "mem_param_122232") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_param_122224,
                                       "mem_param_122224") != 0)
                        return 1;
                    if (memblock_unref(ctx, &stl_res_mem_123757,
                                       "stl_res_mem_123757") != 0)
                        return 1;
                    if (memblock_unref(ctx, &stl_res_mem_123749,
                                       "stl_res_mem_123749") != 0)
                        return 1;
                    if (memblock_unref(ctx, &stl_res_mem_123741,
                                       "stl_res_mem_123741") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
                        return 1;
                    if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
                        return 1;
                    if (memblock_unref(ctx, &out_mem_123852,
                                       "out_mem_123852") != 0)
                        return 1;
                    if (memblock_unref(ctx, &out_mem_123851,
                                       "out_mem_123851") != 0)
                        return 1;
                    if (memblock_unref(ctx, &out_mem_123850,
                                       "out_mem_123850") != 0)
                        return 1;
                    return 1;
                }
                if (memblock_set(ctx, &trend_l_mem_123478,
                                 &defunc_11_loess_l_res_mem_123453,
                                 "defunc_11_loess_l_res_mem_123453") != 0)
                    return 1;
            }
            if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_123453,
                               "defunc_11_loess_l_res_mem_123453") != 0)
                return 1;
            if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_123454,
                               "defunc_11_loess_l_res_mem_123454") != 0)
                return 1;
            
            int64_t ctx_param_ext_tmp_125021 = trend_l_ixfn_123477;
            int64_t ctx_param_ext_tmp_125022 = trend_l_ixfn_123477;
            struct memblock mem_param_tmp_125023;
            
            mem_param_tmp_125023.references = NULL;
            if (memblock_set(ctx, &mem_param_tmp_125023, &mem_122945,
                             "mem_122945") != 0)
                return 1;
            
            struct memblock mem_param_tmp_125024;
            
            mem_param_tmp_125024.references = NULL;
            if (memblock_set(ctx, &mem_param_tmp_125024, &trend_l_mem_123478,
                             "trend_l_mem_123478") != 0)
                return 1;
            ctx_param_ext_122256 = ctx_param_ext_tmp_125021;
            ctx_param_ext_122258 = ctx_param_ext_tmp_125022;
            if (memblock_set(ctx, &mem_param_122254, &mem_param_tmp_125023,
                             "mem_param_tmp_125023") != 0)
                return 1;
            if (memblock_set(ctx, &mem_param_122262, &mem_param_tmp_125024,
                             "mem_param_tmp_125024") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_tmp_125024,
                               "mem_param_tmp_125024") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_param_tmp_125023,
                               "mem_param_tmp_125023") != 0)
                return 1;
            if (memblock_unref(ctx, &trend_l_mem_123478,
                               "trend_l_mem_123478") != 0)
                return 1;
            if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_123454,
                               "defunc_11_loess_l_res_mem_123454") != 0)
                return 1;
            if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_123453,
                               "defunc_11_loess_l_res_mem_123453") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_122945, "mem_122945") != 0)
                return 1;
            if (memblock_unref(ctx, &L_l_mem_122923, "L_l_mem_122923") != 0)
                return 1;
            if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_122899,
                               "defunc_11_loess_l_res_mem_122899") != 0)
                return 1;
            if (memblock_unref(ctx, &defunc_11_loess_l_res_mem_122898,
                               "defunc_11_loess_l_res_mem_122898") != 0)
                return 1;
        }
        loopres_ixfn_123492 = ctx_param_ext_122256;
        loopres_ixfn_123494 = ctx_param_ext_122258;
        if (memblock_set(ctx, &loopres_mem_123490, &mem_param_122254,
                         "mem_param_122254") != 0)
            return 1;
        if (memblock_set(ctx, &loopres_mem_123498, &mem_param_122262,
                         "mem_param_122262") != 0)
            return 1;
        
        bool cond_116542 = slt64(i_outer_115022, y_114943);
        int64_t sizze_116543;
        
        if (cond_116542) {
            sizze_116543 = n_114534;
        } else {
            sizze_116543 = loopz2081Uz2085Uz2089U_115023;
        }
        
        int64_t weights_l_ixfn_123728;
        
        if (cond_116542) {
            weights_l_ixfn_123728 = m_114533;
        } else {
            weights_l_ixfn_123728 = ctx_param_ext_122233;
        }
        
        int64_t weights_l_ixfn_123729;
        
        if (cond_116542) {
            weights_l_ixfn_123729 = n_114534;
        } else {
            weights_l_ixfn_123729 = ctx_param_ext_122234;
        }
        
        int64_t weights_l_ixfn_123730;
        
        if (cond_116542) {
            weights_l_ixfn_123730 = n_114534;
        } else {
            weights_l_ixfn_123730 = ctx_param_ext_122236;
        }
        
        int64_t weights_l_ixfn_123731;
        
        if (cond_116542) {
            weights_l_ixfn_123731 = (int64_t) 1;
        } else {
            weights_l_ixfn_123731 = ctx_param_ext_122238;
        }
        
        int64_t weights_l_ixfn_123732;
        
        if (cond_116542) {
            weights_l_ixfn_123732 = (int64_t) 0;
        } else {
            weights_l_ixfn_123732 = ctx_param_ext_122235;
        }
        
        struct memblock weights_l_mem_123733;
        
        weights_l_mem_123733.references = NULL;
        if (cond_116542) {
            if (mem_123520_cached_sizze_131120 < (size_t) bytes_122001) {
                mem_123520 = realloc(mem_123520, bytes_122001);
                mem_123520_cached_sizze_131120 = bytes_122001;
            }
            
            int64_t flat_tid_120974 = (int64_t) 0;
            int32_t num_tasks_130663;
            int64_t flat_tid_120976 = (int64_t) 0;
            struct futhark_mc_task_131836 futhark_mc_task_131836;
            
            futhark_mc_task_131836.ctx = ctx;
            futhark_mc_task_131836.free_m_114533 = m_114533;
            futhark_mc_task_131836.free_n_114534 = n_114534;
            futhark_mc_task_131836.free_Y_mem_121939 = Y_mem_121939.mem;
            futhark_mc_task_131836.free_bytes_121983 = bytes_121983;
            futhark_mc_task_131836.free_loopres_mem_123490 =
                loopres_mem_123490.mem;
            futhark_mc_task_131836.free_loopres_ixfn_123494 =
                loopres_ixfn_123494;
            futhark_mc_task_131836.free_loopres_mem_123498 =
                loopres_mem_123498.mem;
            futhark_mc_task_131836.free_mem_123520 = mem_123520;
            
            struct scheduler_segop futhark_mc_task_131836_task;
            
            futhark_mc_task_131836_task.args = &futhark_mc_task_131836;
            futhark_mc_task_131836_task.top_level_fn =
                futhark_mc_segmap_task_131837;
            futhark_mc_task_131836_task.name = "futhark_mc_segmap_task_131837";
            futhark_mc_task_131836_task.iterations = m_114533;
            futhark_mc_task_131836_task.task_time =
                &ctx->futhark_mc_segmap_task_131837_total_time;
            futhark_mc_task_131836_task.task_iter =
                &ctx->futhark_mc_segmap_task_131837_total_iter;
            futhark_mc_task_131836_task.sched = STATIC;
            futhark_mc_task_131836_task.nested_fn =
                futhark_mc_segmap_nested_task_131841;
            
            int futhark_mc_segmap_task_131837_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131836_task);
            
            if (futhark_mc_segmap_task_131837_err != 0) {
                err = 1;
                goto cleanup;
            }
            if (mem_123542_cached_sizze_131121 < (size_t) bytes_122001) {
                mem_123542 = realloc(mem_123542, bytes_122001);
                mem_123542_cached_sizze_131121 = bytes_122001;
            }
            
            int64_t flat_tid_120992 = (int64_t) 0;
            int32_t num_tasks_130695;
            int64_t flat_tid_120994 = (int64_t) 0;
            struct futhark_mc_task_131849 futhark_mc_task_131849;
            
            futhark_mc_task_131849.ctx = ctx;
            futhark_mc_task_131849.free_m_114533 = m_114533;
            futhark_mc_task_131849.free_n_114534 = n_114534;
            futhark_mc_task_131849.free_mem_121979 = mem_121979;
            futhark_mc_task_131849.free_bytes_121983 = bytes_121983;
            futhark_mc_task_131849.free_mem_123520 = mem_123520;
            futhark_mc_task_131849.free_mem_123542 = mem_123542;
            
            struct scheduler_segop futhark_mc_task_131849_task;
            
            futhark_mc_task_131849_task.args = &futhark_mc_task_131849;
            futhark_mc_task_131849_task.top_level_fn =
                futhark_mc_segmap_task_131850;
            futhark_mc_task_131849_task.name = "futhark_mc_segmap_task_131850";
            futhark_mc_task_131849_task.iterations = m_114533;
            futhark_mc_task_131849_task.task_time =
                &ctx->futhark_mc_segmap_task_131850_total_time;
            futhark_mc_task_131849_task.task_iter =
                &ctx->futhark_mc_segmap_task_131850_total_iter;
            futhark_mc_task_131849_task.sched = STATIC;
            futhark_mc_task_131849_task.nested_fn =
                futhark_mc_segmap_nested_task_131854;
            
            int futhark_mc_segmap_task_131850_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131849_task);
            
            if (futhark_mc_segmap_task_131850_err != 0) {
                err = 1;
                goto cleanup;
            }
            
            int32_t iters_116571;
            
            if (empty_slice_114994) {
                iters_116571 = 0;
            } else {
                iters_116571 = 16;
            }
            
            bool loop_nonempty_116572 = slt32(0, iters_116571);
            bool loop_not_taken_116573 = !loop_nonempty_116572;
            bool protect_assert_disj_116574 = bounds_check_114613 ||
                 loop_not_taken_116573;
            bool index_certs_116575;
            
            if (!protect_assert_disj_116574) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", i_114610,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #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:334:35-77\n   #5  stl.fut:333:28-335:40\n   #6  stl.fut:394:3-405:33\n   #7  stl.fut:381:1-405:33\n");
                if (memblock_unref(ctx, &weights_l_mem_123733,
                                   "weights_l_mem_123733") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_122262,
                                   "mem_param_122262") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_122254,
                                   "mem_param_122254") != 0)
                    return 1;
                if (memblock_unref(ctx, &loopres_mem_123498,
                                   "loopres_mem_123498") != 0)
                    return 1;
                if (memblock_unref(ctx, &loopres_mem_123490,
                                   "loopres_mem_123490") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_122240,
                                   "mem_param_122240") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_122232,
                                   "mem_param_122232") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_122224,
                                   "mem_param_122224") != 0)
                    return 1;
                if (memblock_unref(ctx, &stl_res_mem_123757,
                                   "stl_res_mem_123757") != 0)
                    return 1;
                if (memblock_unref(ctx, &stl_res_mem_123749,
                                   "stl_res_mem_123749") != 0)
                    return 1;
                if (memblock_unref(ctx, &stl_res_mem_123741,
                                   "stl_res_mem_123741") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
                    return 1;
                if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
                    return 1;
                if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
                    return 1;
                if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
                    return 1;
                return 1;
            }
            if (mem_123696_cached_sizze_131122 < (size_t) bytes_122001) {
                mem_123696 = realloc(mem_123696, bytes_122001);
                mem_123696_cached_sizze_131122 = bytes_122001;
            }
            
            int64_t double_buffer_sizze_123840 = (int64_t) 4 * n_114534;
            int64_t double_buffer_sizze_123844 = (int64_t) 4 * n_114534;
            int64_t flat_tid_121008 = (int64_t) 0;
            int32_t num_tasks_130728;
            int64_t flat_tid_121010 = (int64_t) 0;
            struct futhark_mc_task_131862 futhark_mc_task_131862;
            
            futhark_mc_task_131862.ctx = ctx;
            futhark_mc_task_131862.free_m_114533 = m_114533;
            futhark_mc_task_131862.free_n_114534 = n_114534;
            futhark_mc_task_131862.free_i_114610 = i_114610;
            futhark_mc_task_131862.free_iters_116571 = iters_116571;
            futhark_mc_task_131862.free_bytes_121940 = bytes_121940;
            futhark_mc_task_131862.free_bytes_121983 = bytes_121983;
            futhark_mc_task_131862.free_mem_123542 = mem_123542;
            futhark_mc_task_131862.free_mem_123696 = mem_123696;
            futhark_mc_task_131862.free_double_buffer_sizze_123840 =
                double_buffer_sizze_123840;
            futhark_mc_task_131862.free_double_buffer_sizze_123844 =
                double_buffer_sizze_123844;
            
            struct scheduler_segop futhark_mc_task_131862_task;
            
            futhark_mc_task_131862_task.args = &futhark_mc_task_131862;
            futhark_mc_task_131862_task.top_level_fn =
                futhark_mc_segmap_task_131863;
            futhark_mc_task_131862_task.name = "futhark_mc_segmap_task_131863";
            futhark_mc_task_131862_task.iterations = m_114533;
            futhark_mc_task_131862_task.task_time =
                &ctx->futhark_mc_segmap_task_131863_total_time;
            futhark_mc_task_131862_task.task_iter =
                &ctx->futhark_mc_segmap_task_131863_total_iter;
            futhark_mc_task_131862_task.sched = STATIC;
            futhark_mc_task_131862_task.nested_fn =
                futhark_mc_segmap_nested_task_131873;
            
            int futhark_mc_segmap_task_131863_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131862_task);
            
            if (futhark_mc_segmap_task_131863_err != 0) {
                err = 1;
                goto cleanup;
            }
            
            bool empty_slice_116689 = j_m_i_115007 == (int64_t) 0;
            int64_t m_116690 = sub64(j_m_i_115007, (int64_t) 1);
            int64_t i_p_m_t_s_116691 = add64(stl_res_114604, m_116690);
            bool zzero_leq_i_p_m_t_s_116692 = sle64((int64_t) 0,
                                                    i_p_m_t_s_116691);
            bool i_p_m_t_s_leq_w_116693 = slt64(i_p_m_t_s_116691, n_114534);
            bool zzero_lte_i_116694 = sle64((int64_t) 0, stl_res_114604);
            bool i_lte_j_116695 = sle64(stl_res_114604, stl_res_114605);
            bool y_116696 = i_p_m_t_s_leq_w_116693 && zzero_lte_i_116694;
            bool y_116697 = zzero_leq_i_p_m_t_s_116692 && y_116696;
            bool y_116698 = i_lte_j_116695 && y_116697;
            bool forwards_ok_116699 = zzero_lte_i_116694 && y_116698;
            bool ok_or_empty_116700 = empty_slice_116689 || forwards_ok_116699;
            bool index_certs_116701;
            
            if (!ok_or_empty_116700) {
                ctx->error =
                    msgprintf("Error: %s%lld%s%lld%s%lld%s\n\nBacktrace:\n%s",
                              "Index [", stl_res_114604, ":", stl_res_114605,
                              "] out of bounds for array of shape [", n_114534,
                              "].",
                              "-> #0  stl.fut:340:33-51\n   #1  stl.fut:338:13-345:28\n   #2  stl.fut:394:3-405:33\n   #3  stl.fut:381:1-405:33\n");
                if (memblock_unref(ctx, &weights_l_mem_123733,
                                   "weights_l_mem_123733") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_122262,
                                   "mem_param_122262") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_122254,
                                   "mem_param_122254") != 0)
                    return 1;
                if (memblock_unref(ctx, &loopres_mem_123498,
                                   "loopres_mem_123498") != 0)
                    return 1;
                if (memblock_unref(ctx, &loopres_mem_123490,
                                   "loopres_mem_123490") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_122240,
                                   "mem_param_122240") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_122232,
                                   "mem_param_122232") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_param_122224,
                                   "mem_param_122224") != 0)
                    return 1;
                if (memblock_unref(ctx, &stl_res_mem_123757,
                                   "stl_res_mem_123757") != 0)
                    return 1;
                if (memblock_unref(ctx, &stl_res_mem_123749,
                                   "stl_res_mem_123749") != 0)
                    return 1;
                if (memblock_unref(ctx, &stl_res_mem_123741,
                                   "stl_res_mem_123741") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
                    return 1;
                if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
                    return 1;
                if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
                    return 1;
                if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
                    return 1;
                if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
                    return 1;
                return 1;
            }
            
            int64_t binop_y_123698 = (int64_t) 4 * m_114533;
            int64_t bytes_123697 = smax64((int64_t) 0, binop_y_123698);
            
            if (mem_123699_cached_sizze_131123 < (size_t) bytes_123697) {
                mem_123699 = realloc(mem_123699, bytes_123697);
                mem_123699_cached_sizze_131123 = bytes_123697;
            }
            if (mem_123702_cached_sizze_131124 < (size_t) bytes_123697) {
                mem_123702 = realloc(mem_123702, bytes_123697);
                mem_123702_cached_sizze_131124 = bytes_123697;
            }
            if (mem_123705_cached_sizze_131125 < (size_t) bytes_123697) {
                mem_123705 = realloc(mem_123705, bytes_123697);
                mem_123705_cached_sizze_131125 = bytes_123697;
            }
            
            int64_t flat_tid_121101 = (int64_t) 0;
            int32_t num_tasks_130994;
            int64_t flat_tid_121103 = (int64_t) 0;
            struct futhark_mc_task_131897 futhark_mc_task_131897;
            
            futhark_mc_task_131897.ctx = ctx;
            futhark_mc_task_131897.free_m_114533 = m_114533;
            futhark_mc_task_131897.free_n_114534 = n_114534;
            futhark_mc_task_131897.free_stl_res_114604 = stl_res_114604;
            futhark_mc_task_131897.free_j_m_i_115007 = j_m_i_115007;
            futhark_mc_task_131897.free_mem_123696 = mem_123696;
            futhark_mc_task_131897.free_mem_123699 = mem_123699;
            futhark_mc_task_131897.free_mem_123702 = mem_123702;
            futhark_mc_task_131897.free_mem_123705 = mem_123705;
            
            struct scheduler_segop futhark_mc_task_131897_task;
            
            futhark_mc_task_131897_task.args = &futhark_mc_task_131897;
            futhark_mc_task_131897_task.top_level_fn =
                futhark_mc_segmap_task_131898;
            futhark_mc_task_131897_task.name = "futhark_mc_segmap_task_131898";
            futhark_mc_task_131897_task.iterations = m_114533;
            futhark_mc_task_131897_task.task_time =
                &ctx->futhark_mc_segmap_task_131898_total_time;
            futhark_mc_task_131897_task.task_iter =
                &ctx->futhark_mc_segmap_task_131898_total_iter;
            futhark_mc_task_131897_task.sched = STATIC;
            futhark_mc_task_131897_task.nested_fn =
                futhark_mc_segmap_nested_task_131901;
            
            int futhark_mc_segmap_task_131898_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131897_task);
            
            if (futhark_mc_segmap_task_131898_err != 0) {
                err = 1;
                goto cleanup;
            }
            
            struct memblock mem_123727;
            
            mem_123727.references = NULL;
            if (memblock_alloc(ctx, &mem_123727, bytes_122001, "mem_123727")) {
                err = 1;
                goto cleanup;
            }
            
            int64_t flat_tid_121116 = (int64_t) 0;
            int32_t num_tasks_131021;
            int64_t flat_tid_121118 = (int64_t) 0;
            struct futhark_mc_task_131909 futhark_mc_task_131909;
            
            futhark_mc_task_131909.ctx = ctx;
            futhark_mc_task_131909.free_m_114533 = m_114533;
            futhark_mc_task_131909.free_n_114534 = n_114534;
            futhark_mc_task_131909.free_bytes_121983 = bytes_121983;
            futhark_mc_task_131909.free_mem_123520 = mem_123520;
            futhark_mc_task_131909.free_mem_123699 = mem_123699;
            futhark_mc_task_131909.free_mem_123702 = mem_123702;
            futhark_mc_task_131909.free_mem_123705 = mem_123705;
            futhark_mc_task_131909.free_mem_123727 = mem_123727.mem;
            
            struct scheduler_segop futhark_mc_task_131909_task;
            
            futhark_mc_task_131909_task.args = &futhark_mc_task_131909;
            futhark_mc_task_131909_task.top_level_fn =
                futhark_mc_segmap_task_131910;
            futhark_mc_task_131909_task.name = "futhark_mc_segmap_task_131910";
            futhark_mc_task_131909_task.iterations = m_114533;
            futhark_mc_task_131909_task.task_time =
                &ctx->futhark_mc_segmap_task_131910_total_time;
            futhark_mc_task_131909_task.task_iter =
                &ctx->futhark_mc_segmap_task_131910_total_iter;
            futhark_mc_task_131909_task.sched = STATIC;
            futhark_mc_task_131909_task.nested_fn =
                futhark_mc_segmap_nested_task_131914;
            
            int futhark_mc_segmap_task_131910_err =
                scheduler_prepare_task(&ctx->scheduler,
                                       &futhark_mc_task_131909_task);
            
            if (futhark_mc_segmap_task_131910_err != 0) {
                err = 1;
                goto cleanup;
            }
            if (memblock_set(ctx, &weights_l_mem_123733, &mem_123727,
                             "mem_123727") != 0)
                return 1;
            if (memblock_unref(ctx, &mem_123727, "mem_123727") != 0)
                return 1;
        } else {
            if (memblock_set(ctx, &weights_l_mem_123733, &mem_param_122240,
                             "mem_param_122240") != 0)
                return 1;
        }
        
        int64_t loopz2081Uz2085Uz2089U_tmp_125006 = sizze_116543;
        int64_t ctx_param_ext_tmp_125007 = loopres_ixfn_123492;
        int64_t ctx_param_ext_tmp_125008 = loopres_ixfn_123494;
        int64_t ctx_param_ext_tmp_125009 = weights_l_ixfn_123728;
        int64_t ctx_param_ext_tmp_125010 = weights_l_ixfn_123729;
        int64_t ctx_param_ext_tmp_125011 = weights_l_ixfn_123732;
        int64_t ctx_param_ext_tmp_125012 = weights_l_ixfn_123730;
        int64_t ctx_param_ext_tmp_125013 = weights_l_ixfn_123731;
        int64_t ctx_param_ext_tmp_125014 = sizze_116543;
        struct memblock mem_param_tmp_125015;
        
        mem_param_tmp_125015.references = NULL;
        if (memblock_set(ctx, &mem_param_tmp_125015, &loopres_mem_123490,
                         "loopres_mem_123490") != 0)
            return 1;
        
        struct memblock mem_param_tmp_125016;
        
        mem_param_tmp_125016.references = NULL;
        if (memblock_set(ctx, &mem_param_tmp_125016, &loopres_mem_123498,
                         "loopres_mem_123498") != 0)
            return 1;
        
        struct memblock mem_param_tmp_125017;
        
        mem_param_tmp_125017.references = NULL;
        if (memblock_set(ctx, &mem_param_tmp_125017, &weights_l_mem_123733,
                         "weights_l_mem_123733") != 0)
            return 1;
        loopz2081Uz2085Uz2089U_115023 = loopz2081Uz2085Uz2089U_tmp_125006;
        ctx_param_ext_122226 = ctx_param_ext_tmp_125007;
        ctx_param_ext_122228 = ctx_param_ext_tmp_125008;
        ctx_param_ext_122233 = ctx_param_ext_tmp_125009;
        ctx_param_ext_122234 = ctx_param_ext_tmp_125010;
        ctx_param_ext_122235 = ctx_param_ext_tmp_125011;
        ctx_param_ext_122236 = ctx_param_ext_tmp_125012;
        ctx_param_ext_122238 = ctx_param_ext_tmp_125013;
        ctx_param_ext_122239 = ctx_param_ext_tmp_125014;
        if (memblock_set(ctx, &mem_param_122224, &mem_param_tmp_125015,
                         "mem_param_tmp_125015") != 0)
            return 1;
        if (memblock_set(ctx, &mem_param_122232, &mem_param_tmp_125016,
                         "mem_param_tmp_125016") != 0)
            return 1;
        if (memblock_set(ctx, &mem_param_122240, &mem_param_tmp_125017,
                         "mem_param_tmp_125017") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_tmp_125017,
                           "mem_param_tmp_125017") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_tmp_125016,
                           "mem_param_tmp_125016") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_tmp_125015,
                           "mem_param_tmp_125015") != 0)
            return 1;
        if (memblock_unref(ctx, &weights_l_mem_123733,
                           "weights_l_mem_123733") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_122262, "mem_param_122262") != 0)
            return 1;
        if (memblock_unref(ctx, &mem_param_122254, "mem_param_122254") != 0)
            return 1;
        if (memblock_unref(ctx, &loopres_mem_123498, "loopres_mem_123498") != 0)
            return 1;
        if (memblock_unref(ctx, &loopres_mem_123490, "loopres_mem_123490") != 0)
            return 1;
    }
    sizze_115018 = loopz2081Uz2085Uz2089U_115023;
    stl_res_ixfn_123743 = ctx_param_ext_122226;
    stl_res_ixfn_123745 = ctx_param_ext_122228;
    stl_res_ixfn_123750 = ctx_param_ext_122233;
    stl_res_ixfn_123751 = ctx_param_ext_122234;
    stl_res_ixfn_123752 = ctx_param_ext_122235;
    stl_res_ixfn_123753 = ctx_param_ext_122236;
    stl_res_ixfn_123755 = ctx_param_ext_122238;
    stl_res_ixfn_123756 = ctx_param_ext_122239;
    if (memblock_set(ctx, &stl_res_mem_123741, &mem_param_122224,
                     "mem_param_122224") != 0)
        return 1;
    if (memblock_set(ctx, &stl_res_mem_123749, &mem_param_122232,
                     "mem_param_122232") != 0)
        return 1;
    if (memblock_set(ctx, &stl_res_mem_123757, &mem_param_122240,
                     "mem_param_122240") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
        return 1;
    
    struct memblock mem_123779;
    
    mem_123779.references = NULL;
    if (memblock_alloc(ctx, &mem_123779, bytes_122001, "mem_123779")) {
        err = 1;
        goto cleanup;
    }
    
    int64_t flat_tid_121144 = (int64_t) 0;
    int32_t num_tasks_131076;
    int64_t flat_tid_121146 = (int64_t) 0;
    struct futhark_mc_task_131922 futhark_mc_task_131922;
    
    futhark_mc_task_131922.ctx = ctx;
    futhark_mc_task_131922.free_m_114533 = m_114533;
    futhark_mc_task_131922.free_n_114534 = n_114534;
    futhark_mc_task_131922.free_Y_mem_121939 = Y_mem_121939.mem;
    futhark_mc_task_131922.free_bytes_121983 = bytes_121983;
    futhark_mc_task_131922.free_stl_res_mem_123741 = stl_res_mem_123741.mem;
    futhark_mc_task_131922.free_stl_res_ixfn_123745 = stl_res_ixfn_123745;
    futhark_mc_task_131922.free_stl_res_mem_123749 = stl_res_mem_123749.mem;
    futhark_mc_task_131922.free_mem_123779 = mem_123779.mem;
    
    struct scheduler_segop futhark_mc_task_131922_task;
    
    futhark_mc_task_131922_task.args = &futhark_mc_task_131922;
    futhark_mc_task_131922_task.top_level_fn = futhark_mc_segmap_task_131923;
    futhark_mc_task_131922_task.name = "futhark_mc_segmap_task_131923";
    futhark_mc_task_131922_task.iterations = m_114533;
    futhark_mc_task_131922_task.task_time =
        &ctx->futhark_mc_segmap_task_131923_total_time;
    futhark_mc_task_131922_task.task_iter =
        &ctx->futhark_mc_segmap_task_131923_total_iter;
    futhark_mc_task_131922_task.sched = STATIC;
    futhark_mc_task_131922_task.nested_fn =
        futhark_mc_segmap_nested_task_131927;
    
    int futhark_mc_segmap_task_131923_err =
        scheduler_prepare_task(&ctx->scheduler, &futhark_mc_task_131922_task);
    
    if (futhark_mc_segmap_task_131923_err != 0) {
        err = 1;
        goto cleanup;
    }
    
    struct memblock mem_123783;
    
    mem_123783.references = NULL;
    if (memblock_alloc(ctx, &mem_123783, bytes_122001, "mem_123783")) {
        err = 1;
        goto cleanup;
    }
    memmove(mem_123783.mem + (int64_t) 0, stl_res_mem_123741.mem + (int64_t) 0,
            m_114533 * n_114534 * (int64_t) 4);
    if (memblock_unref(ctx, &stl_res_mem_123741, "stl_res_mem_123741") != 0)
        return 1;
    
    struct memblock mem_123788;
    
    mem_123788.references = NULL;
    if (memblock_alloc(ctx, &mem_123788, bytes_122001, "mem_123788")) {
        err = 1;
        goto cleanup;
    }
    memmove(mem_123788.mem + (int64_t) 0, stl_res_mem_123749.mem + (int64_t) 0,
            m_114533 * n_114534 * (int64_t) 4);
    if (memblock_unref(ctx, &stl_res_mem_123749, "stl_res_mem_123749") != 0)
        return 1;
    if (memblock_set(ctx, &out_mem_123850, &mem_123783, "mem_123783") != 0)
        return 1;
    if (memblock_set(ctx, &out_mem_123851, &mem_123788, "mem_123788") != 0)
        return 1;
    if (memblock_set(ctx, &out_mem_123852, &mem_123779, "mem_123779") != 0)
        return 1;
    (*out_mem_p_131101).references = NULL;
    if (memblock_set(ctx, &*out_mem_p_131101, &out_mem_123850,
                     "out_mem_123850") != 0)
        return 1;
    (*out_mem_p_131102).references = NULL;
    if (memblock_set(ctx, &*out_mem_p_131102, &out_mem_123851,
                     "out_mem_123851") != 0)
        return 1;
    (*out_mem_p_131103).references = NULL;
    if (memblock_set(ctx, &*out_mem_p_131103, &out_mem_123852,
                     "out_mem_123852") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_123788, "mem_123788") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_123783, "mem_123783") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_123779, "mem_123779") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_param_122240, "mem_param_122240") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_param_122232, "mem_param_122232") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_param_122224, "mem_param_122224") != 0)
        return 1;
    if (memblock_unref(ctx, &stl_res_mem_123757, "stl_res_mem_123757") != 0)
        return 1;
    if (memblock_unref(ctx, &stl_res_mem_123749, "stl_res_mem_123749") != 0)
        return 1;
    if (memblock_unref(ctx, &stl_res_mem_123741, "stl_res_mem_123741") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_122216, "mem_122216") != 0)
        return 1;
    if (memblock_unref(ctx, &mem_122212, "mem_122212") != 0)
        return 1;
    if (memblock_unref(ctx, &out_mem_123852, "out_mem_123852") != 0)
        return 1;
    if (memblock_unref(ctx, &out_mem_123851, "out_mem_123851") != 0)
        return 1;
    if (memblock_unref(ctx, &out_mem_123850, "out_mem_123850") != 0)
        return 1;
    
  cleanup:
    { }
    free(mem_121979);
    free(mem_121982);
    free(mem_122004);
    free(mem_122026);
    free(mem_122048);
    free(mem_122124);
    free(mem_122128);
    free(mem_122204);
    free(mem_122208);
    free(mem_122284);
    free(mem_122306);
    free(mem_122328);
    free(mem_122386);
    free(mem_122426);
    free(mem_122430);
    free(mem_122985);
    free(mem_123520);
    free(mem_123542);
    free(mem_123696);
    free(mem_123699);
    free(mem_123702);
    free(mem_123705);
    return err;
}
int futhark_entry_main(struct futhark_context *ctx,
                       struct futhark_f32_2d **out0,
                       struct futhark_f32_2d **out1,
                       struct futhark_f32_2d **out2, const
                       struct futhark_f32_2d *in0, const int64_t in1, const
                       int64_t in2, const int64_t in3, const int64_t in4, const
                       int64_t in5, const int64_t in6, const int64_t in7, const
                       int64_t in8, const int64_t in9, const int64_t in10, const
                       int64_t in11)
{
    struct memblock Y_mem_121939;
    
    Y_mem_121939.references = NULL;
    
    int64_t m_114533;
    int64_t n_114534;
    int64_t n_p_114536;
    int64_t t_window_114537;
    int64_t l_window_114538;
    int64_t t_degree_114539;
    int64_t l_degree_114540;
    int64_t t_jump_114541;
    int64_t l_jump_114542;
    int64_t inner_114543;
    int64_t outer_114544;
    int64_t jump_threshold_114545;
    int64_t max_group_sizze_114546;
    struct memblock out_mem_123850;
    
    out_mem_123850.references = NULL;
    
    struct memblock out_mem_123851;
    
    out_mem_123851.references = NULL;
    
    struct memblock out_mem_123852;
    
    out_mem_123852.references = NULL;
    
    int ret = 0;
    
    lock_lock(&ctx->lock);
    worker_local = &ctx->scheduler.workers[0];
    Y_mem_121939 = in0->mem;
    m_114533 = in0->shape[0];
    n_114534 = in0->shape[1];
    n_p_114536 = in1;
    t_window_114537 = in2;
    l_window_114538 = in3;
    t_degree_114539 = in4;
    l_degree_114540 = in5;
    t_jump_114541 = in6;
    l_jump_114542 = in7;
    inner_114543 = in8;
    outer_114544 = in9;
    jump_threshold_114545 = in10;
    max_group_sizze_114546 = in11;
    if (!((m_114533 == in0->shape[0] && n_114534 == in0->shape[1]) && (true &&
                                                                       (true &&
                                                                        (true &&
                                                                         (true &&
                                                                          (true &&
                                                                           (true &&
                                                                            (true &&
                                                                             (true &&
                                                                              (true &&
                                                                               (true &&
                                                                                true)))))))))))) {
        ret = 1;
        if (!ctx->error)
            ctx->error =
                msgprintf("Error: entry point arguments have invalid sizes.\n");
    } else {
        ret = futrts_entry_main(ctx, &out_mem_123850, &out_mem_123851,
                                &out_mem_123852, Y_mem_121939, m_114533,
                                n_114534, n_p_114536, t_window_114537,
                                l_window_114538, t_degree_114539,
                                l_degree_114540, t_jump_114541, l_jump_114542,
                                inner_114543, outer_114544,
                                jump_threshold_114545, max_group_sizze_114546);
        if (ret == 0) {
            assert((*out0 =
                    (struct futhark_f32_2d *) malloc(sizeof(struct futhark_f32_2d))) !=
                NULL);
            (*out0)->mem = out_mem_123850;
            (*out0)->shape[0] = m_114533;
            (*out0)->shape[1] = n_114534;
            assert((*out1 =
                    (struct futhark_f32_2d *) malloc(sizeof(struct futhark_f32_2d))) !=
                NULL);
            (*out1)->mem = out_mem_123851;
            (*out1)->shape[0] = m_114533;
            (*out1)->shape[1] = n_114534;
            assert((*out2 =
                    (struct futhark_f32_2d *) malloc(sizeof(struct futhark_f32_2d))) !=
                NULL);
            (*out2)->mem = out_mem_123852;
            (*out2)->shape[0] = m_114533;
            (*out2)->shape[1] = n_114534;
        }
    }
    lock_unlock(&ctx->lock);
    return ret;
}
