Correctly cast int64_t to intmax_t