I still don't get it.
We don't go all the 40 million people the same place to vote, nor do we count the ballots one by one.
We open up nearly all schools, so every one of us is assigned the nearest from his home, just a few minutes walking. Inside each school, there are several ballot boxes, so in the end, there's no more than a few hundred ballots in each box, maybe a thousand at the most.
Counting that, is just a matter of minutes, and reporting the total count to a central administration is againt a matter of seconds by phone. Of course you then have to take all the ballots and you can recount them all many times you want, and a physical hand signed report from all the members at the school, but anyhow, it's just a matter of parallelizing properly.
Sure it's more difficult in a place like Brazil, but having a 90% count by the end of the day, seems really feasible to me. Maybe you can enlighten me if I made wrong suppositions, but I suspect there was something really bad done there in those days.