// bench_bc2.cvm — 大量算术/比较/分支,考验 VM 综合能力
let total = 0;
let t0 = clock_ms();
let i = 0;
while (i < 10000000) {
let a = i;
let b = i + 1;
let c = i * 3;
if (a < b) {
total = total + a;
} else {
total = total - a;
}
if (c % 7 == 0) {
total = total + c;
}
if (i % 2 == 0) {
total = total + 1;
} else {
total = total - 1;
}
i = i + 1;
}
let t1 = clock_ms();
println("total=" + str(total) + " time=" + str(t1 - t0) + "ms");