Advertisement
Mr-A

random

Aug 25th, 2014
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.99 KB | None | 0 0
  1. //I didn't do anything about the pushes or pops.
  2. //I assumed those were optimizations by the compiler to reuse registers
  3.  
  4. uint32_t
  5. func_417170_random( range /*ESI*/ )
  6. {
  7.     uint32_t _450C34=0;
  8.     uint32_t _450BBC=0;
  9.  
  10.     //some code I didn't understand:
  11.     /*
  12.     TEST ESI,ESI
  13.     JG 0xoof1717D //it always jumps here ?_?
  14.     XOR EAX, EAX
  15.     POP ESI
  16.     return
  17.     */
  18.  
  19.     uint64_t somevar=_450C34;  //EAX
  20.     somevar++;
  21.     uint32_t somevar_0_o=1234; //ECX
  22.     uint32_t remainder=somevar%somevar_0_o;  //EDX=EAX%ECX: IDIV ECX
  23.     somevar=_450C34;   //EAX
  24.     somevar++;
  25.  
  26.     uint32_t somevar2_0_o=3000; //EDI
  27.     somevar_0_o=remainder;  //MOV ECX, EDX
  28.     remainder=somevar%somevar2_0_o; //EDX=EAX%EDI: IDIV EDI
  29.  
  30.     _450C34=somevar_0_o;
  31.  
  32.     //MOVZX ?_?:
  33.     somevar=*(remainder+0x44FF90); //no idea what is going on here, might be the seed somehow
  34.     somevar+=somevar_0_o; //add remainder
  35.     _450BBC=remainder;
  36.  
  37.     remainder=somevar%range;
  38.     return remainder;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement