user: What is the c source code of the assembly code below?

```asm
<I2C_write>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %rdx,-0x30(%rbp)
  mov    %ecx,-0x34(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x18(%rbp)
  jmp    L125
L186:
  mov    $0x0,%eax
  call   <send_i2c_start@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L288
  mov    -0xc(%rbp),%eax
  jmp    L116
L288:
  mov    -0x24(%rbp),%eax
  add    %eax,%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <send_i2c_data@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L154
  mov    -0xc(%rbp),%eax
  jmp    L116
L154:
  lea    -0x1c(%rbp),%rax
  mov    %rax,%rdi
  call   <receive_i2c_ack@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L239
  mov    -0xc(%rbp),%eax
  jmp    L116
L239:
  mov    -0x1c(%rbp),%eax
  test   %eax,%eax
  jne    L36
  mov    $0x0,%eax
  call   <send_i2c_stop@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L6
  mov    -0xc(%rbp),%eax
  jmp    L116
L6:
  mov    $0xa,%edi
  call   <OS_mdelay@plt>
  jmp    L125
L36:
  mov    -0x28(%rbp),%eax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <send_i2c_data@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L144
  mov    -0xc(%rbp),%eax
  jmp    L116
L144:
  lea    -0x1c(%rbp),%rax
  mov    %rax,%rdi
  call   <receive_i2c_ack@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L42
  mov    -0xc(%rbp),%eax
  jmp    L116
L42:
  mov    -0x1c(%rbp),%eax
  test   %eax,%eax
  jne    L111
  mov    $0x0,%eax
  call   <send_i2c_stop@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L332
  mov    -0xc(%rbp),%eax
  jmp    L116
L332:
  mov    $0xa,%edi
  call   <OS_mdelay@plt>
  jmp    L125
L111:
  movl   $0x0,-0x10(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L108
L213:
  mov    -0x14(%rbp),%eax
  shl    $0x3,%eax
  mov    -0x30(%rbp),%rdx
  mov    %eax,%ecx
  shr    %cl,%rdx
  mov    %rdx,%rax
  movzbl %al,%eax
  mov    %eax,%edi
  call   <send_i2c_data@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L13
  mov    -0xc(%rbp),%eax
  jmp    L116
L13:
  lea    -0x1c(%rbp),%rax
  mov    %rax,%rdi
  call   <receive_i2c_ack@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L336
  mov    -0xc(%rbp),%eax
  jmp    L116
L336:
  mov    -0x1c(%rbp),%eax
  test   %eax,%eax
  jne    L38
  mov    $0x0,%eax
  call   <send_i2c_stop@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L200
  mov    -0xc(%rbp),%eax
  jmp    L116
L200:
  mov    $0xa,%edi
  call   <OS_mdelay@plt>
  movl   $0x1,-0x10(%rbp)
  jmp    L146
L38:
  addl   $0x1,-0x14(%rbp)
L108:
  mov    -0x14(%rbp),%eax
  cmp    -0x34(%rbp),%eax
  jb     L213
L146:
  cmpl   $0x0,-0x10(%rbp)
  je     L322
  jmp    L125
L322:
  mov    $0x0,%eax
  call   <send_i2c_stop@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  je     L181
  mov    -0xc(%rbp),%eax
  jmp    L116
L181:
  mov    $0x0,%eax
  jmp    L116
L125:
  mov    -0x18(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x18(%rbp)
  cmp    $0x4,%eax
  jle    L186
  mov    $0x1122,%eax
L116:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L18
  call   <__stack_chk_fail@plt>
L18:
  leave
  ret
```

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;
}
```