Problem 215

Crack-free walls 32 x 10.

Answer806844323190414
Output806844323190414
StatusPASS
Native helperno
Runtime0 ms
Peak memory44752 KB
Time complexityO(n^3) (estimated)
Space complexityO(n^2) (estimated)

Performance comparison

MetricOur solutionBest known
Time complexityO(n^3)O(n^2)
Space complexityO(n^2)O(n^2)
ApproachFlow solutionCombinatorial or DP counting
VerdictSuboptimal

Flow source

# Project Euler 215
# Crack-free walls 32 x 10.

extern {
    function calloc(n: i64, size: i64) -> ptr<void>
    function free(p: ptr<void>) -> void
}

let mut ALL_ROWS: ptr<i64> = null
let mut ROW_LEN: ptr<i32> = null
let mut ROW_CRACKS: ptr<i32> = null
let mut NRC: i32 = 0
let mut WIDTH: i32 = 32

function gen_rows(pos: i32, mask: i64, ncracks: i32) -> void {
    if pos == WIDTH {
        ALL_ROWS[NRC] = mask
        ROW_LEN[NRC] = ncracks
        # store cracks list packed? use separate array ROW_CRACKS[NRC*40 + k]
        NRC = NRC + 1
        return
    }
    if pos > WIDTH { return }
    if pos + 2 <= WIDTH {
        let mut nmask: i64 = mask
        let mut nc: i32 = ncracks
        if pos + 2 < WIDTH {
            # crack at pos+2
            ROW_CRACKS[NRC * 40 + nc] = pos + 2  # WRONG - NRC changes
        }
        # Better approach: build recursively with temp buffer
    }
}

function main() -> i32 {
    # Implement via bitsets of crack positions
    let MAXR: i64 = 10000
    ALL_ROWS = calloc(MAXR, 8)
    let cracks: ptr<i32> = calloc(MAXR * 40, 4)
    let ncr: ptr<i32> = calloc(MAXR, 4)
    let tmp: ptr<i32> = calloc(40, 4)
    if ALL_ROWS == null || cracks == null || ncr == null || tmp == null { return 1 }

    # iterative stack simulation for generate
    # Use recursive helper with globals
    # Actually rewrite cleanly below in a second function via DFS stack arrays

    let stack_pos: ptr<i32> = calloc(40, 4)
    let stack_choice: ptr<i32> = calloc(40, 4)
    let stack_n: ptr<i32> = calloc(40, 4)
    # DFS
    let mut sp: i32 = 0
    stack_pos[0] = 0
    stack_choice[0] = 0  # 0=try2, 1=try3, 2=done
    stack_n[0] = 0
    let mut tc: i32 = 0

    while sp >= 0 {
        let pos: i32 = stack_pos[sp]
        let ch: i32 = stack_choice[sp]
        let tn: i32 = stack_n[sp]
        if pos == WIDTH {
            # commit
            let mut mask: i64 = 0
            let mut k: i32 = 0
            while k < tn {
                let c: i32 = tmp[k]
                cracks[NRC * 40 + k] = c
                mask = mask | (1 << c)
                k = k + 1
            }
            ncr[NRC] = tn
            ALL_ROWS[NRC] = mask
            NRC = NRC + 1
            sp = sp - 1
            continue
        }
        match ch {
            0 => {
                stack_choice[sp] = 1
                if pos + 2 <= WIDTH {
                    if pos + 2 < WIDTH {
                        tmp[tn] = pos + 2
                        stack_n[sp + 1] = tn + 1
                    } else {
                        stack_n[sp + 1] = tn
                    }
                    stack_pos[sp + 1] = pos + 2
                    stack_choice[sp + 1] = 0
                    sp = sp + 1
                }
            }
            1 => {
                stack_choice[sp] = 2
                if pos + 3 <= WIDTH {
                    if pos + 3 < WIDTH {
                        tmp[tn] = pos + 3
                        stack_n[sp + 1] = tn + 1
                    } else {
                        stack_n[sp + 1] = tn
                    }
                    stack_pos[sp + 1] = pos + 3
                    stack_choice[sp + 1] = 0
                    sp = sp + 1
                }
            }
            _ => {
                sp = sp - 1
            }
        }
    }

    # compatibility
    let compat: ptr<i32> = calloc((NRC as i64) * (NRC as i64), 4)
    let ncompat: ptr<i32> = calloc(NRC as i64, 4)
    let mut i: i32 = 0
    while i < NRC {
        let mut j: i32 = i + 1
        while j < NRC {
            if (ALL_ROWS[i] & ALL_ROWS[j]) == 0 {
                compat[(i as i64) * (NRC as i64) + (ncompat[i] as i64)] = j
                ncompat[i] = ncompat[i] + 1
                compat[(j as i64) * (NRC as i64) + (ncompat[j] as i64)] = i
                ncompat[j] = ncompat[j] + 1
            }
            j = j + 1
        }
        i = i + 1
    }

    let H: i32 = 10
    let dp: ptr<i64> = calloc((NRC as i64) * ((H + 1) as i64), 8)
    # dp[row_id][rows_left]
    i = 0
    while i < NRC {
        dp[(i as i64) * ((H + 1) as i64) + 1] = 1
        i = i + 1
    }
    let mut left: i32 = 2
    while left <= H {
        i = 0
        while i < NRC {
            let mut total: i64 = 0
            let mut k: i32 = 0
            while k < ncompat[i] {
                let j: i32 = compat[(i as i64) * (NRC as i64) + (k as i64)]
                total = total + dp[(j as i64) * ((H + 1) as i64) + ((left - 1) as i64)]
                k = k + 1
            }
            dp[(i as i64) * ((H + 1) as i64) + (left as i64)] = total
            i = i + 1
        }
        left = left + 1
    }
    let mut result: i64 = 0
    i = 0
    while i < NRC {
        result = result + dp[(i as i64) * ((H + 1) as i64) + (H as i64)]
        i = i + 1
    }
    printf("%lld\n", result)
    return 0
}

Generated C

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* Flow runtime helpers */
typedef struct flow_temp_node { struct flow_temp_node* next; } flow_temp_node;
static flow_temp_node* flow_temp_head = NULL;
static int flow_temp_atexit_set = 0;
__attribute__((unused)) static void flow_temp_free_all(void) {
    while (flow_temp_head) {
        flow_temp_node* n = flow_temp_head;
        flow_temp_head = n->next;
        free(n);
    }
}
__attribute__((unused)) static void* flow_temp_alloc(size_t nbytes) {
    flow_temp_node* node = (flow_temp_node*)malloc(sizeof(flow_temp_node) + nbytes);
    if (!node) return NULL;
    node->next = flow_temp_head;
    flow_temp_head = node;
    if (!flow_temp_atexit_set) {
        flow_temp_atexit_set = 1;
        atexit(flow_temp_free_all);
    }
    return (void*)(node + 1);
}
#ifndef FLOW_DIAG
#define FLOW_DIAG(msg) fprintf(stderr, "%s", (msg))
#endif
#ifndef FLOW_LOG
#define FLOW_LOG(fmt, ...) printf(fmt, __VA_ARGS__)
#endif
#ifndef FLOW_LOG_EMPTY
#define FLOW_LOG_EMPTY(fmt) printf(fmt)
#endif
static char* flow_strcat(const char* a, const char* b) {
    size_t la = strlen(a ? a : ""), lb = strlen(b ? b : "");
    char* r = (char*)flow_temp_alloc(la + lb + 1);
    if (!r) return NULL;
    if (la) memcpy(r, a, la);
    if (lb) memcpy(r + la, b, lb);
    r[la + lb] = '\0';
    return r;
}

