Hardware-accelerated reverse-mode automatic differentiation library with N-rank tensor support and various optimizers in freestanding C99