What hamster_nz said.
Plus, there are other part s of code which might not do what you expect, if anything at all.
As a beginner in C, this is not surprising, but luckily many tools will help you detect and correct this kind of problems.
A good editor/IDE will automatically indent the code, in fact, it has (or you did) and the wrong position of the return statement is made clear by its indentation.
A good compiler, with the right options, will then warn you that the statement "cleanup_platform();" has no effect, as it will never be executed after the return.
Then there are the the if statement resetting the variables used for the loops: the condition in the the if will never be verified, so they are not needed.
Moving them outside the loop will cause the if to trigger, but with no practical effect (the variables are not used anywhere else, and are reset by the for statements).