user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<ran2>:
  endbr64
  mov    (%rdi),%edx
  mov    %rdi,%r9
  test   %edx,%edx
  jle    L77
  movslq D9(%rip),%rax
  lea    D50(%rip),%rdi
  mov    %rax,%rcx
  imul   $0x4f7a09cd,%rax,%rax
  mov    %ecx,%esi
  sar    $0x1f,%esi
  sar    $0x2e,%rax
  sub    %esi,%eax
  imul   $0xffff31da,%eax,%r8d
  imul   $0xfffff131,%eax,%eax
  add    %ecx,%r8d
  mov    D36(%rip),%ecx
  imul   $0x9ef4,%r8d,%r8d
  add    %eax,%r8d
L44:
  movslq %edx,%rax
  mov    %edx,%esi
  imul   $0x1389c755,%rax,%rax
  sar    $0x1f,%esi
  sar    $0x2c,%rax
  sub    %esi,%eax
  imul   $0xffff2e5c,%eax,%esi
  imul   $0xffffd04d,%eax,%eax
  add    %esi,%edx
  imul   $0x9c4e,%edx,%edx
  add    %eax,%edx
  jns    L80
  add    $0x7fffffab,%edx
L80:
  mov    %edx,(%r9)
  test   %r8d,%r8d
  jns    L33
  add    $0x7fffff07,%r8d
L33:
  movslq %ecx,%rax
  mov    %r8d,D76(%rip)
  imul   $0xffffffff80000041,%rax,%rax
  shr    $0x20,%rax
  add    %ecx,%eax
  sar    $0x1f,%ecx
  sar    $0x19,%eax
  sub    %ecx,%eax
  cltq
  mov    (%rdi,%rax,4),%ecx
  mov    %edx,(%rdi,%rax,4)
  sub    %r8d,%ecx
  mov    %ecx,D76(%rip)
  test   %ecx,%ecx
  jg     L82
  add    $0x7fffffaa,%ecx
  mov    %ecx,D76(%rip)
L82:
  pxor   %xmm0,%xmm0
  movsd  D76(%rip),%xmm1
  cvtsi2sd %ecx,%xmm0
  mulsd  D10(%rip),%xmm0
  minsd  %xmm0,%xmm1
  movapd %xmm1,%xmm0
  ret
  nopw   0x0(%rax,%rax,1)
L77:
  je     L67
  mov    %edx,%ecx
  mov    $0x9ef41399,%esi
  neg    %ecx
  mov    %ecx,%eax
  imul   %rsi,%rax
  shr    $0x2f,%rax
  imul   $0xffff31da,%eax,%r8d
  imul   $0xfffff131,%eax,%eax
  sub    %edx,%r8d
  mov    %ecx,%edx
  imul   $0x9ef4,%r8d,%r8d
  add    %eax,%r8d
L63:
  mov    $0x27,%esi
  lea    D50(%rip),%rdi
  nopl   0x0(%rax)
L45:
  movslq %edx,%rax
  mov    %edx,%ecx
  imul   $0x1389c755,%rax,%rax
  sar    $0x1f,%ecx
  sar    $0x2c,%rax
  sub    %ecx,%eax
  imul   $0xffff2e5c,%eax,%ecx
  imul   $0xffffd04d,%eax,%eax
  add    %ecx,%edx
  imul   $0x9c4e,%edx,%edx
  add    %eax,%edx
  lea    0x7fffffab(%rdx),%eax
  cmovs  %eax,%edx
  cmp    $0x1f,%rsi
  ja     L43
  mov    %edx,(%rdi,%rsi,4)
L43:
  sub    $0x1,%rsi
  jae    L45
  mov    %edx,(%r9)
  mov    D50(%rip),%ecx
  jmp    L44
  nopl   0x0(%rax)
L67:
  mov    $0x9ef4,%r8d
  mov    $0x1,%edx
  jmp    L63
```

tool_calls: name: extract_symbolic_data
arguments: tag: D76
type: byte[8]
name: extract_symbolic_data
arguments: tag: D10
type: byte[8]

tool: {"D76": [0x59,0x53,0x93,0xbf,0xff,0xff,0xef,0x3f]}

tool: {"D10": [0x07,0x00,0xa0,0x0a,0x00,0x00,0x00,0x3e]}

assistant: ```c
double ran2(int *idum) {
  int j;
  int k;
  static int idum2 = 123456789;
  static int iy = 0;
  static int iv[32];
  double tempran;
  if (*idum <= 0) {
    if (-(*idum) < 1) {
      *idum = 1;
    } else {
      *idum = -(*idum);
    }
    idum2 = (*idum);
    for (j = 32 + 7; j >= 0; j--) {
      k = (*idum) / 53668;
      *idum = 40014 * (*idum - k * 53668) - k * 12211;
      if (*idum < 0) {
        *idum += 2147483563;
      }
      if (j < 32) {
        iv[j] = *idum;
      }
    }
    iy = iv[0];
  }
  k = (*idum) / 53668;
  *idum = 40014 * (*idum - k * 53668) - k * 12211;
  if (*idum < 0) {
    *idum += 2147483563;
  }
  k = idum2 / 52774;
  idum2 = 40692 * (idum2 - k * 52774) - k * 3791;
  if (idum2 < 0) {
    idum2 += 2147483399;
  }
  j = iy / (1 + (2147483563 - 1) / 32);
  iy = iv[j] - idum2;
  iv[j] = *idum;
  if (iy < 1) {
    iy += (2147483563 - 1);
  }
  if ((tempran = (1.0 / 2147483563) * iy) > (1.0 - 1.2e-7)) {
    return (1.0 - 1.2e-7);
  } else
    return tempran;
}
```