Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add debug locations #512

Merged
merged 7 commits into from
Apr 16, 2024
Merged

Add debug locations #512

merged 7 commits into from
Apr 16, 2024

Conversation

edg-l
Copy link
Member

@edg-l edg-l commented Apr 12, 2024

This just makes more locations show in the MLIR, sadly right now the locations dont get translated to llvm debug info as of yet.

Improved readme adding a section about debugging.

Also added better locations to know what libfunc is which MLIR instruction:

image
#loc1 = [unknown]
#loc47 = "array_append<felt252>"
module attributes {llvm.data_layout = "e-m:o-i64:64-i128:128-n32:64-S128", llvm.target_triple = "arm64-apple-darwin23.4.0"} {
  func.func public @"program::program::try_into_bytes(f1)"(%arg0: i64 [unknown], %arg1: i128 [unknown], %arg2: !llvm.struct<(struct<(ptr, i32, i32, i32)>)> [unknown]) -> (i64, i128, !llvm.struct<(i64, array<20 x i8>)>) attributes {llvm.emit_c_interface} {
    %c1_i64 = arith.constant 1 : i64 "function_call<user@program::program::try_into_bytes[expr25]>"(#loc2)
    %0 = llvm.alloca %c1_i64 x !llvm.struct<(i64, array<24 x i8>)> {alignment = 8 : i64} : (i64) -> !llvm.ptr "function_call<user@program::program::try_into_bytes[expr25]>"(#loc2)
    %c1_i64_0 = arith.constant 1 : i64 "enum_init<core::panics::PanicResult::<((),)>, 1>"
    %1 = llvm.alloca %c1_i64_0 x !llvm.struct<(i64, array<20 x i8>)> {alignment = 8 : i64} : (i64) -> !llvm.ptr "enum_init<core::panics::PanicResult::<((),)>, 1>"
    %c1_i64_1 = arith.constant 1 : i64 "enum_init<core::panics::PanicResult::<((),)>, 0>"
    %2 = llvm.alloca %c1_i64_1 x !llvm.struct<(i64, array<20 x i8>)> {alignment = 8 : i64} : (i64) -> !llvm.ptr "enum_init<core::panics::PanicResult::<((),)>, 0>"
    cf.br ^bb1(%arg0, %arg1, %arg2 : i64, i128, !llvm.struct<(struct<(ptr, i32, i32, i32)>)>) [unknown]
  ^bb1(%3: i64 [unknown], %4: i128 [unknown], %5: !llvm.struct<(struct<(ptr, i32, i32, i32)>)> [unknown]):  // pred: ^bb0
    cf.br ^bb2 [unknown]
  ^bb2:  // pred: ^bb1
    cf.br ^bb3 "disable_ap_tracking"(#loc5)
  ^bb3:  // pred: ^bb2
    %6 = llvm.mlir.null : !llvm.ptr "array_new<felt252>"
    %c0_i32 = arith.constant 0 : i32 "array_new<felt252>"
    %7 = llvm.mlir.undef : !llvm.struct<(ptr, i32, i32, i32)> "array_new<felt252>"
    %8 = llvm.insertvalue %6, %7[0] : !llvm.struct<(ptr, i32, i32, i32)>  "array_new<felt252>"
    %9 = llvm.insertvalue %c0_i32, %8[1] : !llvm.struct<(ptr, i32, i32, i32)>  "array_new<felt252>"
    %10 = llvm.insertvalue %c0_i32, %9[2] : !llvm.struct<(ptr, i32, i32, i32)>  "array_new<felt252>"
    %11 = llvm.insertvalue %c0_i32, %10[3] : !llvm.struct<(ptr, i32, i32, i32)>  "array_new<felt252>"
    cf.br ^bb4 "array_new<felt252>"
  ^bb4:  // pred: ^bb3
    %c0_i32_2 = arith.constant 0 : i32 "u32_const<0>"(#loc2)
    cf.br ^bb5(%3 : i64) "u32_const<0>"(#loc2)
  ^bb5(%12: i64 [unknown]):  // pred: ^bb4
    cf.br ^bb6(%4 : i128) "store_temp<RangeCheck>"(#loc7)
  ^bb6(%13: i128 [unknown]):  // pred: ^bb5
    cf.br ^bb7(%c0_i32_2 : i32) "store_temp<GasBuiltin>"(#loc8)
  ^bb7(%14: i32 [unknown]):  // pred: ^bb6
    cf.br ^bb8(%5 : !llvm.struct<(struct<(ptr, i32, i32, i32)>)>) "store_temp<u32>"(#loc8)
  ^bb8(%15: !llvm.struct<(struct<(ptr, i32, i32, i32)>)> [unknown]):  // pred: ^bb7
    cf.br ^bb9(%11 : !llvm.struct<(ptr, i32, i32, i32)>) "store_temp<core::array::Span::<core::integer::u8>>"(#loc8)
  ^bb9(%16: !llvm.struct<(ptr, i32, i32, i32)> [unknown]):  // pred: ^bb8
    cf.br ^bb10(%12, %13, %14, %15, %16 : i64, i128, i32, !llvm.struct<(struct<(ptr, i32, i32, i32)>)>, !llvm.struct<(ptr, i32, i32, i32)>) "store_temp<Array<felt252>>"(#loc2)
  ^bb10(%17: i64 [unknown], %18: i128 [unknown], %19: i32 [unknown], %20: !llvm.struct<(struct<(ptr, i32, i32, i32)>)> [unknown], %21: !llvm.struct<(ptr, i32, i32, i32)> [unknown]):  // pred: ^bb9
    %22:3 = call @"program::program::try_into_bytes[expr25](f0)"(%17, %18, %19, %20, %21) : (i64, i128, i32, !llvm.struct<(struct<(ptr, i32, i32, i32)>)>, !llvm.struct<(ptr, i32, i32, i32)>) -> (i64, i128, !llvm.struct<(i64, array<24 x i8>)>) "function_call<user@program::program::try_into_bytes[expr25]>"(#loc2)
    llvm.store %22#2, %0 {alignment = 8 : i64} : !llvm.struct<(i64, array<24 x i8>)>, !llvm.ptr "function_call<user@program::program::try_into_bytes[expr25]>"(#loc2)
    cf.br ^bb11(%0 : !llvm.ptr) "function_call<user@program::program::try_into_bytes[expr25]>"(#loc2)
  ^bb11(%23: !llvm.ptr [unknown]):  // pred: ^bb10
    %24 = llvm.load %23 {alignment = 8 : i64} : !llvm.ptr -> i1 "enum_match<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"
    cf.switch %24 : i1, [
      default: ^bb12,
      0: ^bb13,
      1: ^bb14
    ] "enum_match<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"
  ^bb12:  // pred: ^bb11
    %false = arith.constant false "enum_match<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"
    cf.assert %false, "Invalid enum tag." "enum_match<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"
    llvm.unreachable "enum_match<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"
  ^bb13:  // pred: ^bb11
    %25 = llvm.load %23 {alignment = 8 : i64} : !llvm.ptr -> !llvm.struct<(i1, struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>)> "enum_match<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"
    %26 = llvm.extractvalue %25[1] : !llvm.struct<(i1, struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>)>  "enum_match<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"
    cf.br ^bb15 "enum_match<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"
  ^bb14:  // pred: ^bb11
    %27 = llvm.load %23 {alignment = 8 : i64} : !llvm.ptr -> !llvm.struct<(i1, struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>)> "enum_match<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"
    %28 = llvm.extractvalue %27[1] : !llvm.struct<(i1, struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>)>  "enum_match<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"
    cf.br ^bb24 "enum_match<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"
  ^bb15:  // pred: ^bb13
    cf.br ^bb16(%26 : !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>) "branch_align"
  ^bb16(%29: !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)> [unknown]):  // pred: ^bb15
    cf.br ^bb17 "drop<Tuple<Array<felt252>, u32, Unit>>"
  ^bb17:  // pred: ^bb16
    %30 = llvm.mlir.undef : !llvm.struct<()> "struct_construct<Unit>"
    cf.br ^bb18(%30 : !llvm.struct<()>) "struct_construct<Unit>"
  ^bb18(%31: !llvm.struct<()> [unknown]):  // pred: ^bb17
    %32 = llvm.mlir.undef : !llvm.struct<(struct<()>)> "struct_construct<Tuple<Unit>>"
    %33 = llvm.insertvalue %31, %32[0] : !llvm.struct<(struct<()>)>  "struct_construct<Tuple<Unit>>"
    cf.br ^bb19(%33 : !llvm.struct<(struct<()>)>) "struct_construct<Tuple<Unit>>"
  ^bb19(%34: !llvm.struct<(struct<()>)> [unknown]):  // pred: ^bb18
    %false_3 = arith.constant false "enum_init<core::panics::PanicResult::<((),)>, 0>"
    %35 = llvm.mlir.undef : !llvm.struct<(i1, array<0 x i8>)> "enum_init<core::panics::PanicResult::<((),)>, 0>"
    %36 = llvm.insertvalue %false_3, %35[0] : !llvm.struct<(i1, array<0 x i8>)>  "enum_init<core::panics::PanicResult::<((),)>, 0>"
    llvm.store %36, %2 {alignment = 8 : i64} : !llvm.struct<(i1, array<0 x i8>)>, !llvm.ptr "enum_init<core::panics::PanicResult::<((),)>, 0>"
    cf.br ^bb20(%22#0 : i64) "enum_init<core::panics::PanicResult::<((),)>, 0>"
  ^bb20(%37: i64 [unknown]):  // pred: ^bb19
    cf.br ^bb21(%22#1 : i128) "store_temp<RangeCheck>"
  ^bb21(%38: i128 [unknown]):  // pred: ^bb20
    cf.br ^bb22(%2 : !llvm.ptr) "store_temp<GasBuiltin>"
  ^bb22(%39: !llvm.ptr [unknown]):  // pred: ^bb21
    cf.br ^bb23(%37, %38, %39 : i64, i128, !llvm.ptr) "store_temp<core::panics::PanicResult::<((),)>>"
  ^bb23(%40: i64 [unknown], %41: i128 [unknown], %42: !llvm.ptr [unknown]):  // pred: ^bb22
    %43 = llvm.load %39 {alignment = 8 : i64} : !llvm.ptr -> !llvm.struct<(i64, array<20 x i8>)> [unknown]
    return %37, %38, %43 : i64, i128, !llvm.struct<(i64, array<20 x i8>)> [unknown]
  ^bb24:  // pred: ^bb14
    cf.br ^bb25(%28 : !llvm.struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>) "branch_align"
  ^bb25(%44: !llvm.struct<(struct<()>, struct<(ptr, i32, i32, i32)>)> [unknown]):  // pred: ^bb24
    %true = arith.constant true "enum_init<core::panics::PanicResult::<((),)>, 1>"
    %45 = llvm.mlir.undef : !llvm.struct<(i1, struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>)> "enum_init<core::panics::PanicResult::<((),)>, 1>"
    %46 = llvm.insertvalue %true, %45[0] : !llvm.struct<(i1, struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>)>  "enum_init<core::panics::PanicResult::<((),)>, 1>"
    %47 = llvm.insertvalue %44, %46[1] : !llvm.struct<(i1, struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>)>  "enum_init<core::panics::PanicResult::<((),)>, 1>"
    llvm.store %47, %1 {alignment = 8 : i64} : !llvm.struct<(i1, struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>)>, !llvm.ptr "enum_init<core::panics::PanicResult::<((),)>, 1>"
    cf.br ^bb26(%22#0 : i64) "enum_init<core::panics::PanicResult::<((),)>, 1>"
  ^bb26(%48: i64 [unknown]):  // pred: ^bb25
    cf.br ^bb27(%22#1 : i128) "store_temp<RangeCheck>"
  ^bb27(%49: i128 [unknown]):  // pred: ^bb26
    cf.br ^bb28(%1 : !llvm.ptr) "store_temp<GasBuiltin>"
  ^bb28(%50: !llvm.ptr [unknown]):  // pred: ^bb27
    cf.br ^bb29(%48, %49, %50 : i64, i128, !llvm.ptr) "store_temp<core::panics::PanicResult::<((),)>>"
  ^bb29(%51: i64 [unknown], %52: i128 [unknown], %53: !llvm.ptr [unknown]):  // pred: ^bb28
    %54 = llvm.load %50 {alignment = 8 : i64} : !llvm.ptr -> !llvm.struct<(i64, array<20 x i8>)> [unknown]
    return %48, %49, %54 : i64, i128, !llvm.struct<(i64, array<20 x i8>)> [unknown]
  } [unknown]
  func.func private @realloc(!llvm.ptr, i64) -> !llvm.ptr [unknown]
  func.func private @free(!llvm.ptr) [unknown]
  func.func public @"program::program::main(f2)"(%arg0: i64 [unknown], %arg1: i128 [unknown]) -> (i64, i128, !llvm.struct<(i64, array<20 x i8>)>) attributes {llvm.emit_c_interface} {
    %c1_i64 = arith.constant 1 : i64 "function_call<user@program::program::try_into_bytes>"(#loc17)
    %0 = llvm.alloca %c1_i64 x !llvm.struct<(i64, array<20 x i8>)> {alignment = 8 : i64} : (i64) -> !llvm.ptr "function_call<user@program::program::try_into_bytes>"(#loc17)
    cf.br ^bb1(%arg0, %arg1 : i64, i128) [unknown]
  ^bb1(%1: i64 [unknown], %2: i128 [unknown]):  // pred: ^bb0
    cf.br ^bb2 [unknown]
  ^bb2:  // pred: ^bb1
    cf.br ^bb3 "disable_ap_tracking"
  ^bb3:  // pred: ^bb2
    %3 = llvm.mlir.null : !llvm.ptr "array_new<u8>"
    %c0_i32 = arith.constant 0 : i32 "array_new<u8>"
    %4 = llvm.mlir.undef : !llvm.struct<(ptr, i32, i32, i32)> "array_new<u8>"
    %5 = llvm.insertvalue %3, %4[0] : !llvm.struct<(ptr, i32, i32, i32)>  "array_new<u8>"
    %6 = llvm.insertvalue %c0_i32, %5[1] : !llvm.struct<(ptr, i32, i32, i32)>  "array_new<u8>"
    %7 = llvm.insertvalue %c0_i32, %6[2] : !llvm.struct<(ptr, i32, i32, i32)>  "array_new<u8>"
    %8 = llvm.insertvalue %c0_i32, %7[3] : !llvm.struct<(ptr, i32, i32, i32)>  "array_new<u8>"
    cf.br ^bb4(%8 : !llvm.struct<(ptr, i32, i32, i32)>) "array_new<u8>"
  ^bb4(%9: !llvm.struct<(ptr, i32, i32, i32)> [unknown]):  // pred: ^bb3
    %10 = llvm.extractvalue %9[0] : !llvm.struct<(ptr, i32, i32, i32)>  "snapshot_take<Array<u8>>"(#loc7)
    %11 = llvm.extractvalue %9[1] : !llvm.struct<(ptr, i32, i32, i32)>  "snapshot_take<Array<u8>>"(#loc7)
    %12 = llvm.extractvalue %9[2] : !llvm.struct<(ptr, i32, i32, i32)>  "snapshot_take<Array<u8>>"(#loc7)
    %c1_i64_0 = arith.constant 1 : i64 "snapshot_take<Array<u8>>"(#loc7)
    %13 = arith.subi %12, %11 : i32 "snapshot_take<Array<u8>>"(#loc7)
    %14 = arith.extui %13 : i32 to i64 "snapshot_take<Array<u8>>"(#loc7)
    %15 = arith.muli %14, %c1_i64_0 : i64 "snapshot_take<Array<u8>>"(#loc7)
    %16 = llvm.mlir.null : !llvm.ptr "snapshot_take<Array<u8>>"(#loc7)
    %17 = call @realloc(%16, %15) : (!llvm.ptr, i64) -> !llvm.ptr "snapshot_take<Array<u8>>"(#loc7)
    %18 = arith.extui %11 : i32 to i64 "snapshot_take<Array<u8>>"(#loc7)
    %19 = arith.muli %18, %c1_i64_0 : i64 "snapshot_take<Array<u8>>"(#loc7)
    %20 = llvm.getelementptr %10[%19] : (!llvm.ptr, i64) -> !llvm.ptr, i8 "snapshot_take<Array<u8>>"(#loc7)
    "llvm.intr.memcpy"(%17, %20, %15) <{isVolatile = false}> : (!llvm.ptr, !llvm.ptr, i64) -> () "snapshot_take<Array<u8>>"(#loc7)
    %21 = llvm.mlir.undef : !llvm.struct<(ptr, i32, i32, i32)> "snapshot_take<Array<u8>>"(#loc7)
    %c0_i32_1 = arith.constant 0 : i32 "snapshot_take<Array<u8>>"(#loc7)
    %22 = llvm.insertvalue %17, %21[0] : !llvm.struct<(ptr, i32, i32, i32)>  "snapshot_take<Array<u8>>"(#loc7)
    %23 = llvm.insertvalue %c0_i32_1, %22[1] : !llvm.struct<(ptr, i32, i32, i32)>  "snapshot_take<Array<u8>>"(#loc7)
    %24 = llvm.insertvalue %13, %23[2] : !llvm.struct<(ptr, i32, i32, i32)>  "snapshot_take<Array<u8>>"(#loc7)
    %25 = llvm.insertvalue %13, %24[3] : !llvm.struct<(ptr, i32, i32, i32)>  "snapshot_take<Array<u8>>"(#loc7)
    cf.br ^bb5(%9 : !llvm.struct<(ptr, i32, i32, i32)>) "snapshot_take<Array<u8>>"(#loc7)
  ^bb5(%26: !llvm.struct<(ptr, i32, i32, i32)> [unknown]):  // pred: ^bb4
    %27 = llvm.extractvalue %26[0] : !llvm.struct<(ptr, i32, i32, i32)>  "drop<Array<u8>>"
    call @free(%27) : (!llvm.ptr) -> () "drop<Array<u8>>"
    cf.br ^bb6(%25 : !llvm.struct<(ptr, i32, i32, i32)>) "drop<Array<u8>>"
  ^bb6(%28: !llvm.struct<(ptr, i32, i32, i32)> [unknown]):  // pred: ^bb5
    %29 = llvm.mlir.undef : !llvm.struct<(struct<(ptr, i32, i32, i32)>)> "struct_construct<core::array::Span::<core::integer::u8>>"(#loc21)
    %30 = llvm.insertvalue %28, %29[0] : !llvm.struct<(struct<(ptr, i32, i32, i32)>)>  "struct_construct<core::array::Span::<core::integer::u8>>"(#loc21)
    cf.br ^bb7(%1 : i64) "struct_construct<core::array::Span::<core::integer::u8>>"(#loc21)
  ^bb7(%31: i64 [unknown]):  // pred: ^bb6
    cf.br ^bb8(%2 : i128) "store_temp<RangeCheck>"(#loc22)
  ^bb8(%32: i128 [unknown]):  // pred: ^bb7
    cf.br ^bb9(%30 : !llvm.struct<(struct<(ptr, i32, i32, i32)>)>) "store_temp<GasBuiltin>"(#loc17)
  ^bb9(%33: !llvm.struct<(struct<(ptr, i32, i32, i32)>)> [unknown]):  // pred: ^bb8
    cf.br ^bb10(%31, %32, %33 : i64, i128, !llvm.struct<(struct<(ptr, i32, i32, i32)>)>) "store_temp<core::array::Span::<core::integer::u8>>"(#loc17)
  ^bb10(%34: i64 [unknown], %35: i128 [unknown], %36: !llvm.struct<(struct<(ptr, i32, i32, i32)>)> [unknown]):  // pred: ^bb9
    %37:3 = call @"program::program::try_into_bytes(f1)"(%34, %35, %36) : (i64, i128, !llvm.struct<(struct<(ptr, i32, i32, i32)>)>) -> (i64, i128, !llvm.struct<(i64, array<20 x i8>)>) "function_call<user@program::program::try_into_bytes>"(#loc17)
    llvm.store %37#2, %0 {alignment = 8 : i64} : !llvm.struct<(i64, array<20 x i8>)>, !llvm.ptr "function_call<user@program::program::try_into_bytes>"(#loc17)
    cf.br ^bb11(%37#0, %37#1, %0 : i64, i128, !llvm.ptr) "function_call<user@program::program::try_into_bytes>"(#loc17)
  ^bb11(%38: i64 [unknown], %39: i128 [unknown], %40: !llvm.ptr [unknown]):  // pred: ^bb10
    %41 = llvm.load %0 {alignment = 8 : i64} : !llvm.ptr -> !llvm.struct<(i64, array<20 x i8>)> [unknown]
    return %37#0, %37#1, %41 : i64, i128, !llvm.struct<(i64, array<20 x i8>)> [unknown]
  } [unknown]
  func.func public @"program::program::try_into_bytes[expr25](f0)"(%arg0: i64 [unknown], %arg1: i128 [unknown], %arg2: i32 [unknown], %arg3: !llvm.struct<(struct<(ptr, i32, i32, i32)>)> [unknown], %arg4: !llvm.struct<(ptr, i32, i32, i32)> [unknown]) -> (i64, i128, !llvm.struct<(i64, array<24 x i8>)>) attributes {llvm.emit_c_interface} {
    %c1_i64 = arith.constant 1 : i64 "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 1>"(#loc23)
    %0 = llvm.alloca %c1_i64 x !llvm.struct<(i64, array<24 x i8>)> {alignment = 8 : i64} : (i64) -> !llvm.ptr "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 1>"(#loc23)
    %c1_i64_0 = arith.constant 1 : i64 "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc2)
    %1 = llvm.alloca %c1_i64_0 x !llvm.struct<(i64, array<24 x i8>)> {alignment = 8 : i64} : (i64) -> !llvm.ptr "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc2)
    %c1_i64_1 = arith.constant 1 : i64 "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc24)
    %2 = llvm.alloca %c1_i64_1 x !llvm.struct<(i64, array<24 x i8>)> {alignment = 8 : i64} : (i64) -> !llvm.ptr "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc24)
    cf.br ^bb1(%arg0, %arg1, %arg2, %arg3, %arg4 : i64, i128, i32, !llvm.struct<(struct<(ptr, i32, i32, i32)>)>, !llvm.struct<(ptr, i32, i32, i32)>) [unknown]
  ^bb1(%3: i64 [unknown], %4: i128 [unknown], %5: i32 [unknown], %6: !llvm.struct<(struct<(ptr, i32, i32, i32)>)> [unknown], %7: !llvm.struct<(ptr, i32, i32, i32)> [unknown]):  // pred: ^bb0
    cf.br ^bb2 [unknown]
  ^bb2:  // pred: ^bb1
    %8 = llvm.mlir.undef : !llvm.array<0 x i8> "get_builtin_costs"
    cf.br ^bb3(%8 : !llvm.array<0 x i8>) "get_builtin_costs"
  ^bb3(%9: !llvm.array<0 x i8> [unknown]):  // pred: ^bb2
    cf.br ^bb4(%3, %4, %9 : i64, i128, !llvm.array<0 x i8>) "store_temp<BuiltinCosts>"(#loc2)
  ^bb4(%10: i64 [unknown], %11: i128 [unknown], %12: !llvm.array<0 x i8> [unknown]):  // pred: ^bb3
    %c1_i64_2 = arith.constant 1 : i64 "withdraw_gas_all"
    %13 = arith.addi %10, %c1_i64_2 : i64 "withdraw_gas_all"
    %c0_i128 = arith.constant 0 : i128 "withdraw_gas_all"
    %14 = arith.cmpi uge, %11, %c0_i128 : i128 "withdraw_gas_all"
    %15 = llvm.intr.usub.sat(%11, %c0_i128)  : (i128, i128) -> i128 "withdraw_gas_all"
    cf.cond_br %14, ^bb5, ^bb28 "withdraw_gas_all"
  ^bb5:  // pred: ^bb4
    cf.br ^bb6(%6 : !llvm.struct<(struct<(ptr, i32, i32, i32)>)>) "branch_align"(#loc27)
  ^bb6(%16: !llvm.struct<(struct<(ptr, i32, i32, i32)>)> [unknown]):  // pred: ^bb5
    %17 = llvm.extractvalue %16[0] : !llvm.struct<(struct<(ptr, i32, i32, i32)>)>  "struct_deconstruct<core::array::Span::<core::integer::u8>>"(#loc27)
    cf.br ^bb7(%17 : !llvm.struct<(ptr, i32, i32, i32)>) "struct_deconstruct<core::array::Span::<core::integer::u8>>"(#loc27)
  ^bb7(%18: !llvm.struct<(ptr, i32, i32, i32)> [unknown]):  // pred: ^bb6
    %19 = llvm.extractvalue %18[1] : !llvm.struct<(ptr, i32, i32, i32)>  "array_len<u8>"
    %20 = llvm.extractvalue %18[2] : !llvm.struct<(ptr, i32, i32, i32)>  "array_len<u8>"
    %21 = arith.subi %20, %19 : i32 "array_len<u8>"
    cf.br ^bb8(%5 : i32) "array_len<u8>"
  ^bb8(%22: i32 [unknown]):  // pred: ^bb7
    cf.br ^bb9(%21 : i32) "dup<u32>"
  ^bb9(%23: i32 [unknown]):  // pred: ^bb8
    cf.br ^bb10(%13 : i64) "store_temp<u32>"(#loc27)
  ^bb10(%24: i64 [unknown]):  // pred: ^bb9
    cf.br ^bb11(%22, %23 : i32, i32) "store_temp<RangeCheck>"(#loc30)
  ^bb11(%25: i32 [unknown], %26: i32 [unknown]):  // pred: ^bb10
    %27 = arith.cmpi eq, %25, %26 : i32 "u32_eq"
    cf.cond_br %27, ^bb20, ^bb12 "u32_eq"
  ^bb12:  // pred: ^bb11
    cf.br ^bb13 "branch_align"(#loc32)
  ^bb13:  // pred: ^bb12
    %28 = llvm.mlir.undef : !llvm.struct<()> "struct_construct<Unit>"(#loc24)
    cf.br ^bb14(%7, %22, %28 : !llvm.struct<(ptr, i32, i32, i32)>, i32, !llvm.struct<()>) "struct_construct<Unit>"(#loc24)
  ^bb14(%29: !llvm.struct<(ptr, i32, i32, i32)> [unknown], %30: i32 [unknown], %31: !llvm.struct<()> [unknown]):  // pred: ^bb13
    %32 = llvm.mlir.undef : !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)> "struct_construct<Tuple<Array<felt252>, u32, Unit>>"(#loc24)
    %33 = llvm.insertvalue %29, %32[0] : !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>  "struct_construct<Tuple<Array<felt252>, u32, Unit>>"(#loc24)
    %34 = llvm.insertvalue %30, %33[1] : !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>  "struct_construct<Tuple<Array<felt252>, u32, Unit>>"(#loc24)
    %35 = llvm.insertvalue %31, %34[2] : !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>  "struct_construct<Tuple<Array<felt252>, u32, Unit>>"(#loc24)
    cf.br ^bb15(%35 : !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>) "struct_construct<Tuple<Array<felt252>, u32, Unit>>"(#loc24)
  ^bb15(%36: !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)> [unknown]):  // pred: ^bb14
    %false = arith.constant false "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc24)
    %37 = llvm.mlir.undef : !llvm.struct<(i1, struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>)> "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc24)
    %38 = llvm.insertvalue %false, %37[0] : !llvm.struct<(i1, struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>)>  "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc24)
    %39 = llvm.insertvalue %36, %38[1] : !llvm.struct<(i1, struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>)>  "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc24)
    llvm.store %39, %2 {alignment = 8 : i64} : !llvm.struct<(i1, struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>)>, !llvm.ptr "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc24)
    cf.br ^bb16(%24 : i64) "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc24)
  ^bb16(%40: i64 [unknown]):  // pred: ^bb15
    cf.br ^bb17(%15 : i128) "store_temp<RangeCheck>"(#loc33)
  ^bb17(%41: i128 [unknown]):  // pred: ^bb16
    cf.br ^bb18(%2 : !llvm.ptr) "store_temp<GasBuiltin>"(#loc34)
  ^bb18(%42: !llvm.ptr [unknown]):  // pred: ^bb17
    cf.br ^bb19(%40, %41, %42 : i64, i128, !llvm.ptr) "store_temp<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"(#loc35)
  ^bb19(%43: i64 [unknown], %44: i128 [unknown], %45: !llvm.ptr [unknown]):  // pred: ^bb18
    %46 = llvm.load %42 {alignment = 8 : i64} : !llvm.ptr -> !llvm.struct<(i64, array<24 x i8>)> [unknown]
    return %40, %41, %46 : i64, i128, !llvm.struct<(i64, array<24 x i8>)> [unknown]
  ^bb20:  // pred: ^bb11
    cf.br ^bb21 "branch_align"(#loc36)
  ^bb21:  // pred: ^bb20
    %47 = llvm.mlir.undef : !llvm.struct<()> "struct_construct<Unit>"(#loc37)
    cf.br ^bb22(%7, %22, %47 : !llvm.struct<(ptr, i32, i32, i32)>, i32, !llvm.struct<()>) "struct_construct<Unit>"(#loc37)
  ^bb22(%48: !llvm.struct<(ptr, i32, i32, i32)> [unknown], %49: i32 [unknown], %50: !llvm.struct<()> [unknown]):  // pred: ^bb21
    %51 = llvm.mlir.undef : !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)> "struct_construct<Tuple<Array<felt252>, u32, Unit>>"(#loc38)
    %52 = llvm.insertvalue %48, %51[0] : !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>  "struct_construct<Tuple<Array<felt252>, u32, Unit>>"(#loc38)
    %53 = llvm.insertvalue %49, %52[1] : !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>  "struct_construct<Tuple<Array<felt252>, u32, Unit>>"(#loc38)
    %54 = llvm.insertvalue %50, %53[2] : !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>  "struct_construct<Tuple<Array<felt252>, u32, Unit>>"(#loc38)
    cf.br ^bb23(%54 : !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>) "struct_construct<Tuple<Array<felt252>, u32, Unit>>"(#loc38)
  ^bb23(%55: !llvm.struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)> [unknown]):  // pred: ^bb22
    %false_3 = arith.constant false "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc2)
    %56 = llvm.mlir.undef : !llvm.struct<(i1, struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>)> "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc2)
    %57 = llvm.insertvalue %false_3, %56[0] : !llvm.struct<(i1, struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>)>  "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc2)
    %58 = llvm.insertvalue %55, %57[1] : !llvm.struct<(i1, struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>)>  "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc2)
    llvm.store %58, %1 {alignment = 8 : i64} : !llvm.struct<(i1, struct<(struct<(ptr, i32, i32, i32)>, i32, struct<()>)>)>, !llvm.ptr "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc2)
    cf.br ^bb24(%24 : i64) "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc2)
  ^bb24(%59: i64 [unknown]):  // pred: ^bb23
    cf.br ^bb25(%15 : i128) "store_temp<RangeCheck>"(#loc39)
  ^bb25(%60: i128 [unknown]):  // pred: ^bb24
    cf.br ^bb26(%1 : !llvm.ptr) "store_temp<GasBuiltin>"(#loc40)
  ^bb26(%61: !llvm.ptr [unknown]):  // pred: ^bb25
    cf.br ^bb27(%59, %60, %61 : i64, i128, !llvm.ptr) "store_temp<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"(#loc41)
  ^bb27(%62: i64 [unknown], %63: i128 [unknown], %64: !llvm.ptr [unknown]):  // pred: ^bb26
    %65 = llvm.load %61 {alignment = 8 : i64} : !llvm.ptr -> !llvm.struct<(i64, array<24 x i8>)> [unknown]
    return %59, %60, %65 : i64, i128, !llvm.struct<(i64, array<24 x i8>)> [unknown]
  ^bb28:  // pred: ^bb4
    cf.br ^bb29(%6 : !llvm.struct<(struct<(ptr, i32, i32, i32)>)>) "branch_align"(#loc42)
  ^bb29(%66: !llvm.struct<(struct<(ptr, i32, i32, i32)>)> [unknown]):  // pred: ^bb28
    cf.br ^bb30(%5 : i32) "drop<core::array::Span::<core::integer::u8>>"
  ^bb30(%67: i32 [unknown]):  // pred: ^bb29
    cf.br ^bb31(%7 : !llvm.struct<(ptr, i32, i32, i32)>) "drop<u32>"
  ^bb31(%68: !llvm.struct<(ptr, i32, i32, i32)> [unknown]):  // pred: ^bb30
    %69 = llvm.extractvalue %68[0] : !llvm.struct<(ptr, i32, i32, i32)>  "drop<Array<felt252>>"
    call @free(%69) : (!llvm.ptr) -> () "drop<Array<felt252>>"
    cf.br ^bb32 "drop<Array<felt252>>"
  ^bb32:  // pred: ^bb31
    %70 = llvm.mlir.null : !llvm.ptr "array_new<felt252>"
    %c0_i32 = arith.constant 0 : i32 "array_new<felt252>"
    %71 = llvm.mlir.undef : !llvm.struct<(ptr, i32, i32, i32)> "array_new<felt252>"
    %72 = llvm.insertvalue %70, %71[0] : !llvm.struct<(ptr, i32, i32, i32)>  "array_new<felt252>"
    %73 = llvm.insertvalue %c0_i32, %72[1] : !llvm.struct<(ptr, i32, i32, i32)>  "array_new<felt252>"
    %74 = llvm.insertvalue %c0_i32, %73[2] : !llvm.struct<(ptr, i32, i32, i32)>  "array_new<felt252>"
    %75 = llvm.insertvalue %c0_i32, %74[3] : !llvm.struct<(ptr, i32, i32, i32)>  "array_new<felt252>"
    cf.br ^bb33 "array_new<felt252>"
  ^bb33:  // pred: ^bb32
    %c375233589013918064796019_i252 = arith.constant 375233589013918064796019 : i252 "felt252_const<375233589013918064796019>"
    cf.br ^bb34(%c375233589013918064796019_i252 : i252) "felt252_const<375233589013918064796019>"
  ^bb34(%76: i252 [unknown]):  // pred: ^bb33
    cf.br ^bb35(%75, %76 : !llvm.struct<(ptr, i32, i32, i32)>, i252) "store_temp<felt252>"(#loc42)
  ^bb35(%77: !llvm.struct<(ptr, i32, i32, i32)> [unknown], %78: i252 [unknown]):  // pred: ^bb34
    %c1_i32 = arith.constant 1 : i32 "array_append<felt252>"
    %c32_i64 = arith.constant 32 : i64 "array_append<felt252>"
    %79 = llvm.extractvalue %77[2] : !llvm.struct<(ptr, i32, i32, i32)>  "array_append<felt252>"
    %80 = llvm.extractvalue %77[3] : !llvm.struct<(ptr, i32, i32, i32)>  "array_append<felt252>"
    %81 = arith.cmpi ult, %79, %80 : i32 "array_append<felt252>"
    cf.cond_br %81, ^bb39(%77 : !llvm.struct<(ptr, i32, i32, i32)>), ^bb36 "array_append<felt252>"
  ^bb36:  // pred: ^bb35
    %c0_i32_4 = arith.constant 0 : i32 "array_append<felt252>"
    %82 = llvm.extractvalue %77[1] : !llvm.struct<(ptr, i32, i32, i32)>  "array_append<felt252>"
    %83 = arith.cmpi ne, %82, %c0_i32_4 : i32 "array_append<felt252>"
    cf.cond_br %83, ^bb37, ^bb38 "array_append<felt252>"
  ^bb37:  // pred: ^bb36
    %84 = llvm.extractvalue %77[1] : !llvm.struct<(ptr, i32, i32, i32)>  "array_append<felt252>"
    %85 = arith.extui %84 : i32 to i64 "array_append<felt252>"
    %86 = arith.muli %85, %c32_i64 : i64 "array_append<felt252>"
    %87 = llvm.extractvalue %77[0] : !llvm.struct<(ptr, i32, i32, i32)>  "array_append<felt252>"
    %88 = llvm.getelementptr %87[%86] : (!llvm.ptr, i64) -> !llvm.ptr, i8 "array_append<felt252>"
    %89 = arith.subi %79, %84 : i32 "array_append<felt252>"
    %90 = arith.extui %89 : i32 to i64 "array_append<felt252>"
    %91 = arith.muli %90, %c32_i64 : i64 "array_append<felt252>"
    "llvm.intr.memmove"(%87, %88, %91) <{isVolatile = false}> : (!llvm.ptr, !llvm.ptr, i64) -> () "array_append<felt252>"
    %c0_i32_5 = arith.constant 0 : i32 "array_append<felt252>"
    %92 = llvm.insertvalue %c0_i32_5, %77[1] : !llvm.struct<(ptr, i32, i32, i32)>  "array_append<felt252>"
    %93 = llvm.insertvalue %89, %92[2] : !llvm.struct<(ptr, i32, i32, i32)>  "array_append<felt252>"
    cf.br ^bb39(%93 : !llvm.struct<(ptr, i32, i32, i32)>) "array_append<felt252>"
  ^bb38:  // pred: ^bb36
    %c8_i32 = arith.constant 8 : i32 "array_append<felt252>"
    %c1024_i32 = arith.constant 1024 : i32 "array_append<felt252>"
    %94 = arith.shli %79, %c1_i32 : i32 "array_append<felt252>"
    %95 = arith.minui %94, %c1024_i32 : i32 "array_append<felt252>"
    %96 = arith.addi %95, %79 : i32 "array_append<felt252>"
    %97 = arith.maxui %96, %c8_i32 : i32 "array_append<felt252>"
    %98 = arith.extui %97 : i32 to i64 "array_append<felt252>"
    %99 = arith.muli %98, %c32_i64 : i64 "array_append<felt252>"
    %100 = llvm.extractvalue %77[0] : !llvm.struct<(ptr, i32, i32, i32)>  "array_append<felt252>"
    %101 = call @realloc(%100, %99) : (!llvm.ptr, i64) -> !llvm.ptr "array_append<felt252>"
    %102 = llvm.insertvalue %101, %77[0] : !llvm.struct<(ptr, i32, i32, i32)>  "array_append<felt252>"
    %103 = llvm.insertvalue %97, %102[3] : !llvm.struct<(ptr, i32, i32, i32)>  "array_append<felt252>"
    cf.br ^bb39(%103 : !llvm.struct<(ptr, i32, i32, i32)>) "array_append<felt252>"
  ^bb39(%104: !llvm.struct<(ptr, i32, i32, i32)> "array_append<felt252>"):  // 3 preds: ^bb35, ^bb37, ^bb38
    %105 = llvm.extractvalue %104[0] : !llvm.struct<(ptr, i32, i32, i32)>  "array_append<felt252>"
    %106 = llvm.extractvalue %104[2] : !llvm.struct<(ptr, i32, i32, i32)>  "array_append<felt252>"
    %107 = arith.extui %106 : i32 to i64 "array_append<felt252>"
    %108 = arith.muli %107, %c32_i64 : i64 "array_append<felt252>"
    %109 = llvm.getelementptr %105[%108] : (!llvm.ptr, i64) -> !llvm.ptr, i8 "array_append<felt252>"
    llvm.store %78, %109 {alignment = 16 : i64} : i252, !llvm.ptr "array_append<felt252>"
    %110 = arith.addi %106, %c1_i32 : i32 "array_append<felt252>"
    %111 = llvm.insertvalue %110, %104[2] : !llvm.struct<(ptr, i32, i32, i32)>  "array_append<felt252>"
    cf.br ^bb40 "array_append<felt252>"
  ^bb40:  // pred: ^bb39
    %112 = llvm.mlir.undef : !llvm.struct<()> "struct_construct<core::panics::Panic>"(#loc42)
    cf.br ^bb41(%112, %111 : !llvm.struct<()>, !llvm.struct<(ptr, i32, i32, i32)>) "struct_construct<core::panics::Panic>"(#loc42)
  ^bb41(%113: !llvm.struct<()> [unknown], %114: !llvm.struct<(ptr, i32, i32, i32)> [unknown]):  // pred: ^bb40
    %115 = llvm.mlir.undef : !llvm.struct<(struct<()>, struct<(ptr, i32, i32, i32)>)> "struct_construct<Tuple<core::panics::Panic, Array<felt252>>>"(#loc42)
    %116 = llvm.insertvalue %113, %115[0] : !llvm.struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>  "struct_construct<Tuple<core::panics::Panic, Array<felt252>>>"(#loc42)
    %117 = llvm.insertvalue %114, %116[1] : !llvm.struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>  "struct_construct<Tuple<core::panics::Panic, Array<felt252>>>"(#loc42)
    cf.br ^bb42(%117 : !llvm.struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>) "struct_construct<Tuple<core::panics::Panic, Array<felt252>>>"(#loc42)
  ^bb42(%118: !llvm.struct<(struct<()>, struct<(ptr, i32, i32, i32)>)> [unknown]):  // pred: ^bb41
    %true = arith.constant true "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 1>"(#loc23)
    %119 = llvm.mlir.undef : !llvm.struct<(i1, struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>)> "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 1>"(#loc23)
    %120 = llvm.insertvalue %true, %119[0] : !llvm.struct<(i1, struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>)>  "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 1>"(#loc23)
    %121 = llvm.insertvalue %118, %120[1] : !llvm.struct<(i1, struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>)>  "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 1>"(#loc23)
    llvm.store %121, %0 {alignment = 8 : i64} : !llvm.struct<(i1, struct<(struct<()>, struct<(ptr, i32, i32, i32)>)>)>, !llvm.ptr "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 1>"(#loc23)
    cf.br ^bb43(%13 : i64) "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 1>"(#loc23)
  ^bb43(%122: i64 [unknown]):  // pred: ^bb42
    cf.br ^bb44(%15 : i128) "store_temp<RangeCheck>"(#loc2)
  ^bb44(%123: i128 [unknown]):  // pred: ^bb43
    cf.br ^bb45(%0 : !llvm.ptr) "store_temp<GasBuiltin>"(#loc2)
  ^bb45(%124: !llvm.ptr [unknown]):  // pred: ^bb44
    cf.br ^bb46(%122, %123, %124 : i64, i128, !llvm.ptr) "store_temp<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"(#loc2)
  ^bb46(%125: i64 [unknown], %126: i128 [unknown], %127: !llvm.ptr [unknown]):  // pred: ^bb45
    %128 = llvm.load %124 {alignment = 8 : i64} : !llvm.ptr -> !llvm.struct<(i64, array<24 x i8>)> [unknown]
    return %122, %123, %128 : i64, i128, !llvm.struct<(i64, array<24 x i8>)> [unknown]
  } [unknown]
} "module"
#loc = "module"
#loc2 = program.cairo:4:4
#loc3 = "enum_init<core::panics::PanicResult::<((),)>, 1>"
#loc4 = "enum_init<core::panics::PanicResult::<((),)>, 0>"
#loc5 = program.cairo:1:8
#loc6 = "array_new<felt252>"
#loc7 = /Users/edgar/corelib/src/array.cairo:30:8
#loc8 = program.cairo:0:34
#loc9 = "enum_match<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"
#loc10 = "branch_align"
#loc11 = "drop<Tuple<Array<felt252>, u32, Unit>>"
#loc12 = "struct_construct<Unit>"
#loc13 = "struct_construct<Tuple<Unit>>"
#loc14 = "store_temp<RangeCheck>"
#loc15 = "store_temp<GasBuiltin>"
#loc16 = "store_temp<core::panics::PanicResult::<((),)>>"
#loc17 = program.cairo:24:10
#loc18 = "disable_ap_tracking"
#loc19 = "array_new<u8>"
#loc20 = "drop<Array<u8>>"
#loc21 = program.cairo:26:4
#loc22 = /Users/edgar/corelib/src/array.cairo:83:8
#loc23 = program.cairo:5:12
#loc24 = program.cairo:16:22
#loc25 = "get_builtin_costs"
#loc26 = "withdraw_gas_all"
#loc27 = program.cairo:6:18
#loc28 = "array_len<u8>"
#loc29 = "dup<u32>"
#loc30 = program.cairo:9:33
#loc31 = "u32_eq"
#loc32 = program.cairo:9:12
#loc33 = program.cairo:20:13
#loc34 = program.cairo:5:17
#loc35 = /Users/edgar/corelib/src/array.cairo:203:11
#loc36 = /Users/edgar/corelib/src/array.cairo:204:8
#loc37 = /Users/edgar/corelib/src/array.cairo:34:8
#loc38 = /Users/edgar/corelib/src/array.cairo:33:52
#loc39 = /Users/edgar/corelib/src/integer.cairo:744:15
#loc40 = /Users/edgar/corelib/src/integer.cairo:681:15
#loc41 = /Users/edgar/corelib/src/integer.cairo:681:21
#loc42 = /Users/edgar/corelib/src/integer.cairo:681:8
#loc43 = "drop<core::array::Span::<core::integer::u8>>"
#loc44 = "drop<u32>"
#loc45 = "drop<Array<felt252>>"
#loc46 = "felt252_const<375233589013918064796019>"
#loc48 = "function_call<user@program::program::try_into_bytes[expr25]>"(#loc2)
#loc49 = "disable_ap_tracking"(#loc5)
#loc50 = "u32_const<0>"(#loc2)
#loc51 = "store_temp<RangeCheck>"(#loc7)
#loc52 = "store_temp<GasBuiltin>"(#loc8)
#loc53 = "store_temp<u32>"(#loc8)
#loc54 = "store_temp<core::array::Span::<core::integer::u8>>"(#loc8)
#loc55 = "store_temp<Array<felt252>>"(#loc2)
#loc56 = "function_call<user@program::program::try_into_bytes>"(#loc17)
#loc57 = "snapshot_take<Array<u8>>"(#loc7)
#loc58 = "struct_construct<core::array::Span::<core::integer::u8>>"(#loc21)
#loc59 = "store_temp<RangeCheck>"(#loc22)
#loc60 = "store_temp<GasBuiltin>"(#loc17)
#loc61 = "store_temp<core::array::Span::<core::integer::u8>>"(#loc17)
#loc62 = "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 1>"(#loc23)
#loc63 = "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc2)
#loc64 = "enum_init<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>, 0>"(#loc24)
#loc65 = "store_temp<BuiltinCosts>"(#loc2)
#loc66 = "branch_align"(#loc27)
#loc67 = "struct_deconstruct<core::array::Span::<core::integer::u8>>"(#loc27)
#loc68 = "store_temp<u32>"(#loc27)
#loc69 = "store_temp<RangeCheck>"(#loc30)
#loc70 = "branch_align"(#loc32)
#loc71 = "struct_construct<Unit>"(#loc24)
#loc72 = "struct_construct<Tuple<Array<felt252>, u32, Unit>>"(#loc24)
#loc73 = "store_temp<RangeCheck>"(#loc33)
#loc74 = "store_temp<GasBuiltin>"(#loc34)
#loc75 = "store_temp<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"(#loc35)
#loc76 = "branch_align"(#loc36)
#loc77 = "struct_construct<Unit>"(#loc37)
#loc78 = "struct_construct<Tuple<Array<felt252>, u32, Unit>>"(#loc38)
#loc79 = "store_temp<RangeCheck>"(#loc39)
#loc80 = "store_temp<GasBuiltin>"(#loc40)
#loc81 = "store_temp<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"(#loc41)
#loc82 = "branch_align"(#loc42)
#loc83 = "store_temp<felt252>"(#loc42)
#loc84 = "struct_construct<core::panics::Panic>"(#loc42)
#loc85 = "struct_construct<Tuple<core::panics::Panic, Array<felt252>>>"(#loc42)
#loc86 = "store_temp<RangeCheck>"(#loc2)
#loc87 = "store_temp<GasBuiltin>"(#loc2)
#loc88 = "store_temp<core::panics::PanicResult::<(core::array::Array::<core::felt252>, core::integer::u32, ())>>"(#loc2)

Copy link

github-actions bot commented Apr 12, 2024

Benchmarking results

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 13.448 ± 0.042 13.402 13.549 30.90 ± 0.15
cairo-native (embedded AOT) 1.550 ± 0.009 1.541 1.567 3.56 ± 0.02
cairo-native (embedded JIT using LLVM's ORC Engine) 1.522 ± 0.008 1.511 1.534 3.50 ± 0.02
cairo-native (standalone AOT) 0.636 ± 0.002 0.634 0.638 1.46 ± 0.01
cairo-native (standalone AOT with -march=native) 0.435 ± 0.002 0.433 0.437 1.00

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 12.948 ± 0.032 12.904 13.021 1593.36 ± 18.14
cairo-native (embedded AOT) 1.071 ± 0.008 1.052 1.079 131.80 ± 1.75
cairo-native (embedded JIT using LLVM's ORC Engine) 1.091 ± 0.006 1.082 1.101 134.23 ± 1.66
cairo-native (standalone AOT) 0.008 ± 0.000 0.008 0.009 1.01 ± 0.02
cairo-native (standalone AOT with -march=native) 0.008 ± 0.000 0.008 0.009 1.00

Benchmark for program logistic_map

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 1.824 ± 0.010 1.816 1.848 26.86 ± 0.17
cairo-native (embedded AOT) 1.179 ± 0.007 1.167 1.189 17.37 ± 0.12
cairo-native (embedded JIT using LLVM's ORC Engine) 1.417 ± 0.006 1.408 1.425 20.87 ± 0.12
cairo-native (standalone AOT) 0.112 ± 0.000 0.111 0.113 1.64 ± 0.01
cairo-native (standalone AOT with -march=native) 0.068 ± 0.000 0.068 0.069 1.00

@codecov-commenter
Copy link

codecov-commenter commented Apr 12, 2024

Codecov Report

Attention: Patch coverage is 37.50000% with 75 lines in your changes are missing coverage. Please review.

Project coverage is 90.09%. Comparing base (60ed062) to head (efce43a).

❗ Current head efce43a differs from pull request most recent head 51108b8. Consider uploading reports for the commit 51108b8 to get more accurate results

Files Patch % Lines
src/utils.rs 0.00% 30 Missing ⚠️
src/context.rs 56.52% 20 Missing ⚠️
src/bin/cairo-native-run.rs 0.00% 15 Missing ⚠️
src/bin/cairo-native-compile.rs 0.00% 5 Missing ⚠️
src/bin/cairo-native-dump.rs 0.00% 2 Missing ⚠️
src/cache/aot.rs 0.00% 1 Missing ⚠️
src/compiler.rs 94.73% 1 Missing ⚠️
src/libfuncs/enum.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #512      +/-   ##
==========================================
- Coverage   90.24%   90.09%   -0.16%     
==========================================
  Files         107      107              
  Lines       34398    34480      +82     
==========================================
+ Hits        31042    31064      +22     
- Misses       3356     3416      +60     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

igaray
igaray previously approved these changes Apr 12, 2024
Copy link
Member

@juanbono juanbono left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

@edg-l edg-l added this pull request to the merge queue Apr 16, 2024
Merged via the queue into main with commit 2264ce4 Apr 16, 2024
9 checks passed
@edg-l edg-l deleted the add_debug_locations branch April 16, 2024 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants