codegen: generalize arith_op to many arguments