user: 请从给定的汇编指令推导出C源代码：

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  sub    $0x828,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x818(%rsp)
  xor    %eax,%eax
  call   <getuid@plt>
  test   %rax,%rax
  jne    L63
  lea    D30(%rip),%r13
  lea    D11(%rip),%rdi
  mov    %r13,%rsi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L163
  lea    0x10(%rsp),%r14
  lea    0x410(%rsp),%r15
  mov    %rax,%rdi
  xor    %eax,%eax
  mov    %r15,%rcx
  mov    %r14,%rdx
  lea    D117(%rip),%rsi
  call   <fscanf@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  lea    D88(%rip),%rsi
  mov    %r14,%rdi
  call   <fopen@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L178
  mov    %r13,%rsi
  mov    %r15,%rdi
  call   <fopen@plt>
  mov    %rax,%r13
  test   %rax,%rax
  je     L114
  lea    D2(%rip),%r14
  lea    0x4(%rsp),%rdx
  mov    %rbp,%rdi
  xor    %eax,%eax
  mov    %r14,%rsi
  call   <fscanf@plt>
  mov    %r13,%rdi
  lea    0x8(%rsp),%rdx
  mov    %r14,%rsi
  xor    %eax,%eax
  call   <fscanf@plt>
  mov    %r13,%rdi
  call   <fclose@plt>
  pxor   %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2ssl 0x4(%rsp),%xmm0
  cvtsi2ssl 0x8(%rsp),%xmm1
  divss  %xmm1,%xmm0
  cvtss2sd %xmm0,%xmm0
  mulsd  D60(%rip),%xmm0
  addsd  D78(%rip),%xmm0
  cvttsd2si %xmm0,%r13d
  cmp    $0x1,%ebx
  jle    L16
  cmp    $0x2,%ebx
  je     L197
