Skip to content

perf: allocate Enzyme shadow memory during preparation#782

Merged
gdalle merged 9 commits intomainfrom
gd/enzyme_cache
May 7, 2025
Merged

perf: allocate Enzyme shadow memory during preparation#782
gdalle merged 9 commits intomainfrom
gd/enzyme_cache

Conversation

@gdalle
Copy link
Copy Markdown
Member

@gdalle gdalle commented May 6, 2025

Fixes #766

@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.90%. Comparing base (bdddafb) to head (d6ead1b).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #782      +/-   ##
==========================================
- Coverage   97.93%   97.90%   -0.03%     
==========================================
  Files         129      129              
  Lines        7458     7549      +91     
==========================================
+ Hits         7304     7391      +87     
- Misses        154      158       +4     
Flag Coverage Δ
DI 99.03% <100.00%> (+0.01%) ⬆️
DIT 95.03% <100.00%> (-0.17%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gdalle
Copy link
Copy Markdown
Member Author

gdalle commented May 6, 2025

This PR introduces an error on my Mac M3 which does not occur on the Ubuntu CI runners.

MWE:

using DifferentiationInterface, DifferentiationInterfaceTest
import DifferentiationInterfaceTest as DIT
using Enzyme: Enzyme

test_differentiation(
    AutoEnzyme(; mode=Enzyme.Forward, function_annotation=Enzyme.Duplicated),
    filter(
        s ->
            s.x isa Vector &&
                s.y isa Matrix &&
                s isa Scenario{:pushforward,:out,:in} &&
                length(s.tang) == 1,
        default_scenarios(; include_normal=false, include_closurified=true),
    );
    excluded=vcat([:jacobian, :gradient, :derivative, :pullback], SECOND_ORDER),
    logging=false,
)

Error:

Details
Correctness: Error During Test at /Users/guillaumedalle/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:157
  Got exception outside of a @test
  Enzyme compilation failed due to an internal error.
   Please open an issue with the code to reproduce and full error log on github.com/EnzymeAD/Enzyme.jl
   To toggle more information for debugging (needed for bug reports), set Enzyme.Compiler.VERBOSE_ERRORS[] = true (default false)
  
  Stacktrace:
   [1] ==
     @ ./promotion.jl:639
   [2] _copyto_impl!
     @ ./array.jl:302
   [3] copyto!
     @ ./array.jl:299
   [4] copyto!
     @ ./array.jl:322
   [5] WritableClosure
     @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/scenarios/modify.jl:126
   [6] WritableClosure
     @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/scenarios/modify.jl:0
  
  Stacktrace:
    [1] julia_error(msg::String, val::Ptr{LLVM.API.LLVMOpaqueValue}, errtype::Enzyme.API.ErrorType, data::Ptr{Nothing}, data2::Ptr{LLVM.API.LLVMOpaqueValue}, B::Ptr{LLVM.API.LLVMOpaqueBuilder})
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/errors.jl:394
    [2] julia_error(cstr::Cstring, val::Ptr{LLVM.API.LLVMOpaqueValue}, errtype::Enzyme.API.ErrorType, data::Ptr{Nothing}, data2::Ptr{LLVM.API.LLVMOpaqueValue}, B::Ptr{LLVM.API.LLVMOpaqueBuilder})
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/errors.jl:249
    [3] EnzymeCreateForwardDiff(logic::Enzyme.Logic, todiff::LLVM.Function, retType::Enzyme.API.CDIFFE_TYPE, constant_args::Vector{Enzyme.API.CDIFFE_TYPE}, TA::Enzyme.TypeAnalysis, returnValue::Bool, mode::Enzyme.API.CDerivativeMode, runtimeActivity::Bool, width::Int64, additionalArg::Ptr{Nothing}, typeInfo::Enzyme.FnTypeInfo, uncacheable_args::Vector{Bool})
      @ Enzyme.API ~/.julia/packages/Enzyme/3VNOP/src/api.jl:338
    [4] enzyme!(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, mod::LLVM.Module, primalf::LLVM.Function, TT::Type, mode::Enzyme.API.CDerivativeMode, width::Int64, parallel::Bool, actualRetType::Type, wrap::Bool, modifiedBetween::NTuple{N, Bool} where N, returnPrimal::Bool, expectedTapeType::Type, loweredArgs::Set{Int64}, boxedArgs::Set{Int64})
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:1793
    [5] codegen(output::Symbol, job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, toplevel::Bool, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing)
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:4664
    [6] codegen
      @ ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:3450 [inlined]
    [7] _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, postopt::Bool)
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:5528
    [8] _thunk
      @ ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:5528 [inlined]
    [9] cached_compilation
      @ ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:5580 [inlined]
   [10] thunkbase(mi::Core.MethodInstance, World::UInt64, FA::Type{<:EnzymeCore.Annotation}, A::Type{<:EnzymeCore.Annotation}, TT::Type, Mode::Enzyme.API.CDerivativeMode, width::Int64, ModifiedBetween::NTuple{N, Bool} where N, ReturnPrimal::Bool, ShadowInit::Bool, ABI::Type, ErrIfFuncWritten::Bool, RuntimeActivity::Bool, edges::Vector{Any})
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:5691
   [11] thunk_generator(world::UInt64, source::LineNumberNode, FA::Type, A::Type, TT::Type, Mode::Enzyme.API.CDerivativeMode, Width::Int64, ModifiedBetween::NTuple{N, Bool} where N, ReturnPrimal::Bool, ShadowInit::Bool, ABI::Type, ErrIfFuncWritten::Bool, RuntimeActivity::Bool, self::Any, fakeworld::Any, fa::Type, a::Type, tt::Type, mode::Type, width::Type, modifiedbetween::Type, returnprimal::Type, shadowinit::Type, abi::Type, erriffuncwritten::Type, runtimeactivity::Type)
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:5876
   [12] autodiff
      @ ~/.julia/packages/Enzyme/3VNOP/src/Enzyme.jl:640 [inlined]
   [13] value_and_pushforward(::DifferentiationInterfaceTest.WritableClosure{:in, typeof(DifferentiationInterfaceTest.vec_to_mat!), Vector{Float64}, Matrix{Float64}}, ::Matrix{Float64}, ::DifferentiationInterfaceEnzymeExt.EnzymeTwoArgPushforwardPrep{Tuple{DifferentiationInterfaceTest.WritableClosure{:in, typeof(DifferentiationInterfaceTest.vec_to_mat!), Vector{Float64}, Matrix{Float64}}, Matrix{Float64}, AutoEnzyme{EnzymeCore.ForwardMode{false, EnzymeCore.FFIABI, false, false}, EnzymeCore.Duplicated}, Vector{Float64}, Tuple{Vector{Float64}}, Tuple{}}, DifferentiationInterfaceTest.WritableClosure{:in, typeof(DifferentiationInterfaceTest.vec_to_mat!), Vector{Float64}, Matrix{Float64}}, Tuple{}}, ::AutoEnzyme{EnzymeCore.ForwardMode{false, EnzymeCore.FFIABI, false, false}, EnzymeCore.Duplicated}, ::Vector{Float64}, ::Tuple{Vector{Float64}})
      @ DifferentiationInterfaceEnzymeExt ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterface/ext/DifferentiationInterfaceEnzymeExt/forward_twoarg.jl:43
   [14] value_and_pushforward(::DifferentiationInterfaceTest.WritableClosure{:in, typeof(DifferentiationInterfaceTest.vec_to_mat!), Vector{Float64}, Matrix{Float64}}, ::Matrix{Float64}, ::AutoEnzyme{EnzymeCore.ForwardMode{false, EnzymeCore.FFIABI, false, false}, EnzymeCore.Duplicated}, ::Vector{Float64}, ::Tuple{Vector{Float64}})
      @ DifferentiationInterface ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterface/src/fallbacks/no_prep.jl:203
   [15] test_correctness(ba::AutoEnzyme{EnzymeCore.ForwardMode{false, EnzymeCore.FFIABI, false, false}, EnzymeCore.Duplicated}, scen::Scenario{:pushforward, :out, :in, DifferentiationInterfaceTest.WritableClosure{:in, typeof(DifferentiationInterfaceTest.vec_to_mat!), Vector{Float64}, Matrix{Float64}}, Vector{Float64}, Matrix{Float64}, Tuple{Vector{Float64}}, Tuple{}, Tuple{Matrix{Float64}}, Nothing, Nothing}; isapprox::typeof(isapprox), atol::Int64, rtol::Float64, scenario_intact::Bool, sparsity::Bool)
      @ DifferentiationInterfaceTest ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/tests/correctness_eval.jl:708
   [16] macro expansion
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:158 [inlined]
   [17] macro expansion
      @ ~/.julia/juliaup/julia-1.11.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
   [18] macro expansion
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:158 [inlined]
   [19] macro expansion
      @ ~/.julia/juliaup/julia-1.11.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1793 [inlined]
   [20] macro expansion
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:131 [inlined]
   [21] macro expansion
      @ ~/.julia/juliaup/julia-1.11.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1793 [inlined]
   [22] macro expansion
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:129 [inlined]
   [23] macro expansion
      @ ~/.julia/juliaup/julia-1.11.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1793 [inlined]
   [24] macro expansion
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:126 [inlined]
   [25] macro expansion
      @ ~/.julia/juliaup/julia-1.11.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
   [26] test_differentiation(backends::Vector{AutoEnzyme{EnzymeCore.ForwardMode{false, EnzymeCore.FFIABI, false, false}, EnzymeCore.Duplicated}}, scenarios::Vector{Scenario}; testset_name::Nothing, correctness::Bool, type_stability::Symbol, allocations::Symbol, benchmark::Symbol, excluded::Vector{Symbol}, detailed::Bool, logging::Bool, isapprox::typeof(isapprox), atol::Int64, rtol::Float64, scenario_intact::Bool, sparsity::Bool, ignored_modules::Nothing, function_filter::DifferentiationInterfaceTest.var"#637#644", skip_allocations::Bool, count_calls::Bool, benchmark_test::Bool, benchmark_seconds::Int64, benchmark_aggregation::typeof(minimum), adaptive_batchsize::Bool)
      @ DifferentiationInterfaceTest ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:126
   [27] test_differentiation
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:92 [inlined]
   [28] #test_differentiation#646
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:219 [inlined]
   [29] top-level scope
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterface/test/Back/Enzyme/playground.jl:5
   [30] eval
      @ ./boot.jl:430 [inlined]
   [31] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
      @ Base ./loading.jl:2734
   [32] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@Kwargs{})
      @ Base ./essentials.jl:1055
   [33] invokelatest(::Any, ::Any, ::Vararg{Any})
      @ Base ./essentials.jl:1052
   [34] inlineeval(m::Module, code::String, code_line::Int64, code_column::Int64, file::String; softscope::Bool)
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/eval.jl:271
   [35] (::VSCodeServer.var"#69#74"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/eval.jl:181
   [36] withpath(f::VSCodeServer.var"#69#74"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/repl.jl:276
   [37] (::VSCodeServer.var"#68#73"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/eval.jl:179
   [38] hideprompt(f::VSCodeServer.var"#68#73"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/repl.jl:38
   [39] #67
      @ ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/eval.jl:150 [inlined]
   [40] with_logstate(f::VSCodeServer.var"#67#72"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, logstate::Base.CoreLogging.LogState)
      @ Base.CoreLogging ./logging/logging.jl:522
   [41] with_logger
      @ ./logging/logging.jl:632 [inlined]
   [42] (::VSCodeServer.var"#66#71"{VSCodeServer.ReplRunCodeRequestParams})()
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/eval.jl:263
   [43] #invokelatest#2
      @ ./essentials.jl:1055 [inlined]
   [44] invokelatest(::Any)
      @ Base ./essentials.jl:1052
   [45] (::VSCodeServer.var"#64#65")()
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/eval.jl:34
Test Summary:                                                                                                                  | Error  Total  Time
Testing correctness                                                                                                            |     1      1  0.3s
  AutoEnzyme(mode=EnzymeCore.ForwardMode{false, EnzymeCore.FFIABI, false, false}(), function_annotation=EnzymeCore.Duplicated) |     1      1  0.3s
    pushforward                                                                                                                |     1      1  0.3s
      Scenario{:pushforward,:out} WritableClosure(vec_to_mat!) : Vector{Float64} -> Matrix{Float64} (1 tangents)               |     1      1  0.3s
        Correctness                                                                                                            |     1      1  0.3s
ERROR: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.

Error with LLVM blurb (Enzyme.API.printall!(true)):

Details
julia> test_differentiation(
           AutoEnzyme(; mode=Enzyme.Forward, function_annotation=Enzyme.Duplicated),
           filter(
               s ->
                   s.x isa Vector &&
                       s.y isa Matrix &&
                       s isa Scenario{:pushforward,:out,:in} &&
                       length(s.tang) == 1,
               default_scenarios(; include_normal=false, include_closurified=true),
           );
           excluded=vcat([:jacobian, :gradient, :derivative, :pullback], SECOND_ORDER),
           logging=false,
       )
after simplification :
; Function Attrs: mustprogress willreturn
define void @preprocess_julia_WritableClosure_250993_inner.5({ {} addrspace(10)*, {} addrspace(10)* } "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,0]:Pointer, [-1,0,0,0]:Pointer, [-1,0,0,0,-1]:Float@double, [-1,0,0,8]:Pointer, [-1,0,0,8,0]:Integer, [-1,0,0,8,1]:Integer, [-1,0,0,8,2]:Integer, [-1,0,0,8,3]:Integer, [-1,0,0,8,4]:Integer, [-1,0,0,8,5]:Integer, [-1,0,0,8,6]:Integer, [-1,0,0,8,7]:Integer, [-1,0,0,8,8]:Pointer, [-1,0,0,8,8,-1]:Float@double, [-1,0,0,16]:Integer, [-1,0,0,17]:Integer, [-1,0,0,18]:Integer, [-1,0,0,19]:Integer, [-1,0,0,20]:Integer, [-1,0,0,21]:Integer, [-1,0,0,22]:Integer, [-1,0,0,23]:Integer, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,0]:Pointer, [-1,8,8,0,0]:Pointer, [-1,8,8,0,0,-1]:Float@double, [-1,8,8,0,8]:Pointer, [-1,8,8,0,8,0]:Integer, [-1,8,8,0,8,1]:Integer, [-1,8,8,0,8,2]:Integer, [-1,8,8,0,8,3]:Integer, [-1,8,8,0,8,4]:Integer, [-1,8,8,0,8,5]:Integer, [-1,8,8,0,8,6]:Integer, [-1,8,8,0,8,7]:Integer, [-1,8,8,0,8,8]:Pointer, [-1,8,8,0,16]:Integer, [-1,8,8,0,17]:Integer, [-1,8,8,0,18]:Integer, [-1,8,8,0,19]:Integer, [-1,8,8,0,20]:Integer, [-1,8,8,0,21]:Integer, [-1,8,8,0,22]:Integer, [-1,8,8,0,23]:Integer, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer, [8,0,0,24]:Integer, [8,0,0,25]:Integer, [8,0,0,26]:Integer, [8,0,0,27]:Integer, [8,0,0,28]:Integer, [8,0,0,29]:Integer, [8,0,0,30]:Integer, [8,0,0,31]:Integer, [8,8,8,0,24]:Integer, [8,8,8,0,25]:Integer, [8,8,8,0,26]:Integer, [8,8,8,0,27]:Integer, [8,8,8,0,28]:Integer, [8,8,8,0,29]:Integer, [8,8,8,0,30]:Integer, [8,8,8,0,31]:Integer}" "enzymejl_parmtype"="14135654096" "enzymejl_parmtype_ref"="0" %0, {} addrspace(10)* noundef nonnull align 8 dereferenceable(32) "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer, [-1,24]:Integer, [-1,25]:Integer, [-1,26]:Integer, [-1,27]:Integer, [-1,28]:Integer, [-1,29]:Integer, [-1,30]:Integer, [-1,31]:Integer}" "enzymejl_parmtype"="4706449232" "enzymejl_parmtype_ref"="2" %1, {} addrspace(10)* nocapture noundef nonnull readonly align 8 dereferenceable(24) "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer}" "enzymejl_parmtype"="5268576208" "enzymejl_parmtype_ref"="2" %2) local_unnamed_addr #28 !dbg !1806 {
entry:
  %3 = alloca [1 x [2 x i64]], align 8
  %4 = alloca [1 x i64], align 8
  %5 = alloca [1 x i64], align 8
  %6 = alloca [1 x i64], align 8
  %.fca.0.extract = extractvalue { {} addrspace(10)*, {} addrspace(10)* } %0, 0, !dbg !1807, !enzyme_type !1666, !enzymejl_byref_MUT_REF !25, !enzymejl_source_type_Vector\7BVector\7BFloat64\7D\7D !25
  %.fca.1.extract = extractvalue { {} addrspace(10)*, {} addrspace(10)* } %0, 1, !dbg !1807, !enzyme_type !1674, !enzymejl_byref_MUT_REF !25, !enzymejl_source_type_Vector\7BMatrix\7BFloat64\7D\7D !25
  %7 = bitcast [1 x [2 x i64]]* %3 to i8*
  %8 = bitcast [1 x i64]* %4 to i8*
  call void @llvm.lifetime.start.p0i8(i64 noundef 8, i8* noundef nonnull dereferenceable(8) %8) #29
  %9 = bitcast [1 x i64]* %5 to i8*
  call void @llvm.lifetime.start.p0i8(i64 noundef 8, i8* noundef nonnull dereferenceable(8) %9) #29
  %10 = bitcast [1 x i64]* %6 to i8*
  call void @llvm.lifetime.start.p0i8(i64 noundef 8, i8* noundef nonnull dereferenceable(8) %10) #29
  %pgcstack.i = call {}*** @julia.get_pgcstack() #29
  %current_task1.i30 = getelementptr inbounds {}**, {}*** %pgcstack.i, i64 -14
  %ptls_field.i31 = getelementptr inbounds {}**, {}*** %pgcstack.i, i64 2
  %11 = bitcast {}*** %ptls_field.i31 to i64***
  %ptls_load.i3233 = load i64**, i64*** %11, align 8, !tbaa !26
  %12 = getelementptr inbounds i64*, i64** %ptls_load.i3233, i64 2
  %safepoint.i = load i64*, i64** %12, align 8, !tbaa !30
  fence syncscope("singlethread") seq_cst
  call void @julia.safepoint(i64* %safepoint.i) #29, !dbg !1808
  fence syncscope("singlethread") seq_cst
  %13 = bitcast {} addrspace(10)* %2 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !1810
  %14 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %13 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !1810
  %15 = bitcast {} addrspace(10)* %2 to i8* addrspace(10)*, !dbg !1810
  %16 = addrspacecast i8* addrspace(10)* %15 to i8* addrspace(11)*, !dbg !1810
  %17 = load i8*, i8* addrspace(11)* %16, align 8, !dbg !1810, !tbaa !828, !alias.scope !793, !noalias !794, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !25, !enzymejl_source_type_Ptr\7BFloat64\7D !25
  %18 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %14, i64 0, i32 1, !dbg !1810
  %19 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %18, align 8, !dbg !1810, !tbaa !828, !alias.scope !793, !noalias !794, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !25, !enzymejl_byref_MUT_REF !25
  %20 = bitcast {} addrspace(10)* %2 to i8 addrspace(10)*, !dbg !1813
  %21 = addrspacecast i8 addrspace(10)* %20 to i8 addrspace(11)*, !dbg !1813
  %22 = getelementptr inbounds i8, i8 addrspace(11)* %21, i64 16, !dbg !1813
  %23 = bitcast i8 addrspace(11)* %22 to i64 addrspace(11)*, !dbg !1813
  %24 = load i64, i64 addrspace(11)* %23, align 8, !dbg !1813, !tbaa !790, !alias.scope !793, !noalias !794, !enzyme_type !41, !enzyme_inactive !25, !enzymejl_source_type_Int64 !25, !enzymejl_byref_BITS_VALUE !25
  %25 = ptrtoint i8* %17 to i64, !dbg !1815
  %26 = call noalias nonnull "enzyme_type"="{[-1]:Pointer, [-1,0]:Integer, [-1,1]:Integer, [-1,2]:Integer, [-1,3]:Integer, [-1,4]:Integer, [-1,5]:Integer, [-1,6]:Integer, [-1,7]:Integer, [-1,8]:Pointer, [-1,8,-1]:Float@double}" {} addrspace(10)* @jl_genericmemory_copy_slice({} addrspace(10)* noundef %19, i64 %25, i64 %24) #30, !dbg !1815
  %27 = bitcast {} addrspace(10)* %26 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !1816
  %28 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %27 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !1816
  %29 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %28, i64 0, i32 1, !dbg !1816
  %30 = bitcast {} addrspace(10)** addrspace(11)* %29 to i8* addrspace(11)*, !dbg !1816
  %31 = load i8*, i8* addrspace(11)* %30, align 8, !dbg !1816, !tbaa !30, !alias.scope !33, !noalias !36, !nonnull !25, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !25, !enzymejl_source_type_Ptr\7BFloat64\7D !25
  %32 = bitcast {}*** %current_task1.i30 to {}*, !dbg !1818
  %33 = call noalias nonnull align 8 dereferenceable(24) "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer}" {} addrspace(10)* @julia.gc_alloc_obj({}* nonnull %32, i64 noundef 24, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5268576208 to {}*) to {} addrspace(10)*)) #31, !dbg !1818
  %34 = bitcast {} addrspace(10)* %33 to {} addrspace(10)* addrspace(10)*, !dbg !1818
  %35 = addrspacecast {} addrspace(10)* addrspace(10)* %34 to {} addrspace(10)* addrspace(11)*, !dbg !1818
  %36 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %35, i64 1, !dbg !1818
  store {} addrspace(10)* null, {} addrspace(10)* addrspace(11)* %36, align 8, !dbg !1818, !tbaa !1696, !alias.scope !793, !noalias !1819
  %37 = bitcast {} addrspace(10)* %33 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !1818
  %38 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %37 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !1818
  %.repack = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %38, i64 0, i32 0, !dbg !1818
  store i8* %31, i8* addrspace(11)* %.repack, align 8, !dbg !1818, !tbaa !828, !alias.scope !793, !noalias !1819
  %.repack34 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %38, i64 0, i32 1, !dbg !1818
  store {} addrspace(10)* %26, {} addrspace(10)* addrspace(11)* %.repack34, align 8, !dbg !1818, !tbaa !828, !alias.scope !793, !noalias !1819
  %39 = bitcast {} addrspace(10)* %33 to i8 addrspace(10)*, !dbg !1818
  %40 = addrspacecast i8 addrspace(10)* %39 to i8 addrspace(11)*, !dbg !1818
  %41 = getelementptr inbounds i8, i8 addrspace(11)* %40, i64 16, !dbg !1818
  %42 = bitcast i8 addrspace(11)* %41 to i64 addrspace(11)*, !dbg !1818
  store i64 %24, i64 addrspace(11)* %42, align 8, !dbg !1818, !tbaa !790, !alias.scope !793, !noalias !1819
  %43 = bitcast {} addrspace(10)* %.fca.0.extract to i8 addrspace(10)*, !dbg !1822
  %44 = addrspacecast i8 addrspace(10)* %43 to i8 addrspace(11)*, !dbg !1822
  %45 = getelementptr inbounds i8, i8 addrspace(11)* %44, i64 16, !dbg !1822
  %46 = bitcast i8 addrspace(11)* %45 to i64 addrspace(11)*, !dbg !1822
  %47 = load i64, i64 addrspace(11)* %46, align 8, !dbg !1822, !tbaa !790, !alias.scope !793, !noalias !794, !enzyme_type !41, !enzyme_inactive !25, !enzymejl_source_type_Int64 !25, !enzymejl_byref_BITS_VALUE !25
  %.not = icmp eq i64 %47, 0, !dbg !1824
  br i1 %.not, label %L23.i, label %L22.i, !dbg !1825

L22.i:                                            ; preds = %entry
  %48 = bitcast {} addrspace(10)* %.fca.0.extract to { {} addrspace(10)**, {} addrspace(10)* } addrspace(10)*, !dbg !1826
  %49 = addrspacecast { {} addrspace(10)**, {} addrspace(10)* } addrspace(10)* %48 to { {} addrspace(10)**, {} addrspace(10)* } addrspace(11)*, !dbg !1826
  %50 = bitcast {} addrspace(10)* %.fca.0.extract to {} addrspace(10)** addrspace(10)*, !dbg !1826
  %51 = addrspacecast {} addrspace(10)** addrspace(10)* %50 to {} addrspace(10)** addrspace(11)*, !dbg !1826
  %52 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %51, align 8, !dbg !1826, !tbaa !828, !alias.scope !793, !noalias !794, !enzyme_type !1705, !enzymejl_byref_BITS_VALUE !25, !enzymejl_source_type_Ptr\7BVector\7BFloat64\7D\7D !25, !enzyme_nocache !25
  %53 = getelementptr inbounds { {} addrspace(10)**, {} addrspace(10)* }, { {} addrspace(10)**, {} addrspace(10)* } addrspace(11)* %49, i64 0, i32 1, !dbg !1826
  %54 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %53, align 8, !dbg !1826, !tbaa !828, !alias.scope !793, !noalias !794, !dereferenceable_or_null !830, !align !831, !enzyme_type !1706, !enzymejl_byref_MUT_REF !25, !enzymejl_source_type_Memory\7BVector\7BFloat64\7D\7D !25
  %55 = call align 8 "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,0]:Pointer, [-1,0,0,-1]:Float@double, [-1,0,8]:Pointer, [-1,0,8,0]:Integer, [-1,0,8,1]:Integer, [-1,0,8,2]:Integer, [-1,0,8,3]:Integer, [-1,0,8,4]:Integer, [-1,0,8,5]:Integer, [-1,0,8,6]:Integer, [-1,0,8,7]:Integer, [-1,0,8,8]:Pointer, [-1,0,8,8,-1]:Float@double, [-1,0,16]:Integer, [-1,0,17]:Integer, [-1,0,18]:Integer, [-1,0,19]:Integer, [-1,0,20]:Integer, [-1,0,21]:Integer, [-1,0,22]:Integer, [-1,0,23]:Integer}" {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* noundef %54, {} addrspace(10)** noundef %52) #29, !dbg !1828
  %56 = bitcast {} addrspace(10)* %54 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !1828
  %57 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %56 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !1828
  %58 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %57, i64 0, i32 1, !dbg !1828
  %59 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %58, align 8, !dbg !1828, !tbaa !837, !alias.scope !793, !noalias !794, !nonnull !25, !enzyme_type !1705, !enzymejl_byref_BITS_VALUE !25, !enzymejl_source_type_Ptr\7BVector\7BFloat64\7D\7D !25
  %60 = bitcast {} addrspace(10)* %54 to {} addrspace(10)* addrspace(10)*, !dbg !1828
  %61 = addrspacecast {} addrspace(10)* addrspace(10)* %60 to {} addrspace(10)* addrspace(11)*, !dbg !1828
  %62 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %61, i64 2, !dbg !1828
  %63 = addrspacecast {} addrspace(10)** %59 to {} addrspace(10)* addrspace(11)*, !dbg !1828
  %.not36 = icmp eq {} addrspace(10)* addrspace(11)* %62, %63, !dbg !1828
  br i1 %.not36, label %guard_exit.i, label %guard_pass.i, !dbg !1828

L23.i:                                            ; preds = %entry
  %64 = getelementptr inbounds [1 x i64], [1 x i64]* %6, i64 0, i64 0, !dbg !1825
  store i64 1, i64* %64, align 8, !dbg !1825, !tbaa !766, !alias.scope !768, !noalias !1829
  %65 = addrspacecast [1 x i64]* %6 to [1 x i64] addrspace(11)*, !dbg !1825
  call fastcc void @julia_throw_boundserror_251033({} addrspace(10)* nofree noundef nonnull align 8 dereferenceable(24) %.fca.0.extract, [1 x i64] addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) %65) #32, !dbg !1825
  unreachable, !dbg !1825

L41.i:                                            ; preds = %guard_exit.i
  %66 = bitcast {} addrspace(10)* %.fca.1.extract to { {} addrspace(10)**, {} addrspace(10)* } addrspace(10)*, !dbg !1830
  %67 = addrspacecast { {} addrspace(10)**, {} addrspace(10)* } addrspace(10)* %66 to { {} addrspace(10)**, {} addrspace(10)* } addrspace(11)*, !dbg !1830
  %68 = bitcast {} addrspace(10)* %.fca.1.extract to {} addrspace(10)** addrspace(10)*, !dbg !1830
  %69 = addrspacecast {} addrspace(10)** addrspace(10)* %68 to {} addrspace(10)** addrspace(11)*, !dbg !1830
  %70 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %69, align 8, !dbg !1830, !tbaa !828, !alias.scope !793, !noalias !794, !enzyme_type !1712, !enzymejl_byref_BITS_VALUE !25, !enzymejl_source_type_Ptr\7BMatrix\7BFloat64\7D\7D !25, !enzyme_nocache !25
  %71 = getelementptr inbounds { {} addrspace(10)**, {} addrspace(10)* }, { {} addrspace(10)**, {} addrspace(10)* } addrspace(11)* %67, i64 0, i32 1, !dbg !1830
  %72 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %71, align 8, !dbg !1830, !tbaa !828, !alias.scope !793, !noalias !794, !dereferenceable_or_null !830, !align !831, !enzyme_type !1713, !enzymejl_byref_MUT_REF !25, !enzymejl_source_type_Memory\7BMatrix\7BFloat64\7D\7D !25
  %73 = call align 8 "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,0]:Pointer, [-1,0,0,-1]:Float@double, [-1,0,8]:Pointer, [-1,0,8,0]:Integer, [-1,0,8,1]:Integer, [-1,0,8,2]:Integer, [-1,0,8,3]:Integer, [-1,0,8,4]:Integer, [-1,0,8,5]:Integer, [-1,0,8,6]:Integer, [-1,0,8,7]:Integer, [-1,0,8,8]:Pointer, [-1,0,8,8,-1]:Float@double, [-1,0,16]:Integer, [-1,0,17]:Integer, [-1,0,18]:Integer, [-1,0,19]:Integer, [-1,0,20]:Integer, [-1,0,21]:Integer, [-1,0,22]:Integer, [-1,0,23]:Integer, [-1,0,24]:Integer, [-1,0,25]:Integer, [-1,0,26]:Integer, [-1,0,27]:Integer, [-1,0,28]:Integer, [-1,0,29]:Integer, [-1,0,30]:Integer, [-1,0,31]:Integer}" {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* noundef %72, {} addrspace(10)** noundef %70) #29, !dbg !1830
  %74 = load atomic {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %73 unordered, align 8, !dbg !1830, !tbaa !1715, !alias.scope !47, !noalias !502, !dereferenceable_or_null !1717, !align !831, !enzyme_type !1718, !enzymejl_byref_MUT_REF !25, !enzymejl_source_type_Matrix\7BFloat64\7D !25
  %.not38 = icmp eq {} addrspace(10)* %74, null, !dbg !1830
  %75 = load {}*, {}** @jl_undefref_exception, align 8, !dbg !1830, !tbaa !30, !alias.scope !33, !noalias !36, !nonnull !25
  br i1 %.not38, label %fail.i, label %pass4.i, !dbg !1830

L42.i:                                            ; preds = %guard_exit.i
  %76 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0, !dbg !1832
  store i64 1, i64* %76, align 8, !dbg !1832, !tbaa !766, !alias.scope !768, !noalias !1829
  %77 = addrspacecast [1 x i64]* %5 to [1 x i64] addrspace(11)*, !dbg !1832
  call fastcc void @julia_throw_boundserror_251040({} addrspace(10)* nofree noundef nonnull align 8 dereferenceable(24) %.fca.1.extract, [1 x i64] addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) %77) #32, !dbg !1832
  unreachable, !dbg !1832

L80.i:                                            ; preds = %pass4.i
  %78 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %69, align 8, !dbg !1833, !tbaa !828, !alias.scope !793, !noalias !794, !enzyme_type !1712, !enzymejl_byref_BITS_VALUE !25, !enzymejl_source_type_Ptr\7BMatrix\7BFloat64\7D\7D !25, !enzyme_nocache !25
  %79 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %71, align 8, !dbg !1833, !tbaa !828, !alias.scope !793, !noalias !794, !dereferenceable_or_null !830, !align !831, !enzyme_type !1713, !enzymejl_byref_MUT_REF !25, !enzymejl_source_type_Memory\7BMatrix\7BFloat64\7D\7D !25
  %80 = call align 8 "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,0]:Pointer, [-1,0,0,-1]:Float@double, [-1,0,8]:Pointer, [-1,0,8,0]:Integer, [-1,0,8,1]:Integer, [-1,0,8,2]:Integer, [-1,0,8,3]:Integer, [-1,0,8,4]:Integer, [-1,0,8,5]:Integer, [-1,0,8,6]:Integer, [-1,0,8,7]:Integer, [-1,0,8,8]:Pointer, [-1,0,8,8,-1]:Float@double, [-1,0,16]:Integer, [-1,0,17]:Integer, [-1,0,18]:Integer, [-1,0,19]:Integer, [-1,0,20]:Integer, [-1,0,21]:Integer, [-1,0,22]:Integer, [-1,0,23]:Integer, [-1,0,24]:Integer, [-1,0,25]:Integer, [-1,0,26]:Integer, [-1,0,27]:Integer, [-1,0,28]:Integer, [-1,0,29]:Integer, [-1,0,30]:Integer, [-1,0,31]:Integer}" {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* noundef %79, {} addrspace(10)** noundef %78) #29, !dbg !1833
  %81 = load atomic {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %80 unordered, align 8, !dbg !1833, !tbaa !1715, !alias.scope !47, !noalias !502, !dereferenceable_or_null !1717, !align !831, !enzyme_type !1718, !enzymejl_byref_MUT_REF !25, !enzymejl_source_type_Matrix\7BFloat64\7D !25
  %.not40 = icmp eq {} addrspace(10)* %81, null, !dbg !1833
  br i1 %.not40, label %fail5.i, label %pass6.i, !dbg !1833

L81.i:                                            ; preds = %pass4.i
  %82 = getelementptr inbounds [1 x i64], [1 x i64]* %4, i64 0, i64 0, !dbg !1835
  store i64 1, i64* %82, align 8, !dbg !1835, !tbaa !766, !alias.scope !768, !noalias !1829
  %83 = addrspacecast [1 x i64]* %4 to [1 x i64] addrspace(11)*, !dbg !1835
  call fastcc void @julia_throw_boundserror_251040({} addrspace(10)* nofree noundef nonnull align 8 dereferenceable(24) %.fca.1.extract, [1 x i64] addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(8) %83) #32, !dbg !1835
  unreachable, !dbg !1835

L94.i:                                            ; preds = %pass6.i
  %84 = icmp slt i64 %130, 1, !dbg !1836
  br i1 %84, label %L189.i, label %L96.i, !dbg !1841

L96.i:                                            ; preds = %L94.i
  %.sroa.07.0..sroa_idx = getelementptr inbounds [1 x [2 x i64]], [1 x [2 x i64]]* %3, i64 0, i64 0, i64 0, !dbg !1842
  store i64 1, i64* %.sroa.07.0..sroa_idx, align 8, !dbg !1842, !tbaa !766, !alias.scope !768, !noalias !1829
  %.sroa.49.0..sroa_idx10 = getelementptr inbounds [1 x [2 x i64]], [1 x [2 x i64]]* %3, i64 0, i64 0, i64 1, !dbg !1842
  store i64 %130, i64* %.sroa.49.0..sroa_idx10, align 8, !dbg !1842, !tbaa !766, !alias.scope !768, !noalias !1829
  %85 = bitcast {} addrspace(10)* %1 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !1844
  %86 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %85 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !1844
  %87 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %86, i64 0, i32 1, !dbg !1844
  %88 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %87, align 8, !dbg !1844, !tbaa !828, !alias.scope !793, !noalias !794, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !25, !enzymejl_byref_MUT_REF !25
  %89 = bitcast {} addrspace(10)* %88 to i64 addrspace(10)*, !dbg !1848
  %90 = addrspacecast i64 addrspace(10)* %89 to i64 addrspace(11)*, !dbg !1848
  %91 = load i64, i64 addrspace(11)* %90, align 8, !dbg !1848, !tbaa !1748, !alias.scope !793, !noalias !794, !enzyme_type !41, !enzyme_inactive !25, !enzymejl_source_type_Int64 !25, !enzymejl_byref_BITS_VALUE !25
  %92 = call i64 @llvm.smax.i64(i64 %91, i64 noundef 0) #29, !dbg !1853
  %93 = icmp slt i64 %91, 1, !dbg !1854
  %94 = add nsw i64 %130, -1, !dbg !1857
  %95 = icmp uge i64 %94, %92, !dbg !1854
  %.not44 = or i1 %93, %95, !dbg !1858
  br i1 %.not44, label %L125.i, label %L156.i, !dbg !1858

L125.i:                                           ; preds = %L96.i
  %96 = addrspacecast [1 x [2 x i64]]* %3 to [1 x [2 x i64]] addrspace(11)*, !dbg !1858
  call fastcc void @julia_throw_boundserror_251046({} addrspace(10)* nofree noundef nonnull align 8 dereferenceable(32) %1, [1 x [2 x i64]] addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(16) %96) #32, !dbg !1858
  unreachable, !dbg !1858

L156.i:                                           ; preds = %L96.i
  %97 = bitcast {} addrspace(10)* %1 to i8* addrspace(10)*, !dbg !1859
  %98 = addrspacecast i8* addrspace(10)* %97 to i8* addrspace(11)*, !dbg !1859
  %99 = load i8*, i8* addrspace(11)* %98, align 8, !dbg !1859, !tbaa !828, !alias.scope !793, !noalias !794, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !25, !enzymejl_source_type_Ptr\7BFloat64\7D !25
  %100 = bitcast {} addrspace(10)* %81 to i8* addrspace(10)*, !dbg !1859
  %101 = addrspacecast i8* addrspace(10)* %100 to i8* addrspace(11)*, !dbg !1859
  %102 = load i8*, i8* addrspace(11)* %101, align 8, !dbg !1859, !tbaa !828, !alias.scope !793, !noalias !794, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !25, !enzymejl_source_type_Ptr\7BFloat64\7D !25
  %103 = call token (...) @llvm.julia.gc_preserve_begin({} addrspace(10)* %88) #29, !dbg !1860
  %104 = call token (...) @llvm.julia.gc_preserve_begin({} addrspace(10)* %127) #29, !dbg !1862
  %105 = shl i64 %130, 3, !dbg !1863
  %.not48 = icmp sgt i64 %105, -1, !dbg !1865
  br i1 %.not48, label %L177.i, label %L175.i, !dbg !1872

L175.i:                                           ; preds = %L156.i
  %106 = load {}*, {}** bitcast (i8* getelementptr (i8, i8* @jl_small_typeof, i64 320) to {}**), align 8, !dbg !1872, !tbaa !30, !alias.scope !33, !noalias !36, !nonnull !25, !dereferenceable !1784, !align !830
  %107 = addrspacecast {}* %106 to {} addrspace(10)*, !dbg !1872
  %108 = call noalias nonnull align 8 dereferenceable(8) "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,-1]:Integer}" {} addrspace(10)* @ijl_box_int64(i64 signext %105) #33, !dbg !1872
  %109 = call nonnull "enzyme_type"="{[-1]:Pointer}" {} addrspace(10)* ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)*, {} addrspace(10)*, {} addrspace(10)*, ...) @julia.call2({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)* noundef nonnull @ijl_invoke, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5266671520 to {}*) to {} addrspace(10)*), {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5300488496 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 4372996128 to {}*) to {} addrspace(10)*), {} addrspace(10)* %107, {} addrspace(10)* nonnull %108) #34, !dbg !1872
  unreachable, !dbg !1872

