rotl
use constants below 32 though...
-- xoshiro128**
type PRNG = {state: (u32,u32,u32,u32)}
let rotl (x:u32) (k:u32) = x << k | x >> 32-k
let next (g:PRNG) : (u32, PRNG) =
let (a,b,c,d) = g.state
let res = (rotl (b * 5) 7) * 9
let t = b << 9
let c = c ^ a
let d = d ^ b
let b = b ^ c
let a = a ^ d
let c = c ^ t
let d = rotl d 11
in (res, {state = (a,b,c,d)})
while (loop_while_150581) {
int32_t defunc_0_f_res_150583 = add32(1, x_150582);
int32_t x_150584 = lshr32(defunc_2_reduce_res_150569,
defunc_0_f_res_150583);
bool defunc_0_p_res_150585 = x_150584 == 0;
bool loop_cond_150586 = !defunc_0_p_res_150585;
bool loop_while_tmp_162843 = loop_cond_150586;
int32_t x_tmp_162844 = defunc_0_f_res_150583;
loop_while_150581 = loop_while_tmp_162843;
x_150582 = x_tmp_162844;
}
This is the loop that fails
x>>32
, which is undefined behaviour (and just returns x
on x86).