>>107236288
#include <stdio.h>
enum tranny_acking_status {
INIT,
IN_PROGRESS,
NOT_YET,
ALMOST,
YOU_MAY_ACK_NOW,
CLEANUP
};
struct tranny_acking_context {
enum tranny_acking_status where;
int times_called;
};
int eventually_ack_all_trannies(struct tranny_acking_context* const ctx) {
static void *jump[] = {
[INIT] = &&init,
[IN_PROGRESS] = &&in_progress,
[NOT_YET] = &¬_yet,
[ALMOST] = &&almost,
[YOU_MAY_ACK_NOW] = &&you_may_ack_now,
[CLEANUP] = &&cleanup
};
goto *jump[ctx->where];
init:
ctx->where = IN_PROGRESS;
ctx->times_called = 1;
return 0;
in_progress:
puts("Starting to kill trannies...");
ctx->where = NOT_YET;
ctx->times_called++;
return 0;
not_yet:
puts("No, Timmy, trannies are not yet dead...");
ctx->where = ALMOST;
ctx->times_called++;
return 0;
almost:
puts("Yes, Timmy, we're almost done...");
ctx->where = YOU_MAY_ACK_NOW;
ctx->times_called++;
return 0;
you_may_ack_now:
puts("Okay tranny, you have an option to kill yourself or we will kill you.");
ctx->where = CLEANUP;
ctx->times_called++;
return 0;
cleanup:
puts("But Chud, you cannot do that, it's not safe for our democr-AAAAAAAAAACCCCCK!");
ctx->times_called++;
return 1;
}
int main() {
struct tranny_acking_context ctx = { .where = INIT };
while (!eventually_ack_all_trannies(&ctx));
printf("Calls needed to ack all trannies: %d\n", ctx.times_called);
}
There you go, no inline assembly used.