user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<I2C_write>:
  endbr64
  push   %r15
  add    %edi,%edi
  mov    $0x5,%r15d
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  movzbl %dil,%ebp
  push   %rbx
  sub    $0x28,%rsp
  mov    %esi,0xc(%rsp)
  lea    0x14(%rsp),%r14
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
L30:
  xor    %eax,%eax
  call   <send_i2c_start@plt>
  test   %eax,%eax
  jne    L174
  mov    %ebp,%edi
  call   <send_i2c_data@plt>
  test   %eax,%eax
  jne    L174
  mov    %r14,%rdi
  call   <receive_i2c_ack@plt>
  test   %eax,%eax
  jne    L174
  mov    0x14(%rsp),%esi
  test   %esi,%esi
  je     L36
  movzbl 0xc(%rsp),%edi
  call   <send_i2c_data@plt>
  test   %eax,%eax
  jne    L174
  mov    %r14,%rdi
  call   <receive_i2c_ack@plt>
  test   %eax,%eax
  jne    L174
  mov    0x14(%rsp),%ecx
  xor    %eax,%eax
  test   %ecx,%ecx
  je     L36
  test   %r12d,%r12d
  je     L132
  xor    %ebx,%ebx
  jmp    L93
  nopl   0x0(%rax)
L39:
  add    $0x1,%ebx
  cmp    %ebx,%r12d
  je     L132
L93:
  lea    0x0(,%rbx,8),%ecx
  mov    %r13,%rdi
  shr    %cl,%rdi
  movzbl %dil,%edi
  call   <send_i2c_data@plt>
  test   %eax,%eax
  jne    L174
  mov    %r14,%rdi
  call   <receive_i2c_ack@plt>
  test   %eax,%eax
  jne    L174
  mov    0x14(%rsp),%edx
  test   %edx,%edx
  jne    L39
  nopw   0x0(%rax,%rax,1)
L36:
  call   <send_i2c_stop@plt>
  test   %eax,%eax
  je     L59
L174:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L57
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L59:
  mov    $0xa,%edi
  call   <OS_mdelay@plt>
  sub    $0x1,%r15d
  jne    L30
  mov    $0x1122,%eax
  jmp    L174
  nopl   0x0(%rax,%rax,1)
L132:
  xor    %eax,%eax
  call   <send_i2c_stop@plt>
  jmp    L174
L57:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int I2C_write(unsigned int address, unsigned int reg, unsigned long value, unsigned int bytes) {
  int err;
  int restart_count = 0;
  int ack;
  unsigned int b;
  int nack;
  while (restart_count++ < 5) {
    err = send_i2c_start();
    if (err)
      return err;
    err = send_i2c_data((char)((address << 1) | 0x00));
    if (err)
      return err;
    err = receive_i2c_ack(&ack);
    if (err)
      return err;
    if (!ack) {
      {}
      err = send_i2c_stop();
      if (err)
        return err;
      OS_mdelay(10);
      continue;
    }
    err = send_i2c_data((unsigned char)reg);
    if (err)
      return err;
    err = receive_i2c_ack(&ack);
    if (err)
      return err;
    if (!ack) {
      {}
      err = send_i2c_stop();
      if (err)
        return err;
      OS_mdelay(10);
      continue;
    }
    nack = 0;
    for (b = 0; b < bytes; b++) {
      err = send_i2c_data((unsigned char)(value >> (b * 8)));
      if (err)
        return err;
      err = receive_i2c_ack(&ack);
      if (err)
        return err;
      if (!ack) {
        {}
        err = send_i2c_stop();
        if (err)
          return err;
        OS_mdelay(10);
        nack = 1;
        break;
      }
    }
    if (nack)
      continue;
    err = send_i2c_stop();
    if (err)
      return err;
    return 0;
  }
  {}
  return 0x1122;
}
```