user: 请将以下的汇编代码转换成C语言代码：

```asm
<battery>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  lea    D77(%rip),%rax
  mov    %rax,%rsi
  lea    D62(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x18(%rbp)
  lea    -0x28(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  lea    D75(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  lea    D77(%rip),%rax
  mov    %rax,%rsi
  lea    D70(%rip),%rax
  mov    %rax,%rdi
  call   <fopen@plt>
  mov    %rax,-0x18(%rbp)
  lea    -0x24(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  lea    D75(%rip),%rcx
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <fscanf@plt>
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <fclose@plt>
  mov    $0x19,%edi
  call   <malloc@plt>
  mov    %rax,-0x10(%rbp)
  mov    -0x24(%rbp),%edx
  mov    %edx,%eax
  shl    $0x2,%eax
  add    %edx,%eax
  add    %eax,%eax
  mov    -0x28(%rbp),%ecx
  cltd
  idiv   %ecx
  mov    %eax,-0x1c(%rbp)
  mov    -0x24(%rbp),%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  mov    -0x28(%rbp),%eax
  pxor   %xmm2,%xmm2
  cvtsi2sd %eax,%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  movsd  D67(%rip),%xmm0
  comisd %xmm1,%xmm0
  jb     L64
  mov    -0x10(%rbp),%rax
  lea    D32(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  jmp    L26
L64:
  mov    -0x10(%rbp),%rax
  lea    D7(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcpy@plt>
  movl   $0x1,-0x20(%rbp)
  jmp    L39
L24:
  mov    -0x20(%rbp),%eax
  cmp    -0x1c(%rbp),%eax
  jg     L30
  mov    -0x10(%rbp),%rax
  lea    D109(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
  jmp    L47
L30:
  mov    -0x10(%rbp),%rax
  lea    D40(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
L47:
  addl   $0x1,-0x20(%rbp)
L39:
  cmpl   $0xa,-0x20(%rbp)
  jle    L24
  mov    -0x10(%rbp),%rax
  lea    D71(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcat@plt>
L26:
  mov    -0x10(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L15
  call   <__stack_chk_fail@plt>
L15:
  leave
  ret
```

tool_calls: name: parse_data
arguments: tag: D77
datatype: string
name: parse_data
arguments: tag: D62
datatype: string
name: parse_data
arguments: tag: D75
datatype: string
name: parse_data
arguments: tag: D70
datatype: string
name: parse_data
arguments: tag: D67
datatype: f64
name: parse_data
arguments: tag: D32
datatype: string
name: parse_data
arguments: tag: D7
datatype: string
name: parse_data
arguments: tag: D109
datatype: string
name: parse_data
arguments: tag: D40
datatype: string
name: parse_data
arguments: tag: D71
datatype: string

tool: D77: r

tool: D62: /sys/class/power_supply/BAT1/energy_full

tool: D75: %d

tool: D70: /sys/class/power_supply/BAT1/energy_now

tool: D67: 0.05

tool: D32: *** BATTERIE < 5% ***

tool: D7: [

tool: D109: #

tool: D40:  

tool: D71: ]

assistant: ```c
char *battery(void) {
  int nmarks, full, now;
  char *bar;
  FILE *battinfo = fopen("/sys/class/power_supply/BAT1/energy_full", "r");
  fscanf(battinfo, "%d", &full);
  fclose(battinfo);
  battinfo = fopen("/sys/class/power_supply/BAT1/energy_now", "r");
  fscanf(battinfo, "%d", &now);
  fclose(battinfo);
  bar = (char *)malloc(sizeof(char) * 25);
  nmarks = 10 * now / full;
  if ((double)now / full <= 0.05) {
    strcpy(bar, "*** BATTERIE < 5% ***");
  } else {
    strcpy(bar, "[");
    for (int i = 1; i < 11; i++) {
      if (i <= nmarks)
        strcat(bar, "#");
      else
        strcat(bar, " ");
    }
    strcat(bar, "]");
  }
  return bar;
}
```