L177.i:                                           ; preds = %L156.i
  call void @llvm.memmove.p0i8.p0i8.i64(i8* align 1 %99, i8* align 1 %102, i64 %105, i1 noundef false) #29, !dbg !1873, !noalias !1874
  call void @llvm.julia.gc_preserve_end(token %104) #29, !dbg !1875
  call void @llvm.julia.gc_preserve_end(token %103) #29, !dbg !1876
  br label %julia_WritableClosure_250993_inner.exit, !dbg !1877

L189.i:                                           ; preds = %L94.i
  call fastcc void @julia__throw_argerror_251042() #32, !dbg !1841
  unreachable, !dbg !1841

guard_pass.i:                                     ; preds = %L22.i
  %110 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %57, i64 1, !dbg !1828
  %111 = bitcast { i64, {} addrspace(10)** } addrspace(11)* %110 to {} addrspace(10)* addrspace(11)*, !dbg !1828
  %112 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %111, align 8, !dbg !1828, !tbaa !30, !alias.scope !33, !noalias !36, !enzyme_type !946
  %113 = icmp eq {} addrspace(10)* %112, null, !dbg !1828
  %114 = select i1 %113, {} addrspace(10)* %54, {} addrspace(10)* %112, !dbg !1828
  br label %guard_exit.i, !dbg !1828

