--- Raw source ---
(n)
{
  return Math.floor(Math.random() * n);
}


--- Optimized code ---
optimization_id = 0
source_position = 27528
kind = OPTIMIZED_FUNCTION
name = rnd
stack_slots = 2
compiler = crankshaft
Instructions (size = 612)
0x2020e060     0  55             push ebp
0x2020e061     1  89e5           mov ebp,esp
0x2020e063     3  56             push esi
0x2020e064     4  57             push edi
0x2020e065     5  83ec08         sub esp,0x8
0x2020e068     8  50             push eax
0x2020e069     9  c7c002000000   mov eax,0x2
0x2020e06f    15  c70484efdeefbe mov [esp+eax*4],0xbeefdeef
0x2020e076    22  48             dec eax
0x2020e077    23  75f6           jnz 15  (0x2020e06f)
0x2020e079    25  58             pop eax
0x2020e07a    26  c745f400000000 mov [ebp-0xc],0x0
0x2020e081    33  8b45fc         mov eax,[ebp-0x4]
0x2020e084    36  8945f0         mov [ebp-0x10],eax
0x2020e087    39  89c6           mov esi,eax
0x2020e089    41  3b25241aa009   cmp esp,[0x9a01a24]         ;; external reference (StackGuard::address_of_jslimit())
0x2020e08f    47  7305           jnc 54  (0x2020e096)
0x2020e091    49  e8ea15321b     call StackCheck  (0x3b52f680)    ;; code: BUILTIN
0x2020e096    54  b805cfb729     mov eax,0x29b7cf05          ;; debug: position 27559
                                                             ;; object: 0x29b7cf05 <FixedArray[15]>
