julia> A = Tensor(Dense(SparseList(Element(0.0))), [0 0 3.3; 1.1 0 0; 2.2 0 4.4; 0 0 5.5])
Dense [:,1:3]
├─ [:, 1]: SparseList (0.0) [1:4]
│  ├─ [2]: 1.1
│  └─ [3]: 2.2
├─ [:, 2]: SparseList (0.0) [1:4]
└─ [:, 3]: SparseList (0.0) [1:4]
   ├─ [1]: 3.3
   ├─ [3]: 4.4
   └─ [4]: 5.5

julia> B = Tensor(SparseDict(SparseDict(Element(0.0))))
Sparse (0.0) [:,1:0]

julia> @finch_code mode = :fast begin
        B .= 0
        for j = _
            for i = _
                B[j, i] = A[i, j]
            end
        end
    end
quote
    B_lvl = ((ex.bodies[1]).bodies[1]).tns.bind.lvl
    B_lvl_tbl = B_lvl.tbl
    B_lvl_2 = B_lvl.lvl
    B_lvl_tbl_2 = B_lvl_2.tbl
    B_lvl_3 = B_lvl_2.lvl
    B_lvl_2_val = B_lvl_2.lvl.val
    A_lvl = ((ex.bodies[1]).bodies[2]).body.body.rhs.tns.bind.lvl
    A_lvl_2 = A_lvl.lvl
    A_lvl_ptr = A_lvl_2.ptr
    A_lvl_idx = A_lvl_2.idx
    A_lvl_2_val = A_lvl_2.lvl.val
    result = nothing
    qos = Finch.declare_table!(B_lvl_tbl, 1)
    B_lvl_qos_stop = 0
    Finch.declare_table!(B_lvl_tbl_2, qos)
    B_lvl_qos_stop_2 = 0
    assemble_table!(B_lvl_tbl, 1, 1)
    for j_4 = 1:A_lvl.shape
        A_lvl_q = (1 - 1) * A_lvl.shape + j_4
        B_lvl_subtbl = table_register(B_lvl_tbl, 1)
        A_lvl_2_q = A_lvl_ptr[A_lvl_q]
        A_lvl_2_q_stop = A_lvl_ptr[A_lvl_q + 1]
        if A_lvl_2_q < A_lvl_2_q_stop
            A_lvl_2_i1 = A_lvl_idx[A_lvl_2_q_stop - 1]
        else
            A_lvl_2_i1 = 0
        end
        phase_stop = min(A_lvl_2_i1, A_lvl_2.shape)
        if phase_stop >= 1
            if A_lvl_idx[A_lvl_2_q] < 1
                A_lvl_2_q = Finch.scansearch(A_lvl_idx, 1, A_lvl_2_q, A_lvl_2_q_stop - 1)
            end
            while true
                A_lvl_2_i = A_lvl_idx[A_lvl_2_q]
                if A_lvl_2_i < phase_stop
                    A_lvl_3_val = A_lvl_2_val[A_lvl_2_q]
                    B_lvl_qos = subtable_register(B_lvl_tbl, B_lvl_subtbl, A_lvl_2_i)
                    if B_lvl_qos > B_lvl_qos_stop
                        B_lvl_qos_stop = max(B_lvl_qos_stop << 1, 1)
                        assemble_table!(B_lvl_tbl_2, B_lvl_qos, B_lvl_qos_stop)
                    end
                    B_lvl_2_subtbl = table_register(B_lvl_tbl_2, B_lvl_qos)
                    B_lvl_2_qos = subtable_register(B_lvl_tbl_2, B_lvl_2_subtbl, j_4)
                    if B_lvl_2_qos > B_lvl_qos_stop_2
                        B_lvl_qos_stop_2 = max(B_lvl_qos_stop_2 << 1, 1)
                        Finch.resize_if_smaller!(B_lvl_2_val, B_lvl_qos_stop_2)
                        Finch.fill_range!(B_lvl_2_val, 0.0, B_lvl_2_qos, B_lvl_qos_stop_2)
                    end
                    B_lvl_2_val[B_lvl_2_qos] = A_lvl_3_val
                    A_lvl_2_q += 1
                else
                    phase_stop_3 = min(A_lvl_2_i, phase_stop)
                    if A_lvl_2_i == phase_stop_3
                        A_lvl_3_val = A_lvl_2_val[A_lvl_2_q]
                        B_lvl_qos = subtable_register(B_lvl_tbl, B_lvl_subtbl, phase_stop_3)
                        if B_lvl_qos > B_lvl_qos_stop
                            B_lvl_qos_stop = max(B_lvl_qos_stop << 1, 1)
                            assemble_table!(B_lvl_tbl_2, B_lvl_qos, B_lvl_qos_stop)
                        end
                        B_lvl_2_subtbl_2 = table_register(B_lvl_tbl_2, B_lvl_qos)
                        B_lvl_2_qos_2 = subtable_register(B_lvl_tbl_2, B_lvl_2_subtbl_2, j_4)
                        if B_lvl_2_qos_2 > B_lvl_qos_stop_2
                            B_lvl_qos_stop_2 = max(B_lvl_qos_stop_2 << 1, 1)
                            Finch.resize_if_smaller!(B_lvl_2_val, B_lvl_qos_stop_2)
                            Finch.fill_range!(B_lvl_2_val, 0.0, B_lvl_2_qos_2, B_lvl_qos_stop_2)
                        end
                        B_lvl_2_val[B_lvl_2_qos_2] = A_lvl_3_val
                        A_lvl_2_q += 1
                    end
                    break
                end
            end
        end
    end
    qos_stop = Finch.freeze_table!(B_lvl_tbl, 1)
    qos_stop_2 = Finch.freeze_table!(B_lvl_tbl_2, qos_stop)
    resize!(B_lvl_2_val, qos_stop_2)
    result = (B = Tensor((SparseLevel){Int32}((SparseLevel){Int32}(B_lvl_3, A_lvl.shape, B_lvl_tbl_2), A_lvl_2.shape, B_lvl_tbl)),)
    result
end
julia> @finch mode = :fast begin
        B .= 0
        for j = _
            for i = _
                B[j, i] = A[i, j]
            end
        end
    end
(B = Tensor(Sparse{Int32}(Sparse{Int32}(Element{0.0, Float64, Int32}([1.1, 2.2, 3.3, 4.4, 5.5]), 3, Finch.DictTable{Int32, Int32, Vector{Int32}, Vector{Int32}, Vector{Int32}, Dict{Tuple{Int32, Int32}, Int32}}([1, 2, 4, 5, 6], [1, 1, 3, 3, 3], [1, 2, 4, 3, 5], Dict((2, 1) => 2, (2, 3) => 4, (1, 1) => 1, (3, 3) => 3, (4, 3) => 5))), 4, Finch.DictTable{Int32, Int32, Vector{Int32}, Vector{Int32}, Vector{Int32}, Dict{Tuple{Int32, Int32}, Int32}}([1, 5], [1, 2, 3, 4], [3, 1, 2, 4], Dict((1, 2) => 1, (1, 4) => 4, (1, 3) => 2, (1, 1) => 3)))),)