guard_exit.i:                                     ; preds = %guard_pass.i, %L22.i
  %115 = phi {} addrspace(10)* [ %54, %L22.i ], [ %114, %guard_pass.i ], !dbg !1828
  store atomic {} addrspace(10)* %33, {} addrspace(10)* addrspace(13)* %55 release, align 8, !dbg !1828, !tbaa !1715, !alias.scope !47, !noalias !1878
  call void ({} addrspace(10)*, ...) @julia.write_barrier({} addrspace(10)* %115, {} addrspace(10)* nofree nonnull align 8 dereferenceable(24) %33) #35, !dbg !1828
  %116 = bitcast {} addrspace(10)* %.fca.1.extract to i8 addrspace(10)*, !dbg !1879
  %117 = addrspacecast i8 addrspace(10)* %116 to i8 addrspace(11)*, !dbg !1879
  %118 = getelementptr inbounds i8, i8 addrspace(11)* %117, i64 16, !dbg !1879
  %119 = bitcast i8 addrspace(11)* %118 to i64 addrspace(11)*, !dbg !1879
  %120 = load i64, i64 addrspace(11)* %119, align 8, !dbg !1879, !tbaa !790, !alias.scope !793, !noalias !794, !enzyme_type !41, !enzyme_inactive !25, !enzymejl_source_type_Int64 !25, !enzymejl_byref_BITS_VALUE !25
  %.not37 = icmp eq i64 %120, 0, !dbg !1832
  br i1 %.not37, label %L42.i, label %L41.i, !dbg !1832

fail.i:                                           ; preds = %L41.i
  %121 = addrspacecast {}* %75 to {} addrspace(12)*, !dbg !1830
  call void @ijl_throw({} addrspace(12)* %121) #32, !dbg !1830
  unreachable, !dbg !1830

pass4.i:                                          ; preds = %L41.i
  call fastcc void @julia_vec_to_mat__251050({} addrspace(10)* noundef nonnull align 8 dereferenceable(32) %74, {} addrspace(10)* nocapture noundef nonnull readonly align 8 dereferenceable(24) %33) #29, !dbg !1881
  %122 = load i64, i64 addrspace(11)* %119, align 8, !dbg !1882, !tbaa !790, !alias.scope !793, !noalias !794, !enzyme_type !41, !enzyme_inactive !25, !enzymejl_source_type_Int64 !25, !enzymejl_byref_BITS_VALUE !25
  %.not39 = icmp eq i64 %122, 0, !dbg !1835
  br i1 %.not39, label %L81.i, label %L80.i, !dbg !1835

fail5.i:                                          ; preds = %L80.i
  %123 = addrspacecast {}* %75 to {} addrspace(12)*, !dbg !1833
  call void @ijl_throw({} addrspace(12)* %123) #32, !dbg !1833
  unreachable, !dbg !1833

pass6.i:                                          ; preds = %L80.i
  %124 = bitcast {} addrspace(10)* %81 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !1884
  %125 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %124 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !1884
  %126 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %125, i64 0, i32 1, !dbg !1884
  %127 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %126, align 8, !dbg !1884, !tbaa !828, !alias.scope !793, !noalias !794, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !25, !enzymejl_byref_MUT_REF !25
  %128 = bitcast {} addrspace(10)* %127 to i64 addrspace(10)*, !dbg !1885
  %129 = addrspacecast i64 addrspace(10)* %128 to i64 addrspace(11)*, !dbg !1885
  %130 = load i64, i64 addrspace(11)* %129, align 8, !dbg !1885, !tbaa !1748, !alias.scope !793, !noalias !794, !enzyme_type !41, !enzyme_inactive !25, !enzymejl_source_type_Int64 !25, !enzymejl_byref_BITS_VALUE !25
  %.not41 = icmp eq i64 %130, 0, !dbg !1885
  br i1 %.not41, label %julia_WritableClosure_250993_inner.exit, label %L94.i, !dbg !1887

julia_WritableClosure_250993_inner.exit:          ; preds = %pass6.i, %L177.i
  call void @llvm.lifetime.end.p0i8(i64 noundef 16, i8* noundef nonnull %7) #29, !dbg !1888
  call void @llvm.lifetime.end.p0i8(i64 noundef 8, i8* noundef nonnull %8) #29, !dbg !1888
  call void @llvm.lifetime.end.p0i8(i64 noundef 8, i8* noundef nonnull %9) #29, !dbg !1888
  call void @llvm.lifetime.end.p0i8(i64 noundef 8, i8* noundef nonnull %10) #29, !dbg !1888
  ret void, !dbg !1807
}

after simplification :
; Function Attrs: mustprogress willreturn
define internal fastcc void @preprocess_julia_vec_to_mat__251050({} addrspace(10)* noundef nonnull align 8 dereferenceable(32) "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer, [-1,24]:Integer, [-1,25]:Integer, [-1,26]:Integer, [-1,27]:Integer, [-1,28]:Integer, [-1,29]:Integer, [-1,30]:Integer, [-1,31]:Integer}" "enzymejl_parmtype"="4706449232" "enzymejl_parmtype_ref"="2" %0, {} addrspace(10)* nocapture noundef nonnull readonly align 8 dereferenceable(24) "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer}" "enzymejl_parmtype"="5268576208" "enzymejl_parmtype_ref"="2" %1) unnamed_addr #29 !dbg !2069 {
top:
  %2 = alloca { [1 x [1 x i64]], i64 }, align 8
  %3 = alloca { [1 x [1 x i64]], i64 }, align 8
  %pgcstack = call {}*** @julia.get_pgcstack() #30
  %current_task1140 = getelementptr inbounds {}**, {}*** %pgcstack, i64 -14
  %4 = bitcast {}*** %current_task1140 to {}*
  %ptls_field141 = getelementptr inbounds {}**, {}*** %pgcstack, i64 2
  %5 = bitcast {}*** %ptls_field141 to i64***
  %ptls_load142143 = load i64**, i64*** %5, align 8, !tbaa !26
  %6 = getelementptr inbounds i64*, i64** %ptls_load142143, i64 2
  %safepoint = load i64*, i64** %6, align 8, !tbaa !30
  fence syncscope("singlethread") seq_cst
  call void @julia.safepoint(i64* %safepoint) #31, !dbg !2070
  fence syncscope("singlethread") seq_cst
  %7 = bitcast {} addrspace(10)* %0 to i8 addrspace(10)*, !dbg !2071
  %8 = addrspacecast i8 addrspace(10)* %7 to i8 addrspace(11)*, !dbg !2071
  %9 = getelementptr inbounds i8, i8 addrspace(11)* %8, i64 16, !dbg !2071
  %.sroa.095.0..sroa_idx = bitcast i8 addrspace(11)* %9 to i64 addrspace(11)*, !dbg !2071
  %.sroa.095.0.copyload = load i64, i64 addrspace(11)* %.sroa.095.0..sroa_idx, align 8, !dbg !2071, !tbaa !760, !alias.scope !761, !noalias !2078, !enzyme_type !41, !enzyme_inactive !0, !enzymejl_source_type_Int64 !0, !enzymejl_byref_BITS_VALUE !0
  %.sroa.8102.0..sroa_idx103 = getelementptr inbounds i8, i8 addrspace(11)* %8, i64 24, !dbg !2071
  %10 = bitcast i8 addrspace(11)* %.sroa.8102.0..sroa_idx103 to i64 addrspace(11)*, !dbg !2071
  %11 = getelementptr inbounds { [1 x [1 x i64]], i64 }, { [1 x [1 x i64]], i64 }* %2, i64 0, i32 0, i64 0, i64 0, !dbg !2081
  store i64 %.sroa.095.0.copyload, i64* %11, align 8, !dbg !2081, !tbaa !766, !alias.scope !768, !noalias !2083
  %12 = getelementptr inbounds { [1 x [1 x i64]], i64 }, { [1 x [1 x i64]], i64 }* %2, i64 0, i32 1, !dbg !2081
  store i64 1, i64* %12, align 8, !dbg !2081, !tbaa !766, !alias.scope !768, !noalias !2083
  %.sroa.188.0.copyload = load i64, i64 addrspace(11)* %10, align 8, !dbg !2084, !tbaa !760, !alias.scope !761, !noalias !2078, !enzyme_type !41, !enzyme_inactive !0, !enzymejl_source_type_Int64 !0, !enzymejl_byref_BITS_VALUE !0
  %.not = icmp eq i64 %.sroa.188.0.copyload, 0, !dbg !2088
  br i1 %.not, label %L22, label %L25, !dbg !2087

L22:                                              ; preds = %top
  %13 = addrspacecast { [1 x [1 x i64]], i64 }* %2 to { [1 x [1 x i64]], i64 } addrspace(11)*, !dbg !2087
  call fastcc void @julia_throw_boundserror_251070({} addrspace(10)* nofree noundef nonnull align 8 dereferenceable(32) %0, { [1 x [1 x i64]], i64 } addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(16) %13) #32, !dbg !2087
  unreachable, !dbg !2087

L25:                                              ; preds = %top
  %14 = addrspacecast {} addrspace(10)* %1 to {} addrspace(11)*, !dbg !2092
  %15 = bitcast {} addrspace(10)* %1 to i8 addrspace(10)*, !dbg !2092
  %16 = addrspacecast i8 addrspace(10)* %15 to i8 addrspace(11)*, !dbg !2092
  %17 = getelementptr inbounds i8, i8 addrspace(11)* %16, i64 16, !dbg !2092
  %18 = bitcast i8 addrspace(11)* %17 to i64 addrspace(11)*, !dbg !2092
  %19 = load i64, i64 addrspace(11)* %18, align 8, !dbg !2092, !tbaa !790, !alias.scope !793, !noalias !794, !enzyme_type !41, !enzyme_inactive !0, !enzymejl_source_type_Int64 !0, !enzymejl_byref_BITS_VALUE !0
  %20 = icmp eq i64 %.sroa.095.0.copyload, %19, !dbg !2098
  %21 = icmp eq i64 %19, 1, !dbg !2100
  %value_phi.in = or i1 %20, %21, !dbg !2100
  br i1 %value_phi.in, label %L62, label %L49, !dbg !2101

