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

```asm
<update_blc_ratio>:
  endbr64
  push   %r12
  mov    %rdi,%rdx
  mov    %rdi,%r12
  mov    $0xdf,%esi
  push   %rbp
  mov    $0x3d84,%edi
  xor    %eax,%eax
  sub    $0x8,%rsp
  call   <write_sccb16@plt>
  mov    %r12,%rdx
  mov    $0x1,%esi
  xor    %eax,%eax
  mov    $0x3d81,%edi
  call   <write_sccb16@plt>
  mov    $0x5,%edi
  xor    %eax,%eax
  call   <msleep@plt>
  mov    %r12,%rsi
  mov    $0x3d0b,%edi
  xor    %eax,%eax
  call   <read_sccb16@plt>
  sub    $0x15,%eax
  cmp    $0x2b,%eax
  ja     L12
  lea    D25(%rip),%rsi
  lea    D20(%rip),%rdi
  xor    %eax,%eax
  call   <pr_err@plt>
  mov    %r12,%rsi
  mov    $0x4008,%edi
  xor    %eax,%eax
  call   <read_sccb16@plt>
  mov    %r12,%rdx
  mov    $0x4008,%edi
  and    $0xfb,%eax
  mov    %eax,%esi
  xor    %eax,%eax
  call   <write_sccb16@plt>
  mov    %r12,%rsi
  mov    $0x4000,%edi
  xor    %eax,%eax
  call   <read_sccb16@plt>
  mov    %r12,%rdx
  mov    $0x4000,%edi
  and    $0xf7,%eax
  mov    %eax,%esi
  xor    %eax,%eax
  call   <write_sccb16@plt>
  add    $0x8,%rsp
  mov    $0x2,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   (%rax)
L12:
  mov    %r12,%rsi
  mov    $0x3d0a,%edi
  xor    %eax,%eax
  call   <read_sccb16@plt>
  lea    D25(%rip),%rsi
  mov    %eax,%ebp
  lea    -0x10(%rax),%eax
  cmp    $0x30,%eax
  ja     L16
  lea    D37(%rip),%rdi
  xor    %eax,%eax
  call   <pr_err@plt>
  mov    %r12,%rdx
  mov    %ebp,%esi
  mov    $0x4006,%edi
  xor    %eax,%eax
  call   <write_sccb16@plt>
  mov    %r12,%rsi
  mov    $0x4008,%edi
  xor    %eax,%eax
  call   <read_sccb16@plt>
  mov    %r12,%rdx
  mov    $0x4008,%edi
  and    $0xfb,%eax
  mov    %eax,%esi
  xor    %eax,%eax
  call   <write_sccb16@plt>
  mov    %r12,%rsi
  mov    $0x4000,%edi
  xor    %eax,%eax
  call   <read_sccb16@plt>
  mov    %r12,%rdx
  mov    $0x4000,%edi
  or     $0x8,%eax
  mov    %eax,%esi
  xor    %eax,%eax
  call   <write_sccb16@plt>
  add    $0x8,%rsp
  mov    $0x1,%eax
  pop    %rbp
  pop    %r12
  ret
  nopl   0x0(%rax)
L16:
  lea    D43(%rip),%rdi
  xor    %eax,%eax
  call   <pr_err@plt>
  mov    %r12,%rdx
  mov    $0x20,%esi
  xor    %eax,%eax
  mov    $0x4006,%edi
  call   <write_sccb16@plt>
  mov    %r12,%rsi
  mov    $0x4008,%edi
  xor    %eax,%eax
  call   <read_sccb16@plt>
  mov    %r12,%rdx
  mov    $0x4008,%edi
  and    $0xfb,%eax
  mov    %eax,%esi
  xor    %eax,%eax
  call   <write_sccb16@plt>
  mov    %r12,%rsi
  mov    $0x4000,%edi
  xor    %eax,%eax
  call   <read_sccb16@plt>
  mov    %r12,%rdx
  mov    $0x4000,%edi
  or     $0x8,%eax
  mov    %eax,%esi
  xor    %eax,%eax
  call   <write_sccb16@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
```

tool_calls: name: read_data
arguments: data_tag: D25
type_infered: string
name: read_data
arguments: data_tag: D20
type_infered: string
name: read_data
arguments: data_tag: D37
type_infered: string
name: read_data
arguments: data_tag: D43
type_infered: string

tool: D25: update_blc_ratio

tool: D20: %s  auto load mode 

tool: D37: %s  manual load mode 

tool: D43: %s  set to default 

assistant: ```c
int update_blc_ratio(struct msm_sensor_ctrl_t *a_ctrl) {
  int K, temp;
  write_sccb16(0x3d84, 0xdf, a_ctrl);
  write_sccb16(0x3d81, 0x01, a_ctrl);
  msleep(5);
  K = read_sccb16(0x3d0b, a_ctrl);
  if (K != 0) {
    if ((K >= 0x15) && (K <= 0x40)) {
      pr_err("%s  auto load mode ", __func__);
      temp = read_sccb16(0x4008, a_ctrl);
      temp &= 0xfb;
      write_sccb16(0x4008, temp, a_ctrl);
      temp = read_sccb16(0x4000, a_ctrl);
      temp &= 0xf7;
      write_sccb16(0x4000, temp, a_ctrl);
      return 2;
    }
  }
  K = read_sccb16(0x3d0a, a_ctrl);
  if ((K >= 0x10) && (K <= 0x40)) {
    pr_err("%s  manual load mode ", __func__);
    write_sccb16(0x4006, K, a_ctrl);
    temp = read_sccb16(0x4008, a_ctrl);
    temp &= 0xfb;
    write_sccb16(0x4008, temp, a_ctrl);
    temp = read_sccb16(0x4000, a_ctrl);
    temp |= 0x08;
    write_sccb16(0x4000, temp, a_ctrl);
    return 1;
  } else {
    pr_err("%s  set to default ", __func__);
    write_sccb16(0x4006, 0x20, a_ctrl);
    temp = read_sccb16(0x4008, a_ctrl);
    temp &= 0xfb;
    write_sccb16(0x4008, temp, a_ctrl);
    temp = read_sccb16(0x4000, a_ctrl);
    temp |= 0x08;
    write_sccb16(0x4000, temp, a_ctrl);
    return 0;
  }
}
```