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

```asm
<islandPerimeter>:
  endbr64
  mov    %edx,%r11d
  xor    %eax,%eax
  xor    %edx,%edx
  xor    %ecx,%ecx
  test   %r11d,%r11d
  jle    L368
L242:
  test   %esi,%esi
  jle    L319
  push   %rbp
  push   %rbx
L171:
  lea    0x1(%rcx),%r10d
  lea    -0x4(%rdx),%rbp
  lea    0x4(%rdx),%r9
  cmp    %r10d,%r11d
  jle    L158
  test   %ecx,%ecx
  je     L288
  mov    $0x1,%ecx
  jmp    L185
  nopl   0x0(%rax)
L89:
  cmpl   $0x1,(%r8,%rbp,1)
  adc    $0x0,%eax
  cmpl   $0x1,(%r8,%r9,1)
  adc    $0x0,%eax
  cmp    $0x1,%rcx
  je     L136
  mov    -0x10(%rdi,%rcx,8),%r8
  cmpl   $0x1,(%r8,%rdx,1)
  adc    $0x0,%eax
L296:
  cmp    %ecx,%esi
  jle    L147
  mov    (%rdi,%rcx,8),%r8
  cmpl   $0x1,(%r8,%rdx,1)
  adc    $0x0,%eax
L112:
  add    $0x1,%rcx
L185:
  mov    -0x8(%rdi,%rcx,8),%r8
  mov    (%r8,%rdx,1),%ebx
  test   %ebx,%ebx
  jne    L89
  cmp    %ecx,%esi
  jg     L112
L241:
  mov    %r10d,%ecx
  mov    %r9,%rdx
  cmp    %r10d,%r11d
  je     L209
L256:
  test   %esi,%esi
  jg     L171
  lea    0x1(%r10),%r10d
  lea    0x4(%r9),%r9
  mov    %r10d,%ecx
  mov    %r9,%rdx
  cmp    %r10d,%r11d
  jne    L256
L209:
  pop    %rbx
  pop    %rbp
  ret
  nopl   (%rax)
L147:
  add    $0x1,%eax
  jmp    L241
  nopl   (%rax)
L136:
  add    $0x1,%eax
  jmp    L296
  nopl   (%rax)
L158:
  test   %ecx,%ecx
  je     L211
  mov    %eax,%ebx
  mov    $0x1,%ecx
  jmp    L388
  nopl   0x0(%rax)
L304:
  mov    (%r8,%rbp,1),%r8d
  test   %r8d,%r8d
  jne    L255
  lea    0x1(%rax),%ebx
L255:
  lea    0x1(%rbx),%eax
  cmp    $0x1,%rcx
  je     L139
  mov    -0x10(%rdi,%rcx,8),%r8
  mov    (%r8,%rdx,1),%r8d
  test   %r8d,%r8d
  jne    L86
L139:
  lea    0x2(%rbx),%eax
L86:
  cmp    %ecx,%esi
  jle    L147
  mov    (%rdi,%rcx,8),%r8
  cmpl   $0x1,(%r8,%rdx,1)
  adc    $0x0,%eax
  mov    %eax,%ebx
L155:
  add    $0x1,%rcx
L388:
  mov    -0x8(%rdi,%rcx,8),%r8
  cmpl   $0x0,(%r8,%rdx,1)
  jne    L304
  cmp    %ecx,%esi
  jg     L155
  jmp    L241
  nopl   0x0(%rax)
L288:
  mov    %eax,%ebx
  mov    $0x1,%ecx
  jmp    L184
  nopl   0x0(%rax)
L64:
  mov    (%r8,%r9,1),%r8d
  add    $0x1,%eax
  test   %r8d,%r8d
  jne    L7
  lea    0x2(%rbx),%eax
L7:
  cmp    $0x1,%rcx
  je     L15
  mov    -0x10(%rdi,%rcx,8),%r8
  cmpl   $0x1,(%r8,%rdx,1)
  adc    $0x0,%eax
L179:
  cmp    %ecx,%esi
  jle    L147
  mov    (%rdi,%rcx,8),%r8
  cmpl   $0x1,(%r8,%rdx,1)
  adc    $0x0,%eax
  mov    %eax,%ebx
L260:
  add    $0x1,%rcx
L184:
  mov    -0x8(%rdi,%rcx,8),%r8
  mov    (%r8,%rdx,1),%ebp
  test   %ebp,%ebp
  jne    L64
  cmp    %ecx,%esi
  jg     L260
  jmp    L241
  nopw   0x0(%rax,%rax,1)
L15:
  add    $0x1,%eax
  jmp    L179
  nopl   (%rax)
L211:
  mov    $0x1,%ecx
  jmp    L129
  nop
L389:
  lea    0x2(%rax),%r8d
  cmp    $0x1,%rcx
  je     L352
  mov    -0x10(%rdi,%rcx,8),%rbx
  mov    (%rbx,%rdx,1),%ebp
  test   %ebp,%ebp
  je     L352
  mov    %r8d,%eax
L176:
  cmp    %ecx,%esi
  jle    L147
  mov    (%rdi,%rcx,8),%r8
  cmpl   $0x1,(%r8,%rdx,1)
  adc    $0x0,%eax
L244:
  add    $0x1,%rcx
L129:
  mov    -0x8(%rdi,%rcx,8),%r8
  mov    (%r8,%rdx,1),%r8d
  test   %r8d,%r8d
  jne    L389
  cmp    %ecx,%esi
  jg     L244
  jmp    L241
  nopl   0x0(%rax,%rax,1)
L352:
  add    $0x3,%eax
  jmp    L176
L368:
  ret
L319:
  lea    0x1(%rcx),%r10d
  lea    0x4(%rdx),%r9
  mov    %r10d,%ecx
  mov    %r9,%rdx
  cmp    %r10d,%r11d
  jne    L242
  ret
```

assistant: ```c
int islandPerimeter(int **grid, int gridRowSize, int gridColSize) {
  int ans = 0;
  for (int i = 0; i < gridColSize; ++i) {
    for (int j = 0; j < gridRowSize; ++j) {
      if (!grid[j][i])
        continue;
      if (i - 1 < 0)
        ans++;
      else if (grid[j][i - 1] == 0)
        ans++;
      if (i + 1 >= gridColSize)
        ans++;
      else if (grid[j][i + 1] == 0)
        ans++;
      if (j - 1 < 0)
        ans++;
      else if (grid[j - 1][i] == 0)
        ans++;
      if (j + 1 >= gridRowSize)
        ans++;
      else if (grid[j + 1][i] == 0)
        ans++;
    }
  }
  return ans;
}
```