<?php
declare(strict_types=1);
$original=$argv[1]??'';$candidate=$argv[2]??'';if(hash_file('sha256',$original)!=='fff65332f062328dc6a6378a5d575e8947065198a87bfa6f4ccfa23f6ef107ad'||hash_file('sha256',$candidate)!=='6eae0679fbb36a8dc76f5287e28257bc991e4db1993c4c638c1f55f8b4b9f0b1')throw new RuntimeException('Candidate exact source identity');$p=proc_open(['diff','-u','--label','a/app/terminal/service/analysis/Analysis.php','--label','b/app/terminal/service/analysis/Analysis.php',$original,$candidate],[0=>STDIN,1=>['pipe','w'],2=>STDERR],$pipes);$patch=stream_get_contents($pipes[1]);fclose($pipes[1]);if(proc_close($p)!==1||$patch==='')throw new RuntimeException('Exact candidate diff not produced');file_put_contents(__DIR__.'/AnalysisDecimalProjectionCandidate.patch',$patch);echo json_encode(['original_sha256'=>hash_file('sha256',$original),'candidate_sha256'=>hash_file('sha256',$candidate),'patch_sha256'=>hash('sha256',$patch)]),"\n";
