typedef unsigned char u8; u8 i0, i1, i2; u8 notes[] = { 0x84, 0x9d, 0xb0, 0x69, 0x9d, 0x84, 0x69, 0x58, 0x75, 0x8c, 0xb0, 0x69, 0x8c, 0x75, 0x69, 0x58 }; u8 g(u8 x, u8 t, u8 o){ u8 notes_ix = t & 0x7; if(3&i2) notes_ix += 8; u8 result = ((i1<<8|i0)*notes[notes_ix])>>o; result &= x; result &= 3; return result; } void main(void){ i0 = i1 = i2 = 0; for(;;) { u8 sample; u8 n = i2<<2 | i1>>6; u8 s = i2>>1; sample = g(1,n,12); { u8 tmp; tmp = i2<<3 | i1>>5; tmp ^= n; sample += g(s,tmp,10); } //tmp { u8 tmp1 = s/3; u8 tmp2; tmp2 = (i2<<5|i1>>3)%3; tmp2 += n; sample += g(tmp1,tmp2,10); } //tmp1, tmp2 { u8 tmp1 = s/5; u8 tmp2 = n; { u8 tmp3 = (i2<<6|i1>>2)%3; tmp2 -= tmp3; } // tmp3 tmp2 += 8; sample += g(tmp1,tmp2,9); } //tmp1, tmp2 putchar(sample<<4); i0++; i1 += !i0; i2 += !i1 && !i0; } }