0x2020e09b    59  8b4037         mov eax,[eax+0x37]          ;; debug: position 1912
0x2020e09e    62  b925bfb829     mov ecx,0x29b8bf25          ;; object: 0x29b8bf25 PropertyCell for 0x2b012d29 <an Uint32Array with map 0x5cb0af41> (data, dictionary_index: 63, attrs: [_E_])
0x2020e0a3    67  8b4907         mov ecx,[ecx+0x7]
0x2020e0a6    70  f6c101         test_b cl,0x1
0x2020e0a9    73  0f84cb010000   jz 538  (0x2020e27a)
0x2020e0af    79  8179ff41afb05c cmp [ecx-0x1],0x5cb0af41    ;; object: 0x5cb0af41 <Map(UINT32_ELEMENTS)>
0x2020e0b6    86  0f85c3010000   jnz 543  (0x2020e27f)
0x2020e0bc    92  8b5107         mov edx,[ecx+0x7]
0x2020e0bf    95  8b5a03         mov ebx,[edx+0x3]
0x2020e0c2    98  8b490b         mov ecx,[ecx+0xb]
0x2020e0c5   101  f6411308       test_b [ecx+0x13],0x8
0x2020e0c9   105  0f85b5010000   jnz 548  (0x2020e284)
0x2020e0cf   111  8b4a0b         mov ecx,[edx+0xb]
0x2020e0d2   114  8b5207         mov edx,[edx+0x7]
0x2020e0d5   117  03ca           add ecx,edx
0x2020e0d7   119  83fb00         cmp ebx,0x0
0x2020e0da   122  0f86a9010000   jna 553  (0x2020e289)
0x2020e0e0   128  83fb02         cmp ebx,0x2                 ;; debug: position 1992
0x2020e0e3   131  0f86a5010000   jna 558  (0x2020e28e)
0x2020e0e9   137  8b11           mov edx,[ecx]               ;; debug: position 1912
0x2020e0eb   139  89d3           mov ebx,edx
0x2020e0ed   141  81e3ffff0000   and ebx,0xffff              ;; debug: position 1938
0x2020e0f3   147  3de9cfb729     cmp eax,0x29b7cfe9          ;; object: 0x29b7cfe9 <JS Function imul (SharedFunctionInfo 0x29b401c9)>
0x2020e0f8   152  0f8595010000   jnz 563  (0x2020e293)
0x2020e0fe   158  69db6e460000   imul ebx,ebx,18030
0x2020e104   164  c1ea10         shr edx,16                  ;; debug: position 1959
0x2020e107   167  03d3           add edx,ebx                 ;; debug: position 1946
0x2020e109   169  8911           mov [ecx],edx               ;; debug: position 1966
0x2020e10b   171  8b4104         mov eax,[ecx+0x4]           ;; debug: position 1992
0x2020e10e   174  89c3           mov ebx,eax
0x2020e110   176  81e3ffff0000   and ebx,0xffff              ;; debug: position 2018
0x2020e116   182  69db69900000   imul ebx,ebx,36969
0x2020e11c   188  c1e810         shr eax,16                  ;; debug: position 2039
0x2020e11f   191  03c3           add eax,ebx                 ;; debug: position 2026
0x2020e121   193  894104         mov [ecx+0x4],eax           ;; debug: position 2046
0x2020e124   196  c1e210         shl edx,16                  ;; debug: position 2074
0x2020e127   199  25ffff0000     and eax,0xffff              ;; debug: position 2082
0x2020e12c   204  03c2           add eax,edx                 ;; debug: position 2079
0x2020e12e   206  83f800         cmp eax,0x0                 ;; debug: position 2103
0x2020e131   209  0f8c0f000000   jl 230  (0x2020e146)
0x2020e137   215  0f57c9         xorps xmm1,xmm1             ;; debug: position 2108
0x2020e13a   218  f20f2ac8       cvtsi2sd xmm1,eax
0x2020e13e   222  0f28d1         movaps xmm2,xmm1
0x2020e141   225  e919000000     jmp 255  (0x2020e15f)
0x2020e146   230  b90000f041     mov ecx,0x41f00000          ;; debug: position 2103
0x2020e14b   235  660f6ec9       movd xmm1,ecx
0x2020e14f   239  660f73f120     psllq xmm1,32
0x2020e154   244  0f57d2         xorps xmm2,xmm2             ;; debug: position 2108
0x2020e157   247  f20f2ad0       cvtsi2sd xmm2,eax
0x2020e15b   251  f20f58d1       addsd xmm2,xmm1
0x2020e15f   255  b80000f03d     mov eax,0x3df00000
0x2020e164   260  660f6ec8       movd xmm1,eax
0x2020e168   264  660f73f120     psllq xmm1,32
0x2020e16d   269  f20f59d1       mulsd xmm2,xmm1             ;; debug: position 2124
0x2020e171   273  8b4508         mov eax,[ebp+0x8]           ;; debug: position 27568
0x2020e174   276  a801           test al,0x1
0x2020e176   278  7421           jz 313  (0x2020e199)
0x2020e178   280  8178ff0d82b05c cmp [eax-0x1],0x5cb0820d    ;; object: 0x5cb0820d <Map(FAST_HOLEY_ELEMENTS)>
0x2020e17f   287  7507           jnz 296  (0x2020e188)
0x2020e181   289  f20f104803     movsd xmm1,[eax+0x3]
0x2020e186   294  eb1c           jmp 324  (0x2020e1a4)
0x2020e188   296  3dc980b029     cmp eax,0x29b080c9          ;; object: 0x29b080c9 <undefined>
0x2020e18d   301  0f8505010000   jnz 568  (0x2020e298)
0x2020e193   307  660f76c9       pcmpeqd xmm1,xmm1
0x2020e197   311  eb0b           jmp 324  (0x2020e1a4)
0x2020e199   313  89c1           mov ecx,eax
0x2020e19b   315  d1f9           sar ecx,1
0x2020e19d   317  0f57c9         xorps xmm1,xmm1
0x2020e1a0   320  f20f2ac9       cvtsi2sd xmm1,ecx
0x2020e1a4   324  f20f59ca       mulsd xmm1,xmm2
0x2020e1a8   328  0f57c0         xorps xmm0,xmm0
0x2020e1ab   331  660f2ec8       ucomisd xmm1,xmm0
0x2020e1af   335  0f8ae8000000   jpe 573  (0x2020e29d)
0x2020e1b5   341  7222           jc 377  (0x2020e1d9)
0x2020e1b7   343  7711           ja 362  (0x2020e1ca)
0x2020e1b9   345  660f50c9       movmskpd ecx,xmm1
0x2020e1bd   349  f6c101         test_b cl,0x1
0x2020e1c0   352  0f85d7000000   jnz 573  (0x2020e29d)
0x2020e1c6   358  33c9           xor ecx,ecx
0x2020e1c8   360  eb29           jmp 403  (0x2020e1f3)
0x2020e1ca   362  f20f2cc9       cvttsd2si ecx,xmm1
0x2020e1ce   366  83f901         cmp ecx,0x1
0x2020e1d1   369  0f80c6000000   jo 573  (0x2020e29d)
0x2020e1d7   375  eb1a           jmp 403  (0x2020e1f3)
0x2020e1d9   377  f20f2cc9       cvttsd2si ecx,xmm1
0x2020e1dd   381  0f57c0         xorps xmm0,xmm0
0x2020e1e0   384  f20f2ac1       cvtsi2sd xmm0,ecx
0x2020e1e4   388  660f2ec8       ucomisd xmm1,xmm0
0x2020e1e8   392  7409           jz 403  (0x2020e1f3)
0x2020e1ea   394  83e901         sub ecx,0x1
0x2020e1ed   397  0f80aa000000   jo 573  (0x2020e29d)
0x2020e1f3   403  03c9           add ecx,ecx
0x2020e1f5   405  0f8008000000   jo 419  (0x2020e203)
0x2020e1fb   411  89c8           mov eax,ecx
0x2020e1fd   413  89ec           mov esp,ebp
0x2020e1ff   415  5d             pop ebp
0x2020e200   416  c20800         ret 0x8
0x2020e203   419  d1f9           sar ecx,1
0x2020e205   421  81f100000080   xor ecx,0x80000000
0x2020e20b   427  0f57c0         xorps xmm0,xmm0
0x2020e20e   430  f20f2ac1       cvtsi2sd xmm0,ecx
0x2020e212   434  8b0dc411a009   mov ecx,[0x9a011c4]         ;; external reference (Heap::NewSpaceAllocationTopAddress())
0x2020e218   440  89c8           mov eax,ecx
0x2020e21a   442  83c00c         add eax,0xc
0x2020e21d   445  0f8239000000   jc 508  (0x2020e25c)
0x2020e223   451  3b05c811a009   cmp eax,[0x9a011c8]         ;; external reference (Heap::NewSpaceAllocationLimitAddress())
0x2020e229   457  0f872d000000   ja 508  (0x2020e25c)
0x2020e22f   463  a803           test al,0x3
0x2020e231   465  0f8415000000   jz 492  (0x2020e24c)
0x2020e237   471  6850010000     push 0x150
0x2020e23c   476  b801000000     mov eax,0x1
0x2020e241   481  bbe0b55108     mov ebx,0x851b5e0           ;; external reference (Runtime::Abort)
0x2020e246   486  e8f5c12f1b     call 0x3b50a440             ;; code: STUB, CEntryStub, minor: 0
0x2020e24b   491  cc             int3
0x2020e24c   492  8905c411a009   mov [0x9a011c4],eax         ;; external reference (Heap::NewSpaceAllocationTopAddress())
0x2020e252   498  41             inc ecx
0x2020e253   499  c741ff0d82b05c mov [ecx-0x1],0x5cb0820d    ;; object: 0x5cb0820d <Map(FAST_HOLEY_ELEMENTS)>
0x2020e25a   506  eb17           jmp 531  (0x2020e273)
0x2020e25c   508  33c9           xor ecx,ecx
0x2020e25e   510  60             pushad
0x2020e25f   511  8b75fc         mov esi,[ebp-0x4]
0x2020e262   514  33c0           xor eax,eax
0x2020e264   516  bb00da3408     mov ebx,0x834da00           ;; external reference (Runtime::AllocateHeapNumber)
0x2020e269   521  e852bf2f1b     call 0x3b50a1c0             ;; code: STUB, CEntryStub, minor: 1
0x2020e26e   526  89442418       mov [esp+0x18],eax
0x2020e272   530  61             popad
0x2020e273   531  f20f114103     movsd [ecx+0x3],xmm0
0x2020e278   536  eb81           jmp 411  (0x2020e1fb)
0x2020e27a   538  e895bd1f14     call 0x3440a014             ;; deoptimization bailout 2
0x2020e27f   543  e89abd1f14     call 0x3440a01e             ;; deoptimization bailout 3
0x2020e284   548  e89fbd1f14     call 0x3440a028             ;; deoptimization bailout 4
0x2020e289   553  e8a4bd1f14     call 0x3440a032             ;; deoptimization bailout 5
0x2020e28e   558  e8a9bd1f14     call 0x3440a03c             ;; deoptimization bailout 6
0x2020e293   563  e8aebd1f14     call 0x3440a046             ;; deoptimization bailout 7
0x2020e298   568  e8b3bd1f14     call 0x3440a050             ;; deoptimization bailout 8
0x2020e29d   573  e8b8bd1f14     call 0x3440a05a             ;; deoptimization bailout 9
0x2020e2a2   578  90             nop
0x2020e2a3   579  90             nop
0x2020e2a4   580  90             nop
0x2020e2a5   581  90             nop
0x2020e2a6   582  90             nop
0x2020e2a7   583  90             nop