L49:                                              ; preds = %L25
  %22 = call noalias nonnull align 8 dereferenceable(8) "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,-1]:Pointer}" {} addrspace(10)* @julia.gc_alloc_obj({}* nonnull %4, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5269459216 to {}*) to {} addrspace(10)*)) #33, !dbg !2101
  %23 = bitcast {} addrspace(10)* %22 to [1 x {} addrspace(10)*] addrspace(10)*, !dbg !2101, !enzyme_inactive !0
  %24 = getelementptr [1 x {} addrspace(10)*], [1 x {} addrspace(10)*] addrspace(10)* %23, i64 0, i64 0, !dbg !2101
  store {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5359992384 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspace(10)* %24, align 8, !dbg !2101, !tbaa !43, !alias.scope !47, !noalias !2102
  %25 = addrspacecast {} addrspace(10)* %22 to {} addrspace(12)*, !dbg !2101, !enzyme_inactive !0
  call void @ijl_throw({} addrspace(12)* %25) #32, !dbg !2101
  unreachable, !dbg !2101

L62:                                              ; preds = %L25
  %26 = icmp eq i64 %.sroa.095.0.copyload, 0, !dbg !2103
  %27 = icmp eq i64 %19, 0
  %or.cond = select i1 %26, i1 true, i1 %27, !dbg !2105
  br i1 %or.cond, label %L122, label %L71, !dbg !2105

L71:                                              ; preds = %L62
  %28 = bitcast {} addrspace(10)* %0 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2113
  %29 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %28 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2113
  %30 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %29, i64 0, i32 1, !dbg !2113
  %31 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %30, align 8, !dbg !2113, !tbaa !828, !alias.scope !793, !noalias !794, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %32 = bitcast {} addrspace(10)* %31 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2116
  %33 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %32 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2116
  %34 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %33, i64 0, i32 1, !dbg !2116
  %35 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %34, align 8, !dbg !2116, !tbaa !837, !alias.scope !793, !noalias !794, !nonnull !0, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %36 = bitcast {} addrspace(10)* %31 to {} addrspace(10)* addrspace(10)*, !dbg !2116
  %37 = addrspacecast {} addrspace(10)* addrspace(10)* %36 to {} addrspace(10)* addrspace(11)*, !dbg !2116
  %38 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %37, i64 2, !dbg !2116
  %39 = addrspacecast {} addrspace(10)** %35 to {} addrspace(10)* addrspace(11)*, !dbg !2116
  %.not144 = icmp eq {} addrspace(10)* addrspace(11)* %38, %39, !dbg !2116
  br i1 %.not144, label %guard_exit, label %guard_pass, !dbg !2116

L108:                                             ; preds = %guard_exit7
  %40 = bitcast {} addrspace(10)* %1 to i8* addrspace(10)*, !dbg !2117
  %41 = addrspacecast i8* addrspace(10)* %40 to i8* addrspace(11)*, !dbg !2117
  %42 = load i8*, i8* addrspace(11)* %41, align 8, !dbg !2117, !tbaa !828, !alias.scope !793, !noalias !794, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %43 = ptrtoint i8* %42 to i64, !dbg !2120
  %44 = call nonnull "enzyme_type"="{[-1]:Pointer, [-1,0]:Integer, [-1,1]:Integer, [-1,2]:Integer, [-1,3]:Integer, [-1,4]:Integer, [-1,5]:Integer, [-1,6]:Integer, [-1,7]:Integer, [-1,8]:Pointer, [-1,8,-1]:Float@double}" {} addrspace(10)* @jl_genericmemory_copy_slice({} addrspace(10)* noundef %147, i64 %43, i64 %19) #34, !dbg !2120
  %45 = bitcast {} addrspace(10)* %44 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2121
  %46 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %45 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2121
  %47 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %46, i64 0, i32 1, !dbg !2121
  %48 = bitcast {} addrspace(10)** addrspace(11)* %47 to i8* addrspace(11)*, !dbg !2121
  %49 = load i8*, i8* addrspace(11)* %48, align 8, !dbg !2121, !tbaa !30, !alias.scope !33, !noalias !36, !nonnull !0, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %50 = call noalias nonnull align 8 dereferenceable(24) "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer}" {} addrspace(10)* @julia.gc_alloc_obj({}* nonnull %4, i64 noundef 24, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5268576208 to {}*) to {} addrspace(10)*)) #33, !dbg !2122
  %51 = addrspacecast {} addrspace(10)* %50 to {} addrspace(11)*, !dbg !2122
  %52 = bitcast {} addrspace(10)* %50 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2122
  %53 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %52 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2122
  %.repack = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %53, i64 0, i32 0, !dbg !2122
  store i8* %49, i8* addrspace(11)* %.repack, align 8, !dbg !2122, !tbaa !828, !alias.scope !793, !noalias !2123
  %.repack150 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %53, i64 0, i32 1, !dbg !2122
  store {} addrspace(10)* %44, {} addrspace(10)* addrspace(11)* %.repack150, align 8, !dbg !2122, !tbaa !828, !alias.scope !793, !noalias !2123
  br label %L122, !dbg !2122

L122:                                             ; preds = %guard_exit7, %L108, %L62
  %nodecayed..pre-phi = phi {} addrspace(10)* [ %50, %L108 ], [ %1, %L62 ], [ %1, %guard_exit7 ], !dbg !2124
  %54 = addrspacecast {} addrspace(10)* %nodecayed..pre-phi to {} addrspace(11)*, !dbg !2128
  %55 = icmp slt i64 %.sroa.095.0.copyload, 1, !dbg !2128
  br i1 %55, label %L237, label %L140.lr.ph, !dbg !2129

L140.lr.ph:                                       ; preds = %L122
  %56 = bitcast {} addrspace(11)* %54 to { i8*, {} addrspace(10)* } addrspace(11)*
  %57 = bitcast {} addrspace(11)* %54 to {} addrspace(10)** addrspace(11)*
  %58 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %57, align 8, !tbaa !828, !alias.scope !793, !noalias !794, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0, !enzyme_nocache !0
  %59 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %56, i64 0, i32 1
  %60 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %59, align 8, !tbaa !828, !alias.scope !793, !noalias !794, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %61 = call "enzyme_type"="{[-1]:Pointer, [-1,-1]:Float@double}" {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* noundef %60, {} addrspace(10)** noundef %58) #30, !dbg !2131
  %62 = bitcast {} addrspace(10)* %0 to { i8*, {} addrspace(10)* } addrspace(10)*
  %63 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %62 to { i8*, {} addrspace(10)* } addrspace(11)*
  %64 = bitcast {} addrspace(10)* %0 to {} addrspace(10)** addrspace(10)*
  %65 = addrspacecast {} addrspace(10)** addrspace(10)* %64 to {} addrspace(10)** addrspace(11)*
  %66 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %65, align 8, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0, !enzyme_nocache !0
  %67 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %63, i64 0, i32 1
  %68 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %67, align 8, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %69 = call "enzyme_type"="{[-1]:Pointer, [-1,-1]:Float@double}" {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* noundef %68, {} addrspace(10)** noundef %66) #30, !dbg !2131
  br label %L140, !dbg !2132

L140:                                             ; preds = %L140, %L140.lr.ph
  %iv = phi i64 [ %iv.next, %L140 ], [ 0, %L140.lr.ph ]
  %iv.next = add nuw nsw i64 %iv, 1, !dbg !2133
  %70 = select i1 %21, i64 0, i64 %iv, !dbg !2136
  %71 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %61, i64 %70, !dbg !2136
  %72 = bitcast {} addrspace(10)* addrspace(13)* %71 to double addrspace(13)*, !dbg !2136
  %73 = load double, double addrspace(13)* %72, align 8, !dbg !2136, !tbaa !880, !alias.scope !47, !noalias !502
  %74 = call double @julia_sin_251131(double %73) #30, !dbg !2143
  %75 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %69, i64 %iv, !dbg !2145
  %76 = bitcast {} addrspace(10)* addrspace(13)* %75 to double addrspace(13)*, !dbg !2145
  store double %74, double addrspace(13)* %76, align 8, !dbg !2145, !tbaa !880, !alias.scope !47, !noalias !2102
  %exitcond172.not = icmp eq i64 %iv.next, %.sroa.095.0.copyload, !dbg !2147
  br i1 %exitcond172.not, label %L237.loopexit, label %L140, !dbg !2132, !llvm.loop !2148

L237.loopexit:                                    ; preds = %L140
  br label %L237, !dbg !2149

L237:                                             ; preds = %L237.loopexit, %L122
  %77 = getelementptr inbounds { [1 x [1 x i64]], i64 }, { [1 x [1 x i64]], i64 }* %3, i64 0, i32 0, i64 0, i64 0, !dbg !2149
  store i64 %.sroa.095.0.copyload, i64* %77, align 8, !dbg !2149, !tbaa !766, !alias.scope !768, !noalias !2083
  %78 = getelementptr inbounds { [1 x [1 x i64]], i64 }, { [1 x [1 x i64]], i64 }* %3, i64 0, i32 1, !dbg !2149
  store i64 2, i64* %78, align 8, !dbg !2149, !tbaa !766, !alias.scope !768, !noalias !2083
  %79 = icmp ult i64 %.sroa.188.0.copyload, 2, !dbg !2154
  br i1 %79, label %L258, label %L298, !dbg !2159

L258:                                             ; preds = %L237
  %80 = addrspacecast { [1 x [1 x i64]], i64 }* %3 to { [1 x [1 x i64]], i64 } addrspace(11)*, !dbg !2159
  call fastcc void @julia_throw_boundserror_251070({} addrspace(10)* nofree noundef nonnull align 8 dereferenceable(32) %0, { [1 x [1 x i64]], i64 } addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(16) %80) #32, !dbg !2159
  unreachable, !dbg !2159

L298:                                             ; preds = %L237
  br i1 %or.cond, label %L358, label %L307, !dbg !2160

L307:                                             ; preds = %L298
  %81 = bitcast {} addrspace(10)* %0 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2170
  %82 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %81 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2170
  %83 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %82, i64 0, i32 1, !dbg !2170
  %84 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %83, align 8, !dbg !2170, !tbaa !828, !alias.scope !793, !noalias !794, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %85 = bitcast {} addrspace(10)* %84 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2173
  %86 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %85 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2173
  %87 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %86, i64 0, i32 1, !dbg !2173
  %88 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %87, align 8, !dbg !2173, !tbaa !837, !alias.scope !793, !noalias !794, !nonnull !0, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %89 = bitcast {} addrspace(10)* %84 to {} addrspace(10)* addrspace(10)*, !dbg !2173
  %90 = addrspacecast {} addrspace(10)* addrspace(10)* %89 to {} addrspace(10)* addrspace(11)*, !dbg !2173
  %91 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %90, i64 2, !dbg !2173
  %92 = addrspacecast {} addrspace(10)** %88 to {} addrspace(10)* addrspace(11)*, !dbg !2173
  %.not153 = icmp eq {} addrspace(10)* addrspace(11)* %91, %92, !dbg !2173
  br i1 %.not153, label %guard_exit22, label %guard_pass21, !dbg !2173

L344:                                             ; preds = %guard_exit27
  %93 = bitcast {} addrspace(10)* %1 to i8* addrspace(10)*, !dbg !2174
  %94 = addrspacecast i8* addrspace(10)* %93 to i8* addrspace(11)*, !dbg !2174
  %95 = load i8*, i8* addrspace(11)* %94, align 8, !dbg !2174, !tbaa !828, !alias.scope !793, !noalias !794, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %96 = ptrtoint i8* %95 to i64, !dbg !2177
  %97 = call nonnull "enzyme_type"="{[-1]:Pointer, [-1,0]:Integer, [-1,1]:Integer, [-1,2]:Integer, [-1,3]:Integer, [-1,4]:Integer, [-1,5]:Integer, [-1,6]:Integer, [-1,7]:Integer, [-1,8]:Pointer, [-1,8,-1]:Float@double}" {} addrspace(10)* @jl_genericmemory_copy_slice({} addrspace(10)* noundef %188, i64 %96, i64 %19) #34, !dbg !2177
  %98 = bitcast {} addrspace(10)* %97 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2178
  %99 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %98 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2178
  %100 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %99, i64 0, i32 1, !dbg !2178
  %101 = bitcast {} addrspace(10)** addrspace(11)* %100 to i8* addrspace(11)*, !dbg !2178
  %102 = load i8*, i8* addrspace(11)* %101, align 8, !dbg !2178, !tbaa !30, !alias.scope !33, !noalias !36, !nonnull !0, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %103 = call noalias nonnull align 8 dereferenceable(24) "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer}" {} addrspace(10)* @julia.gc_alloc_obj({}* nonnull %4, i64 noundef 24, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5268576208 to {}*) to {} addrspace(10)*)) #33, !dbg !2179
  %104 = addrspacecast {} addrspace(10)* %103 to {} addrspace(11)*, !dbg !2179
  %105 = bitcast {} addrspace(10)* %103 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2179
  %106 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %105 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2179
  %.repack159 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %106, i64 0, i32 0, !dbg !2179
  store i8* %102, i8* addrspace(11)* %.repack159, align 8, !dbg !2179, !tbaa !828, !alias.scope !793, !noalias !2123
  %.repack160 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %106, i64 0, i32 1, !dbg !2179
  store {} addrspace(10)* %97, {} addrspace(10)* addrspace(11)* %.repack160, align 8, !dbg !2179, !tbaa !828, !alias.scope !793, !noalias !2123
  br label %L358, !dbg !2179

L358:                                             ; preds = %guard_exit27, %L344, %L298
  %nodecayed..pre-phi130 = phi {} addrspace(10)* [ %103, %L344 ], [ %1, %L298 ], [ %1, %guard_exit27 ], !dbg !2180
  %107 = addrspacecast {} addrspace(10)* %nodecayed..pre-phi130 to {} addrspace(11)*, !dbg !2184
  br i1 %55, label %L473, label %L376.lr.ph, !dbg !2184

L376.lr.ph:                                       ; preds = %L358
  %108 = bitcast {} addrspace(11)* %107 to { i8*, {} addrspace(10)* } addrspace(11)*
  %109 = bitcast {} addrspace(11)* %107 to {} addrspace(10)** addrspace(11)*
  %110 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %109, align 8, !tbaa !828, !alias.scope !793, !noalias !794, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0, !enzyme_nocache !0
  %111 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %108, i64 0, i32 1
  %112 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %111, align 8, !tbaa !828, !alias.scope !793, !noalias !794, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %113 = call "enzyme_type"="{[-1]:Pointer, [-1,-1]:Float@double}" {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* noundef %112, {} addrspace(10)** noundef %110) #30, !dbg !2131
  %114 = bitcast {} addrspace(10)* %0 to { i8*, {} addrspace(10)* } addrspace(10)*
  %115 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %114 to { i8*, {} addrspace(10)* } addrspace(11)*
  %116 = bitcast {} addrspace(10)* %0 to {} addrspace(10)** addrspace(10)*
  %117 = addrspacecast {} addrspace(10)** addrspace(10)* %116 to {} addrspace(10)** addrspace(11)*
  %118 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %117, align 8, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0, !enzyme_nocache !0
  %119 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %115, i64 0, i32 1
  %120 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %119, align 8, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %121 = call "enzyme_type"="{[-1]:Pointer, [-1,-1]:Float@double}" {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* noundef %120, {} addrspace(10)** noundef %118) #30, !dbg !2131
  br label %L376, !dbg !2186

L376:                                             ; preds = %L376, %L376.lr.ph
  %iv1 = phi i64 [ %iv.next2, %L376 ], [ 0, %L376.lr.ph ]
  %iv.next2 = add nuw nsw i64 %iv1, 1, !dbg !2187
  %122 = select i1 %21, i64 0, i64 %iv1, !dbg !2190
  %123 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %113, i64 %122, !dbg !2190
  %124 = bitcast {} addrspace(10)* addrspace(13)* %123 to double addrspace(13)*, !dbg !2190
  %125 = load double, double addrspace(13)* %124, align 8, !dbg !2190, !tbaa !880, !alias.scope !47, !noalias !502
  %126 = call double @julia_cos_251086(double %125) #30, !dbg !2197
  %127 = add i64 %iv1, %.sroa.095.0.copyload, !dbg !2199
  %128 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %121, i64 %127, !dbg !2199
  %129 = bitcast {} addrspace(10)* addrspace(13)* %128 to double addrspace(13)*, !dbg !2199
  store double %126, double addrspace(13)* %129, align 8, !dbg !2199, !tbaa !880, !alias.scope !47, !noalias !2102
  %exitcond.not = icmp eq i64 %iv.next2, %.sroa.095.0.copyload, !dbg !2201
  br i1 %exitcond.not, label %L473.loopexit, label %L376, !dbg !2186, !llvm.loop !2202

L473.loopexit:                                    ; preds = %L376
  br label %L473, !dbg !2203

L473:                                             ; preds = %L473.loopexit, %L358
  ret void, !dbg !2203

guard_pass:                                       ; preds = %L71
  %130 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %33, i64 1, !dbg !2116
  %131 = bitcast { i64, {} addrspace(10)** } addrspace(11)* %130 to {} addrspace(10)* addrspace(11)*, !dbg !2116
  %132 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %131, align 8, !dbg !2116, !tbaa !30, !alias.scope !33, !noalias !36, !enzyme_type !946
  %133 = icmp eq {} addrspace(10)* %132, null, !dbg !2116
  %134 = select i1 %133, {} addrspace(10)* %31, {} addrspace(10)* %132, !dbg !2116
  br label %guard_exit, !dbg !2116

