Jay Foad writes:
> This source code:
>
> $ cat rand.c
> #include
> uint32_t rand(uint32_t x) { return (uint64_t)x * 16807 % 0x7FFF; }
>
> compiles to this optimised x86 code:
>
> $ gcc -S -O3 -m32 -fomit-frame-pointer -o - rand.c
> ...
> rand:
> subl$28, %esp
> movl$16807
Hello!
> $ cat rand.c
> #include
> uint32_t rand(uint32_t x) { return (uint64_t)x * 16807 % 0x7FFF; }
>
> compiles to this optimised x86 code:
>
> $ gcc -S -O3 -m32 -fomit-frame-pointer -o - rand.c
> ...
> rand:
> subl$28, %esp
> movl$16807, %eax
> mull32(%esp)
>