user: 请将以下的汇编代码转换成C语言代码:

```asm
<search>:
  endbr64
  push   %r15
  push   %r14
  movslq %r9d,%r14
  push   %r13
  movslq %r8d,%r13
  lea    0x0(,%r14,4),%r10
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    (%rdi,%r13,8),%r15
  add    %r10,%r15
  mov    (%r15),%eax
  cmp    $0xffffffff,%eax
  jne    L46
  movl   $0x1,(%r15)
  mov    %rsi,%r12
  mov    %r13,%rbx
  mov    %r14,%rbp
  lea    0x0(,%r13,8),%r11
  test   %r13d,%r13d
  jle    L163
  mov    (%r12,%r13,8),%rax
  mov    -0x8(%rsi,%r11,1),%rsi
  mov    (%rax,%r14,4),%eax
  cmp    %eax,(%rsi,%r14,4)
  jl     L84
L163:
  lea    -0x1(%rdx),%eax
  cmp    %ebx,%eax
  jle    L14
  mov    (%r12,%r13,8),%rax
  mov    0x8(%r12,%r11,1),%rsi
  mov    (%rax,%r14,4),%eax
  cmp    %eax,(%rsi,%r14,4)
  jl     L140
L14:
  test   %ebp,%ebp
  jle    L32
  mov    (%r12,%r13,8),%rax
  mov    (%rax,%r14,4),%esi
  cmp    %esi,-0x4(%rax,%r10,1)
  jl     L61
L32:
  lea    -0x1(%rcx),%eax
  cmp    %ebp,%eax
  jle    L112
  mov    (%r12,%r13,8),%rax
  mov    (%rax,%r14,4),%esi
  cmp    %esi,0x4(%rax,%r10,1)
  jl     L30
L112:
  mov    (%r15),%eax
L46:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L84:
  mov    %r14d,%r9d
  lea    -0x1(%r13),%r8d
  mov    %r12,%rsi
  mov    %r10,0x18(%rsp)
  mov    %r11,0x10(%rsp)
  mov    %ecx,0xc(%rsp)
  mov    %edx,0x8(%rsp)
  mov    %rdi,(%rsp)
  call   <search>
  cmp    %eax,(%r15)
  mov    (%rsp),%rdi
  mov    0x8(%rsp),%edx
  mov    0xc(%rsp),%ecx
  mov    0x10(%rsp),%r11
  mov    0x18(%rsp),%r10
  jg     L163
  add    $0x1,%eax
  mov    %eax,(%r15)
  jmp    L163
  nopw   0x0(%rax,%rax,1)
L61:
  lea    -0x1(%rbp),%r9d
  mov    %ebx,%r8d
  mov    %r12,%rsi
  mov    %r10,0x10(%rsp)
  mov    %ecx,0xc(%rsp)
  mov    %edx,0x8(%rsp)
  mov    %rdi,(%rsp)
  call   <search>
  cmp    %eax,(%r15)
  mov    (%rsp),%rdi
  mov    0x8(%rsp),%edx
  mov    0xc(%rsp),%ecx
  mov    0x10(%rsp),%r10
  jg     L32
  add    $0x1,%eax
  mov    %eax,(%r15)
  jmp    L32
  nopl   (%rax)
L30:
  lea    0x1(%rbp),%r9d
  mov    %ebx,%r8d
  mov    %r12,%rsi
  call   <search>
  mov    %eax,%edx
  mov    (%r15),%eax
  cmp    %edx,%eax
  jg     L46
  lea    0x1(%rdx),%eax
  mov    %eax,(%r15)
  jmp    L46
  nop
L140:
  mov    %ebp,%r9d
  lea    0x1(%rbx),%r8d
  mov    %r12,%rsi
  mov    %r10,0x10(%rsp)
  mov    %ecx,0xc(%rsp)
  mov    %edx,0x8(%rsp)
  mov    %rdi,(%rsp)
  call   <search>
  cmp    %eax,(%r15)
  mov    (%rsp),%rdi
  mov    0x8(%rsp),%edx
  mov    0xc(%rsp),%ecx
  mov    0x10(%rsp),%r10
  jg     L14
  add    $0x1,%eax
  mov    %eax,(%r15)
  jmp    L14
```

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];
}
```