user: Please show me the C implementation that matches the assembly code listed below:

```asm
<dig_level>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    $0x0,%eax
  call   <rand@plt>
  mov    %eax,%edx
  shr    $0x1f,%edx
  lea    (%rax,%rdx,1),%ebx
  and    $0x1,%ebx
  sub    %edx,%ebx
  add    $0x1,%ebx
  mov    $0x0,%eax
  call   <rand@plt>
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  and    $0x1,%eax
  sub    %edx,%eax
  mov    %eax,0x14(%rsp)
  mov    $0x0,%r13d
  mov    $0x0,%r12d
L15:
  test   %r12d,%r12d
  jne    L125
  test   %r13d,%r13d
  jne    L126
  movl   $0xc,0xc(%rsp)
L128:
  movl   $0x18,0x10(%rsp)
L103:
  mov    0x14(%rsp),%ecx
  mov    %ebx,%edx
  mov    0x10(%rsp),%esi
  mov    0xc(%rsp),%edi
  call   <dig_room@plt>
  test   %rax,%rax
  je     L15
  jmp    L69
L126:
  mov    %r13d,0x10(%rsp)
  movl   $0xc,0xc(%rsp)
  jmp    L103
L120:
  cmp    $0x2710,%r15d
  jg     L58
  mov    %r13d,%ecx
  mov    %r12d,%edx
  mov    0x10(%rsp),%esi
  mov    0xc(%rsp),%edi
  call   <dig_path@plt>
  addl   $0x1,0x18(%rsp)
  mov    0x18(%rsp),%eax
  cmp    %eax,0x1c(%rsp)
  jl     L15
L104:
  mov    $0x1,%r15d
L2:
  mov    $0x0,%eax
  call   <rand@plt>
  mov    %eax,%edx
  shr    $0x1f,%edx
  lea    (%rax,%rdx,1),%ebp
  and    $0x1,%ebp
  sub    %edx,%ebp
  mov    %ebp,0x14(%rsp)
  mov    $0x0,%eax
  call   <rand@plt>
  mov    %eax,%edx
  shr    $0x1f,%edx
  lea    (%rax,%rdx,1),%ebx
  and    $0x1,%ebx
  sub    %edx,%ebx
  add    $0x1,%ebx
  mov    $0x0,%eax
  call   <rand@plt>
  lea    0x0(,%rbx,8),%r12d
  lea    0x0(,%rbx,4),%r14d
  cltd
  idiv   %r12d
  mov    0x10(%rsp),%eax
  lea    (%rdx,%rax,1),%r13d
  sub    %r14d,%r13d
  mov    $0x0,%eax
  call   <rand@plt>
  cltd
  idiv   %r12d
  mov    0xc(%rsp),%eax
  lea    (%rdx,%rax,1),%r12d
  sub    %r14d,%r12d
  mov    %ebp,%ecx
  mov    %ebx,%edx
  mov    %r13d,%esi
  mov    %r12d,%edi
  call   <dig_room@plt>
  test   %rax,%rax
  jne    L120
  add    $0x1,%r15d
  cmp    $0x2711,%r15d
  jne    L2
L58:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L125:
  test   %r13d,%r13d
  je     L44
  mov    %r13d,0x10(%rsp)
  mov    %r12d,0xc(%rsp)
L69:
  mov    $0x0,%eax
  call   <rand@plt>
  movslq %eax,%rdx
  imul   $0x66666667,%rdx,%rdx
  sar    $0x21,%rdx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  lea    (%rdx,%rdx,4),%edx
  sub    %edx,%eax
  mov    %eax,0x1c(%rsp)
  js     L15
  movl   $0x0,0x18(%rsp)
  jmp    L104
L44:
  mov    %r12d,0xc(%rsp)
  jmp    L128
```

assistant: ```c
void dig_level() {
  int new_ry = 0;
  int new_rx = 0;
  int radius = 1 + rand() % 2;
  bool radial = (bool)rand() % 2;
  while (true) {
    int ry = (0 == new_ry ? 24 / 2 : new_ry);
    int rx = (0 == new_rx ? 48 / 2 : new_rx);
    if ((0 != new_rx && 0 != new_ry) || dig_room(ry, rx, radius, radial)) {
      int paths = 1 + rand() % 5;
      for (int p = 0; p < paths; p++) {
        int tries = 0;
        while (tries++ < 10000 && !dig_room(new_ry = ry + rand() % (8 * radius) - 4 * radius, new_rx = rx + rand() % (8 * radius) - 4 * radius, radius = 1 + rand() % 2, radial = rand() % 2))
          ;
        if (tries > 10000)
          return;
        dig_path(ry, rx, new_ry, new_rx);
      }
    }
  }
}
```