Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on GodBolt: Enter C, get Assembly. Parent comment
if (num <= 0) { return 0; } int a = 0; int loop_n = (unsigned)(num - 1) / 5; for (int x = 0; x <= loop_n; x++) { a += x * 5 - 1; } return a;
From there you just have a summation, which has two components.
((loop_n + 1) * loop_n / 2) * 5 // 5x - loop_n - 1 // -1
There are no comments on this comment yet.
From there you just have a summation, which has two components.
The assembly between these the manual and automatic methods is slightly different, but the difference is fairly trivial and opaque.