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

```asm
<getrmap1>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %rsi,0x30(%rsp)
  mov    %edx,(%rsp)
  mov    %r8,0x70(%rsp)
  mov    %r9d,0x68(%rsp)
  movss  %xmm0,0x7c(%rsp)
  mov    0xe0(%rsp),%rax
  mov    %rax,0x38(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  mov    %edx,%eax
  imul   %ecx,%edx
  test   %eax,%eax
  jle    L32
  mov    %ecx,%r13d
  movl   $0x1,0x5c(%rsp)
  movl   $0x0,0x78(%rsp)
  movl   $0x0,0x6c(%rsp)
  lea    0x90(%rsp),%rax
  mov    %rax,0x8(%rsp)
  lea    0x8c(%rsp),%rax
  mov    %rax,0x10(%rsp)
  mov    %edx,%r15d
  mov    %rdi,%r14
  jmp    L197
L3:
  lea    0x1(%r12),%eax
  add    $0x1,%rbx
  cmp    %eax,%r13d
  je     L473
  mov    %eax,%r12d
L316:
  cmpw   $0xff9c,(%r14,%rbx,2)
  jne    L3
  mov    0x58(%rsp),%eax
  mov    %eax,0x8c(%rsp)
  mov    %r12d,0x90(%rsp)
  mov    %ebx,0x94(%rsp)
  mov    %r12d,0x1c(%rsp)
  mov    %rbx,0x20(%rsp)
  mov    0x30(%rsp),%rbx
  mov    0x38(%rsp),%r12
L136:
  sub    $0x8,%rsp
  lea    0x9c(%rsp),%rax
  push   %rax
  push   %r15
  push   %r12
  push   %rbx
  push   %r13
  movss  0x34(%rsp),%xmm0
  mov    0x30(%rsp),%r9d
  mov    0x48(%rsp),%r8d
  mov    0x118(%rsp),%ecx
  mov    0x38(%rsp),%rdx
  mov    0x40(%rsp),%rsi
  mov    %r14,%rdi
  call   <rmapgrow1@plt>
  add    %eax,%ebp
  add    $0x30,%rsp
  test   %eax,%eax
  jne    L136
  mov    0x1c(%rsp),%r12d
  mov    0x20(%rsp),%rbx
  jmp    L3
L473:
  sub    0x64(%rsp),%r12d
  mov    0x54(%rsp),%eax
  lea    (%r12,%rax,1),%ebx
  mov    0x5c(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  cmp    %eax,(%rsp)
  jg     L504
L227:
  test   %ebp,%ebp
  je     L53
L395:
  mov    0x60(%rsp),%eax
  mov    %eax,%r12d
  cmp    %eax,%r13d
  jle    L163
  movslq 0x48(%rsp),%rbx
  mov    0x44(%rsp),%ebp
  jmp    L316
L92:
  add    $0x1,%ebx
  add    $0x1,%r12
  cmp    %ebx,%r13d
  je     L458
L447:
  cmpw   $0xff9c,(%r14,%r12,2)
  jne    L92
  mov    0x1c(%rsp),%eax
  mov    %eax,0x8c(%rsp)
  mov    %ebx,0x90(%rsp)
  mov    %r12d,0x94(%rsp)
  mov    %ebx,0x20(%rsp)
  mov    %r12,0x28(%rsp)
  mov    0x30(%rsp),%rbx
  mov    0x38(%rsp),%r12
L120:
  sub    $0x8,%rsp
  lea    0x9c(%rsp),%rax
  push   %rax
  push   %r15
  push   %r12
  push   %rbx
  push   %r13
  movss  0x34(%rsp),%xmm0
  mov    0x30(%rsp),%r9d
  mov    0x48(%rsp),%r8d
  mov    0x118(%rsp),%ecx
  mov    0x38(%rsp),%rdx
  mov    0x40(%rsp),%rsi
  mov    %r14,%rdi
  call   <rmapgrow1@plt>
  add    %eax,%ebp
  add    $0x30,%rsp
  test   %eax,%eax
  jne    L120
  mov    0x20(%rsp),%ebx
  mov    0x28(%rsp),%r12
  jmp    L92
L458:
  add    0x40(%rsp),%ebx
  addl   $0x1,0x1c(%rsp)
  mov    0x1c(%rsp),%eax
  cmp    %eax,(%rsp)
  jle    L227
L504:
  mov    %ebx,0x40(%rsp)
  add    $0x1,%ebx
  movslq %ebx,%r12
  mov    0x44(%rsp),%ebx
  jmp    L447
L53:
  addl   $0x1,0x50(%rsp)
  mov    0x50(%rsp),%eax
  addq   $0x1,0x48(%rsp)
  cmp    %eax,%r13d
  je     L230
L289:
  mov    0x48(%rsp),%rax
  lea    -0x1(%rax),%edi
  mov    %edi,0x54(%rsp)
  movswl -0x2(%r14,%rax,2),%eax
  cmp    0xe8(%rsp),%eax
  jne    L53
  mov    0x38(%rsp),%rax
  mov    0x48(%rsp),%rdx
  movzbl -0x1(%rax,%rdx,1),%eax
  mov    0x70(%rsp),%rcx
  movss  (%rcx,%rax,4),%xmm1
  movss  %xmm1,0x4(%rsp)
  mov    0x30(%rsp),%rax
  comiss -0x4(%rax,%rdx,4),%xmm1
  jb     L53
  addl   $0x1,0x6c(%rsp)
  mov    0x6c(%rsp),%eax
  movw   $0xff9c,-0x2(%r14,%rdx,2)
  mov    0x58(%rsp),%ecx
  mov    %ecx,0x8c(%rsp)
  mov    0x50(%rsp),%ecx
  mov    %ecx,0x90(%rsp)
  mov    %edi,0x94(%rsp)
  mov    $0x0,%ebx
  mov    0x68(%rsp),%ecx
  add    %eax,%ecx
  mov    %ecx,0x18(%rsp)
  mov    0x30(%rsp),%rbp
  mov    0x38(%rsp),%r12
L63:
  sub    $0x8,%rsp
  lea    0x9c(%rsp),%rax
  push   %rax
  push   %r15
  push   %r12
  push   %rbp
  push   %r13
  movss  0x34(%rsp),%xmm0
  mov    0x30(%rsp),%r9d
  mov    0x48(%rsp),%r8d
  mov    0x118(%rsp),%ecx
  mov    0x38(%rsp),%rdx
  mov    0x40(%rsp),%rsi
  mov    %r14,%rdi
  call   <rmapgrow1@plt>
  add    %eax,%ebx
  add    $0x30,%rsp
  test   %eax,%eax
  jne    L63
  mov    %eax,0x44(%rsp)
  test   %ebx,%ebx
  je     L53
  mov    0x50(%rsp),%eax
  mov    %eax,0x64(%rsp)
  add    $0x1,%eax
  mov    %eax,0x60(%rsp)
  jmp    L395
L230:
  add    %eax,0x78(%rsp)
L349:
  mov    0x5c(%rsp),%edi
  lea    0x1(%rdi),%eax
  cmp    (%rsp),%edi
  je     L308
  mov    %eax,0x5c(%rsp)
L197:
  mov    0x5c(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0x58(%rsp)
  mov    0x78(%rsp),%eax
  add    $0x1,%eax
  cltq
  mov    %rax,0x48(%rsp)
  movl   $0x0,0x50(%rsp)
  test   %r13d,%r13d
  jg     L289
  jmp    L349
L308:
  mov    %r14,%rax
  mov    %r15d,%r14d
  mov    %rax,%r15
  mov    0x68(%rsp),%ebx
  mov    0x6c(%rsp),%eax
  add    %eax,%ebx
  test   %eax,%eax
  jg     L65
L82:
  mov    0x98(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L476
  mov    %ebx,%eax
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L65:
  lea    0x1(%rbx),%r12d
  mov    $0x4,%esi
  mov    %r12d,%edi
  call   <calloc@plt>
  mov    %rax,%rbp
  test   %r14d,%r14d
  jle    L298
  mov    %r15,%rdx
  lea    -0x1(%r14),%eax
  lea    0x2(%r15,%rax,2),%rcx
  jmp    L88
L509:
  add    $0x2,%rdx
  cmp    %rcx,%rdx
  je     L298
L88:
  movzwl (%rdx),%eax
  movswl %ax,%esi
  cmp    0x68(%rsp),%esi
  jle    L509
  movswq %ax,%rax
  addl   $0x1,0x0(%rbp,%rax,4)
  jmp    L509
L298:
  mov    $0x4,%esi
  mov    %r12d,%edi
  call   <calloc@plt>
  mov    %rax,%rdi
  test   %ebx,%ebx
  jle    L79
  lea    0x4(%rax),%rdx
  lea    0x1(%rbx),%ecx
  mov    $0x1,%eax
L302:
  mov    %eax,(%rdx)
  add    $0x1,%eax
  add    $0x4,%rdx
  cmp    %ecx,%eax
  jne    L302
L79:
  mov    0x68(%rsp),%eax
  lea    0x2(%rax),%edx
  movslq %edx,%rdx
  add    $0x1,%eax
  cltq
  lea    (%rdi,%rax,4),%rcx
  mov    %ebx,%r12d
  mov    %rbp,%r10
  sub    %rdi,%r10
  lea    0x8(%rdi),%r9
  jmp    L503
L156:
  add    $0x4,%rsi
  cmp    %r11,%rsi
  je     L330
L54:
  mov    (%rsi),%r8d
  cmp    (%rcx),%r8d
  jle    L156
  sub    $0x1,%r8d
  mov    %r8d,(%rsi)
  jmp    L156
L330:
  mov    0xe8(%rsp),%esi
  mov    %esi,(%rcx)
  sub    $0x1,%r12d
L384:
  add    $0x1,%rdx
  add    $0x1,%rax
  add    $0x4,%rcx
  cmp    %eax,%ebx
  jl     L93
L503:
  pxor   %xmm0,%xmm0
  cvtsi2ssl (%r10,%rcx,1),%xmm0
  movss  0x7c(%rsp),%xmm2
  comiss %xmm0,%xmm2
  jbe    L384
  cmp    %edx,%ebx
  jl     L330
  movslq %edx,%rsi
  lea    (%rdi,%rsi,4),%rsi
  mov    %ebx,%r8d
  sub    %edx,%r8d
  add    %rax,%r8
  lea    (%r9,%r8,4),%r11
  jmp    L54
L93:
  test   %r14d,%r14d
  jle    L108
  mov    %r15,%rax
  lea    -0x1(%r14),%edx
  lea    0x2(%r15,%rdx,2),%rcx
  jmp    L22
L207:
  add    $0x2,%rax
  cmp    %rax,%rcx
  je     L108
L22:
  movzwl (%rax),%edx
  movswl %dx,%esi
  cmp    0x68(%rsp),%esi
  jle    L207
  movswq %dx,%rdx
  mov    (%rdi,%rdx,4),%edx
  mov    %dx,(%rax)
  jmp    L207
L108:
  call   <free@plt>
  mov    %rbp,%rdi
  call   <free@plt>
  mov    %r12d,%ebx
  jmp    L82
L32:
  mov    0x68(%rsp),%ebx
  jmp    L82
L163:
  mov    0x5c(%rsp),%eax
  mov    %eax,0x1c(%rsp)
  cmp    %eax,(%rsp)
  jle    L53
  mov    0x44(%rsp),%ebp
  mov    0x54(%rsp),%ebx
  jmp    L504
L476:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int getrmap1(short *rmap, float *J, int ny, int nx, float *threshJ, int TR, float RSIZE, unsigned char *rmap0, int n2bgrow) {
  int i, j, k, l, iy, ix, *count, *convert, newTR, loc, loc1, imgsize, grow, jy, jx;
  int grow1, ky, kx, kl;
  float threshJ1;
  imgsize = ny * nx;
  j = 0;
  loc = 0;
  for (iy = 0; iy < ny; iy++) {
    for (ix = 0; ix < nx; ix++) {
      if (rmap[loc] == n2bgrow && J[loc] <= threshJ[rmap0[loc]]) {
        threshJ1 = threshJ[rmap0[loc]];
        j++;
        rmap[loc] = -100;
        grow = 0;
        ky = iy;
        kx = ix;
        kl = loc;
        do {
          grow1 = rmapgrow1(rmap, &ky, &kx, n2bgrow, j + TR, ny, nx, J, threshJ1, rmap0, imgsize, &kl);
          grow += grow1;
        } while (grow1);
        while (grow) {
          grow = 0;
          loc1 = loc;
          jy = iy;
          for (jx = ix + 1; jx < nx; jx++) {
            loc1++;
            if (rmap[loc1] == -100) {
              ky = jy;
              kx = jx;
              kl = loc1;
              do {
                grow1 = rmapgrow1(rmap, &ky, &kx, n2bgrow, j + TR, ny, nx, J, threshJ1, rmap0, imgsize, &kl);
                grow += grow1;
              } while (grow1);
            }
          }
          for (jy = iy + 1; jy < ny; jy++) {
            for (jx = 0; jx < nx; jx++) {
              loc1++;
              if (rmap[loc1] == -100) {
                ky = jy;
                kx = jx;
                kl = loc1;
                do {
                  grow1 = rmapgrow1(rmap, &ky, &kx, n2bgrow, j + TR, ny, nx, J, threshJ1, rmap0, imgsize, &kl);
                  grow += grow1;
                } while (grow1);
              }
            }
          }
        }
      }
      loc++;
    }
  }
  newTR = j + TR;
  if (j > 0) {
    count = (int *)calloc(newTR + 1, sizeof(int));
    for (l = 0; l < imgsize; l++) {
      if (rmap[l] > TR)
        count[rmap[l]]++;
    }
    convert = (int *)calloc(newTR + 1, sizeof(int));
    for (i = 1; i <= newTR; i++)
      convert[i] = i;
    for (i = TR + 1; i <= j + TR; i++) {
      if (count[i] < RSIZE) {
        for (k = i + 1; k <= j + TR; k++) {
          if (convert[k] > convert[i])
            convert[k]--;
        }
        convert[i] = n2bgrow;
        newTR--;
      }
    }
    for (l = 0; l < imgsize; l++) {
      if (rmap[l] > TR)
        rmap[l] = convert[rmap[l]];
    }
    free(convert);
    free(count);
  }
  return newTR;
}
```