def METHOD_NAME(data, out):
    """Low level IR to get invert_permutation.
    Parameters
    ----------
    data : Buffer
        Input data. 1-D Buffer with shape [elem_num].
    out : Buffer
        1D buffer for invert permutation result with the same shape with data.
    Returns
    -------
    stmt : Stmt
        The result IR statement.
    """
    elem_num = data.shape[0]
    irb = tvm.tir.ir_builder.create()
    data = irb.buffer_ptr(data)
    out = irb.buffer_ptr(out)
    max_threads = int(Target.current(allow_none=False).max_num_threads)
    nthread_tx = max_threads
    nthread_bx = elem_num // max_threads + 1
    thread_x = te.thread_axis("threadIdx.x")
    block_x = te.thread_axis("blockIdx.x")
    irb.scope_attr(thread_x, "thread_extent", nthread_tx)
    irb.scope_attr(block_x, "thread_extent", nthread_bx)
    tid = block_x * max_threads + thread_x
    with irb.if_scope(tid < elem_num):
        r_ind = data[tid]
        out[r_ind] = tid
    return irb.get()