// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/deps/lua/src/lmathlib.c
// Function: math_random
static int math_random (lua_State *L) {
  /* the `%' avoids the (rare) case of r==1, and is needed also because on
     some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */
  lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX;
  switch (lua_gettop(L)) {  /* check number of arguments */
    case 0: {  /* no arguments */
      lua_pushnumber(L, r);  /* Number between 0 and 1 */
      break;
    }
    case 1: {  /* only upper limit */
      int u = luaL_checkint(L, 1);
      luaL_argcheck(L, 1<=u, 1, "interval is empty");
      lua_pushnumber(L, floor(r*u)+1);  /* int between 1 and `u' */
      break;
    }
    case 2: {  /* lower and upper limits */
      int l = luaL_checkint(L, 1);
      int u = luaL_checkint(L, 2);
      luaL_argcheck(L, l<=u, 2, "interval is empty");
      lua_pushnumber(L, floor(r*(u-l+1))+l);  /* int between `l' and `u' */
      break;
    }
    default: return luaL_error(L, "wrong number of arguments");
  }
  return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
callq 0x5560
movslq %eax, %rdx
movq %rdx, %rcx
shlq $0x1e, %rcx
addq %rcx, %rdx
movq %rdx, %rcx
shrq $0x3f, %rcx
sarq $0x3d, %rdx
addl %ecx, %edx
movl %edx, %ecx
shll $0x1f, %ecx
addl %edx, %ecx
addl %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd 0x7e70(%rip), %xmm1     # 0x2c9c0
divsd %xmm1, %xmm0
movsd %xmm0, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6a80
movl %eax, %ecx
movl %ecx, -0x28(%rbp)
testl %eax, %eax
je 0x24b88
jmp 0x24b6d
movl -0x28(%rbp), %eax
subl $0x1, %eax
je 0x24b9b
jmp 0x24b77
movl -0x28(%rbp), %eax
subl $0x2, %eax
je 0x24c11
jmp 0x24c98
movq -0x10(%rbp), %rdi
movsd -0x18(%rbp), %xmm0
callq 0x7830
jmp 0x24caf
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x1af30
movl %eax, -0x1c(%rbp)
movb $0x1, %al
movl $0x1, %ecx
cmpl -0x1c(%rbp), %ecx
movb %al, -0x29(%rbp)
jle 0x24bd9
movq -0x10(%rbp), %rdi
movl $0x1, %esi
leaq 0x7e97(%rip), %rdx      # 0x2ca62
callq 0x1a7b0
cmpl $0x0, %eax
setne %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movsd -0x18(%rbp), %xmm0
cvtsi2sdl -0x1c(%rbp), %xmm1
mulsd %xmm1, %xmm0
callq 0x5480
movq -0x38(%rbp), %rdi
movsd 0x6dcd(%rip), %xmm1     # 0x2b9d0
addsd %xmm1, %xmm0
callq 0x7830
jmp 0x24caf
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x1af30
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x1af30
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %ecx
movb $0x1, %al
cmpl -0x24(%rbp), %ecx
movb %al, -0x39(%rbp)
jle 0x24c5e
movq -0x10(%rbp), %rdi
movl $0x2, %esi
leaq 0x7e12(%rip), %rdx      # 0x2ca62
callq 0x1a7b0
cmpl $0x0, %eax
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movsd -0x18(%rbp), %xmm0
movl -0x24(%rbp), %eax
subl -0x20(%rbp), %eax
addl $0x1, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
callq 0x5480
movq -0x48(%rbp), %rdi
cvtsi2sdl -0x20(%rbp), %xmm1
addsd %xmm1, %xmm0
callq 0x7830
jmp 0x24caf
movq -0x10(%rbp), %rdi
leaq 0x7dd1(%rip), %rsi      # 0x2ca74
movb $0x0, %al
callq 0x1a8b0
movl %eax, -0x4(%rbp)
jmp 0x24cb6
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop