(bind-func stbi_flip_vertically
(lambda (width:i32 height:i32 ncomp:i32 data:i8*)
(let ((stride (* ncomp width))
(tmp 0))
(doloop (i (/ height 2))
(doloop (j stride)
(set! tmp (pref data (+ (* i stride) j)))
(pset! data (+ (* i stride) j) (pref data (+ (* (- height i 1) stride) j)))
(pset! data (+ (* (- height i 1) stride) j) tmp))))))