#define __flow_in_arr(arr, val) __extension__ ({ \
    int _found = 0; \
    size_t _n = sizeof(arr)/sizeof((arr)[0]); \
    for (size_t _i = 0; _i < _n; _i++) { \
        if ((arr)[_i] == (val)) { _found = 1; break; } \
    } _found; })

/* Unified fault handler (MISRA #279) — override with -DFLOW_FAULT_HANDLER=fn */
#ifndef FLOW_FAULT_HANDLER
__attribute__((unused)) static inline void flow_fault_handler(const char* msg) {
    fprintf(stderr, "flow: %s\n", msg ? msg : "fault");
    abort();
#if defined(__GNUC__) || defined(__clang__)
    __builtin_unreachable();
#endif
}
#else
#define flow_fault_handler FLOW_FAULT_HANDLER
#endif
#define flow_div_by_zero_handler() flow_fault_handler("division by zero")
#define flow_shift_ub_handler() flow_fault_handler("invalid shift (amount out of range or left-shift of negative)")

#ifndef FLOW_CHECKED_DIV
#define FLOW_CHECKED_DIV(L, R) (((R) != 0) ? ((L) / (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_MOD
#define FLOW_CHECKED_MOD(L, R) (((R) != 0) ? ((L) % (R)) : (flow_div_by_zero_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHL
#define FLOW_CHECKED_SHL(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull)) && ((L) >= 0)) ? ((L) << (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif
#ifndef FLOW_CHECKED_SHR
#define FLOW_CHECKED_SHR(L, R) ((((R) >= 0) && ((unsigned long long)(R) < (sizeof(L) * 8ull))) ? ((L) >> (R)) : (flow_shift_ub_handler(), (L) * 0))
#endif

#include <math.h>

void* _ui_state = NULL;

static inline float i32_to_f32(int32_t v) { return (float)v; }

/* Host stub for @gpu kernels (device codegen replaces this). */
static inline int32_t gpu_thread_id(void) { return 0; }

void gen_rows_i32_i64_i32(int32_t pos, int64_t mask, int32_t ncracks);
int32_t main(void);

/* Module statics */
static int64_t* ALL_ROWS = NULL;
static int32_t* ROW_LEN = NULL;
static int32_t* ROW_CRACKS = NULL;
static int32_t NRC = 0;
static int32_t WIDTH = 32;



void gen_rows_i32_i64_i32(int32_t pos, int64_t mask, int32_t ncracks) {
    if (pos == WIDTH) {
        ALL_ROWS[NRC] = mask;
        ROW_LEN[NRC] = ncracks;
        NRC = (NRC + 1);
        return;
    }
    if (pos > WIDTH) {
        return;
    }
    if ((pos + 2) <= WIDTH) {
        int64_t nmask = mask;
        int32_t nc = ncracks;
        if ((pos + 2) < WIDTH) {
            ROW_CRACKS[((NRC * 40) + nc)] = (pos + 2);
        }
    }
}

int32_t main(void) {
    int64_t MAXR = 10000;
    ALL_ROWS = calloc(MAXR, 8);
    int32_t* cracks = (int32_t*)(calloc((MAXR * 40), 4));
    int32_t* ncr = (int32_t*)(calloc(MAXR, 4));
    int32_t* tmp = (int32_t*)(calloc(40, 4));
    if ((((ALL_ROWS == NULL || cracks == NULL) || ncr == NULL) || tmp == NULL)) {
        return 1;
    }
    int32_t* stack_pos = (int32_t*)(calloc(40, 4));
    int32_t* stack_choice = (int32_t*)(calloc(40, 4));
    int32_t* stack_n = (int32_t*)(calloc(40, 4));
    int32_t sp = 0;
    stack_pos[0] = 0;
    stack_choice[0] = 0;
    stack_n[0] = 0;
    int32_t tc = 0;
    while (sp >= 0) {
        int32_t pos = stack_pos[sp];
        int32_t ch = stack_choice[sp];
        int32_t tn = stack_n[sp];
        if (pos == WIDTH) {
            int64_t mask = 0;
            int32_t k = 0;
            while (k < tn) {
                int32_t c = tmp[k];
                cracks[((NRC * 40) + k)] = c;
                mask = (mask | FLOW_CHECKED_SHL((1), (c)));
                k = (k + 1);
            }
            ncr[NRC] = tn;
            ALL_ROWS[NRC] = mask;
            NRC = (NRC + 1);
            sp = (sp - 1);
            continue;
        }
        { // match block
            if ((ch) == 0) {
                stack_choice[sp] = 1;
                if ((pos + 2) <= WIDTH) {
                    if ((pos + 2) < WIDTH) {
                        tmp[tn] = (pos + 2);
                        stack_n[(sp + 1)] = (tn + 1);
                    } else {
                        stack_n[(sp + 1)] = tn;
                    }
                    stack_pos[(sp + 1)] = (pos + 2);
                    stack_choice[(sp + 1)] = 0;
                    sp = (sp + 1);
                }
            } else if ((ch) == 1) {
                stack_choice[sp] = 2;
                if ((pos + 3) <= WIDTH) {
                    if ((pos + 3) < WIDTH) {
                        tmp[tn] = (pos + 3);
                        stack_n[(sp + 1)] = (tn + 1);
                    } else {
                        stack_n[(sp + 1)] = tn;
                    }
                    stack_pos[(sp + 1)] = (pos + 3);
                    stack_choice[(sp + 1)] = 0;
                    sp = (sp + 1);
                }
            } else { // exhaustive
                sp = (sp - 1);
            }
        } // end match
    }
    int32_t* compat = (int32_t*)(calloc((((int64_t)(NRC)) * ((int64_t)(NRC))), 4));
    int32_t* ncompat = (int32_t*)(calloc(((int64_t)(NRC)), 4));
    int32_t i = 0;
    while (i < NRC) {
        int32_t j = (i + 1);
        while (j < NRC) {
            if ((ALL_ROWS[i] & ALL_ROWS[j]) == 0) {
                compat[((((int64_t)(i)) * ((int64_t)(NRC))) + ((int64_t)(ncompat[i])))] = j;
                ncompat[i] = (ncompat[i] + 1);
                compat[((((int64_t)(j)) * ((int64_t)(NRC))) + ((int64_t)(ncompat[j])))] = i;
                ncompat[j] = (ncompat[j] + 1);
            }
            j = (j + 1);
        }
        i = (i + 1);
    }
    int32_t H = 10;
    int64_t* dp = (int64_t*)(calloc((((int64_t)(NRC)) * ((int64_t)((H + 1)))), 8));
    i = 0;
    while (i < NRC) {
        dp[((((int64_t)(i)) * ((int64_t)((H + 1)))) + 1)] = 1;
        i = (i + 1);
    }
    int32_t left = 2;
    while (left <= H) {
        i = 0;
        while (i < NRC) {
            int64_t total = 0;
            int32_t k = 0;
            while (k < ncompat[i]) {
                int32_t j = compat[((((int64_t)(i)) * ((int64_t)(NRC))) + ((int64_t)(k)))];
                total = (total + dp[((((int64_t)(j)) * ((int64_t)((H + 1)))) + ((int64_t)((left - 1))))]);
                k = (k + 1);
            }
            dp[((((int64_t)(i)) * ((int64_t)((H + 1)))) + ((int64_t)(left)))] = total;
            i = (i + 1);
        }
        left = (left + 1);
    }
    int64_t result = 0;
    i = 0;
    while (i < NRC) {
        result = (result + dp[((((int64_t)(i)) * ((int64_t)((H + 1)))) + ((int64_t)(H)))]);
        i = (i + 1);
    }
    printf("%lld\n", result);
    return 0;
}

