replaced more asm code by less C code