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

```asm
<EEPROM_Write>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rsi,0x8(%rsp)
  mov    %edx,%r14d
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  test   %edx,%edx
  setne  %dl
  cmp    $0x100,%r14d
  setle  %al
  test   %al,%dl
  je     L26
  mov    %edi,%r15d
  cmp    $0xff,%edi
  jle    L63
L26:
  lea    D14(%rip),%rdi
  call   <printf@plt>
  mov    $0xfffffffd,%ebx
  jmp    L38
L58:
  test   %ebx,%ebx
  jne    L31
  add    %r13d,%r15d
  movslq %r13d,%rax
  mov    0x8(%rsp),%rcx
  lea    (%rcx,%rax,4),%rax
  mov    %rax,0x8(%rsp)
  sub    %r13d,%r14d
  je     L36
L63:
  mov    %r15d,%eax
  and    $0x7,%eax
  mov    $0x8,%r13d
  sub    %eax,%r13d
  cmp    %r14d,%r13d
  cmovg  %r14d,%r13d
  mov    %r15d,0x10(%rsp)
  lea    0x10(%rsp),%rbx
  lea    0x14(%rsp),%rdi
  mov    %r13d,%edx
  mov    0x8(%rsp),%rsi
  call   <memcpy@plt>
  lea    0x1(%r13),%edx
  mov    $0x1,%ecx
  mov    %rbx,%rsi
  mov    $0xa0,%edi
  call   <I2C_Xfer@plt>
  mov    %eax,%ebp
  test   %eax,%eax
  jne    L114
  mov    %rbx,%r12
L22:
  mov    $0x1,%ecx
  mov    $0x1,%edx
  mov    %r12,%rsi
  mov    $0xa0,%edi
  call   <I2C_Xfer@plt>
  mov    %eax,%ebx
  add    $0x1,%ebp
  test   %eax,%eax
  je     L58
  cmp    $0x18f,%ebp
  jle    L22
  jmp    L58
L31:
  lea    D2(%rip),%rdi
  call   <printf@plt>
  jmp    L38
L36:
  mov    %r14d,%ebx
  jmp    L38
L114:
  lea    D17(%rip),%rdi
  call   <printf@plt>
  mov    $0xfffffffe,%ebx
L38:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L53
  mov    %ebx,%eax
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L53:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D14
datatype: string
name: parse_data
arguments: data_tag: D2
datatype: string
name: parse_data
arguments: data_tag: D17
datatype: string

tool: D14: 
Invalid EEPROM addressing

tool: D2: 
Timeout getting ACK from EEPROM during write!

tool: D17: 
Failed to write to EEPROM!

assistant: ```c
int32_t EEPROM_Write(uint32_t startdestpos, uint8_t *src, uint32_t len) {
  int32_t retval = 0;
  if (startdestpos < 256 && len && len <= 256) {
    uint8_t tmpbuf[9];
    uint8_t i = startdestpos;
    while (len) {
      uint32_t loopcnt = 0;
      uint8_t startoffset = i & 0x07;
      uint8_t maxcopysize = 8 - startoffset;
      uint8_t bytestocopy = (len > maxcopysize) ? maxcopysize : len;
      tmpbuf[0] = i;
      memcpy(tmpbuf + 1, src, bytestocopy);
      retval = I2C_Xfer((0x50 << 1), tmpbuf, bytestocopy + 1, 1);
      if (!retval) {
        do {
          retval = I2C_Xfer((0x50 << 1), tmpbuf, 1, 1);
          loopcnt++;
        } while (retval && loopcnt < 400);
        if (retval) {
          printf("\nTimeout getting ACK from EEPROM during write!");
          break;
        }
        len -= bytestocopy;
        i += bytestocopy;
        src += bytestocopy;
      } else {
        printf("\nFailed to write to EEPROM!");
        retval = -2;
        break;
      }
    }
  } else {
    printf("\nInvalid EEPROM addressing");
    retval = -3;
  }
  return retval;
}
```