Generated MLIR

module {
  llvm.func @printf(!llvm.ptr, ...) -> i32
  llvm.mlir.global internal constant @str_0("%lld\n\00") {addr_space = 0 : i32} : !llvm.array<6 x i8>
  func.func private @calloc(i64, i64) -> !llvm.ptr
  func.func private @free(!llvm.ptr) -> ()
  // Module static: ALL_ROWS
  llvm.mlir.global internal @ALL_ROWS() {addr_space = 0 : i32} : !llvm.ptr {
    %0 = llvm.mlir.zero : !llvm.ptr
    llvm.return %0 : !llvm.ptr
  }
  // Module static: ROW_LEN
  llvm.mlir.global internal @ROW_LEN() {addr_space = 0 : i32} : !llvm.ptr {
    %1 = llvm.mlir.zero : !llvm.ptr
    llvm.return %1 : !llvm.ptr
  }
  // Module static: ROW_CRACKS
  llvm.mlir.global internal @ROW_CRACKS() {addr_space = 0 : i32} : !llvm.ptr {
    %2 = llvm.mlir.zero : !llvm.ptr
    llvm.return %2 : !llvm.ptr
  }
  // Module static: NRC
  llvm.mlir.global internal @NRC(0 : i32) : i32
  // Module static: WIDTH
  llvm.mlir.global internal @WIDTH(32 : i32) : i32
  func.func @gen_rows(%arg0: i32, %arg1: i64, %arg2: i32) -> () {
    %3 = llvm.mlir.addressof @WIDTH : !llvm.ptr
    %4 = llvm.load %3 : !llvm.ptr -> i32
    %5 = arith.cmpi eq, %arg0, %4 : i32
    cf.cond_br %5, ^bb0, ^bb1
    ^bb0:
      %6 = llvm.mlir.addressof @ALL_ROWS : !llvm.ptr
      %7 = llvm.load %6 : !llvm.ptr -> !llvm.ptr
      %8 = llvm.mlir.addressof @NRC : !llvm.ptr
      %9 = llvm.load %8 : !llvm.ptr -> i32
      %10 = arith.extsi %9 : i32 to i64
      %11 = llvm.getelementptr %7[%10] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %arg1, %11 : i64, !llvm.ptr
      %12 = llvm.mlir.addressof @ROW_LEN : !llvm.ptr
      %13 = llvm.load %12 : !llvm.ptr -> !llvm.ptr
      %14 = llvm.mlir.addressof @NRC : !llvm.ptr
      %15 = llvm.load %14 : !llvm.ptr -> i32
      %16 = arith.extsi %15 : i32 to i64
      %17 = llvm.getelementptr %13[%16] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      llvm.store %arg2, %17 : i32, !llvm.ptr
      %18 = llvm.mlir.addressof @NRC : !llvm.ptr
      %19 = llvm.load %18 : !llvm.ptr -> i32
      %20 = arith.constant 1 : i32
      %21 = arith.addi %19, %20 : i32
      %22 = llvm.mlir.addressof @NRC : !llvm.ptr
      llvm.store %21, %22 : i32, !llvm.ptr
      func.return
    ^bb1:
      cf.br ^bb2
    ^bb2:
    %23 = llvm.mlir.addressof @WIDTH : !llvm.ptr
    %24 = llvm.load %23 : !llvm.ptr -> i32
    %25 = arith.cmpi sgt, %arg0, %24 : i32
    cf.cond_br %25, ^bb3, ^bb4
    ^bb3:
      func.return
    ^bb4:
      cf.br ^bb5
    ^bb5:
    %26 = arith.constant 2 : i32
    %27 = arith.addi %arg0, %26 : i32
    %28 = llvm.mlir.addressof @WIDTH : !llvm.ptr
    %29 = llvm.load %28 : !llvm.ptr -> i32
    %30 = arith.cmpi sle, %27, %29 : i32
    cf.cond_br %30, ^bb6, ^bb7
    ^bb6:
      %31 = llvm.mlir.constant(1 : i64) : i64
      %32 = llvm.alloca %31 x i64 : (i64) -> !llvm.ptr
      llvm.store %arg1, %32 : i64, !llvm.ptr
      %33 = llvm.mlir.constant(1 : i64) : i64
      %34 = llvm.alloca %33 x i32 : (i64) -> !llvm.ptr
      llvm.store %arg2, %34 : i32, !llvm.ptr
      %35 = arith.constant 2 : i32
      %36 = arith.addi %arg0, %35 : i32
      %37 = llvm.mlir.addressof @WIDTH : !llvm.ptr
      %38 = llvm.load %37 : !llvm.ptr -> i32
      %39 = arith.cmpi slt, %36, %38 : i32
      cf.cond_br %39, ^bb9, ^bb10
      ^bb9:
        %40 = arith.constant 2 : i32
        %41 = arith.addi %arg0, %40 : i32
        %42 = llvm.mlir.addressof @ROW_CRACKS : !llvm.ptr
        %43 = llvm.load %42 : !llvm.ptr -> !llvm.ptr
        %44 = llvm.mlir.addressof @NRC : !llvm.ptr
        %45 = llvm.load %44 : !llvm.ptr -> i32
        %46 = arith.constant 40 : i32
        %47 = arith.muli %45, %46 : i32
        %48 = llvm.load %34 : !llvm.ptr -> i32
        %49 = arith.addi %47, %48 : i32
        %50 = arith.extsi %49 : i32 to i64
        %51 = llvm.getelementptr %43[%50] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %41, %51 : i32, !llvm.ptr
        cf.br ^bb11
      ^bb10:
        cf.br ^bb11
      ^bb11:
      cf.br ^bb8
    ^bb7:
      cf.br ^bb8
    ^bb8:
    func.return
  }
  func.func @main() -> i32 {
    %52 = arith.constant 10000 : i32
    %53 = arith.extsi %52 : i32 to i64
    %55 = arith.constant 8 : i32
    %56 = arith.extsi %55 : i32 to i64
    %54 = func.call @calloc(%53, %56) : (i64, i64) -> !llvm.ptr
    %57 = llvm.mlir.addressof @ALL_ROWS : !llvm.ptr
    llvm.store %54, %57 : !llvm.ptr, !llvm.ptr
    %59 = arith.constant 40 : i32
    %61 = arith.extsi %59 : i32 to i64
    %60 = arith.muli %53, %61 : i64
    %62 = arith.constant 4 : i32
    %63 = arith.extsi %62 : i32 to i64
    %58 = func.call @calloc(%60, %63) : (i64, i64) -> !llvm.ptr
    %65 = arith.constant 4 : i32
    %66 = arith.extsi %65 : i32 to i64
    %64 = func.call @calloc(%53, %66) : (i64, i64) -> !llvm.ptr
    %68 = arith.constant 40 : i32
    %69 = arith.constant 4 : i32
    %70 = arith.extsi %68 : i32 to i64
    %71 = arith.extsi %69 : i32 to i64
    %67 = func.call @calloc(%70, %71) : (i64, i64) -> !llvm.ptr
    %72 = llvm.mlir.addressof @ALL_ROWS : !llvm.ptr
    %73 = llvm.load %72 : !llvm.ptr -> !llvm.ptr
    %74 = llvm.mlir.zero : !llvm.ptr
    %75 = llvm.icmp "eq" %73, %74 : !llvm.ptr
    %76 = scf.if %75 -> (i1) {
      %77 = arith.constant true
      scf.yield %77 : i1
    } else {
      %78 = llvm.mlir.zero : !llvm.ptr
      %79 = llvm.icmp "eq" %58, %78 : !llvm.ptr
      scf.yield %79 : i1
    }
    %80 = scf.if %76 -> (i1) {
      %81 = arith.constant true
      scf.yield %81 : i1
    } else {
      %82 = llvm.mlir.zero : !llvm.ptr
      %83 = llvm.icmp "eq" %64, %82 : !llvm.ptr
      scf.yield %83 : i1
    }
    %84 = scf.if %80 -> (i1) {
      %85 = arith.constant true
      scf.yield %85 : i1
    } else {
      %86 = llvm.mlir.zero : !llvm.ptr
      %87 = llvm.icmp "eq" %67, %86 : !llvm.ptr
      scf.yield %87 : i1
    }
    cf.cond_br %84, ^bb12, ^bb13
    ^bb12:
      %88 = arith.constant 1 : i32
      func.return %88 : i32
    ^bb13:
      cf.br ^bb14
    ^bb14:
    %90 = arith.constant 40 : i32
    %91 = arith.constant 4 : i32
    %92 = arith.extsi %90 : i32 to i64
    %93 = arith.extsi %91 : i32 to i64
    %89 = func.call @calloc(%92, %93) : (i64, i64) -> !llvm.ptr
    %95 = arith.constant 40 : i32
    %96 = arith.constant 4 : i32
    %97 = arith.extsi %95 : i32 to i64
    %98 = arith.extsi %96 : i32 to i64
    %94 = func.call @calloc(%97, %98) : (i64, i64) -> !llvm.ptr
    %100 = arith.constant 40 : i32
    %101 = arith.constant 4 : i32
    %102 = arith.extsi %100 : i32 to i64
    %103 = arith.extsi %101 : i32 to i64
    %99 = func.call @calloc(%102, %103) : (i64, i64) -> !llvm.ptr
    %104 = arith.constant 0 : i32
    %105 = llvm.mlir.constant(1 : i64) : i64
    %106 = llvm.alloca %105 x i32 : (i64) -> !llvm.ptr
    llvm.store %104, %106 : i32, !llvm.ptr
    %107 = arith.constant 0 : i32
    %108 = arith.constant 0 : i32
    %109 = arith.extsi %108 : i32 to i64
    %110 = llvm.getelementptr %89[%109] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %107, %110 : i32, !llvm.ptr
    %111 = arith.constant 0 : i32
    %112 = arith.constant 0 : i32
    %113 = arith.extsi %112 : i32 to i64
    %114 = llvm.getelementptr %94[%113] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %111, %114 : i32, !llvm.ptr
    %115 = arith.constant 0 : i32
    %116 = arith.constant 0 : i32
    %117 = arith.extsi %116 : i32 to i64
    %118 = llvm.getelementptr %99[%117] : (!llvm.ptr, i64) -> !llvm.ptr, i32
    llvm.store %115, %118 : i32, !llvm.ptr
    %119 = arith.constant 0 : i32
    %120 = llvm.mlir.constant(1 : i64) : i64
    %121 = llvm.alloca %120 x i32 : (i64) -> !llvm.ptr
    llvm.store %119, %121 : i32, !llvm.ptr
    cf.br ^bb15
    ^bb15:
    %122 = llvm.load %106 : !llvm.ptr -> i32
    %123 = arith.constant 0 : i32
    %124 = arith.cmpi sge, %122, %123 : i32
    cf.cond_br %124, ^bb16, ^bb17
    ^bb16:
      %126 = llvm.load %106 : !llvm.ptr -> i32
      %127 = arith.extsi %126 : i32 to i64
      %128 = llvm.getelementptr %89[%127] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %125 = llvm.load %128 : !llvm.ptr -> i32
      %130 = llvm.load %106 : !llvm.ptr -> i32
      %131 = arith.extsi %130 : i32 to i64
      %132 = llvm.getelementptr %94[%131] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %129 = llvm.load %132 : !llvm.ptr -> i32
      %134 = llvm.load %106 : !llvm.ptr -> i32
      %135 = arith.extsi %134 : i32 to i64
      %136 = llvm.getelementptr %99[%135] : (!llvm.ptr, i64) -> !llvm.ptr, i32
      %133 = llvm.load %136 : !llvm.ptr -> i32
      %137 = llvm.mlir.addressof @WIDTH : !llvm.ptr
      %138 = llvm.load %137 : !llvm.ptr -> i32
      %139 = arith.cmpi eq, %125, %138 : i32
      cf.cond_br %139, ^bb18, ^bb19
      ^bb18:
        %140 = arith.constant 0 : i32
        %141 = arith.extsi %140 : i32 to i64
        %142 = llvm.mlir.constant(1 : i64) : i64
        %143 = llvm.alloca %142 x i64 : (i64) -> !llvm.ptr
        llvm.store %141, %143 : i64, !llvm.ptr
        %144 = arith.constant 0 : i32
        %145 = llvm.mlir.constant(1 : i64) : i64
        %146 = llvm.alloca %145 x i32 : (i64) -> !llvm.ptr
        llvm.store %144, %146 : i32, !llvm.ptr
        cf.br ^bb21
        ^bb21:
        %147 = llvm.load %146 : !llvm.ptr -> i32
        %148 = arith.cmpi slt, %147, %133 : i32
        cf.cond_br %148, ^bb22, ^bb23
        ^bb22:
          %150 = llvm.load %146 : !llvm.ptr -> i32
          %151 = arith.extsi %150 : i32 to i64
          %152 = llvm.getelementptr %67[%151] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %149 = llvm.load %152 : !llvm.ptr -> i32
          %153 = llvm.mlir.addressof @NRC : !llvm.ptr
          %154 = llvm.load %153 : !llvm.ptr -> i32
          %155 = arith.constant 40 : i32
          %156 = arith.muli %154, %155 : i32
          %157 = llvm.load %146 : !llvm.ptr -> i32
          %158 = arith.addi %156, %157 : i32
          %159 = arith.extsi %158 : i32 to i64
          %160 = llvm.getelementptr %58[%159] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %149, %160 : i32, !llvm.ptr
          %161 = llvm.load %143 : !llvm.ptr -> i64
          %162 = arith.constant 1 : i32
          %163 = arith.shli %162, %149 : i32
          %165 = arith.extsi %163 : i32 to i64
          %164 = arith.ori %161, %165 : i64
          llvm.store %164, %143 : i64, !llvm.ptr
          %166 = llvm.load %146 : !llvm.ptr -> i32
          %167 = arith.constant 1 : i32
          %168 = arith.addi %166, %167 : i32
          llvm.store %168, %146 : i32, !llvm.ptr
          cf.br ^bb21
        ^bb23:
        %169 = llvm.mlir.addressof @NRC : !llvm.ptr
        %170 = llvm.load %169 : !llvm.ptr -> i32
        %171 = arith.extsi %170 : i32 to i64
        %172 = llvm.getelementptr %64[%171] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %133, %172 : i32, !llvm.ptr
        %173 = llvm.load %143 : !llvm.ptr -> i64
        %174 = llvm.mlir.addressof @ALL_ROWS : !llvm.ptr
        %175 = llvm.load %174 : !llvm.ptr -> !llvm.ptr
        %176 = llvm.mlir.addressof @NRC : !llvm.ptr
        %177 = llvm.load %176 : !llvm.ptr -> i32
        %178 = arith.extsi %177 : i32 to i64
        %179 = llvm.getelementptr %175[%178] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %173, %179 : i64, !llvm.ptr
        %180 = llvm.mlir.addressof @NRC : !llvm.ptr
        %181 = llvm.load %180 : !llvm.ptr -> i32
        %182 = arith.constant 1 : i32
        %183 = arith.addi %181, %182 : i32
        %184 = llvm.mlir.addressof @NRC : !llvm.ptr
        llvm.store %183, %184 : i32, !llvm.ptr
        %185 = llvm.load %106 : !llvm.ptr -> i32
        %186 = arith.constant 1 : i32
        %187 = arith.subi %185, %186 : i32
        llvm.store %187, %106 : i32, !llvm.ptr
        cf.br ^bb15
      ^bb19:
        cf.br ^bb20
      ^bb20:
      %188 = arith.constant 0 : i32
      %189 = arith.cmpi eq, %129, %188 : i32
      cf.cond_br %189, ^bb24, ^bb25
^bb24:
        %190 = arith.constant 1 : i32
        %191 = llvm.load %106 : !llvm.ptr -> i32
        %192 = arith.extsi %191 : i32 to i64
        %193 = llvm.getelementptr %94[%192] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %190, %193 : i32, !llvm.ptr
        %194 = arith.constant 2 : i32
        %195 = arith.addi %125, %194 : i32
        %196 = llvm.mlir.addressof @WIDTH : !llvm.ptr
        %197 = llvm.load %196 : !llvm.ptr -> i32
        %198 = arith.cmpi sle, %195, %197 : i32
        cf.cond_br %198, ^bb31, ^bb32
        ^bb31:
          %199 = arith.constant 2 : i32
          %200 = arith.addi %125, %199 : i32
          %201 = llvm.mlir.addressof @WIDTH : !llvm.ptr
          %202 = llvm.load %201 : !llvm.ptr -> i32
          %203 = arith.cmpi slt, %200, %202 : i32
          cf.cond_br %203, ^bb34, ^bb35
          ^bb34:
            %204 = arith.constant 2 : i32
            %205 = arith.addi %125, %204 : i32
            %206 = arith.extsi %133 : i32 to i64
            %207 = llvm.getelementptr %67[%206] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            llvm.store %205, %207 : i32, !llvm.ptr
            %208 = arith.constant 1 : i32
            %209 = arith.addi %133, %208 : i32
            %210 = llvm.load %106 : !llvm.ptr -> i32
            %211 = arith.constant 1 : i32
            %212 = arith.addi %210, %211 : i32
            %213 = arith.extsi %212 : i32 to i64
            %214 = llvm.getelementptr %99[%213] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            llvm.store %209, %214 : i32, !llvm.ptr
            cf.br ^bb36
          ^bb35:
            %215 = llvm.load %106 : !llvm.ptr -> i32
            %216 = arith.constant 1 : i32
            %217 = arith.addi %215, %216 : i32
            %218 = arith.extsi %217 : i32 to i64
            %219 = llvm.getelementptr %99[%218] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            llvm.store %133, %219 : i32, !llvm.ptr
            cf.br ^bb36
          ^bb36:
          %220 = arith.constant 2 : i32
          %221 = arith.addi %125, %220 : i32
          %222 = llvm.load %106 : !llvm.ptr -> i32
          %223 = arith.constant 1 : i32
          %224 = arith.addi %222, %223 : i32
          %225 = arith.extsi %224 : i32 to i64
          %226 = llvm.getelementptr %89[%225] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %221, %226 : i32, !llvm.ptr
          %227 = arith.constant 0 : i32
          %228 = llvm.load %106 : !llvm.ptr -> i32
          %229 = arith.constant 1 : i32
          %230 = arith.addi %228, %229 : i32
          %231 = arith.extsi %230 : i32 to i64
          %232 = llvm.getelementptr %94[%231] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %227, %232 : i32, !llvm.ptr
          %233 = llvm.load %106 : !llvm.ptr -> i32
          %234 = arith.constant 1 : i32
          %235 = arith.addi %233, %234 : i32
          llvm.store %235, %106 : i32, !llvm.ptr
          cf.br ^bb33
        ^bb32:
          cf.br ^bb33
        ^bb33:
        cf.br ^bb30
^bb25:
      %236 = arith.constant 1 : i32
      %237 = arith.cmpi eq, %129, %236 : i32
      cf.cond_br %237, ^bb26, ^bb27
^bb26:
        %238 = arith.constant 2 : i32
        %239 = llvm.load %106 : !llvm.ptr -> i32
        %240 = arith.extsi %239 : i32 to i64
        %241 = llvm.getelementptr %94[%240] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        llvm.store %238, %241 : i32, !llvm.ptr
        %242 = arith.constant 3 : i32
        %243 = arith.addi %125, %242 : i32
        %244 = llvm.mlir.addressof @WIDTH : !llvm.ptr
        %245 = llvm.load %244 : !llvm.ptr -> i32
        %246 = arith.cmpi sle, %243, %245 : i32
        cf.cond_br %246, ^bb37, ^bb38
        ^bb37:
          %247 = arith.constant 3 : i32
          %248 = arith.addi %125, %247 : i32
          %249 = llvm.mlir.addressof @WIDTH : !llvm.ptr
          %250 = llvm.load %249 : !llvm.ptr -> i32
          %251 = arith.cmpi slt, %248, %250 : i32
          cf.cond_br %251, ^bb40, ^bb41
          ^bb40:
            %252 = arith.constant 3 : i32
            %253 = arith.addi %125, %252 : i32
            %254 = arith.extsi %133 : i32 to i64
            %255 = llvm.getelementptr %67[%254] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            llvm.store %253, %255 : i32, !llvm.ptr
            %256 = arith.constant 1 : i32
            %257 = arith.addi %133, %256 : i32
            %258 = llvm.load %106 : !llvm.ptr -> i32
            %259 = arith.constant 1 : i32
            %260 = arith.addi %258, %259 : i32
            %261 = arith.extsi %260 : i32 to i64
            %262 = llvm.getelementptr %99[%261] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            llvm.store %257, %262 : i32, !llvm.ptr
            cf.br ^bb42
          ^bb41:
            %263 = llvm.load %106 : !llvm.ptr -> i32
            %264 = arith.constant 1 : i32
            %265 = arith.addi %263, %264 : i32
            %266 = arith.extsi %265 : i32 to i64
            %267 = llvm.getelementptr %99[%266] : (!llvm.ptr, i64) -> !llvm.ptr, i32
            llvm.store %133, %267 : i32, !llvm.ptr
            cf.br ^bb42
          ^bb42:
          %268 = arith.constant 3 : i32
          %269 = arith.addi %125, %268 : i32
          %270 = llvm.load %106 : !llvm.ptr -> i32
          %271 = arith.constant 1 : i32
          %272 = arith.addi %270, %271 : i32
          %273 = arith.extsi %272 : i32 to i64
          %274 = llvm.getelementptr %89[%273] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %269, %274 : i32, !llvm.ptr
          %275 = arith.constant 0 : i32
          %276 = llvm.load %106 : !llvm.ptr -> i32
          %277 = arith.constant 1 : i32
          %278 = arith.addi %276, %277 : i32
          %279 = arith.extsi %278 : i32 to i64
          %280 = llvm.getelementptr %94[%279] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %275, %280 : i32, !llvm.ptr
          %281 = llvm.load %106 : !llvm.ptr -> i32
          %282 = arith.constant 1 : i32
          %283 = arith.addi %281, %282 : i32
          llvm.store %283, %106 : i32, !llvm.ptr
          cf.br ^bb39
        ^bb38:
          cf.br ^bb39
        ^bb39:
        cf.br ^bb30
^bb27:
      %284 = arith.constant 1 : i1
      cf.cond_br %284, ^bb28, ^bb29
^bb28:
        %285 = llvm.load %106 : !llvm.ptr -> i32
        %286 = arith.constant 1 : i32
        %287 = arith.subi %285, %286 : i32
        llvm.store %287, %106 : i32, !llvm.ptr
        cf.br ^bb30
^bb29:
      cf.br ^bb30
^bb30:
      cf.br ^bb15
    ^bb17:
    %289 = llvm.mlir.addressof @NRC : !llvm.ptr
    %290 = llvm.load %289 : !llvm.ptr -> i32
    %291 = arith.extsi %290 : i32 to i64
    %292 = llvm.mlir.addressof @NRC : !llvm.ptr
    %293 = llvm.load %292 : !llvm.ptr -> i32
    %294 = arith.extsi %293 : i32 to i64
    %295 = arith.muli %291, %294 : i64
    %296 = arith.constant 4 : i32
    %297 = arith.extsi %296 : i32 to i64
    %288 = func.call @calloc(%295, %297) : (i64, i64) -> !llvm.ptr
    %299 = llvm.mlir.addressof @NRC : !llvm.ptr
    %300 = llvm.load %299 : !llvm.ptr -> i32
    %301 = arith.extsi %300 : i32 to i64
    %302 = arith.constant 4 : i32
    %303 = arith.extsi %302 : i32 to i64
    %298 = func.call @calloc(%301, %303) : (i64, i64) -> !llvm.ptr
    %304 = arith.constant 0 : i32
    %305 = llvm.mlir.constant(1 : i64) : i64
    %306 = llvm.alloca %305 x i32 : (i64) -> !llvm.ptr
    llvm.store %304, %306 : i32, !llvm.ptr
    cf.br ^bb43
    ^bb43:
    %307 = llvm.load %306 : !llvm.ptr -> i32
    %308 = llvm.mlir.addressof @NRC : !llvm.ptr
    %309 = llvm.load %308 : !llvm.ptr -> i32
    %310 = arith.cmpi slt, %307, %309 : i32
    cf.cond_br %310, ^bb44, ^bb45
    ^bb44:
      %311 = llvm.load %306 : !llvm.ptr -> i32
      %312 = arith.constant 1 : i32
      %313 = arith.addi %311, %312 : i32
      %314 = llvm.mlir.constant(1 : i64) : i64
      %315 = llvm.alloca %314 x i32 : (i64) -> !llvm.ptr
      llvm.store %313, %315 : i32, !llvm.ptr
      cf.br ^bb46
      ^bb46:
      %316 = llvm.load %315 : !llvm.ptr -> i32
      %317 = llvm.mlir.addressof @NRC : !llvm.ptr
      %318 = llvm.load %317 : !llvm.ptr -> i32
      %319 = arith.cmpi slt, %316, %318 : i32
      cf.cond_br %319, ^bb47, ^bb48
      ^bb47:
        %321 = llvm.mlir.addressof @ALL_ROWS : !llvm.ptr
        %322 = llvm.load %321 : !llvm.ptr -> !llvm.ptr
        %323 = llvm.load %306 : !llvm.ptr -> i32
        %324 = arith.extsi %323 : i32 to i64
        %325 = llvm.getelementptr %322[%324] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %320 = llvm.load %325 : !llvm.ptr -> i64
        %327 = llvm.mlir.addressof @ALL_ROWS : !llvm.ptr
        %328 = llvm.load %327 : !llvm.ptr -> !llvm.ptr
        %329 = llvm.load %315 : !llvm.ptr -> i32
        %330 = arith.extsi %329 : i32 to i64
        %331 = llvm.getelementptr %328[%330] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        %326 = llvm.load %331 : !llvm.ptr -> i64
        %332 = arith.andi %320, %326 : i64
        %333 = arith.constant 0 : i32
        %335 = arith.extsi %333 : i32 to i64
        %334 = arith.cmpi eq, %332, %335 : i64
        cf.cond_br %334, ^bb49, ^bb50
        ^bb49:
          %336 = llvm.load %315 : !llvm.ptr -> i32
          %337 = llvm.load %306 : !llvm.ptr -> i32
          %338 = arith.extsi %337 : i32 to i64
          %339 = llvm.mlir.addressof @NRC : !llvm.ptr
          %340 = llvm.load %339 : !llvm.ptr -> i32
          %341 = arith.extsi %340 : i32 to i64
          %342 = arith.muli %338, %341 : i64
          %344 = llvm.load %306 : !llvm.ptr -> i32
          %345 = arith.extsi %344 : i32 to i64
          %346 = llvm.getelementptr %298[%345] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %343 = llvm.load %346 : !llvm.ptr -> i32
          %347 = arith.extsi %343 : i32 to i64
          %348 = arith.addi %342, %347 : i64
          %349 = llvm.getelementptr %288[%348] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %336, %349 : i32, !llvm.ptr
          %351 = llvm.load %306 : !llvm.ptr -> i32
          %352 = arith.extsi %351 : i32 to i64
          %353 = llvm.getelementptr %298[%352] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %350 = llvm.load %353 : !llvm.ptr -> i32
          %354 = arith.constant 1 : i32
          %355 = arith.addi %350, %354 : i32
          %356 = llvm.load %306 : !llvm.ptr -> i32
          %357 = arith.extsi %356 : i32 to i64
          %358 = llvm.getelementptr %298[%357] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %355, %358 : i32, !llvm.ptr
          %359 = llvm.load %306 : !llvm.ptr -> i32
          %360 = llvm.load %315 : !llvm.ptr -> i32
          %361 = arith.extsi %360 : i32 to i64
          %362 = llvm.mlir.addressof @NRC : !llvm.ptr
          %363 = llvm.load %362 : !llvm.ptr -> i32
          %364 = arith.extsi %363 : i32 to i64
          %365 = arith.muli %361, %364 : i64
          %367 = llvm.load %315 : !llvm.ptr -> i32
          %368 = arith.extsi %367 : i32 to i64
          %369 = llvm.getelementptr %298[%368] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %366 = llvm.load %369 : !llvm.ptr -> i32
          %370 = arith.extsi %366 : i32 to i64
          %371 = arith.addi %365, %370 : i64
          %372 = llvm.getelementptr %288[%371] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %359, %372 : i32, !llvm.ptr
          %374 = llvm.load %315 : !llvm.ptr -> i32
          %375 = arith.extsi %374 : i32 to i64
          %376 = llvm.getelementptr %298[%375] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %373 = llvm.load %376 : !llvm.ptr -> i32
          %377 = arith.constant 1 : i32
          %378 = arith.addi %373, %377 : i32
          %379 = llvm.load %315 : !llvm.ptr -> i32
          %380 = arith.extsi %379 : i32 to i64
          %381 = llvm.getelementptr %298[%380] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          llvm.store %378, %381 : i32, !llvm.ptr
          cf.br ^bb51
        ^bb50:
          cf.br ^bb51
        ^bb51:
        %382 = llvm.load %315 : !llvm.ptr -> i32
        %383 = arith.constant 1 : i32
        %384 = arith.addi %382, %383 : i32
        llvm.store %384, %315 : i32, !llvm.ptr
        cf.br ^bb46
      ^bb48:
      %385 = llvm.load %306 : !llvm.ptr -> i32
      %386 = arith.constant 1 : i32
      %387 = arith.addi %385, %386 : i32
      llvm.store %387, %306 : i32, !llvm.ptr
      cf.br ^bb43
    ^bb45:
    %388 = arith.constant 10 : i32
    %390 = llvm.mlir.addressof @NRC : !llvm.ptr
    %391 = llvm.load %390 : !llvm.ptr -> i32
    %392 = arith.extsi %391 : i32 to i64
    %393 = arith.constant 1 : i32
    %394 = arith.addi %388, %393 : i32
    %395 = arith.extsi %394 : i32 to i64
    %396 = arith.muli %392, %395 : i64
    %397 = arith.constant 8 : i32
    %398 = arith.extsi %397 : i32 to i64
    %389 = func.call @calloc(%396, %398) : (i64, i64) -> !llvm.ptr
    %399 = arith.constant 0 : i32
    llvm.store %399, %306 : i32, !llvm.ptr
    cf.br ^bb52
    ^bb52:
    %400 = llvm.load %306 : !llvm.ptr -> i32
    %401 = llvm.mlir.addressof @NRC : !llvm.ptr
    %402 = llvm.load %401 : !llvm.ptr -> i32
    %403 = arith.cmpi slt, %400, %402 : i32
    cf.cond_br %403, ^bb53, ^bb54
    ^bb53:
      %404 = arith.constant 1 : i32
      %405 = llvm.load %306 : !llvm.ptr -> i32
      %406 = arith.extsi %405 : i32 to i64
      %407 = arith.constant 1 : i32
      %408 = arith.addi %388, %407 : i32
      %409 = arith.extsi %408 : i32 to i64
      %410 = arith.muli %406, %409 : i64
      %411 = arith.constant 1 : i32
      %413 = arith.extsi %411 : i32 to i64
      %412 = arith.addi %410, %413 : i64
      %414 = arith.extsi %404 : i32 to i64
      %415 = llvm.getelementptr %389[%412] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      llvm.store %414, %415 : i64, !llvm.ptr
      %416 = llvm.load %306 : !llvm.ptr -> i32
      %417 = arith.constant 1 : i32
      %418 = arith.addi %416, %417 : i32
      llvm.store %418, %306 : i32, !llvm.ptr
      cf.br ^bb52
    ^bb54:
    %419 = arith.constant 2 : i32
    %420 = llvm.mlir.constant(1 : i64) : i64
    %421 = llvm.alloca %420 x i32 : (i64) -> !llvm.ptr
    llvm.store %419, %421 : i32, !llvm.ptr
    cf.br ^bb55
    ^bb55:
    %422 = llvm.load %421 : !llvm.ptr -> i32
    %423 = arith.cmpi sle, %422, %388 : i32
    cf.cond_br %423, ^bb56, ^bb57
    ^bb56:
      %424 = arith.constant 0 : i32
      llvm.store %424, %306 : i32, !llvm.ptr
      cf.br ^bb58
      ^bb58:
      %425 = llvm.load %306 : !llvm.ptr -> i32
      %426 = llvm.mlir.addressof @NRC : !llvm.ptr
      %427 = llvm.load %426 : !llvm.ptr -> i32
      %428 = arith.cmpi slt, %425, %427 : i32
      cf.cond_br %428, ^bb59, ^bb60
      ^bb59:
        %429 = arith.constant 0 : i32
        %430 = arith.extsi %429 : i32 to i64
        %431 = llvm.mlir.constant(1 : i64) : i64
        %432 = llvm.alloca %431 x i64 : (i64) -> !llvm.ptr
        llvm.store %430, %432 : i64, !llvm.ptr
        %433 = arith.constant 0 : i32
        %434 = llvm.mlir.constant(1 : i64) : i64
        %435 = llvm.alloca %434 x i32 : (i64) -> !llvm.ptr
        llvm.store %433, %435 : i32, !llvm.ptr
        cf.br ^bb61
        ^bb61:
        %436 = llvm.load %435 : !llvm.ptr -> i32
        %438 = llvm.load %306 : !llvm.ptr -> i32
        %439 = arith.extsi %438 : i32 to i64
        %440 = llvm.getelementptr %298[%439] : (!llvm.ptr, i64) -> !llvm.ptr, i32
        %437 = llvm.load %440 : !llvm.ptr -> i32
        %441 = arith.cmpi slt, %436, %437 : i32
        cf.cond_br %441, ^bb62, ^bb63
        ^bb62:
          %443 = llvm.load %306 : !llvm.ptr -> i32
          %444 = arith.extsi %443 : i32 to i64
          %445 = llvm.mlir.addressof @NRC : !llvm.ptr
          %446 = llvm.load %445 : !llvm.ptr -> i32
          %447 = arith.extsi %446 : i32 to i64
          %448 = arith.muli %444, %447 : i64
          %449 = llvm.load %435 : !llvm.ptr -> i32
          %450 = arith.extsi %449 : i32 to i64
          %451 = arith.addi %448, %450 : i64
          %452 = llvm.getelementptr %288[%451] : (!llvm.ptr, i64) -> !llvm.ptr, i32
          %442 = llvm.load %452 : !llvm.ptr -> i32
          %453 = llvm.load %432 : !llvm.ptr -> i64
          %455 = arith.extsi %442 : i32 to i64
          %456 = arith.constant 1 : i32
          %457 = arith.addi %388, %456 : i32
          %458 = arith.extsi %457 : i32 to i64
          %459 = arith.muli %455, %458 : i64
          %460 = llvm.load %421 : !llvm.ptr -> i32
          %461 = arith.constant 1 : i32
          %462 = arith.subi %460, %461 : i32
          %463 = arith.extsi %462 : i32 to i64
          %464 = arith.addi %459, %463 : i64
          %465 = llvm.getelementptr %389[%464] : (!llvm.ptr, i64) -> !llvm.ptr, i64
          %454 = llvm.load %465 : !llvm.ptr -> i64
          %466 = arith.addi %453, %454 : i64
          llvm.store %466, %432 : i64, !llvm.ptr
          %467 = llvm.load %435 : !llvm.ptr -> i32
          %468 = arith.constant 1 : i32
          %469 = arith.addi %467, %468 : i32
          llvm.store %469, %435 : i32, !llvm.ptr
          cf.br ^bb61
        ^bb63:
        %470 = llvm.load %432 : !llvm.ptr -> i64
        %471 = llvm.load %306 : !llvm.ptr -> i32
        %472 = arith.extsi %471 : i32 to i64
        %473 = arith.constant 1 : i32
        %474 = arith.addi %388, %473 : i32
        %475 = arith.extsi %474 : i32 to i64
        %476 = arith.muli %472, %475 : i64
        %477 = llvm.load %421 : !llvm.ptr -> i32
        %478 = arith.extsi %477 : i32 to i64
        %479 = arith.addi %476, %478 : i64
        %480 = llvm.getelementptr %389[%479] : (!llvm.ptr, i64) -> !llvm.ptr, i64
        llvm.store %470, %480 : i64, !llvm.ptr
        %481 = llvm.load %306 : !llvm.ptr -> i32
        %482 = arith.constant 1 : i32
        %483 = arith.addi %481, %482 : i32
        llvm.store %483, %306 : i32, !llvm.ptr
        cf.br ^bb58
      ^bb60:
      %484 = llvm.load %421 : !llvm.ptr -> i32
      %485 = arith.constant 1 : i32
      %486 = arith.addi %484, %485 : i32
      llvm.store %486, %421 : i32, !llvm.ptr
      cf.br ^bb55
    ^bb57:
    %487 = arith.constant 0 : i32
    %488 = arith.extsi %487 : i32 to i64
    %489 = llvm.mlir.constant(1 : i64) : i64
    %490 = llvm.alloca %489 x i64 : (i64) -> !llvm.ptr
    llvm.store %488, %490 : i64, !llvm.ptr
    %491 = arith.constant 0 : i32
    llvm.store %491, %306 : i32, !llvm.ptr
    cf.br ^bb64
    ^bb64:
    %492 = llvm.load %306 : !llvm.ptr -> i32
    %493 = llvm.mlir.addressof @NRC : !llvm.ptr
    %494 = llvm.load %493 : !llvm.ptr -> i32
    %495 = arith.cmpi slt, %492, %494 : i32
    cf.cond_br %495, ^bb65, ^bb66
    ^bb65:
      %496 = llvm.load %490 : !llvm.ptr -> i64
      %498 = llvm.load %306 : !llvm.ptr -> i32
      %499 = arith.extsi %498 : i32 to i64
      %500 = arith.constant 1 : i32
      %501 = arith.addi %388, %500 : i32
      %502 = arith.extsi %501 : i32 to i64
      %503 = arith.muli %499, %502 : i64
      %504 = arith.extsi %388 : i32 to i64
      %505 = arith.addi %503, %504 : i64
      %506 = llvm.getelementptr %389[%505] : (!llvm.ptr, i64) -> !llvm.ptr, i64
      %497 = llvm.load %506 : !llvm.ptr -> i64
      %507 = arith.addi %496, %497 : i64
      llvm.store %507, %490 : i64, !llvm.ptr
      %508 = llvm.load %306 : !llvm.ptr -> i32
      %509 = arith.constant 1 : i32
      %510 = arith.addi %508, %509 : i32
      llvm.store %510, %306 : i32, !llvm.ptr
      cf.br ^bb64
    ^bb66:
    %511 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %512 = llvm.load %490 : !llvm.ptr -> i64
    %513 = llvm.call @printf(%511, %512) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    %514 = arith.constant 0 : i32
    func.return %514 : i32
  }
}