user: 请从给定的汇编指令推导出C源代码:

```asm
<search>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,0x18(%rsp)
  mov    %edx,0xc(%rsp)
  mov    %ecx,0x10(%rsp)
  mov    %r8d,0x14(%rsp)
  mov    %r9d,0x8(%rsp)
  movslq %r8d,%r13
  lea    0x0(,%r13,8),%r15
  lea    (%rdi,%r15,1),%r14
  movslq %r9d,%rbp
  lea    0x0(,%rbp,4),%r12
  mov    %r12,%rdx
  add    (%r14),%rdx
  mov    (%rdx),%eax
  cmp    $0xffffffff,%eax
  jne    L97
  mov    %rsi,%rbx
  movl   $0x1,(%rdx)
  test   %r8d,%r8d
  jle    L116
  mov    -0x8(%rsi,%r15,1),%rdx
  mov    (%rsi,%r13,8),%rax
  mov    (%rax,%rbp,4),%eax
  cmp    %eax,(%rdx,%rbp,4)
  jl     L23
L116:
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  cmp    0x14(%rsp),%eax
  jle    L29
  mov    0x8(%rbx,%r15,1),%rdx
  mov    (%rbx,%r13,8),%rax
  mov    (%rax,%rbp,4),%eax
  cmp    %eax,(%rdx,%rbp,4)
  jl     L19
L29:
  cmpl   $0x0,0x8(%rsp)
  jle    L130
  mov    (%rbx,%r13,8),%rax
  mov    (%rax,%rbp,4),%esi
  cmp    %esi,-0x4(%rax,%r12,1)
  jl     L5
L130:
  mov    0x10(%rsp),%eax
  sub    $0x1,%eax
  cmp    0x8(%rsp),%eax
  jle    L37
  mov    (%rbx,%r13,8),%rax
  mov    (%rax,%rbp,4),%esi
  cmp    %esi,0x4(%rax,%r12,1)
  jl     L96
L37:
  mov    (%r14),%rax
  mov    (%rax,%rbp,4),%eax
L97:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L23:
  lea    -0x1(%r8),%r8d
  mov    0x10(%rsp),%ecx
  mov    0xc(%rsp),%edx
  call   <search>
  mov    %r12,%rdx
  add    (%r14),%rdx
  cmp    %eax,(%rdx)
  jg     L116
  add    $0x1,%eax
  mov    %eax,(%rdx)
  jmp    L116
L19:
  mov    0x8(%rsp),%r9d
  mov    0x14(%rsp),%eax
  lea    0x1(%rax),%r8d
  mov    0x10(%rsp),%ecx
  mov    0xc(%rsp),%edx
  mov    %rbx,%rsi
  mov    0x18(%rsp),%rdi
  call   <search>
  mov    %r12,%rdx
  add    (%r14),%rdx
  cmp    %eax,(%rdx)
  jg     L29
  add    $0x1,%eax
  mov    %eax,(%rdx)
  jmp    L29
L5:
  mov    0x8(%rsp),%eax
  lea    -0x1(%rax),%r9d
  mov    0x14(%rsp),%r8d
  mov    0x10(%rsp),%ecx
  mov    0xc(%rsp),%edx
  mov    %rbx,%rsi
  mov    0x18(%rsp),%rdi
  call   <search>
  mov    %r12,%rdx
  add    (%r14),%rdx
  cmp    %eax,(%rdx)
  jg     L130
  add    $0x1,%eax
  mov    %eax,(%rdx)
  jmp    L130
L96:
  mov    0x8(%rsp),%r9d
  add    $0x1,%r9d
  mov    0x14(%rsp),%r8d
  mov    0x10(%rsp),%ecx
  mov    0xc(%rsp),%edx
  mov    %rbx,%rsi
  mov    0x18(%rsp),%rdi
  call   <search>
  add    (%r14),%r12
  cmp    %eax,(%r12)
  jg     L37
  add    $0x1,%eax
  mov    %eax,(%r12)
  jmp    L37
```

assistant: ```c
int search(int **f, int **h, int rows, int cols, int y, int x) {
  if (f[y][x] != -1)
    return f[y][x];
  f[y][x] = 1;
  int top, bottom, left, right;
  top = bottom = left = right = -1;
  if (y > 0 && h[y - 1][x] < h[y][x]) {
    top = search(f, h, rows, cols, y - 1, x);
    if (top + 1 > f[y][x])
      f[y][x] = top + 1;
  }
  if (y < rows - 1 && h[y + 1][x] < h[y][x]) {
    bottom = search(f, h, rows, cols, y + 1, x);
    if (bottom + 1 > f[y][x]) {
      f[y][x] = bottom + 1;
    }
  }
  if (x > 0 && h[y][x - 1] < h[y][x]) {
    left = search(f, h, rows, cols, y, x - 1);
    if (left + 1 > f[y][x]) {
      f[y][x] = left + 1;
    }
  }
  if (x < cols - 1 && h[y][x + 1] < h[y][x]) {
    right = search(f, h, rows, cols, y, x + 1);
    if (right + 1 > f[y][x]) {
      f[y][x] = right + 1;
    }
  }
  return f[y][x];
}
```