Not that similar. The Brazilian study was chloroquine, not hydroxychloroquine and chloroquine is generally known to be more toxic than hydroxychloroquine, plus that dosing was 30% greater than the HCQ dosing in Recovery (12 g total in Brazilian study vs. 9.2 g total in the Recovery trial, not the 9.6 g you posted: it's 2 g the first 24 hours, then 0.8 g/day for 9 days).
Also, the Chinese trial I cited above, which was a randomized, controlled (but not blinded) trial with hospitalized patients (not too many RC trials with HCQ) used a loading dose of 1.2 g/day for 3 days (3.6 g), followed by 0.8 g/day for 14-21 days (11.2 g - 16.8 g) for a total dose of 14.8 - 20.4 g, which is way more HCQ than the 9.2 g the Recovery trial used. This was the trial that was terminated early due to lack of patients to enroll, as China had controlled their outbreak.
If cumulative dose were truly killing patients we would've seen it in this HCQ trial, but we didn't, plus lupus/RA patients receive about a kilo of HCQ per year, so it seems pretty clear the 4 g lethal dose you cited would refer to an acute dose, not a cumulative chronic dose. Furthermore, the attached study on "Extreme HCQ Toxicity" says, "Unlike a CQ overdose, there is no established lethal or toxic dose of HCQ" and goes on to discuss the case of a woman who tried to commit suicide by ingesting 40 g of HCQ and survived (one can find several examples of suicide attempts on HCQ that were unsuccessful at greater than 4 g).
https://www.hindawi.com/journals/criem/2015/692948/
And while they didn't compare ultimate death rates, they did monitor for adverse events and HCQ had significantly more of those but most were gastrointestinal and there were no reported findings of cardiac arrhythmia, (prolonged QT interval), possibly because azithroymcin wasn't co-administered, as in the Recovery trial. The main point is that a well run randomized/controlled trial was conducted with similar HCQ dosing per day and greater overall dosing without patients dying from the HCQ. So there was certainly precedent for safely using the doses used in the Recovery trial. I am now even less concerned that the Recovery trial was problematic in any way.