This value rolled over after exiting from the loop

while(count-- > 0) means that after the exit of the loop, count rolled
over. I refactored by moving the definition of count inside and then
making it signed, so LLVM's sanitizer wouldn't complain