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

```asm
<main>:
  endbr64
  push   %r13
  xor    %eax,%eax
  push   %r12
  mov    %edi,%r12d
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x8,%rsp
  call   <initEc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L34
L7:
  cmp    $0x3,%r12d
  je     L27
  mov    $0xa3,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <write8@plt>
  mov    (%rbx),%rsi
  lea    D114(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    (%rbx),%rsi
  lea    D8(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D76(%rip),%rdi
  call   <puts@plt>
  mov    $0x5,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <read1@plt>
  lea    D100(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x2,%edx
  mov    $0x7,%esi
  mov    %rbp,%rdi
  call   <read1@plt>
  lea    D74(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x6,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <read1@plt>
  lea    D79(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x7,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <read1@plt>
  lea    D264(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x6,%edx
  mov    $0x2,%esi
  mov    %rbp,%rdi
  call   <read1@plt>
  lea    D165(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x5,%edx
  mov    $0x3,%esi
  mov    %rbp,%rdi
  call   <read1@plt>
  lea    D184(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x66,%esi
  mov    %rbp,%rdi
  call   <read8@plt>
  lea    D3(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x3,%edx
  mov    $0x9,%esi
  mov    %rbp,%rdi
  call   <read1@plt>
  lea    D9(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xd7,%esi
  mov    %rbp,%rdi
  call   <read8@plt>
  lea    D26(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x60,%esi
  mov    %rbp,%rdi
  call   <read8@plt>
  lea    D158(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x61,%esi
  mov    %rbp,%rdi
  call   <read8@plt>
  lea    D248(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x62,%esi
  mov    %rbp,%rdi
  call   <read8@plt>
  lea    D56(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xfc,%esi
  mov    %rbp,%rdi
  call   <read16@plt>
  lea    D93(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xfe,%esi
  mov    %rbp,%rdi
  call   <read16@plt>
  lea    D34(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x3,%edx
  mov    $0x13,%esi
  mov    %rbp,%rdi
  call   <read1@plt>
  lea    D231(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x6,%edx
  mov    $0x8,%esi
  mov    %rbp,%rdi
  call   <read1@plt>
  lea    D164(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x4,%edx
  mov    $0x12,%esi
  mov    %rbp,%rdi
  call   <read1@plt>
  lea    D260(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %edx,%edx
  mov    $0x13,%esi
  mov    %rbp,%rdi
  call   <read1@plt>
  lea    D212(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xb0,%esi
  mov    %rbp,%rdi
  call   <read8@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  divsd  D161(%rip),%xmm0
  call   <round@plt>
  lea    D215(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0xb1,%esi
  mov    %rbp,%rdi
  call   <read8@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  divsd  D161(%rip),%xmm0
  call   <round@plt>
  lea    D16(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x64,%esi
  mov    %rbp,%rdi
  call   <read8@plt>
  lea    D236(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
L50:
  mov    %rbp,%rdi
  call   <closeEc@plt>
  xor    %edi,%edi
  call   <exit@plt>
  add    $0x8,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L27:
  mov    0x8(%rbx),%rdi
  mov    $0x2e,%esi
  call   <strchr@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L10
  movb   $0x0,(%rax)
  mov    0x8(%rbx),%rdi
  xor    %edx,%edx
  xor    %esi,%esi
  call   <strtol@plt>
  lea    0x1(%r12),%rdi
  mov    %rax,%r13
  call   <atoi@plt>
  mov    0x10(%rbx),%rdi
  xor    %edx,%edx
  xor    %esi,%esi
  mov    %rax,%r12
  call   <strtol@plt>
  movzbl %r12b,%edx
  movzbl %r13b,%esi
  mov    %rbp,%rdi
  movzbl %al,%ecx
  call   <write1@plt>
  jmp    L50
L34:
  lea    D88(%rip),%rdi
  call   <fail@plt>
  jmp    L7
L10:
  mov    0x8(%rbx),%rdi
  xor    %edx,%edx
  xor    %esi,%esi
  call   <strtol@plt>
  mov    0x10(%rbx),%rdi
  xor    %edx,%edx
  xor    %esi,%esi
  mov    %rax,%r12
  call   <strtol@plt>
  movzbl %r12b,%esi
  mov    %rbp,%rdi
  movzbl %al,%edx
  call   <write8@plt>
  jmp    L50
```

tool_calls: name: disassemble_data
arguments: label: D114
data_type: string
name: disassemble_data
arguments: label: D8
data_type: string
name: disassemble_data
arguments: label: D76
data_type: string
name: disassemble_data
arguments: label: D100
data_type: string
name: disassemble_data
arguments: label: D74
data_type: string
name: disassemble_data
arguments: label: D79
data_type: string
name: disassemble_data
arguments: label: D264
data_type: string
name: disassemble_data
arguments: label: D165
data_type: string
name: disassemble_data
arguments: label: D184
data_type: string
name: disassemble_data
arguments: label: D3
data_type: string
name: disassemble_data
arguments: label: D9
data_type: string
name: disassemble_data
arguments: label: D26
data_type: string
name: disassemble_data
arguments: label: D158
data_type: string
name: disassemble_data
arguments: label: D248
data_type: string
name: disassemble_data
arguments: label: D56
data_type: string
name: disassemble_data
arguments: label: D93
data_type: string
name: disassemble_data
arguments: label: D34
data_type: string
name: disassemble_data
arguments: label: D231
data_type: string
name: disassemble_data
arguments: label: D164
data_type: string
name: disassemble_data
arguments: label: D260
data_type: string
name: disassemble_data
arguments: label: D212
data_type: string
name: disassemble_data
arguments: label: D161
data_type: f64
name: disassemble_data
arguments: label: D215
data_type: string
name: disassemble_data
arguments: label: D16
data_type: string
name: disassemble_data
arguments: label: D236
data_type: string
name: disassemble_data
arguments: label: D88
data_type: string