guard_exit:                                       ; preds = %guard_pass, %L71
  %135 = phi {} addrspace(10)* [ %31, %L71 ], [ %134, %guard_pass ], !dbg !2116
  %136 = call "enzyme_type"="{[-1]:Pointer}" {} addrspace(10)* @julia.typeof({} addrspace(10)* %135) #35, !dbg !2116
  %137 = addrspacecast {} addrspace(10)* %136 to {} addrspace(11)*, !dbg !2116
  %138 = call nonnull {}* @julia.pointer_from_objref({} addrspace(11)* %137) #36, !dbg !2116
  %.not145 = icmp eq {}* %138, inttoptr (i64 5267711712 to {}*), !dbg !2116
  %spec.select = select i1 %.not145, {} addrspace(10)* %135, {} addrspace(10)* %31, !dbg !2116
  %139 = bitcast {} addrspace(10)* %spec.select to i8 addrspace(10)*, !dbg !2204
  %140 = addrspacecast i8 addrspace(10)* %139 to i8 addrspace(11)*, !dbg !2204
  %141 = getelementptr inbounds i8, i8 addrspace(11)* %140, i64 8, !dbg !2204
  %142 = bitcast i8 addrspace(11)* %141 to i64 addrspace(11)*, !dbg !2206
  %143 = load i64, i64 addrspace(11)* %142, align 8, !dbg !2206, !tbaa !955, !alias.scope !793, !noalias !794
  %144 = bitcast {} addrspace(10)* %1 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2207
  %145 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %144 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2207
  %146 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %145, i64 0, i32 1, !dbg !2207
  %147 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %146, align 8, !dbg !2207, !tbaa !828, !alias.scope !793, !noalias !794, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %148 = bitcast {} addrspace(10)* %147 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2209
  %149 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %148 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2209
  %150 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %149, i64 0, i32 1, !dbg !2209
  %151 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %150, align 8, !dbg !2209, !tbaa !837, !alias.scope !793, !noalias !794, !nonnull !0, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %152 = bitcast {} addrspace(10)* %147 to {} addrspace(10)* addrspace(10)*, !dbg !2209
  %153 = addrspacecast {} addrspace(10)* addrspace(10)* %152 to {} addrspace(10)* addrspace(11)*, !dbg !2209
  %154 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %153, i64 2, !dbg !2209
  %155 = addrspacecast {} addrspace(10)** %151 to {} addrspace(10)* addrspace(11)*, !dbg !2209
  %.not147 = icmp eq {} addrspace(10)* addrspace(11)* %154, %155, !dbg !2209
  br i1 %.not147, label %guard_exit7, label %guard_pass6, !dbg !2209

guard_pass6:                                      ; preds = %guard_exit
  %156 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %149, i64 1, !dbg !2209
  %157 = bitcast { i64, {} addrspace(10)** } addrspace(11)* %156 to {} addrspace(10)* addrspace(11)*, !dbg !2209
  %158 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %157, align 8, !dbg !2209, !tbaa !30, !alias.scope !33, !noalias !36, !enzyme_type !946
  %159 = icmp eq {} addrspace(10)* %158, null, !dbg !2209
  %160 = select i1 %159, {} addrspace(10)* %147, {} addrspace(10)* %158, !dbg !2209
  br label %guard_exit7, !dbg !2209

guard_exit7:                                      ; preds = %guard_pass6, %guard_exit
  %161 = phi {} addrspace(10)* [ %147, %guard_exit ], [ %160, %guard_pass6 ], !dbg !2209
  %162 = call "enzyme_type"="{[-1]:Pointer}" {} addrspace(10)* @julia.typeof({} addrspace(10)* %161) #35, !dbg !2209
  %163 = addrspacecast {} addrspace(10)* %162 to {} addrspace(11)*, !dbg !2209
  %164 = call nonnull {}* @julia.pointer_from_objref({} addrspace(11)* %163) #36, !dbg !2209
  %.not148 = icmp eq {}* %164, inttoptr (i64 5267711712 to {}*), !dbg !2209
  %spec.select164 = select i1 %.not148, {} addrspace(10)* %161, {} addrspace(10)* %147, !dbg !2209
  %165 = bitcast {} addrspace(10)* %spec.select164 to i8 addrspace(10)*, !dbg !2210
  %166 = addrspacecast i8 addrspace(10)* %165 to i8 addrspace(11)*, !dbg !2210
  %167 = getelementptr inbounds i8, i8 addrspace(11)* %166, i64 8, !dbg !2210
  %168 = bitcast i8 addrspace(11)* %167 to i64 addrspace(11)*, !dbg !2212
  %169 = load i64, i64 addrspace(11)* %168, align 8, !dbg !2212, !tbaa !955, !alias.scope !793, !noalias !794
  %170 = icmp eq i64 %143, %169, !dbg !2213
  br i1 %170, label %L108, label %L122, !dbg !2106

guard_pass21:                                     ; preds = %L307
  %171 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %86, i64 1, !dbg !2173
  %172 = bitcast { i64, {} addrspace(10)** } addrspace(11)* %171 to {} addrspace(10)* addrspace(11)*, !dbg !2173
  %173 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %172, align 8, !dbg !2173, !tbaa !30, !alias.scope !33, !noalias !36, !enzyme_type !946
  %174 = icmp eq {} addrspace(10)* %173, null, !dbg !2173
  %175 = select i1 %174, {} addrspace(10)* %84, {} addrspace(10)* %173, !dbg !2173
  br label %guard_exit22, !dbg !2173

guard_exit22:                                     ; preds = %guard_pass21, %L307
  %176 = phi {} addrspace(10)* [ %84, %L307 ], [ %175, %guard_pass21 ], !dbg !2173
  %177 = call "enzyme_type"="{[-1]:Pointer}" {} addrspace(10)* @julia.typeof({} addrspace(10)* %176) #35, !dbg !2173
  %178 = addrspacecast {} addrspace(10)* %177 to {} addrspace(11)*, !dbg !2173
  %179 = call nonnull {}* @julia.pointer_from_objref({} addrspace(11)* %178) #36, !dbg !2173
  %.not154 = icmp eq {}* %179, inttoptr (i64 5267711712 to {}*), !dbg !2173
  %spec.select165 = select i1 %.not154, {} addrspace(10)* %176, {} addrspace(10)* %84, !dbg !2173
  %180 = bitcast {} addrspace(10)* %spec.select165 to i8 addrspace(10)*, !dbg !2216
  %181 = addrspacecast i8 addrspace(10)* %180 to i8 addrspace(11)*, !dbg !2216
  %182 = getelementptr inbounds i8, i8 addrspace(11)* %181, i64 8, !dbg !2216
  %183 = bitcast i8 addrspace(11)* %182 to i64 addrspace(11)*, !dbg !2218
  %184 = load i64, i64 addrspace(11)* %183, align 8, !dbg !2218, !tbaa !955, !alias.scope !793, !noalias !794
  %185 = bitcast {} addrspace(10)* %1 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2219
  %186 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %185 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2219
  %187 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %186, i64 0, i32 1, !dbg !2219
  %188 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %187, align 8, !dbg !2219, !tbaa !828, !alias.scope !793, !noalias !794, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %189 = bitcast {} addrspace(10)* %188 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2221
  %190 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %189 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2221
  %191 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %190, i64 0, i32 1, !dbg !2221
  %192 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %191, align 8, !dbg !2221, !tbaa !837, !alias.scope !793, !noalias !794, !nonnull !0, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %193 = bitcast {} addrspace(10)* %188 to {} addrspace(10)* addrspace(10)*, !dbg !2221
  %194 = addrspacecast {} addrspace(10)* addrspace(10)* %193 to {} addrspace(10)* addrspace(11)*, !dbg !2221
  %195 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %194, i64 2, !dbg !2221
  %196 = addrspacecast {} addrspace(10)** %192 to {} addrspace(10)* addrspace(11)*, !dbg !2221
  %.not156 = icmp eq {} addrspace(10)* addrspace(11)* %195, %196, !dbg !2221
  br i1 %.not156, label %guard_exit27, label %guard_pass26, !dbg !2221

guard_pass26:                                     ; preds = %guard_exit22
  %197 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %190, i64 1, !dbg !2221
  %198 = bitcast { i64, {} addrspace(10)** } addrspace(11)* %197 to {} addrspace(10)* addrspace(11)*, !dbg !2221
  %199 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %198, align 8, !dbg !2221, !tbaa !30, !alias.scope !33, !noalias !36, !enzyme_type !946
  %200 = icmp eq {} addrspace(10)* %199, null, !dbg !2221
  %201 = select i1 %200, {} addrspace(10)* %188, {} addrspace(10)* %199, !dbg !2221
  br label %guard_exit27, !dbg !2221

guard_exit27:                                     ; preds = %guard_pass26, %guard_exit22
  %202 = phi {} addrspace(10)* [ %188, %guard_exit22 ], [ %201, %guard_pass26 ], !dbg !2221
  %203 = call "enzyme_type"="{[-1]:Pointer}" {} addrspace(10)* @julia.typeof({} addrspace(10)* %202) #35, !dbg !2221
  %204 = addrspacecast {} addrspace(10)* %203 to {} addrspace(11)*, !dbg !2221
  %205 = call nonnull {}* @julia.pointer_from_objref({} addrspace(11)* %204) #36, !dbg !2221
  %.not157 = icmp eq {}* %205, inttoptr (i64 5267711712 to {}*), !dbg !2221
  %spec.select166 = select i1 %.not157, {} addrspace(10)* %202, {} addrspace(10)* %188, !dbg !2221
  %206 = bitcast {} addrspace(10)* %spec.select166 to i8 addrspace(10)*, !dbg !2222
  %207 = addrspacecast i8 addrspace(10)* %206 to i8 addrspace(11)*, !dbg !2222
  %208 = getelementptr inbounds i8, i8 addrspace(11)* %207, i64 8, !dbg !2222
  %209 = bitcast i8 addrspace(11)* %208 to i64 addrspace(11)*, !dbg !2224
  %210 = load i64, i64 addrspace(11)* %209, align 8, !dbg !2224, !tbaa !955, !alias.scope !793, !noalias !794
  %.not167 = icmp eq i64 %184, %210, !dbg !2225
  br i1 %.not167, label %L344, label %L358, !dbg !2161
}

; Function Attrs: mustprogress
define internal fastcc void @fwddiffejulia_vec_to_mat__251050({} addrspace(10)* noundef nonnull align 8 dereferenceable(32) "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer, [-1,24]:Integer, [-1,25]:Integer, [-1,26]:Integer, [-1,27]:Integer, [-1,28]:Integer, [-1,29]:Integer, [-1,30]:Integer, [-1,31]:Integer}" "enzymejl_parmtype"="4706449232" "enzymejl_parmtype_ref"="2" %0, {} addrspace(10)* align 8 "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer, [-1,24]:Integer, [-1,25]:Integer, [-1,26]:Integer, [-1,27]:Integer, [-1,28]:Integer, [-1,29]:Integer, [-1,30]:Integer, [-1,31]:Integer}" "enzymejl_parmtype"="4706449232" "enzymejl_parmtype_ref"="2" %"'", {} addrspace(10)* nocapture noundef nonnull readonly align 8 dereferenceable(24) "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer}" "enzymejl_parmtype"="5268576208" "enzymejl_parmtype_ref"="2" %1, {} addrspace(10)* nocapture align 8 "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer}" "enzymejl_parmtype"="5268576208" "enzymejl_parmtype_ref"="2" %"'1") unnamed_addr #30 !dbg !2228 {
top:
  %"iv'ac" = alloca i64, align 8
  %"iv1'ac" = alloca i64, align 8
  %2 = alloca { [1 x [1 x i64]], i64 }, align 8
  %3 = alloca { [1 x [1 x i64]], i64 }, align 8
  %pgcstack = call {}*** @julia.get_pgcstack() #31
  %current_task1140 = getelementptr inbounds {}**, {}*** %pgcstack, i64 -14
  %4 = bitcast {}*** %current_task1140 to {}*
  %ptls_field141 = getelementptr inbounds {}**, {}*** %pgcstack, i64 2
  %5 = bitcast {}*** %ptls_field141 to i64***
  %ptls_load142143 = load i64**, i64*** %5, align 8, !tbaa !26, !alias.scope !2229, !noalias !2232
  %6 = getelementptr inbounds i64*, i64** %ptls_load142143, i64 2
  %safepoint = load i64*, i64** %6, align 8, !tbaa !30, !alias.scope !2234, !noalias !2237
  fence syncscope("singlethread") seq_cst
  call void @julia.safepoint(i64* %safepoint) #32, !dbg !2239
  fence syncscope("singlethread") seq_cst
  %7 = bitcast {} addrspace(10)* %0 to i8 addrspace(10)*, !dbg !2240
  %8 = addrspacecast i8 addrspace(10)* %7 to i8 addrspace(11)*, !dbg !2240
  %9 = getelementptr inbounds i8, i8 addrspace(11)* %8, i64 16, !dbg !2240
  %.sroa.095.0..sroa_idx = bitcast i8 addrspace(11)* %9 to i64 addrspace(11)*, !dbg !2240
  %.sroa.095.0.copyload = load i64, i64 addrspace(11)* %.sroa.095.0..sroa_idx, align 8, !dbg !2240, !tbaa !760, !alias.scope !2247, !noalias !2250, !enzyme_type !41, !enzyme_inactive !0, !enzymejl_source_type_Int64 !0, !enzymejl_byref_BITS_VALUE !0
  %.sroa.8102.0..sroa_idx103 = getelementptr inbounds i8, i8 addrspace(11)* %8, i64 24, !dbg !2240
  %10 = bitcast i8 addrspace(11)* %.sroa.8102.0..sroa_idx103 to i64 addrspace(11)*, !dbg !2240
  %11 = getelementptr inbounds { [1 x [1 x i64]], i64 }, { [1 x [1 x i64]], i64 }* %2, i64 0, i32 0, i64 0, i64 0, !dbg !2252
  store i64 %.sroa.095.0.copyload, i64* %11, align 8, !dbg !2252, !tbaa !766, !alias.scope !768, !noalias !2254
  %12 = getelementptr inbounds { [1 x [1 x i64]], i64 }, { [1 x [1 x i64]], i64 }* %2, i64 0, i32 1, !dbg !2252
  store i64 1, i64* %12, align 8, !dbg !2252, !tbaa !766, !alias.scope !768, !noalias !2254
  %.sroa.188.0.copyload = load i64, i64 addrspace(11)* %10, align 8, !dbg !2257, !tbaa !760, !alias.scope !2247, !noalias !2250, !enzyme_type !41, !enzyme_inactive !0, !enzymejl_source_type_Int64 !0, !enzymejl_byref_BITS_VALUE !0
  %.not = icmp eq i64 %.sroa.188.0.copyload, 0, !dbg !2261
  br i1 %.not, label %L22, label %L25, !dbg !2260

L22:                                              ; preds = %top
  %13 = addrspacecast { [1 x [1 x i64]], i64 }* %2 to { [1 x [1 x i64]], i64 } addrspace(11)*, !dbg !2260
  call fastcc void @julia_throw_boundserror_251070({} addrspace(10)* nofree noundef nonnull align 8 dereferenceable(32) %0, { [1 x [1 x i64]], i64 } addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(16) %13) #33, !dbg !2260
  unreachable, !dbg !2260

L25:                                              ; preds = %top
  %14 = bitcast {} addrspace(10)* %1 to i8 addrspace(10)*, !dbg !2265
  %15 = addrspacecast i8 addrspace(10)* %14 to i8 addrspace(11)*, !dbg !2265
  %16 = getelementptr inbounds i8, i8 addrspace(11)* %15, i64 16, !dbg !2265
  %17 = bitcast i8 addrspace(11)* %16 to i64 addrspace(11)*, !dbg !2265
  %18 = load i64, i64 addrspace(11)* %17, align 8, !dbg !2265, !tbaa !790, !alias.scope !2271, !noalias !2274, !enzyme_type !41, !enzyme_inactive !0, !enzymejl_source_type_Int64 !0, !enzymejl_byref_BITS_VALUE !0
  %19 = icmp eq i64 %.sroa.095.0.copyload, %18, !dbg !2276
  %20 = icmp eq i64 %18, 1, !dbg !2278
  %value_phi.in = or i1 %19, %20, !dbg !2278
  br i1 %value_phi.in, label %L62, label %L49, !dbg !2279

