user: What is the c source code of the assembly code below:

```asm
<transition>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %edx,-0x54(%rbp)
  mov    %ecx,-0x58(%rbp)
  mov    %r8d,-0x5c(%rbp)
  movl   $0x0,-0x38(%rbp)
  movl   $0x0,-0x34(%rbp)
  mov    -0x5c(%rbp),%eax
  cltd
  idivl  -0x54(%rbp)
  mov    %eax,-0x38(%rbp)
  mov    -0x5c(%rbp),%eax
  cltd
  idivl  -0x54(%rbp)
  mov    %edx,-0x34(%rbp)
  cmpl   $0x0,-0x38(%rbp)
  jle    L27
  mov    -0x5c(%rbp),%eax
  sub    -0x54(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L27
  mov    -0x5c(%rbp),%eax
  sub    -0x54(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  jmp    L88
L27:
  pxor   %xmm0,%xmm0
L88:
  movsd  %xmm0,-0x30(%rbp)
  mov    -0x38(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x58(%rbp)
  jle    L84
  mov    -0x5c(%rbp),%edx
  mov    -0x54(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L84
  mov    -0x5c(%rbp),%edx
  mov    -0x54(%rbp),%eax
  add    %edx,%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  jmp    L128
L84:
  pxor   %xmm0,%xmm0
L128:
  movsd  %xmm0,-0x28(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jle    L3
  mov    -0x5c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    -0x4(%rax),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L3
  mov    -0x5c(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  jmp    L4
L3:
  pxor   %xmm0,%xmm0
L4:
  movsd  %xmm0,-0x20(%rbp)
  mov    -0x34(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x54(%rbp)
  jle    L116
  mov    -0x5c(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L116
  mov    -0x5c(%rbp),%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  jmp    L129
L116:
  pxor   %xmm0,%xmm0
L129:
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x30(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  seta   %al
  movzbl %al,%edx
  movsd  -0x28(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  seta   %al
  movzbl %al,%eax
  add    %eax,%edx
  movsd  -0x20(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  seta   %al
  movzbl %al,%eax
  add    %eax,%edx
  movsd  -0x18(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  seta   %al
  movzbl %al,%eax
  add    %edx,%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movsd  -0x30(%rbp),%xmm0
  addsd  -0x28(%rbp),%xmm0
  addsd  -0x20(%rbp),%xmm0
  addsd  -0x18(%rbp),%xmm0
  divsd  -0x10(%rbp),%xmm0
  movsd  %xmm0,-0x8(%rbp)
  mov    -0x5c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  je     L12
  mov    -0x5c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x2,%eax
  jne    L68
L12:
  mov    -0x5c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  jmp    L54
L68:
  movsd  -0x8(%rbp),%xmm0
L54:
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  pop    %rbp
  ret
```

assistant: ```c
double transition(int *B, double *T, int nx, int ny, int cell) {
  int row = 0, col = 0;
  row = cell / nx, col = cell % nx;
  double up = (row - 1 < 0 || B[cell - nx] == 0) ? 0 : T[cell - nx];
  double down = (row + 1 >= ny || B[cell + nx] == 0) ? 0 : T[cell + nx];
  double left = (col - 1 < 0 || B[cell - 1] == 0) ? 0 : T[cell - 1];
  double right = (col + 1 >= nx || B[cell + 1] == 0) ? 0 : T[cell + 1];
  double sum = ((up > 0) ? 1 : 0) + ((down > 0) ? 1 : 0) + ((left > 0) ? 1 : 0) + ((right > 0) ? 1 : 0);
  double Tij = (up + down + left + right) / sum;
  return (B[cell] == 0 || B[cell] == 2) ? T[cell] : Tij;
}
```