Problem 723

Square sums of lattices — S via multiplicative A-functions on target exponents.

Answer1395793419248
Output1395793419248
StatusPASS
Native helperno
Runtime0 ms
Peak memory1072 KB
Time complexityO(n) (estimated)
Space complexityO(1) (estimated)

Performance comparison

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

Flow source

# Project Euler 723
# Square sums of lattices — S via multiplicative A-functions on target exponents.

function A1(e: i64) -> i64 { return (e + 1) * (e + 2) / 2 }
function A2(e: i64) -> i64 { return (e + 1) * (e + 2) * (2 * e + 3) / 6 }
function A3(e: i64) -> i64 { return (A2(e) + e / 2 + 1) / 2 }
function A4(e: i64) -> i64 { let v: i64 = A1(e); return v * v }
function A5(e: i64) -> i64 { return (e + 1) * (e + 2) * (e * e + 3 * e + 3) / 6 }

function prod_A(which: i64, e0: i64, e1: i64, e2: i64, e3: i64, e4: i64, e5: i64, e6: i64, e7: i64) -> i64 {
    let mut r: i64 = 1
    let mut i: i64 = 0
    while i < 8 {
        let e: i64 = e0
        if i == 1 { e = e1 }
        if i == 2 { e = e2 }
        if i == 3 { e = e3 }
        if i == 4 { e = e4 }
        if i == 5 { e = e5 }
        if i == 6 { e = e6 }
        if i == 7 { e = e7 }
        let mut v: i64 = 0
        if which == 1 { v = A1(e) }
        if which == 2 { v = A2(e) }
        if which == 3 { v = A3(e) }
        if which == 4 { v = A4(e) }
        if which == 5 { v = A5(e) }
        r = r * v
        i = i + 1
    }
    return r
}

function main() -> i32 {
    # exponents of 5^6 * 13^3 * 17^2 * 29 * 37 * 41 * 53 * 61
    let t1: i64 = prod_A(1, 6, 3, 2, 1, 1, 1, 1, 1)
    let t2: i64 = prod_A(2, 6, 3, 2, 1, 1, 1, 1, 1)
    let t3: i64 = prod_A(3, 6, 3, 2, 1, 1, 1, 1, 1)
    let t4: i64 = prod_A(4, 6, 3, 2, 1, 1, 1, 1, 1)
    let t5: i64 = prod_A(5, 6, 3, 2, 1, 1, 1, 1, 1)
    let ans: i64 = 7 * t1 - 14 * t2 - 4 * t3 + 8 * t4 + 4 * t5
    printf("%lld\n", ans)
    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; }

int64_t A1_i64(int64_t e);
int64_t A2_i64(int64_t e);
int64_t A3_i64(int64_t e);
int64_t A4_i64(int64_t e);
int64_t A5_i64(int64_t e);
int64_t prod_A_i64_i64_i64_i64_i64_i64_i64_i64_i64(int64_t which, int64_t e0, int64_t e1, int64_t e2, int64_t e3, int64_t e4, int64_t e5, int64_t e6, int64_t e7);
int32_t main(void);

int64_t A1_i64(int64_t e) {
    return FLOW_CHECKED_DIV((((e + 1) * (e + 2))), (2));
}

int64_t A2_i64(int64_t e) {
    return FLOW_CHECKED_DIV(((((e + 1) * (e + 2)) * ((2 * e) + 3))), (6));
}

int64_t A3_i64(int64_t e) {
    return FLOW_CHECKED_DIV((((A2_i64(e) + FLOW_CHECKED_DIV((e), (2))) + 1)), (2));
}

int64_t A4_i64(int64_t e) {
    int64_t v = A1_i64(e);
    return (v * v);
}

int64_t A5_i64(int64_t e) {
    return FLOW_CHECKED_DIV(((((e + 1) * (e + 2)) * (((e * e) + (3 * e)) + 3))), (6));
}

