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

```asm
<gob_encode_array_type>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbx
  mov    %rsi,%rbp
  mov    %rdx,0x8(%rsp)
  mov    %ecx,%r15d
  mov    %r8d,%r14d
  mov    %r9d,%r13d
  call   <gob_start_struct@plt>
  mov    %eax,%r12d
  cltq
  add    %rax,%rbx
  sub    %rax,%rbp
  mov    $0x1,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <gob_encode_unsigned_int@plt>
  movslq %eax,%rdx
  add    %rdx,%rbx
  sub    %rdx,%rbp
  add    %eax,%r12d
  mov    %r15d,%ecx
  mov    0x8(%rsp),%rdx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <gob_encode_common_type@plt>
  movslq %eax,%rdx
  add    %rdx,%rbx
  sub    %rdx,%rbp
  add    %eax,%r12d
  mov    $0x2,%edx
  test   %r14d,%r14d
  jne    L18
L1:
  test   %r13d,%r13d
  jne    L4
L28:
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <gob_end_struct@plt>
  add    %r12d,%eax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L18:
  mov    $0x1,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <gob_encode_unsigned_int@plt>
  movslq %eax,%rdx
  add    %rdx,%rbx
  sub    %rdx,%rbp
  add    %eax,%r12d
  mov    %r14d,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <gob_encode_int@plt>
  movslq %eax,%rdx
  add    %rdx,%rbx
  sub    %rdx,%rbp
  add    %eax,%r12d
  mov    $0x1,%edx
  jmp    L1
L4:
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <gob_encode_unsigned_int@plt>
  movslq %eax,%rdx
  add    %rdx,%rbx
  sub    %rdx,%rbp
  add    %eax,%r12d
  mov    %r13d,%edx
  mov    %rbp,%rsi
  mov    %rbx,%rdi
  call   <gob_encode_int@plt>
  movslq %eax,%rdx
  add    %rdx,%rbx
  sub    %rdx,%rbp
  add    %eax,%r12d
  jmp    L28
```

assistant: ```c
int gob_encode_array_type(char *buf, size_t buf_size, const char *name, int id, int elem_type, int len) {
  int total_size = 0;
  char *write_ptr = buf;
  int num_bytes = gob_start_struct(write_ptr, buf_size);
  write_ptr += num_bytes;
  buf_size -= num_bytes;
  total_size += num_bytes;
  num_bytes = gob_encode_unsigned_int(write_ptr, buf_size, 1);
  write_ptr += num_bytes;
  buf_size -= num_bytes;
  total_size += num_bytes;
  num_bytes = gob_encode_common_type(write_ptr, buf_size, name, id);
  write_ptr += num_bytes;
  buf_size -= num_bytes;
  total_size += num_bytes;
  int field_delta = 1;
  if (elem_type == 0) {
    field_delta++;
  } else {
    num_bytes = gob_encode_unsigned_int(write_ptr, buf_size, field_delta);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
    num_bytes = gob_encode_int(write_ptr, buf_size, elem_type);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
  }
  if (len == 0) {
    field_delta++;
  } else {
    num_bytes = gob_encode_unsigned_int(write_ptr, buf_size, field_delta);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
    num_bytes = gob_encode_int(write_ptr, buf_size, len);
    write_ptr += num_bytes;
    buf_size -= num_bytes;
    total_size += num_bytes;
  }
  num_bytes = gob_end_struct(write_ptr, buf_size);
  write_ptr += num_bytes;
  buf_size -= num_bytes;
  total_size += num_bytes;
  return total_size;
}
```