tool: D114: Usage: sudo %s [<hex-offset[.bit]> <hex-value>]


tool: D8:    Ex: sudo %s 0x01.6 0x07



tool: D76: Current Embedded Controller Values:

tool: D100:   USB Charge During Sleep     [0x01.5]: %d


tool: D74:   USB Charge During Hibernate [0x07.2]: %d


tool: D79:   Camera Enabled              [0x01.6]: %d


tool: D264:   Bluetooth Enabled           [0x01.7]: %d


tool: D165:   WiFi Enabled                [0x02.6]: %d


tool: D184:   Touchpad Enabled            [0x03.5]: %d


tool: D3:   Ambient Light               [0x66]:   %d%%


tool: D9:   Screen Enabled              [0x09.3]: %d


tool: D26:   Keyboard Backlight Mode     [0xD7]:   %d


tool: D158:   CPU Temp                    [0x60]:   %d C


tool: D248:   GPU Temp                    [0x61]:   %d C


tool: D56:   MLB Temp                    [0x62]:   %d C


tool: D93:   Fan0 Speed                  [0xFC]:   %d RPM


tool: D34:   Fan1 Speed                  [0xFE]:   %d RPM


tool: D231:   Fan Control Enabled         [0x13.3]: %d


tool: D164:   Fan Quiet Mode Enabled      [0x08.6]: %d


tool: D260:   Fan Gaming Mode Enabled     [0x12.4]: %d


tool: D212:   Fan Custom Mode Enabled     [0x13.0]: %d


tool: D161: 2.55

tool: D215:   Fan0 Custom Speed Setting   [0xB0]:   %d%%


tool: D16:   Fan1 Custom Speed Setting   [0xB1]:   %d%%


tool: D236:   Current Speed Setting       [0x64]:   %d


tool: D88: Unable to initialize embedded controller; did you forget to use sudo?

assistant: ```c
int main(int argc, char **args) {
  FILE *ec = initEc();
  if (!ec)
    fail("Unable to initialize embedded controller; did you forget to use sudo?");
  if (argc == 3) {
    char *dotIdx = strchr(args[1], '.');
    if (dotIdx != NULL) {
      *dotIdx = '\0';
      dotIdx++;
      unsigned char offset = (unsigned char)strtol(args[1], NULL, 0);
      unsigned char bit = (unsigned char)atoi(dotIdx);
      unsigned char value = (unsigned char)strtol(args[2], NULL, 0);
      write1(ec, offset, bit, value);
    } else {
      unsigned char offset = (unsigned char)strtol(args[1], NULL, 0);
      unsigned char value = (unsigned char)strtol(args[2], NULL, 0);
      write8(ec, offset, value);
    }
  } else {
    write8(ec, 0x01, 0xA3);
    printf("Usage: sudo %s [<hex-offset[.bit]> <hex-value>]\n", args[0]);
    printf("   Ex: sudo %s 0x01.6 0x07\n\n", args[0]);
    printf("Current Embedded Controller Values:\n");
    printf("  USB Charge During Sleep     [0x01.5]: %d\n", read1(ec, 0x01, 5));
    printf("  USB Charge During Hibernate [0x07.2]: %d\n", read1(ec, 0x07, 2));
    printf("  Camera Enabled              [0x01.6]: %d\n", read1(ec, 0x01, 6));
    printf("  Bluetooth Enabled           [0x01.7]: %d\n", read1(ec, 0x01, 7));
    printf("  WiFi Enabled                [0x02.6]: %d\n", read1(ec, 0x02, 6));
    printf("  Touchpad Enabled            [0x03.5]: %d\n", read1(ec, 0x03, 5));
    printf("  Ambient Light               [0x66]:   %d%%\n", read8(ec, 0x66));
    printf("  Screen Enabled              [0x09.3]: %d\n", read1(ec, 0x09, 3));
    printf("  Keyboard Backlight Mode     [0xD7]:   %d\n", read8(ec, 0xD7));
    printf("  CPU Temp                    [0x60]:   %d C\n", read8(ec, 0x60));
    printf("  GPU Temp                    [0x61]:   %d C\n", read8(ec, 0x61));
    printf("  MLB Temp                    [0x62]:   %d C\n", read8(ec, 0x62));
    printf("  Fan0 Speed                  [0xFC]:   %d RPM\n", read16(ec, 0xFC));
    printf("  Fan1 Speed                  [0xFE]:   %d RPM\n", read16(ec, 0xFE));
    printf("  Fan Control Enabled         [0x13.3]: %d\n", read1(ec, 0x13, 3));
    printf("  Fan Quiet Mode Enabled      [0x08.6]: %d\n", read1(ec, 0x08, 6));
    printf("  Fan Gaming Mode Enabled     [0x12.4]: %d\n", read1(ec, 0x12, 4));
    printf("  Fan Custom Mode Enabled     [0x13.0]: %d\n", read1(ec, 0x13, 0));
    printf("  Fan0 Custom Speed Setting   [0xB0]:   %d%%\n", (int)round(read8(ec, 0xB0) / 2.55));
    printf("  Fan1 Custom Speed Setting   [0xB1]:   %d%%\n", (int)round(read8(ec, 0xB1) / 2.55));
    printf("  Current Speed Setting       [0x64]:   %d\n", read8(ec, 0x64));
  }
  closeEc(ec);
  exit(0);
}
```