int64_t prod_A_i64_i64_i64_i64_i64_i64_i64_i64_i64(int64_t which, int64_t e0, int64_t e1, int64_t e2, int64_t e3, int64_t e4, int64_t e5, int64_t e6, int64_t e7) {
    int64_t r = 1;
    int64_t i = 0;
    while (i < 8) {
        int64_t e = e0;
        if (i == 1) {
            e = e1;
        }
        if (i == 2) {
            e = e2;
        }
        if (i == 3) {
            e = e3;
        }
        if (i == 4) {
            e = e4;
        }
        if (i == 5) {
            e = e5;
        }
        if (i == 6) {
            e = e6;
        }
        if (i == 7) {
            e = e7;
        }
        int64_t v = 0;
        if (which == 1) {
            v = A1_i64(e);
        }
        if (which == 2) {
            v = A2_i64(e);
        }
        if (which == 3) {
            v = A3_i64(e);
        }
        if (which == 4) {
            v = A4_i64(e);
        }
        if (which == 5) {
            v = A5_i64(e);
        }
        r = (r * v);
        i = (i + 1);
    }
    return r;
}

int32_t main(void) {
    int64_t t1 = prod_A_i64_i64_i64_i64_i64_i64_i64_i64_i64(1, 6, 3, 2, 1, 1, 1, 1, 1);
    int64_t t2 = prod_A_i64_i64_i64_i64_i64_i64_i64_i64_i64(2, 6, 3, 2, 1, 1, 1, 1, 1);
    int64_t t3 = prod_A_i64_i64_i64_i64_i64_i64_i64_i64_i64(3, 6, 3, 2, 1, 1, 1, 1, 1);
    int64_t t4 = prod_A_i64_i64_i64_i64_i64_i64_i64_i64_i64(4, 6, 3, 2, 1, 1, 1, 1, 1);
    int64_t t5 = prod_A_i64_i64_i64_i64_i64_i64_i64_i64_i64(5, 6, 3, 2, 1, 1, 1, 1, 1);
    int64_t ans = (((((7 * t1) - (14 * t2)) - (4 * t3)) + (8 * t4)) + (4 * t5));
    printf("%lld\n", ans);
    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 @A1(%arg0: i64) -> i64 {
    %0 = arith.constant 1 : i32
    %2 = arith.extsi %0 : i32 to i64
    %1 = arith.addi %arg0, %2 : i64
    %3 = arith.constant 2 : i32
    %5 = arith.extsi %3 : i32 to i64
    %4 = arith.addi %arg0, %5 : i64
    %6 = arith.muli %1, %4 : i64
    %7 = arith.constant 2 : i32
    %9 = arith.extsi %7 : i32 to i64
    %8 = arith.divsi %6, %9 : i64
    func.return %8 : i64
  }
  func.func @A2(%arg0: i64) -> i64 {
    %10 = arith.constant 1 : i32
    %12 = arith.extsi %10 : i32 to i64
    %11 = arith.addi %arg0, %12 : i64
    %13 = arith.constant 2 : i32
    %15 = arith.extsi %13 : i32 to i64
    %14 = arith.addi %arg0, %15 : i64
    %16 = arith.muli %11, %14 : i64
    %17 = arith.constant 2 : i32
    %19 = arith.extsi %17 : i32 to i64
    %18 = arith.muli %19, %arg0 : i64
    %20 = arith.constant 3 : i32
    %22 = arith.extsi %20 : i32 to i64
    %21 = arith.addi %18, %22 : i64
    %23 = arith.muli %16, %21 : i64
    %24 = arith.constant 6 : i32
    %26 = arith.extsi %24 : i32 to i64
    %25 = arith.divsi %23, %26 : i64
    func.return %25 : i64
  }
  func.func @A3(%arg0: i64) -> i64 {
    %27 = func.call @A2(%arg0) : (i64) -> i64
    %28 = arith.constant 2 : i32
    %30 = arith.extsi %28 : i32 to i64
    %29 = arith.divsi %arg0, %30 : i64
    %31 = arith.addi %27, %29 : i64
    %32 = arith.constant 1 : i32
    %34 = arith.extsi %32 : i32 to i64
    %33 = arith.addi %31, %34 : i64
    %35 = arith.constant 2 : i32
    %37 = arith.extsi %35 : i32 to i64
    %36 = arith.divsi %33, %37 : i64
    func.return %36 : i64
  }
  func.func @A4(%arg0: i64) -> i64 {
    %38 = func.call @A1(%arg0) : (i64) -> i64
    %39 = arith.muli %38, %38 : i64
    func.return %39 : i64
  }
  func.func @A5(%arg0: i64) -> i64 {
    %40 = arith.constant 1 : i32
    %42 = arith.extsi %40 : i32 to i64
    %41 = arith.addi %arg0, %42 : i64
    %43 = arith.constant 2 : i32
    %45 = arith.extsi %43 : i32 to i64
    %44 = arith.addi %arg0, %45 : i64
    %46 = arith.muli %41, %44 : i64
    %47 = arith.muli %arg0, %arg0 : i64
    %48 = arith.constant 3 : i32
    %50 = arith.extsi %48 : i32 to i64
    %49 = arith.muli %50, %arg0 : i64
    %51 = arith.addi %47, %49 : i64
    %52 = arith.constant 3 : i32
    %54 = arith.extsi %52 : i32 to i64
    %53 = arith.addi %51, %54 : i64
    %55 = arith.muli %46, %53 : i64
    %56 = arith.constant 6 : i32
    %58 = arith.extsi %56 : i32 to i64
    %57 = arith.divsi %55, %58 : i64
    func.return %57 : i64
  }
  func.func @prod_A(%arg0: i64, %arg1: i64, %arg2: i64, %arg3: i64, %arg4: i64, %arg5: i64, %arg6: i64, %arg7: i64, %arg8: i64) -> i64 {
    %59 = arith.constant 1 : i32
    %60 = arith.extsi %59 : i32 to i64
    %61 = llvm.mlir.constant(1 : i64) : i64
    %62 = llvm.alloca %61 x i64 : (i64) -> !llvm.ptr
    llvm.store %60, %62 : i64, !llvm.ptr
    %63 = arith.constant 0 : i32
    %64 = arith.extsi %63 : i32 to i64
    %65 = llvm.mlir.constant(1 : i64) : i64
    %66 = llvm.alloca %65 x i64 : (i64) -> !llvm.ptr
    llvm.store %64, %66 : i64, !llvm.ptr
    cf.br ^bb0
    ^bb0:
    %67 = llvm.load %66 : !llvm.ptr -> i64
    %68 = arith.constant 8 : i32
    %70 = arith.extsi %68 : i32 to i64
    %69 = arith.cmpi slt, %67, %70 : i64
    cf.cond_br %69, ^bb1, ^bb2
    ^bb1:
      %71 = llvm.load %66 : !llvm.ptr -> i64
      %72 = arith.constant 1 : i32
      %74 = arith.extsi %72 : i32 to i64
      %73 = arith.cmpi eq, %71, %74 : i64
      %75 = scf.if %73 -> (i64) {
        scf.yield %arg2 : i64
      } else {
        scf.yield %arg1 : i64
      }
      %76 = llvm.load %66 : !llvm.ptr -> i64
      %77 = arith.constant 2 : i32
      %79 = arith.extsi %77 : i32 to i64
      %78 = arith.cmpi eq, %76, %79 : i64
      %80 = scf.if %78 -> (i64) {
        scf.yield %arg3 : i64
      } else {
        scf.yield %75 : i64
      }
      %81 = llvm.load %66 : !llvm.ptr -> i64
      %82 = arith.constant 3 : i32
      %84 = arith.extsi %82 : i32 to i64
      %83 = arith.cmpi eq, %81, %84 : i64
      %85 = scf.if %83 -> (i64) {
        scf.yield %arg4 : i64
      } else {
        scf.yield %80 : i64
      }
      %86 = llvm.load %66 : !llvm.ptr -> i64
      %87 = arith.constant 4 : i32
      %89 = arith.extsi %87 : i32 to i64
      %88 = arith.cmpi eq, %86, %89 : i64
      %90 = scf.if %88 -> (i64) {
        scf.yield %arg5 : i64
      } else {
        scf.yield %85 : i64
      }
      %91 = llvm.load %66 : !llvm.ptr -> i64
      %92 = arith.constant 5 : i32
      %94 = arith.extsi %92 : i32 to i64
      %93 = arith.cmpi eq, %91, %94 : i64
      %95 = scf.if %93 -> (i64) {
        scf.yield %arg6 : i64
      } else {
        scf.yield %90 : i64
      }
      %96 = llvm.load %66 : !llvm.ptr -> i64
      %97 = arith.constant 6 : i32
      %99 = arith.extsi %97 : i32 to i64
      %98 = arith.cmpi eq, %96, %99 : i64
      %100 = scf.if %98 -> (i64) {
        scf.yield %arg7 : i64
      } else {
        scf.yield %95 : i64
      }
      %101 = llvm.load %66 : !llvm.ptr -> i64
      %102 = arith.constant 7 : i32
      %104 = arith.extsi %102 : i32 to i64
      %103 = arith.cmpi eq, %101, %104 : i64
      %105 = scf.if %103 -> (i64) {
        scf.yield %arg8 : i64
      } else {
        scf.yield %100 : i64
      }
      %106 = arith.constant 0 : i32
      %107 = arith.extsi %106 : i32 to i64
      %108 = llvm.mlir.constant(1 : i64) : i64
      %109 = llvm.alloca %108 x i64 : (i64) -> !llvm.ptr
      llvm.store %107, %109 : i64, !llvm.ptr
      %110 = arith.constant 1 : i32
      %112 = arith.extsi %110 : i32 to i64
      %111 = arith.cmpi eq, %arg0, %112 : i64
      cf.cond_br %111, ^bb3, ^bb4
      ^bb3:
        %113 = func.call @A1(%105) : (i64) -> i64
        llvm.store %113, %109 : i64, !llvm.ptr
        cf.br ^bb5
      ^bb4:
        cf.br ^bb5
      ^bb5:
      %114 = arith.constant 2 : i32
      %116 = arith.extsi %114 : i32 to i64
      %115 = arith.cmpi eq, %arg0, %116 : i64
      cf.cond_br %115, ^bb6, ^bb7
      ^bb6:
        %117 = func.call @A2(%105) : (i64) -> i64
        llvm.store %117, %109 : i64, !llvm.ptr
        cf.br ^bb8
      ^bb7:
        cf.br ^bb8
      ^bb8:
      %118 = arith.constant 3 : i32
      %120 = arith.extsi %118 : i32 to i64
      %119 = arith.cmpi eq, %arg0, %120 : i64
      cf.cond_br %119, ^bb9, ^bb10
      ^bb9:
        %121 = func.call @A3(%105) : (i64) -> i64
        llvm.store %121, %109 : i64, !llvm.ptr
        cf.br ^bb11
      ^bb10:
        cf.br ^bb11
      ^bb11:
      %122 = arith.constant 4 : i32
      %124 = arith.extsi %122 : i32 to i64
      %123 = arith.cmpi eq, %arg0, %124 : i64
      cf.cond_br %123, ^bb12, ^bb13
      ^bb12:
        %125 = func.call @A4(%105) : (i64) -> i64
        llvm.store %125, %109 : i64, !llvm.ptr
        cf.br ^bb14
      ^bb13:
        cf.br ^bb14
      ^bb14:
      %126 = arith.constant 5 : i32
      %128 = arith.extsi %126 : i32 to i64
      %127 = arith.cmpi eq, %arg0, %128 : i64
      cf.cond_br %127, ^bb15, ^bb16
      ^bb15:
        %129 = func.call @A5(%105) : (i64) -> i64
        llvm.store %129, %109 : i64, !llvm.ptr
        cf.br ^bb17
      ^bb16:
        cf.br ^bb17
      ^bb17:
      %130 = llvm.load %62 : !llvm.ptr -> i64
      %131 = llvm.load %109 : !llvm.ptr -> i64
      %132 = arith.muli %130, %131 : i64
      llvm.store %132, %62 : i64, !llvm.ptr
      %133 = llvm.load %66 : !llvm.ptr -> i64
      %134 = arith.constant 1 : i32
      %136 = arith.extsi %134 : i32 to i64
      %135 = arith.addi %133, %136 : i64
      llvm.store %135, %66 : i64, !llvm.ptr
      cf.br ^bb0
    ^bb2:
    %137 = llvm.load %62 : !llvm.ptr -> i64
    func.return %137 : i64
  }
  func.func @main() -> i32 {
    %139 = arith.constant 1 : i32
    %140 = arith.constant 6 : i32
    %141 = arith.constant 3 : i32
    %142 = arith.constant 2 : i32
    %143 = arith.constant 1 : i32
    %144 = arith.constant 1 : i32
    %145 = arith.constant 1 : i32
    %146 = arith.constant 1 : i32
    %147 = arith.constant 1 : i32
    %148 = arith.extsi %139 : i32 to i64
    %149 = arith.extsi %140 : i32 to i64
    %150 = arith.extsi %141 : i32 to i64
    %151 = arith.extsi %142 : i32 to i64
    %152 = arith.extsi %143 : i32 to i64
    %153 = arith.extsi %144 : i32 to i64
    %154 = arith.extsi %145 : i32 to i64
    %155 = arith.extsi %146 : i32 to i64
    %156 = arith.extsi %147 : i32 to i64
    %138 = func.call @prod_A(%148, %149, %150, %151, %152, %153, %154, %155, %156) : (i64, i64, i64, i64, i64, i64, i64, i64, i64) -> i64
    %158 = arith.constant 2 : i32
    %159 = arith.constant 6 : i32
    %160 = arith.constant 3 : i32
    %161 = arith.constant 2 : i32
    %162 = arith.constant 1 : i32
    %163 = arith.constant 1 : i32
    %164 = arith.constant 1 : i32
    %165 = arith.constant 1 : i32
    %166 = arith.constant 1 : i32
    %167 = arith.extsi %158 : i32 to i64
    %168 = arith.extsi %159 : i32 to i64
    %169 = arith.extsi %160 : i32 to i64
    %170 = arith.extsi %161 : i32 to i64
    %171 = arith.extsi %162 : i32 to i64
    %172 = arith.extsi %163 : i32 to i64
    %173 = arith.extsi %164 : i32 to i64
    %174 = arith.extsi %165 : i32 to i64
    %175 = arith.extsi %166 : i32 to i64
    %157 = func.call @prod_A(%167, %168, %169, %170, %171, %172, %173, %174, %175) : (i64, i64, i64, i64, i64, i64, i64, i64, i64) -> i64
    %177 = arith.constant 3 : i32
    %178 = arith.constant 6 : i32
    %179 = arith.constant 3 : i32
    %180 = arith.constant 2 : i32
    %181 = arith.constant 1 : i32
    %182 = arith.constant 1 : i32
    %183 = arith.constant 1 : i32
    %184 = arith.constant 1 : i32
    %185 = arith.constant 1 : i32
    %186 = arith.extsi %177 : i32 to i64
    %187 = arith.extsi %178 : i32 to i64
    %188 = arith.extsi %179 : i32 to i64
    %189 = arith.extsi %180 : i32 to i64
    %190 = arith.extsi %181 : i32 to i64
    %191 = arith.extsi %182 : i32 to i64
    %192 = arith.extsi %183 : i32 to i64
    %193 = arith.extsi %184 : i32 to i64
    %194 = arith.extsi %185 : i32 to i64
    %176 = func.call @prod_A(%186, %187, %188, %189, %190, %191, %192, %193, %194) : (i64, i64, i64, i64, i64, i64, i64, i64, i64) -> i64
    %196 = arith.constant 4 : i32
    %197 = arith.constant 6 : i32
    %198 = arith.constant 3 : i32
    %199 = arith.constant 2 : i32
    %200 = arith.constant 1 : i32
    %201 = arith.constant 1 : i32
    %202 = arith.constant 1 : i32
    %203 = arith.constant 1 : i32
    %204 = arith.constant 1 : i32
    %205 = arith.extsi %196 : i32 to i64
    %206 = arith.extsi %197 : i32 to i64
    %207 = arith.extsi %198 : i32 to i64
    %208 = arith.extsi %199 : i32 to i64
    %209 = arith.extsi %200 : i32 to i64
    %210 = arith.extsi %201 : i32 to i64
    %211 = arith.extsi %202 : i32 to i64
    %212 = arith.extsi %203 : i32 to i64
    %213 = arith.extsi %204 : i32 to i64
    %195 = func.call @prod_A(%205, %206, %207, %208, %209, %210, %211, %212, %213) : (i64, i64, i64, i64, i64, i64, i64, i64, i64) -> i64
    %215 = arith.constant 5 : i32
    %216 = arith.constant 6 : i32
    %217 = arith.constant 3 : i32
    %218 = arith.constant 2 : i32
    %219 = arith.constant 1 : i32
    %220 = arith.constant 1 : i32
    %221 = arith.constant 1 : i32
    %222 = arith.constant 1 : i32
    %223 = arith.constant 1 : i32
    %224 = arith.extsi %215 : i32 to i64
    %225 = arith.extsi %216 : i32 to i64
    %226 = arith.extsi %217 : i32 to i64
    %227 = arith.extsi %218 : i32 to i64
    %228 = arith.extsi %219 : i32 to i64
    %229 = arith.extsi %220 : i32 to i64
    %230 = arith.extsi %221 : i32 to i64
    %231 = arith.extsi %222 : i32 to i64
    %232 = arith.extsi %223 : i32 to i64
    %214 = func.call @prod_A(%224, %225, %226, %227, %228, %229, %230, %231, %232) : (i64, i64, i64, i64, i64, i64, i64, i64, i64) -> i64
    %233 = arith.constant 7 : i32
    %235 = arith.extsi %233 : i32 to i64
    %234 = arith.muli %235, %138 : i64
    %236 = arith.constant 14 : i32
    %238 = arith.extsi %236 : i32 to i64
    %237 = arith.muli %238, %157 : i64
    %239 = arith.subi %234, %237 : i64
    %240 = arith.constant 4 : i32
    %242 = arith.extsi %240 : i32 to i64
    %241 = arith.muli %242, %176 : i64
    %243 = arith.subi %239, %241 : i64
    %244 = arith.constant 8 : i32
    %246 = arith.extsi %244 : i32 to i64
    %245 = arith.muli %246, %195 : i64
    %247 = arith.addi %243, %245 : i64
    %248 = arith.constant 4 : i32
    %250 = arith.extsi %248 : i32 to i64
    %249 = arith.muli %250, %214 : i64
    %251 = arith.addi %247, %249 : i64
    %252 = llvm.mlir.addressof @str_0 : !llvm.ptr
    %253 = llvm.call @printf(%252, %251) vararg(!llvm.func<i32 (ptr, ...)>) : (!llvm.ptr, i64) -> i32
    %254 = arith.constant 0 : i32
    func.return %254 : i32
  }
}