#include <stdio.h>

    
#define BEGIN switch (ctx->state) { \
                        case 0:
    
#define YIELD(val) do { \
                        ctx->state = __LINE__;   \
                        return val;         \
                        case __LINE__:        \
                        ;                   \
                        } while (0)
    
#define END }

typedef struct{
    int state;	
    int i;
}  Ctx;

int fibs(Ctx* ctx)
{
    int x;
    BEGIN;
        YIELD(++ctx->i);
        YIELD(++ctx->i);

    END;
    return 0;
} 

int main()
{
    int i=0;

    Ctx t0 = {0,1};
    Ctx t1 = {0,101};    
    while (i = fibs(&t0)) {
        printf("t0:%d\n", i);
        printf("t1:%d\n", fibs(&t1));
    } 

    return 0;
}