L117:
  pxor   %xmm0,%xmm0
  cvtss2sd %xmm1,%xmm1
  mov    $0x32,%eax
  mov    %rbp,%rdi
  cvtsi2ss %r13d,%xmm0
  lea    D44(%rip),%rsi
  cvtss2sd %xmm0,%xmm0
  divsd  D60(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%edx
  cmp    %eax,%edx
  cmovl  %eax,%edx
  call   <fprintf@plt>
  mov    %rbp,%rdi
  call   <fclose@plt>
  xor    %eax,%eax
L205:
  mov    0x818(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L104
  add    $0x828,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L63:
  lea    D91(%rip),%rdi
  call   <puts@plt>
  mov    $0x5,%eax
  jmp    L205
L114:
  mov    $0x4,%eax
  jmp    L205
L163:
  mov    $0x2,%eax
  jmp    L205
L178:
  mov    $0x3,%eax
  jmp    L205
L197:
  mov    0x8(%r12),%rdi
  lea    D92(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L172
  mov    0x8(%r12),%rdi
  lea    0xc(%rsp),%rdx
  mov    %r14,%rsi
  call   <sscanf@plt>
  test   %rax,%rax
  je     L151
  mov    0x8(%r12),%rax
  movzbl (%rax),%edx
  mov    0xc(%rsp),%eax
  cmp    $0x2b,%dl
  je     L123
  cmp    $0x2d,%dl
  je     L4
  mov    $0x64,%edx
  mov    $0x1,%r13d
  pxor   %xmm1,%xmm1
  cmp    %edx,%eax
  cvtsi2ssl 0x8(%rsp),%xmm1
  cmovg  %edx,%eax
  test   %eax,%eax
  cmovg  %eax,%r13d
  jmp    L117
L16:
  mov    %r13d,%esi
  lea    D44(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
  jmp    L205
L123:
  add    %r13d,%eax
  mov    $0x64,%r13d
  pxor   %xmm1,%xmm1
  cmp    %r13d,%eax
  cvtsi2ssl 0x8(%rsp),%xmm1
  cmovle %eax,%r13d
  jmp    L117
L172:
  mov    (%r12),%rsi
  lea    D71(%rip),%rdi
  call   <printf@plt>
  xor    %eax,%eax
  jmp    L205
L151:
  lea    D119(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%eax
  jmp    L205
L4:
  add    %r13d,%eax
  pxor   %xmm1,%xmm1
  mov    $0x1,%r13d
  test   %eax,%eax
  cvtsi2ssl 0x8(%rsp),%xmm1
  cmovg  %eax,%r13d
  jmp    L117
L104:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D30
data_type: string
name: disassemble_data
arguments: tag: D11
data_type: string
name: disassemble_data
arguments: tag: D117
data_type: string
name: disassemble_data
arguments: tag: D88
data_type: string
name: disassemble_data
arguments: tag: D2
data_type: string
name: disassemble_data
arguments: tag: D60
data_type: f64
name: disassemble_data
arguments: tag: D78
data_type: byte[8]
name: disassemble_data
arguments: tag: D44
data_type: string
name: disassemble_data
arguments: tag: D91
data_type: string
name: disassemble_data
arguments: tag: D92
data_type: string
name: disassemble_data
arguments: tag: D71
data_type: string
name: disassemble_data
arguments: tag: D119
data_type: string

tool: D30: r

tool: D11: /etc/backlightctl.conf

tool: D117: %s
%s

tool: D88: r+

tool: D2: %d

tool: D60: 100

tool: {"D78": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

tool: D44: %d


tool: D91: You need to be a superuser to use this program.

tool: D92: -h

tool: D71: Usage: %s [[{+,-}]PERCENTAGE]
	 when no parameters are given, the current percentage is printed out.


tool: D119: invalid parameter

assistant: ```c
int main(int argc, char **argv) {
  if (getuid() != 0) {
    printf("You need to be a superuser to use this program.\n");
    return 5;
  }
  static const char *CONFIG_PATH = "/etc/backlightctl.conf";
  FILE *config, *brightness, *max_brightness;
  char brightness_path[1024];
  char max_brightness_path[1024];
  int cur_br, max_br, delta_perc, set_perc, set_br;
  config = fopen(CONFIG_PATH, "r");
  if (config == NULL) {
    return 2;
  }
  fscanf(config, "%s\n%s", brightness_path, max_brightness_path);
  fclose(config);
  brightness = fopen(brightness_path, "r+");
  if (brightness == NULL) {
    return 3;
  }
  max_brightness = fopen(max_brightness_path, "r");
  if (max_brightness == NULL) {
    return 4;
  }
  fscanf(brightness, "%d", &cur_br);
  fscanf(max_brightness, "%d", &max_br);
  fclose(max_brightness);
  set_perc = (int)(((float)cur_br / (float)max_br) * 100.0 + 0.5f);
  if (argc < 2) {
    printf("%d\n", set_perc);
    return 0;
  } else if (argc == 2) {
    if (strcmp(argv[1], "-h") == 0) {
      printf("Usage: %s [[{+,-}]PERCENTAGE]\n\t when no parameters are given, the current percentage is printed out.\n", argv[0]);
      return 0;
    } else if (sscanf(argv[1], "%d", &delta_perc) != 0) {
      if (argv[1][0] == '+') {
        set_perc += delta_perc;
        set_perc = (set_perc > 100) ? 100 : set_perc;
      } else if (argv[1][0] == '-') {
        set_perc += delta_perc;
        set_perc = (set_perc < 1) ? 1 : set_perc;
      } else {
        set_perc = delta_perc;
        set_perc = (set_perc > 100) ? 100 : set_perc;
        set_perc = (set_perc < 1) ? 1 : set_perc;
      }
    } else {
      printf("invalid parameter\n");
      return 1;
    }
  }
  set_br = (int)((((float)set_perc) / 100.0) * ((float)max_br));
  set_br = (set_br < 50) ? 50 : set_br;
  fprintf(brightness, "%d\n", set_br);
  fclose(brightness);
  return 0;
}
```