def kall():
    argcount = ~calldatasize() / 32
    if argcount == 1:
        return(~calldataload(1))

    args = array(argcount)
    ~calldatacopy(args, 1, argcount * 32)
    low = array(argcount)
    lsz = 0
    high = array(argcount)
    hsz = 0
    i = 1
    while i < argcount:
        if args[i] < args[0]:
            low[lsz] = args[i]
            lsz += 1
        else:
            high[hsz] = args[i]
            hsz += 1
        i += 1
    low = self.kall(data=low, datasz=lsz, outsz=lsz)
    high = self.kall(data=high, datasz=hsz, outsz=hsz)
    o = array(argcount)
    i = 0
    while i < lsz:
        o[i] = low[i]
        i += 1
    o[lsz] = args[0]
    j = 0
    while j < hsz:
        o[lsz + 1 + j] = high[j]
        j += 1
    return(o, argcount)
