(module main)

(fn base () -> u64
  4294967296u64)

(fn adjust ((value u64) (delta u64)) -> u64
  (+ value delta))

(fn doubled ((value u64)) -> u64
  (* value 2u64))

(fn local_total () -> u64
  (let offset u64 19u64)
  (adjust (/ (doubled (base)) 2u64) offset))

(fn high_enough ((value u64)) -> bool
  (if (> value 4294967300u64)
    (< value 4294967320u64)
    false))

(fn exact_u64 () -> bool
  (= (local_total) 4294967315u64))

(fn main () -> i32
  (std.io.print_u64 (local_total))
  (if (high_enough (local_total))
    0
    1))

(test "u64 arithmetic returns exact fixture value"
  (exact_u64))

(test "u64 comparison works in predicates"
  (high_enough (local_total)))

(test "u64 division and ordering"
  (if (>= (/ (local_total) 5u64) 858993463u64)
    (<= (/ (local_total) 5u64) 858993463u64)
    false))