L49:                                              ; preds = %L25
  %21 = call noalias nonnull align 8 dereferenceable(8) "enzyme_inactive" "enzyme_type"="{[-1]:Pointer, [-1,-1]:Pointer}" {} addrspace(10)* @julia.gc_alloc_obj({}* nonnull %4, i64 noundef 8, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5269459216 to {}*) to {} addrspace(10)*)) #34, !dbg !2279
  %22 = bitcast {} addrspace(10)* %21 to [1 x {} addrspace(10)*] addrspace(10)*, !dbg !2279, !enzyme_inactive !0
  %23 = getelementptr [1 x {} addrspace(10)*], [1 x {} addrspace(10)*] addrspace(10)* %22, i64 0, i64 0, !dbg !2279
  store {} addrspace(10)* addrspacecast ({}* inttoptr (i64 5359992384 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspace(10)* %23, align 8, !dbg !2279, !tbaa !43, !alias.scope !47, !noalias !2280
  %24 = addrspacecast {} addrspace(10)* %21 to {} addrspace(12)*, !dbg !2279, !enzyme_inactive !0
  call void @ijl_throw({} addrspace(12)* %24) #33, !dbg !2279
  unreachable, !dbg !2279

L62:                                              ; preds = %L25
  %25 = icmp eq i64 %.sroa.095.0.copyload, 0, !dbg !2281
  %26 = icmp eq i64 %18, 0
  %or.cond = select i1 %25, i1 true, i1 %26, !dbg !2283
  br i1 %or.cond, label %L122, label %L71, !dbg !2283

L71:                                              ; preds = %L62
  %27 = bitcast {} addrspace(10)* %0 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2291
  %28 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %27 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2291
  %29 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %28, i64 0, i32 1, !dbg !2291
  %30 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %29, align 8, !dbg !2291, !tbaa !828, !alias.scope !2294, !noalias !2295, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %31 = bitcast {} addrspace(10)* %30 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2296
  %32 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %31 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2296
  %33 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %32, i64 0, i32 1, !dbg !2296
  %34 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %33, align 8, !dbg !2296, !tbaa !837, !alias.scope !2297, !noalias !2300, !nonnull !0, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %35 = bitcast {} addrspace(10)* %30 to {} addrspace(10)* addrspace(10)*, !dbg !2296
  %36 = addrspacecast {} addrspace(10)* addrspace(10)* %35 to {} addrspace(10)* addrspace(11)*, !dbg !2296
  %37 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %36, i64 2, !dbg !2296
  %38 = addrspacecast {} addrspace(10)** %34 to {} addrspace(10)* addrspace(11)*, !dbg !2296
  %.not144 = icmp eq {} addrspace(10)* addrspace(11)* %37, %38, !dbg !2296
  br i1 %.not144, label %guard_exit, label %guard_pass, !dbg !2296

L108:                                             ; preds = %guard_exit7
  %"'ipc" = bitcast {} addrspace(10)* %"'1" to i8* addrspace(10)*, !dbg !2302
  %39 = bitcast {} addrspace(10)* %1 to i8* addrspace(10)*, !dbg !2302
  %"'ipc141" = addrspacecast i8* addrspace(10)* %"'ipc" to i8* addrspace(11)*, !dbg !2302
  %40 = addrspacecast i8* addrspace(10)* %39 to i8* addrspace(11)*, !dbg !2302
  %"'ipl" = load i8*, i8* addrspace(11)* %"'ipc141", align 8, !dbg !2302, !tbaa !828, !alias.scope !2305, !noalias !2306
  %41 = load i8*, i8* addrspace(11)* %40, align 8, !dbg !2302, !tbaa !828, !alias.scope !2271, !noalias !2274, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %"'ipc142" = ptrtoint i8* %"'ipl" to i64, !dbg !2307
  %42 = ptrtoint i8* %41 to i64, !dbg !2307
  %43 = call {} addrspace(10)* @jl_genericmemory_copy_slice({} addrspace(10)* %"'ipl201", i64 %"'ipc142", i64 %18), !dbg !2307
  %44 = call nonnull "enzyme_type"="{[-1]:Pointer, [-1,0]:Integer, [-1,1]:Integer, [-1,2]:Integer, [-1,3]:Integer, [-1,4]:Integer, [-1,5]:Integer, [-1,6]:Integer, [-1,7]:Integer, [-1,8]:Pointer, [-1,8,-1]:Float@double}" {} addrspace(10)* @jl_genericmemory_copy_slice({} addrspace(10)* noundef %173, i64 %42, i64 %18) #35, !dbg !2307
  %"'ipc143" = bitcast {} addrspace(10)* %43 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2308
  %45 = bitcast {} addrspace(10)* %44 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2308
  %"'ipc144" = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %"'ipc143" to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2308
  %46 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %45 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2308
  %"'ipg" = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %"'ipc144", i64 0, i32 1, !dbg !2308
  %47 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %46, i64 0, i32 1, !dbg !2308
  %"'ipc145" = bitcast {} addrspace(10)** addrspace(11)* %"'ipg" to i8* addrspace(11)*, !dbg !2308
  %48 = bitcast {} addrspace(10)** addrspace(11)* %47 to i8* addrspace(11)*, !dbg !2308
  %"'ipl146" = load i8*, i8* addrspace(11)* %"'ipc145", align 8, !dbg !2308, !tbaa !30, !alias.scope !2310, !noalias !2313, !nonnull !0
  %49 = load i8*, i8* addrspace(11)* %48, align 8, !dbg !2308, !tbaa !30, !alias.scope !2315, !noalias !2316, !nonnull !0, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %50 = call noalias nonnull align 8 dereferenceable(24) "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer}" {} addrspace(10)* @julia.gc_alloc_obj({}* nonnull %4, i64 noundef 24, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5268576208 to {}*) to {} addrspace(10)*)) #34, !dbg !2309
  %51 = bitcast {} addrspace(10)* %50 to i8 addrspace(10)*, !dbg !2309
  %52 = getelementptr inbounds i8, i8 addrspace(10)* %51, i64 0, !dbg !2309
  %53 = bitcast i8 addrspace(10)* %52 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2309
  %54 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %53 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2309
  %55 = getelementptr { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %54, i64 0, i32 1, !dbg !2309
  store atomic {} addrspace(10)* @ejl_jl_nothing, {} addrspace(10)* addrspace(11)* %55 syncscope("singlethread") release, align 8, !dbg !2309, !enzymejl_atomicgc !0
  %56 = getelementptr inbounds i8, i8 addrspace(10)* %51, i64 16, !dbg !2309
  %57 = call noalias nonnull align 8 dereferenceable(24) "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer}" {} addrspace(10)* @julia.gc_alloc_obj({}* nonnull %4, i64 noundef 24, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5268576208 to {}*) to {} addrspace(10)*)) #34, !dbg !2309
  %"'ipc148" = bitcast {} addrspace(10)* %57 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2309
  %58 = bitcast {} addrspace(10)* %50 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2309
  %"'ipc149" = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %"'ipc148" to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2309
  %59 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %58 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2309
  %".repack'ipg" = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %"'ipc149", i64 0, i32 0, !dbg !2309
  %.repack = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %59, i64 0, i32 0, !dbg !2309
  store i8* %"'ipl146", i8* addrspace(11)* %".repack'ipg", align 8, !dbg !2309, !tbaa !828, !alias.scope !2317, !noalias !2320
  store i8* %49, i8* addrspace(11)* %.repack, align 8, !dbg !2309, !tbaa !828, !alias.scope !2322, !noalias !2323
  %".repack150'ipg" = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %"'ipc149", i64 0, i32 1, !dbg !2309
  %.repack150 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %59, i64 0, i32 1, !dbg !2309
  store {} addrspace(10)* %43, {} addrspace(10)* addrspace(11)* %".repack150'ipg", align 8, !dbg !2309, !tbaa !828, !alias.scope !2317, !noalias !2320
  store {} addrspace(10)* %44, {} addrspace(10)* addrspace(11)* %.repack150, align 8, !dbg !2309, !tbaa !828, !alias.scope !2322, !noalias !2323
  br label %L122, !dbg !2309

L122:                                             ; preds = %guard_exit7, %L108, %L62
  %60 = phi {} addrspace(10)* [ %57, %L108 ], [ %"'1", %L62 ], [ %"'1", %guard_exit7 ], !dbg !2324
  %nodecayed..pre-phi = phi {} addrspace(10)* [ %50, %L108 ], [ %1, %L62 ], [ %1, %guard_exit7 ], !dbg !2324
  %"'ipc150" = addrspacecast {} addrspace(10)* %60 to {} addrspace(11)*, !dbg !2328
  %61 = addrspacecast {} addrspace(10)* %nodecayed..pre-phi to {} addrspace(11)*, !dbg !2328
  %62 = icmp slt i64 %.sroa.095.0.copyload, 1, !dbg !2328
  br i1 %62, label %L237, label %L140.lr.ph, !dbg !2329

L140.lr.ph:                                       ; preds = %L122
  %"'ipc151" = bitcast {} addrspace(11)* %"'ipc150" to { i8*, {} addrspace(10)* } addrspace(11)*
  %63 = bitcast {} addrspace(11)* %61 to { i8*, {} addrspace(10)* } addrspace(11)*
  %"'ipc152" = bitcast {} addrspace(11)* %"'ipc150" to {} addrspace(10)** addrspace(11)*
  %64 = bitcast {} addrspace(11)* %61 to {} addrspace(10)** addrspace(11)*
  %"'ipl153" = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %"'ipc152", align 8, !tbaa !828, !alias.scope !2331, !noalias !2334
  %65 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %64, align 8, !tbaa !828, !alias.scope !2336, !noalias !2337, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0, !enzyme_nocache !0
  %"'ipg154" = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %"'ipc151", i64 0, i32 1
  %66 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %63, i64 0, i32 1
  %"'ipl155" = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %"'ipg154", align 8, !tbaa !828, !alias.scope !2331, !noalias !2334, !dereferenceable_or_null !830
  %67 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %66, align 8, !tbaa !828, !alias.scope !2336, !noalias !2337, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %68 = call {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* %"'ipl155", {} addrspace(10)** %"'ipl153"), !dbg !2338
  %69 = call "enzyme_type"="{[-1]:Pointer, [-1,-1]:Float@double}" {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* noundef %67, {} addrspace(10)** noundef %65) #31, !dbg !2338
  %"'ipc156" = bitcast {} addrspace(10)* %"'" to { i8*, {} addrspace(10)* } addrspace(10)*
  %70 = bitcast {} addrspace(10)* %0 to { i8*, {} addrspace(10)* } addrspace(10)*
  %"'ipc157" = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %"'ipc156" to { i8*, {} addrspace(10)* } addrspace(11)*
  %71 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %70 to { i8*, {} addrspace(10)* } addrspace(11)*
  %"'ipc158" = bitcast {} addrspace(10)* %"'" to {} addrspace(10)** addrspace(10)*
  %72 = bitcast {} addrspace(10)* %0 to {} addrspace(10)** addrspace(10)*
  %"'ipc159" = addrspacecast {} addrspace(10)** addrspace(10)* %"'ipc158" to {} addrspace(10)** addrspace(11)*
  %73 = addrspacecast {} addrspace(10)** addrspace(10)* %72 to {} addrspace(10)** addrspace(11)*
  %"'ipl160" = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %"'ipc159", align 8, !alias.scope !2339, !noalias !2340
  %74 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %73, align 8, !alias.scope !2340, !noalias !2339, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0, !enzyme_nocache !0
  %"'ipg161" = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %"'ipc157", i64 0, i32 1
  %75 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %71, i64 0, i32 1
  %"'ipl162" = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %"'ipg161", align 8, !alias.scope !2339, !noalias !2340
  %76 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %75, align 8, !alias.scope !2340, !noalias !2339, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %77 = call {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* %"'ipl162", {} addrspace(10)** %"'ipl160"), !dbg !2338
  %78 = call "enzyme_type"="{[-1]:Pointer, [-1,-1]:Float@double}" {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* noundef %76, {} addrspace(10)** noundef %74) #31, !dbg !2338
  %79 = add i64 %.sroa.095.0.copyload, -1, !dbg !2341
  br label %L140, !dbg !2341

L140:                                             ; preds = %L140, %L140.lr.ph
  %iv = phi i64 [ %iv.next, %L140 ], [ 0, %L140.lr.ph ]
  %iv.next = add nuw nsw i64 %iv, 1, !dbg !2342
  %80 = select i1 %20, i64 0, i64 %iv, !dbg !2345
  %"'ipg163" = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %68, i64 %80, !dbg !2345
  %81 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %69, i64 %80, !dbg !2345
  %"'ipc164" = bitcast {} addrspace(10)* addrspace(13)* %"'ipg163" to double addrspace(13)*, !dbg !2345
  %82 = bitcast {} addrspace(10)* addrspace(13)* %81 to double addrspace(13)*, !dbg !2345
  %"'ipl165" = load double, double addrspace(13)* %"'ipc164", align 8, !dbg !2345, !tbaa !880, !alias.scope !2352, !noalias !2355
  %83 = load double, double addrspace(13)* %82, align 8, !dbg !2345, !tbaa !880, !alias.scope !2357, !noalias !2358
  %84 = call double @julia_sin_251131(double %83) #31, !dbg !2359
  %85 = call fast double @llvm.cos.f64(double %83), !dbg !2361
  %86 = fmul fast double %"'ipl165", %85, !dbg !2361
  %"'ipg166" = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %77, i64 %iv, !dbg !2361
  %87 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %78, i64 %iv, !dbg !2361
  %"'ipc167" = bitcast {} addrspace(10)* addrspace(13)* %"'ipg166" to double addrspace(13)*, !dbg !2361
  %88 = bitcast {} addrspace(10)* addrspace(13)* %87 to double addrspace(13)*, !dbg !2361
  store double %86, double addrspace(13)* %"'ipc167", align 8, !dbg !2361, !tbaa !880, !alias.scope !2363, !noalias !2366
  store double %84, double addrspace(13)* %88, align 8, !dbg !2361, !tbaa !880, !alias.scope !2368, !noalias !2369
  %exitcond172.not = icmp eq i64 %iv.next, %.sroa.095.0.copyload, !dbg !2370
  br i1 %exitcond172.not, label %L237.loopexit, label %L140, !dbg !2341, !llvm.loop !2371

L237.loopexit:                                    ; preds = %L140
  br label %L237, !dbg !2372

L237:                                             ; preds = %L237.loopexit, %L122
  %89 = getelementptr inbounds { [1 x [1 x i64]], i64 }, { [1 x [1 x i64]], i64 }* %3, i64 0, i32 0, i64 0, i64 0, !dbg !2372
  store i64 %.sroa.095.0.copyload, i64* %89, align 8, !dbg !2372, !tbaa !766, !alias.scope !768, !noalias !2254
  %90 = getelementptr inbounds { [1 x [1 x i64]], i64 }, { [1 x [1 x i64]], i64 }* %3, i64 0, i32 1, !dbg !2372
  store i64 2, i64* %90, align 8, !dbg !2372, !tbaa !766, !alias.scope !768, !noalias !2254
  %91 = icmp ult i64 %.sroa.188.0.copyload, 2, !dbg !2377
  br i1 %91, label %L258, label %L298, !dbg !2382

L258:                                             ; preds = %L237
  %92 = addrspacecast { [1 x [1 x i64]], i64 }* %3 to { [1 x [1 x i64]], i64 } addrspace(11)*, !dbg !2382
  call fastcc void @julia_throw_boundserror_251070({} addrspace(10)* nofree noundef nonnull align 8 dereferenceable(32) %0, { [1 x [1 x i64]], i64 } addrspace(11)* nocapture nofree noundef nonnull readonly align 8 dereferenceable(16) %92) #33, !dbg !2382
  unreachable, !dbg !2382

L298:                                             ; preds = %L237
  br i1 %or.cond, label %L358, label %L307, !dbg !2383

L307:                                             ; preds = %L298
  %93 = bitcast {} addrspace(10)* %0 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2393
  %94 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %93 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2393
  %95 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %94, i64 0, i32 1, !dbg !2393
  %96 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %95, align 8, !dbg !2393, !tbaa !828, !alias.scope !2294, !noalias !2295, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %97 = bitcast {} addrspace(10)* %96 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2396
  %98 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %97 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2396
  %99 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %98, i64 0, i32 1, !dbg !2396
  %100 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %99, align 8, !dbg !2396, !tbaa !837, !alias.scope !2397, !noalias !2400, !nonnull !0, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %101 = bitcast {} addrspace(10)* %96 to {} addrspace(10)* addrspace(10)*, !dbg !2396
  %102 = addrspacecast {} addrspace(10)* addrspace(10)* %101 to {} addrspace(10)* addrspace(11)*, !dbg !2396
  %103 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %102, i64 2, !dbg !2396
  %104 = addrspacecast {} addrspace(10)** %100 to {} addrspace(10)* addrspace(11)*, !dbg !2396
  %.not153 = icmp eq {} addrspace(10)* addrspace(11)* %103, %104, !dbg !2396
  br i1 %.not153, label %guard_exit22, label %guard_pass21, !dbg !2396

