rewrite C code using ASM