Inlined functions (count = 1)
 0x29b3ffc5 <SharedFunctionInfo random>

Deoptimization Input Data (deopt points = 10)
 index  ast id    argc     pc
     0       1       0     33
     1       3       0     54
     2       2       0     -1
     3       2       0     -1
     4       2       0     -1
     5       2       0     -1
     6       2       0     -1
     7       2       0     -1
     8      22       0     -1
     9      18       0     -1

Safepoints (size = 28)
0x2020e096    54  10 (sp -> fp)       1
0x2020e26e   526  00 | ecx (sp -> fp)  <none>

RelocInfo (size = 104)
0x2020e08b  external reference (StackGuard::address_of_jslimit())  (0x9a01a24)
0x2020e092  code target (BUILTIN)  (0x3b52f680)
0x2020e096  position  (27559)
0x2020e097  embedded object  (0x29b7cf05 <FixedArray[15]>)
0x2020e09b  position  (1912)
0x2020e09f  embedded object  (0x29b8bf25 PropertyCell for 0x2b012d29 <an Uint32Array with map 0x5cb0af41> (data, dictionary_index: 63, attrs: [_E_]))
0x2020e0b2  embedded object  (0x5cb0af41 <Map(UINT32_ELEMENTS)>)
0x2020e0e0  position  (1992)
0x2020e0e9  position  (1912)
0x2020e0ed  position  (1938)
0x2020e0f4  embedded object  (0x29b7cfe9 <JS Function imul (SharedFunctionInfo 0x29b401c9)>)
0x2020e104  position  (1959)
0x2020e107  position  (1946)
0x2020e109  position  (1966)
0x2020e10b  position  (1992)
0x2020e110  position  (2018)
0x2020e11c  position  (2039)
0x2020e11f  position  (2026)
0x2020e121  position  (2046)
0x2020e124  position  (2074)
0x2020e127  position  (2082)
0x2020e12c  position  (2079)
0x2020e12e  position  (2103)
0x2020e137  position  (2108)
0x2020e146  position  (2103)
0x2020e154  position  (2108)
0x2020e16d  position  (2124)
0x2020e171  position  (27568)
0x2020e17b  embedded object  (0x5cb0820d <Map(FAST_HOLEY_ELEMENTS)>)
0x2020e189  embedded object  (0x29b080c9 <undefined>)
0x2020e214  external reference (Heap::NewSpaceAllocationTopAddress())  (0x9a011c4)
0x2020e225  external reference (Heap::NewSpaceAllocationLimitAddress())  (0x9a011c8)
0x2020e242  external reference (Runtime::Abort)  (0x851b5e0)
0x2020e247  code target (STUB)  (0x3b50a440)
0x2020e24e  external reference (Heap::NewSpaceAllocationTopAddress())  (0x9a011c4)
0x2020e256  embedded object  (0x5cb0820d <Map(FAST_HOLEY_ELEMENTS)>)
0x2020e265  external reference (Runtime::AllocateHeapNumber)  (0x834da00)
0x2020e26a  code target (STUB)  (0x3b50a1c0)
0x2020e27b  runtime entry  (deoptimization bailout 2)
0x2020e280  runtime entry  (deoptimization bailout 3)
0x2020e285  runtime entry  (deoptimization bailout 4)
0x2020e28a  runtime entry  (deoptimization bailout 5)
0x2020e28f  runtime entry  (deoptimization bailout 6)
0x2020e294  runtime entry  (deoptimization bailout 7)
0x2020e299  runtime entry  (deoptimization bailout 8)
0x2020e29e  runtime entry  (deoptimization bailout 9)

--- End code ---