L344:                                             ; preds = %guard_exit27
  %"'ipc168" = bitcast {} addrspace(10)* %"'1" to i8* addrspace(10)*, !dbg !2402
  %105 = bitcast {} addrspace(10)* %1 to i8* addrspace(10)*, !dbg !2402
  %"'ipc169" = addrspacecast i8* addrspace(10)* %"'ipc168" to i8* addrspace(11)*, !dbg !2402
  %106 = addrspacecast i8* addrspace(10)* %105 to i8* addrspace(11)*, !dbg !2402
  %"'ipl170" = load i8*, i8* addrspace(11)* %"'ipc169", align 8, !dbg !2402, !tbaa !828, !alias.scope !2305, !noalias !2306
  %107 = load i8*, i8* addrspace(11)* %106, align 8, !dbg !2402, !tbaa !828, !alias.scope !2271, !noalias !2274, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %"'ipc171" = ptrtoint i8* %"'ipl170" to i64, !dbg !2405
  %108 = ptrtoint i8* %107 to i64, !dbg !2405
  %109 = call {} addrspace(10)* @jl_genericmemory_copy_slice({} addrspace(10)* %"'ipl205", i64 %"'ipc171", i64 %18), !dbg !2405
  %110 = call nonnull "enzyme_type"="{[-1]:Pointer, [-1,0]:Integer, [-1,1]:Integer, [-1,2]:Integer, [-1,3]:Integer, [-1,4]:Integer, [-1,5]:Integer, [-1,6]:Integer, [-1,7]:Integer, [-1,8]:Pointer, [-1,8,-1]:Float@double}" {} addrspace(10)* @jl_genericmemory_copy_slice({} addrspace(10)* noundef %214, i64 %108, i64 %18) #35, !dbg !2405
  %"'ipc172" = bitcast {} addrspace(10)* %109 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2406
  %111 = bitcast {} addrspace(10)* %110 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2406
  %"'ipc173" = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %"'ipc172" to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2406
  %112 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %111 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2406
  %"'ipg174" = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %"'ipc173", i64 0, i32 1, !dbg !2406
  %113 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %112, i64 0, i32 1, !dbg !2406
  %"'ipc175" = bitcast {} addrspace(10)** addrspace(11)* %"'ipg174" to i8* addrspace(11)*, !dbg !2406
  %114 = bitcast {} addrspace(10)** addrspace(11)* %113 to i8* addrspace(11)*, !dbg !2406
  %"'ipl176" = load i8*, i8* addrspace(11)* %"'ipc175", align 8, !dbg !2406, !tbaa !30, !alias.scope !2408, !noalias !2411, !nonnull !0
  %115 = load i8*, i8* addrspace(11)* %114, align 8, !dbg !2406, !tbaa !30, !alias.scope !2413, !noalias !2414, !nonnull !0, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %116 = call noalias nonnull align 8 dereferenceable(24) "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer}" {} addrspace(10)* @julia.gc_alloc_obj({}* nonnull %4, i64 noundef 24, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5268576208 to {}*) to {} addrspace(10)*)) #34, !dbg !2407
  %117 = bitcast {} addrspace(10)* %116 to i8 addrspace(10)*, !dbg !2407
  %118 = getelementptr inbounds i8, i8 addrspace(10)* %117, i64 0, !dbg !2407
  %119 = bitcast i8 addrspace(10)* %118 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2407
  %120 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %119 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2407
  %121 = getelementptr { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %120, i64 0, i32 1, !dbg !2407
  store atomic {} addrspace(10)* @ejl_jl_nothing, {} addrspace(10)* addrspace(11)* %121 syncscope("singlethread") release, align 8, !dbg !2407, !enzymejl_atomicgc !0
  %122 = getelementptr inbounds i8, i8 addrspace(10)* %117, i64 16, !dbg !2407
  %123 = call noalias nonnull align 8 dereferenceable(24) "enzyme_type"="{[-1]:Pointer, [-1,0]:Pointer, [-1,0,-1]:Float@double, [-1,8]:Pointer, [-1,8,0]:Integer, [-1,8,1]:Integer, [-1,8,2]:Integer, [-1,8,3]:Integer, [-1,8,4]:Integer, [-1,8,5]:Integer, [-1,8,6]:Integer, [-1,8,7]:Integer, [-1,8,8]:Pointer, [-1,8,8,-1]:Float@double, [-1,16]:Integer, [-1,17]:Integer, [-1,18]:Integer, [-1,19]:Integer, [-1,20]:Integer, [-1,21]:Integer, [-1,22]:Integer, [-1,23]:Integer}" {} addrspace(10)* @julia.gc_alloc_obj({}* nonnull %4, i64 noundef 24, {} addrspace(10)* noundef addrspacecast ({}* inttoptr (i64 5268576208 to {}*) to {} addrspace(10)*)) #34, !dbg !2407
  %"'ipc178" = bitcast {} addrspace(10)* %123 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2407
  %124 = bitcast {} addrspace(10)* %116 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2407
  %"'ipc179" = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %"'ipc178" to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2407
  %125 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %124 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2407
  %".repack159'ipg" = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %"'ipc179", i64 0, i32 0, !dbg !2407
  %.repack159 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %125, i64 0, i32 0, !dbg !2407
  store i8* %"'ipl176", i8* addrspace(11)* %".repack159'ipg", align 8, !dbg !2407, !tbaa !828, !alias.scope !2415, !noalias !2418
  store i8* %115, i8* addrspace(11)* %.repack159, align 8, !dbg !2407, !tbaa !828, !alias.scope !2420, !noalias !2421
  %".repack160'ipg" = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %"'ipc179", i64 0, i32 1, !dbg !2407
  %.repack160 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %125, i64 0, i32 1, !dbg !2407
  store {} addrspace(10)* %109, {} addrspace(10)* addrspace(11)* %".repack160'ipg", align 8, !dbg !2407, !tbaa !828, !alias.scope !2415, !noalias !2418
  store {} addrspace(10)* %110, {} addrspace(10)* addrspace(11)* %.repack160, align 8, !dbg !2407, !tbaa !828, !alias.scope !2420, !noalias !2421
  br label %L358, !dbg !2407

L358:                                             ; preds = %guard_exit27, %L344, %L298
  %126 = phi {} addrspace(10)* [ %123, %L344 ], [ %"'1", %L298 ], [ %"'1", %guard_exit27 ], !dbg !2422
  %nodecayed..pre-phi130 = phi {} addrspace(10)* [ %116, %L344 ], [ %1, %L298 ], [ %1, %guard_exit27 ], !dbg !2422
  %"'ipc180" = addrspacecast {} addrspace(10)* %126 to {} addrspace(11)*, !dbg !2426
  %127 = addrspacecast {} addrspace(10)* %nodecayed..pre-phi130 to {} addrspace(11)*, !dbg !2426
  br i1 %62, label %L473, label %L376.lr.ph, !dbg !2426

L376.lr.ph:                                       ; preds = %L358
  %"'ipc181" = bitcast {} addrspace(11)* %"'ipc180" to { i8*, {} addrspace(10)* } addrspace(11)*
  %128 = bitcast {} addrspace(11)* %127 to { i8*, {} addrspace(10)* } addrspace(11)*
  %"'ipc182" = bitcast {} addrspace(11)* %"'ipc180" to {} addrspace(10)** addrspace(11)*
  %129 = bitcast {} addrspace(11)* %127 to {} addrspace(10)** addrspace(11)*
  %"'ipl183" = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %"'ipc182", align 8, !tbaa !828, !alias.scope !2428, !noalias !2431
  %130 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %129, align 8, !tbaa !828, !alias.scope !2433, !noalias !2434, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0, !enzyme_nocache !0
  %"'ipg184" = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %"'ipc181", i64 0, i32 1
  %131 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %128, i64 0, i32 1
  %"'ipl185" = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %"'ipg184", align 8, !tbaa !828, !alias.scope !2428, !noalias !2431, !dereferenceable_or_null !830
  %132 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %131, align 8, !tbaa !828, !alias.scope !2433, !noalias !2434, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %133 = call {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* %"'ipl185", {} addrspace(10)** %"'ipl183"), !dbg !2338
  %134 = call "enzyme_type"="{[-1]:Pointer, [-1,-1]:Float@double}" {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* noundef %132, {} addrspace(10)** noundef %130) #31, !dbg !2338
  %"'ipc186" = bitcast {} addrspace(10)* %"'" to { i8*, {} addrspace(10)* } addrspace(10)*
  %135 = bitcast {} addrspace(10)* %0 to { i8*, {} addrspace(10)* } addrspace(10)*
  %"'ipc187" = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %"'ipc186" to { i8*, {} addrspace(10)* } addrspace(11)*
  %136 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %135 to { i8*, {} addrspace(10)* } addrspace(11)*
  %"'ipc188" = bitcast {} addrspace(10)* %"'" to {} addrspace(10)** addrspace(10)*
  %137 = bitcast {} addrspace(10)* %0 to {} addrspace(10)** addrspace(10)*
  %"'ipc189" = addrspacecast {} addrspace(10)** addrspace(10)* %"'ipc188" to {} addrspace(10)** addrspace(11)*
  %138 = addrspacecast {} addrspace(10)** addrspace(10)* %137 to {} addrspace(10)** addrspace(11)*
  %"'ipl190" = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %"'ipc189", align 8, !alias.scope !2339, !noalias !2340
  %139 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %138, align 8, !alias.scope !2340, !noalias !2339, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0, !enzyme_nocache !0
  %"'ipg191" = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %"'ipc187", i64 0, i32 1
  %140 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %136, i64 0, i32 1
  %"'ipl192" = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %"'ipg191", align 8, !alias.scope !2339, !noalias !2340
  %141 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %140, align 8, !alias.scope !2340, !noalias !2339, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %142 = call {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* %"'ipl192", {} addrspace(10)** %"'ipl190"), !dbg !2338
  %143 = call "enzyme_type"="{[-1]:Pointer, [-1,-1]:Float@double}" {} addrspace(10)* addrspace(13)* @julia.gc_loaded({} addrspace(10)* noundef %141, {} addrspace(10)** noundef %139) #31, !dbg !2338
  %144 = add i64 %.sroa.095.0.copyload, -1, !dbg !2435
  br label %L376, !dbg !2435

L376:                                             ; preds = %L376, %L376.lr.ph
  %iv1 = phi i64 [ %iv.next2, %L376 ], [ 0, %L376.lr.ph ]
  %iv.next2 = add nuw nsw i64 %iv1, 1, !dbg !2436
  %145 = select i1 %20, i64 0, i64 %iv1, !dbg !2439
  %"'ipg193" = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %133, i64 %145, !dbg !2439
  %146 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %134, i64 %145, !dbg !2439
  %"'ipc194" = bitcast {} addrspace(10)* addrspace(13)* %"'ipg193" to double addrspace(13)*, !dbg !2439
  %147 = bitcast {} addrspace(10)* addrspace(13)* %146 to double addrspace(13)*, !dbg !2439
  %"'ipl195" = load double, double addrspace(13)* %"'ipc194", align 8, !dbg !2439, !tbaa !880, !alias.scope !2446, !noalias !2449
  %148 = load double, double addrspace(13)* %147, align 8, !dbg !2439, !tbaa !880, !alias.scope !2451, !noalias !2452
  %149 = call double @julia_cos_251086(double %148) #31, !dbg !2453
  %150 = call fast double @llvm.sin.f64(double %148), !dbg !2455
  %151 = fneg fast double %150, !dbg !2455
  %152 = fmul fast double %"'ipl195", %151, !dbg !2455
  %153 = add i64 %iv1, %.sroa.095.0.copyload, !dbg !2455
  %"'ipg196" = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %142, i64 %153, !dbg !2455
  %154 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(13)* %143, i64 %153, !dbg !2455
  %"'ipc197" = bitcast {} addrspace(10)* addrspace(13)* %"'ipg196" to double addrspace(13)*, !dbg !2455
  %155 = bitcast {} addrspace(10)* addrspace(13)* %154 to double addrspace(13)*, !dbg !2455
  store double %152, double addrspace(13)* %"'ipc197", align 8, !dbg !2455, !tbaa !880, !alias.scope !2457, !noalias !2460
  store double %149, double addrspace(13)* %155, align 8, !dbg !2455, !tbaa !880, !alias.scope !2462, !noalias !2463
  %exitcond.not = icmp eq i64 %iv.next2, %.sroa.095.0.copyload, !dbg !2464
  br i1 %exitcond.not, label %L473.loopexit, label %L376, !dbg !2435, !llvm.loop !2465

L473.loopexit:                                    ; preds = %L376
  br label %L473, !dbg !2466

L473:                                             ; preds = %L473.loopexit, %L358
  ret void

guard_pass:                                       ; preds = %L71
  %156 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %32, i64 1, !dbg !2296
  %157 = bitcast { i64, {} addrspace(10)** } addrspace(11)* %156 to {} addrspace(10)* addrspace(11)*, !dbg !2296
  %158 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %157, align 8, !dbg !2296, !tbaa !30, !alias.scope !2467, !noalias !2468, !enzyme_type !946
  %159 = icmp eq {} addrspace(10)* %158, null, !dbg !2296
  %160 = select i1 %159, {} addrspace(10)* %30, {} addrspace(10)* %158, !dbg !2296
  br label %guard_exit, !dbg !2296

guard_exit:                                       ; preds = %guard_pass, %L71
  %161 = phi {} addrspace(10)* [ %30, %L71 ], [ %160, %guard_pass ], !dbg !2296
  %162 = call "enzyme_type"="{[-1]:Pointer}" {} addrspace(10)* @julia.typeof({} addrspace(10)* %161) #36, !dbg !2296
  %163 = addrspacecast {} addrspace(10)* %162 to {} addrspace(11)*, !dbg !2296
  %164 = call nonnull {}* @julia.pointer_from_objref({} addrspace(11)* %163) #37, !dbg !2296
  %.not145 = icmp eq {}* %164, inttoptr (i64 5267711712 to {}*), !dbg !2296
  %spec.select = select i1 %.not145, {} addrspace(10)* %161, {} addrspace(10)* %30, !dbg !2296
  %165 = bitcast {} addrspace(10)* %spec.select to i8 addrspace(10)*, !dbg !2469
  %166 = addrspacecast i8 addrspace(10)* %165 to i8 addrspace(11)*, !dbg !2469
  %167 = getelementptr inbounds i8, i8 addrspace(11)* %166, i64 8, !dbg !2469
  %168 = bitcast i8 addrspace(11)* %167 to i64 addrspace(11)*, !dbg !2471
  %169 = load i64, i64 addrspace(11)* %168, align 8, !dbg !2471, !tbaa !955, !alias.scope !2472, !noalias !2475
  %"'ipc198" = bitcast {} addrspace(10)* %"'1" to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2477
  %170 = bitcast {} addrspace(10)* %1 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2477
  %"'ipc199" = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %"'ipc198" to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2477
  %171 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %170 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2477
  %"'ipg200" = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %"'ipc199", i64 0, i32 1, !dbg !2477
  %172 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %171, i64 0, i32 1, !dbg !2477
  %"'ipl201" = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %"'ipg200", align 8, !dbg !2477, !tbaa !828, !alias.scope !2305, !noalias !2306, !dereferenceable_or_null !830
  %173 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %172, align 8, !dbg !2477, !tbaa !828, !alias.scope !2271, !noalias !2274, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %174 = bitcast {} addrspace(10)* %173 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2479
  %175 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %174 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2479
  %176 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %175, i64 0, i32 1, !dbg !2479
  %177 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %176, align 8, !dbg !2479, !tbaa !837, !alias.scope !2480, !noalias !2483, !nonnull !0, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %178 = bitcast {} addrspace(10)* %173 to {} addrspace(10)* addrspace(10)*, !dbg !2479
  %179 = addrspacecast {} addrspace(10)* addrspace(10)* %178 to {} addrspace(10)* addrspace(11)*, !dbg !2479
  %180 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %179, i64 2, !dbg !2479
  %181 = addrspacecast {} addrspace(10)** %177 to {} addrspace(10)* addrspace(11)*, !dbg !2479
  %.not147 = icmp eq {} addrspace(10)* addrspace(11)* %180, %181, !dbg !2479
  br i1 %.not147, label %guard_exit7, label %guard_pass6, !dbg !2479

guard_pass6:                                      ; preds = %guard_exit
  %182 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %175, i64 1, !dbg !2479
  %183 = bitcast { i64, {} addrspace(10)** } addrspace(11)* %182 to {} addrspace(10)* addrspace(11)*, !dbg !2479
  %184 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %183, align 8, !dbg !2479, !tbaa !30, !alias.scope !2485, !noalias !2486, !enzyme_type !946
  %185 = icmp eq {} addrspace(10)* %184, null, !dbg !2479
  %186 = select i1 %185, {} addrspace(10)* %173, {} addrspace(10)* %184, !dbg !2479
  br label %guard_exit7, !dbg !2479

guard_exit7:                                      ; preds = %guard_pass6, %guard_exit
  %187 = phi {} addrspace(10)* [ %173, %guard_exit ], [ %186, %guard_pass6 ], !dbg !2479
  %188 = call "enzyme_type"="{[-1]:Pointer}" {} addrspace(10)* @julia.typeof({} addrspace(10)* %187) #36, !dbg !2479
  %189 = addrspacecast {} addrspace(10)* %188 to {} addrspace(11)*, !dbg !2479
  %190 = call nonnull {}* @julia.pointer_from_objref({} addrspace(11)* %189) #37, !dbg !2479
  %.not148 = icmp eq {}* %190, inttoptr (i64 5267711712 to {}*), !dbg !2479
  %spec.select164 = select i1 %.not148, {} addrspace(10)* %187, {} addrspace(10)* %173, !dbg !2479
  %191 = bitcast {} addrspace(10)* %spec.select164 to i8 addrspace(10)*, !dbg !2487
  %192 = addrspacecast i8 addrspace(10)* %191 to i8 addrspace(11)*, !dbg !2487
  %193 = getelementptr inbounds i8, i8 addrspace(11)* %192, i64 8, !dbg !2487
  %194 = bitcast i8 addrspace(11)* %193 to i64 addrspace(11)*, !dbg !2489
  %195 = load i64, i64 addrspace(11)* %194, align 8, !dbg !2489, !tbaa !955, !alias.scope !2490, !noalias !2493
  %196 = icmp eq i64 %169, %195, !dbg !2495
  br i1 %196, label %L108, label %L122, !dbg !2284

guard_pass21:                                     ; preds = %L307
  %197 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %98, i64 1, !dbg !2396
  %198 = bitcast { i64, {} addrspace(10)** } addrspace(11)* %197 to {} addrspace(10)* addrspace(11)*, !dbg !2396
  %199 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %198, align 8, !dbg !2396, !tbaa !30, !alias.scope !2498, !noalias !2499, !enzyme_type !946
  %200 = icmp eq {} addrspace(10)* %199, null, !dbg !2396
  %201 = select i1 %200, {} addrspace(10)* %96, {} addrspace(10)* %199, !dbg !2396
  br label %guard_exit22, !dbg !2396

guard_exit22:                                     ; preds = %guard_pass21, %L307
  %202 = phi {} addrspace(10)* [ %96, %L307 ], [ %201, %guard_pass21 ], !dbg !2396
  %203 = call "enzyme_type"="{[-1]:Pointer}" {} addrspace(10)* @julia.typeof({} addrspace(10)* %202) #36, !dbg !2396
  %204 = addrspacecast {} addrspace(10)* %203 to {} addrspace(11)*, !dbg !2396
  %205 = call nonnull {}* @julia.pointer_from_objref({} addrspace(11)* %204) #37, !dbg !2396
  %.not154 = icmp eq {}* %205, inttoptr (i64 5267711712 to {}*), !dbg !2396
  %spec.select165 = select i1 %.not154, {} addrspace(10)* %202, {} addrspace(10)* %96, !dbg !2396
  %206 = bitcast {} addrspace(10)* %spec.select165 to i8 addrspace(10)*, !dbg !2500
  %207 = addrspacecast i8 addrspace(10)* %206 to i8 addrspace(11)*, !dbg !2500
  %208 = getelementptr inbounds i8, i8 addrspace(11)* %207, i64 8, !dbg !2500
  %209 = bitcast i8 addrspace(11)* %208 to i64 addrspace(11)*, !dbg !2502
  %210 = load i64, i64 addrspace(11)* %209, align 8, !dbg !2502, !tbaa !955, !alias.scope !2503, !noalias !2506
  %"'ipc202" = bitcast {} addrspace(10)* %"'1" to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2508
  %211 = bitcast {} addrspace(10)* %1 to { i8*, {} addrspace(10)* } addrspace(10)*, !dbg !2508
  %"'ipc203" = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %"'ipc202" to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2508
  %212 = addrspacecast { i8*, {} addrspace(10)* } addrspace(10)* %211 to { i8*, {} addrspace(10)* } addrspace(11)*, !dbg !2508
  %"'ipg204" = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %"'ipc203", i64 0, i32 1, !dbg !2508
  %213 = getelementptr inbounds { i8*, {} addrspace(10)* }, { i8*, {} addrspace(10)* } addrspace(11)* %212, i64 0, i32 1, !dbg !2508
  %"'ipl205" = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %"'ipg204", align 8, !dbg !2508, !tbaa !828, !alias.scope !2305, !noalias !2306, !dereferenceable_or_null !830
  %214 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %213, align 8, !dbg !2508, !tbaa !828, !alias.scope !2271, !noalias !2274, !dereferenceable_or_null !830, !align !831, !enzyme_type !832, !enzymejl_source_type_Memory\7BFloat64\7D !0, !enzymejl_byref_MUT_REF !0
  %215 = bitcast {} addrspace(10)* %214 to { i64, {} addrspace(10)** } addrspace(10)*, !dbg !2510
  %216 = addrspacecast { i64, {} addrspace(10)** } addrspace(10)* %215 to { i64, {} addrspace(10)** } addrspace(11)*, !dbg !2510
  %217 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %216, i64 0, i32 1, !dbg !2510
  %218 = load {} addrspace(10)**, {} addrspace(10)** addrspace(11)* %217, align 8, !dbg !2510, !tbaa !837, !alias.scope !2511, !noalias !2514, !nonnull !0, !enzyme_type !839, !enzymejl_byref_BITS_VALUE !0, !enzymejl_source_type_Ptr\7BFloat64\7D !0
  %219 = bitcast {} addrspace(10)* %214 to {} addrspace(10)* addrspace(10)*, !dbg !2510
  %220 = addrspacecast {} addrspace(10)* addrspace(10)* %219 to {} addrspace(10)* addrspace(11)*, !dbg !2510
  %221 = getelementptr inbounds {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %220, i64 2, !dbg !2510
  %222 = addrspacecast {} addrspace(10)** %218 to {} addrspace(10)* addrspace(11)*, !dbg !2510
  %.not156 = icmp eq {} addrspace(10)* addrspace(11)* %221, %222, !dbg !2510
  br i1 %.not156, label %guard_exit27, label %guard_pass26, !dbg !2510

guard_pass26:                                     ; preds = %guard_exit22
  %223 = getelementptr inbounds { i64, {} addrspace(10)** }, { i64, {} addrspace(10)** } addrspace(11)* %216, i64 1, !dbg !2510
  %224 = bitcast { i64, {} addrspace(10)** } addrspace(11)* %223 to {} addrspace(10)* addrspace(11)*, !dbg !2510
  %225 = load {} addrspace(10)*, {} addrspace(10)* addrspace(11)* %224, align 8, !dbg !2510, !tbaa !30, !alias.scope !2516, !noalias !2517, !enzyme_type !946
  %226 = icmp eq {} addrspace(10)* %225, null, !dbg !2510
  %227 = select i1 %226, {} addrspace(10)* %214, {} addrspace(10)* %225, !dbg !2510
  br label %guard_exit27, !dbg !2510

guard_exit27:                                     ; preds = %guard_pass26, %guard_exit22
  %228 = phi {} addrspace(10)* [ %214, %guard_exit22 ], [ %227, %guard_pass26 ], !dbg !2510
  %229 = call "enzyme_type"="{[-1]:Pointer}" {} addrspace(10)* @julia.typeof({} addrspace(10)* %228) #36, !dbg !2510
  %230 = addrspacecast {} addrspace(10)* %229 to {} addrspace(11)*, !dbg !2510
  %231 = call nonnull {}* @julia.pointer_from_objref({} addrspace(11)* %230) #37, !dbg !2510
  %.not157 = icmp eq {}* %231, inttoptr (i64 5267711712 to {}*), !dbg !2510
  %spec.select166 = select i1 %.not157, {} addrspace(10)* %228, {} addrspace(10)* %214, !dbg !2510
  %232 = bitcast {} addrspace(10)* %spec.select166 to i8 addrspace(10)*, !dbg !2518
  %233 = addrspacecast i8 addrspace(10)* %232 to i8 addrspace(11)*, !dbg !2518
  %234 = getelementptr inbounds i8, i8 addrspace(11)* %233, i64 8, !dbg !2518
  %235 = bitcast i8 addrspace(11)* %234 to i64 addrspace(11)*, !dbg !2520
  %236 = load i64, i64 addrspace(11)* %235, align 8, !dbg !2520, !tbaa !955, !alias.scope !2521, !noalias !2524
  %.not167 = icmp eq i64 %210, %236, !dbg !2526
  br i1 %.not167, label %L344, label %L358, !dbg !2384
}

Correctness: Error During Test at /Users/guillaumedalle/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:157
  Got exception outside of a @test
  Enzyme compilation failed due to an internal error.
   Please open an issue with the code to reproduce and full error log on github.com/EnzymeAD/Enzyme.jl
   To toggle more information for debugging (needed for bug reports), set Enzyme.Compiler.VERBOSE_ERRORS[] = true (default false)
  
  Stacktrace:
   [1] ==
     @ ./promotion.jl:639
   [2] _copyto_impl!
     @ ./array.jl:302
   [3] copyto!
     @ ./array.jl:299
   [4] copyto!
     @ ./array.jl:322
   [5] WritableClosure
     @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/scenarios/modify.jl:126
   [6] WritableClosure
     @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/scenarios/modify.jl:0
  
  Stacktrace:
    [1] julia_error(msg::String, val::Ptr{LLVM.API.LLVMOpaqueValue}, errtype::Enzyme.API.ErrorType, data::Ptr{Nothing}, data2::Ptr{LLVM.API.LLVMOpaqueValue}, B::Ptr{LLVM.API.LLVMOpaqueBuilder})
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/errors.jl:394
    [2] julia_error(cstr::Cstring, val::Ptr{LLVM.API.LLVMOpaqueValue}, errtype::Enzyme.API.ErrorType, data::Ptr{Nothing}, data2::Ptr{LLVM.API.LLVMOpaqueValue}, B::Ptr{LLVM.API.LLVMOpaqueBuilder})
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/errors.jl:249
    [3] EnzymeCreateForwardDiff(logic::Enzyme.Logic, todiff::LLVM.Function, retType::Enzyme.API.CDIFFE_TYPE, constant_args::Vector{Enzyme.API.CDIFFE_TYPE}, TA::Enzyme.TypeAnalysis, returnValue::Bool, mode::Enzyme.API.CDerivativeMode, runtimeActivity::Bool, width::Int64, additionalArg::Ptr{Nothing}, typeInfo::Enzyme.FnTypeInfo, uncacheable_args::Vector{Bool})
      @ Enzyme.API ~/.julia/packages/Enzyme/3VNOP/src/api.jl:338
    [4] enzyme!(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, mod::LLVM.Module, primalf::LLVM.Function, TT::Type, mode::Enzyme.API.CDerivativeMode, width::Int64, parallel::Bool, actualRetType::Type, wrap::Bool, modifiedBetween::NTuple{N, Bool} where N, returnPrimal::Bool, expectedTapeType::Type, loweredArgs::Set{Int64}, boxedArgs::Set{Int64})
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:1793
    [5] codegen(output::Symbol, job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}; libraries::Bool, deferred_codegen::Bool, optimize::Bool, toplevel::Bool, strip::Bool, validate::Bool, only_entry::Bool, parent_job::Nothing)
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:4664
    [6] codegen
      @ ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:3450 [inlined]
    [7] _thunk(job::GPUCompiler.CompilerJob{Enzyme.Compiler.EnzymeTarget, Enzyme.Compiler.EnzymeCompilerParams}, postopt::Bool)
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:5528
    [8] _thunk
      @ ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:5528 [inlined]
    [9] cached_compilation
      @ ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:5580 [inlined]
   [10] thunkbase(mi::Core.MethodInstance, World::UInt64, FA::Type{<:EnzymeCore.Annotation}, A::Type{<:EnzymeCore.Annotation}, TT::Type, Mode::Enzyme.API.CDerivativeMode, width::Int64, ModifiedBetween::NTuple{N, Bool} where N, ReturnPrimal::Bool, ShadowInit::Bool, ABI::Type, ErrIfFuncWritten::Bool, RuntimeActivity::Bool, edges::Vector{Any})
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:5691
   [11] thunk_generator(world::UInt64, source::LineNumberNode, FA::Type, A::Type, TT::Type, Mode::Enzyme.API.CDerivativeMode, Width::Int64, ModifiedBetween::NTuple{N, Bool} where N, ReturnPrimal::Bool, ShadowInit::Bool, ABI::Type, ErrIfFuncWritten::Bool, RuntimeActivity::Bool, self::Any, fakeworld::Any, fa::Type, a::Type, tt::Type, mode::Type, width::Type, modifiedbetween::Type, returnprimal::Type, shadowinit::Type, abi::Type, erriffuncwritten::Type, runtimeactivity::Type)
      @ Enzyme.Compiler ~/.julia/packages/Enzyme/3VNOP/src/compiler.jl:5876
   [12] autodiff
      @ ~/.julia/packages/Enzyme/3VNOP/src/Enzyme.jl:640 [inlined]
   [13] value_and_pushforward(::DifferentiationInterfaceTest.WritableClosure{:in, typeof(DifferentiationInterfaceTest.vec_to_mat!), Vector{Float64}, Matrix{Float64}}, ::Matrix{Float64}, ::DifferentiationInterfaceEnzymeExt.EnzymeTwoArgPushforwardPrep{Tuple{DifferentiationInterfaceTest.WritableClosure{:in, typeof(DifferentiationInterfaceTest.vec_to_mat!), Vector{Float64}, Matrix{Float64}}, Matrix{Float64}, AutoEnzyme{EnzymeCore.ForwardMode{false, EnzymeCore.FFIABI, false, false}, EnzymeCore.Duplicated}, Vector{Float64}, Tuple{Vector{Float64}}, Tuple{}}, DifferentiationInterfaceTest.WritableClosure{:in, typeof(DifferentiationInterfaceTest.vec_to_mat!), Vector{Float64}, Matrix{Float64}}, Tuple{}}, ::AutoEnzyme{EnzymeCore.ForwardMode{false, EnzymeCore.FFIABI, false, false}, EnzymeCore.Duplicated}, ::Vector{Float64}, ::Tuple{Vector{Float64}})
      @ DifferentiationInterfaceEnzymeExt ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterface/ext/DifferentiationInterfaceEnzymeExt/forward_twoarg.jl:43
   [14] value_and_pushforward(::DifferentiationInterfaceTest.WritableClosure{:in, typeof(DifferentiationInterfaceTest.vec_to_mat!), Vector{Float64}, Matrix{Float64}}, ::Matrix{Float64}, ::AutoEnzyme{EnzymeCore.ForwardMode{false, EnzymeCore.FFIABI, false, false}, EnzymeCore.Duplicated}, ::Vector{Float64}, ::Tuple{Vector{Float64}})
      @ DifferentiationInterface ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterface/src/fallbacks/no_prep.jl:203
   [15] test_correctness(ba::AutoEnzyme{EnzymeCore.ForwardMode{false, EnzymeCore.FFIABI, false, false}, EnzymeCore.Duplicated}, scen::Scenario{:pushforward, :out, :in, DifferentiationInterfaceTest.WritableClosure{:in, typeof(DifferentiationInterfaceTest.vec_to_mat!), Vector{Float64}, Matrix{Float64}}, Vector{Float64}, Matrix{Float64}, Tuple{Vector{Float64}}, Tuple{}, Tuple{Matrix{Float64}}, Nothing, Nothing}; isapprox::typeof(isapprox), atol::Int64, rtol::Float64, scenario_intact::Bool, sparsity::Bool)
      @ DifferentiationInterfaceTest ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/tests/correctness_eval.jl:708
   [16] macro expansion
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:158 [inlined]
   [17] macro expansion
      @ ~/.julia/juliaup/julia-1.11.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
   [18] macro expansion
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:158 [inlined]
   [19] macro expansion
      @ ~/.julia/juliaup/julia-1.11.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1793 [inlined]
   [20] macro expansion
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:131 [inlined]
   [21] macro expansion
      @ ~/.julia/juliaup/julia-1.11.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1793 [inlined]
   [22] macro expansion
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:129 [inlined]
   [23] macro expansion
      @ ~/.julia/juliaup/julia-1.11.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1793 [inlined]
   [24] macro expansion
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:126 [inlined]
   [25] macro expansion
      @ ~/.julia/juliaup/julia-1.11.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Test/src/Test.jl:1704 [inlined]
   [26] test_differentiation(backends::Vector{AutoEnzyme{EnzymeCore.ForwardMode{false, EnzymeCore.FFIABI, false, false}, EnzymeCore.Duplicated}}, scenarios::Vector{Scenario}; testset_name::Nothing, correctness::Bool, type_stability::Symbol, allocations::Symbol, benchmark::Symbol, excluded::Vector{Symbol}, detailed::Bool, logging::Bool, isapprox::typeof(isapprox), atol::Int64, rtol::Float64, scenario_intact::Bool, sparsity::Bool, ignored_modules::Nothing, function_filter::DifferentiationInterfaceTest.var"#637#644", skip_allocations::Bool, count_calls::Bool, benchmark_test::Bool, benchmark_seconds::Int64, benchmark_aggregation::typeof(minimum), adaptive_batchsize::Bool)
      @ DifferentiationInterfaceTest ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:126
   [27] test_differentiation
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:92 [inlined]
   [28] #test_differentiation#646
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterfaceTest/src/test_differentiation.jl:219 [inlined]
   [29] top-level scope
      @ ~/Documents/GitHub/Julia/DifferentiationInterface.jl/DifferentiationInterface/test/Back/Enzyme/playground.jl:6
   [30] eval
      @ ./boot.jl:430 [inlined]
   [31] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
      @ Base ./loading.jl:2734
   [32] invokelatest(::Any, ::Any, ::Vararg{Any}; kwargs::@Kwargs{})
      @ Base ./essentials.jl:1055
   [33] invokelatest(::Any, ::Any, ::Vararg{Any})
      @ Base ./essentials.jl:1052
   [34] inlineeval(m::Module, code::String, code_line::Int64, code_column::Int64, file::String; softscope::Bool)
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/eval.jl:271
   [35] (::VSCodeServer.var"#69#74"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/eval.jl:181
   [36] withpath(f::VSCodeServer.var"#69#74"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/repl.jl:276
   [37] (::VSCodeServer.var"#68#73"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/eval.jl:179
   [38] hideprompt(f::VSCodeServer.var"#68#73"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/repl.jl:38
   [39] #67
      @ ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/eval.jl:150 [inlined]
   [40] with_logstate(f::VSCodeServer.var"#67#72"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, logstate::Base.CoreLogging.LogState)
      @ Base.CoreLogging ./logging/logging.jl:522
   [41] with_logger
      @ ./logging/logging.jl:632 [inlined]
   [42] (::VSCodeServer.var"#66#71"{VSCodeServer.ReplRunCodeRequestParams})()
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/eval.jl:263
   [43] #invokelatest#2
      @ ./essentials.jl:1055 [inlined]
   [44] invokelatest(::Any)
      @ Base ./essentials.jl:1052
   [45] (::VSCodeServer.var"#64#65")()
      @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.140.1/scripts/packages/VSCodeServer/src/eval.jl:34
Test Summary:                                                                                                                  | Error  Total  Time
Testing correctness                                                                                                            |     1      1  0.3s
  AutoEnzyme(mode=EnzymeCore.ForwardMode{false, EnzymeCore.FFIABI, false, false}(), function_annotation=EnzymeCore.Duplicated) |     1      1  0.3s
    pushforward                                                                                                                |     1      1  0.3s
      Scenario{:pushforward,:out} WritableClosure(vec_to_mat!) : Vector{Float64} -> Matrix{Float64} (1 tangents)               |     1      1  0.3s
        Correctness                                                                                                            |     1      1  0.3s
ERROR: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.

Error with verbose compiler errors:
error.txt

@gdalle
Copy link
Copy Markdown
Member Author

gdalle commented May 6, 2025

This PR is still wrong for duplicated functions or contexts with mutable constants inside. Those will see their shadows being updated, which will influence the final result by the second derivative run.
The tests don't catch it yet

@gdalle gdalle marked this pull request as ready for review May 7, 2025 09:13
@gdalle gdalle merged commit bb50d0b into main May 7, 2025
72 checks passed
@gdalle gdalle deleted the gd/enzyme_cache branch May 7, 2025 10:47
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.

Enzyme slower than FiniteDiff with Cache

1 participant