$line =~ s{\b sha512_hash \( ([^,]+) (,\s*) ([^,]+) (,\s*) ([^)]+) \)}
{sha512_process_bytes($3$2$5$2$1)}gx;
$line =~ s/\bsha512_done\b/sha512_finish_ctx/g;
$line =~ s{\b sha512_hash \( ([^,]+) (,\s*) ([^,]+) (,\s*) ([^)]+) \)}
{sha512_process_bytes($3$2$5$2$1)}gx;
$line =~ s/\bsha512_done\b/sha512_finish_ctx/g;