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

```asm
<main>:
  endbr64
  push   %r14
  mov    %rsi,%r14
  push   %r13
  lea    D13(%rip),%r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  lea    D38(%rip),%rdi
  call   <in@plt>
  mov    %r13,%rdi
  mov    %eax,%r12d
  call   <in@plt>
  cmp    $0x1,%ebx
  jg     L126
L22:
  mov    %r13,%rdi
  call   <in@plt>
  mov    %r12d,%edx
  lea    D2(%rip),%rdi
  mov    %eax,%esi
  call   <printf@plt>
  pop    %rbx
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L126:
  mov    0x8(%r14),%rdi
  lea    D50(%rip),%rsi
  mov    %eax,%ebp
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L80
  mov    $0x1,%eax
  cmp    $0x2,%ebx
  jne    L8
L24:
  lea    (%rax,%rbp,1),%r14d
  cmp    %r12d,%r14d
  cmovg  %r12d,%r14d
L9:
  lea    D37(%rip),%rbx
  cmp    %r14d,%ebp
  je     L22
  nopl   0x0(%rax)
L41:
  mov    %r14d,%edx
  mov    %r13,%rdi
  sub    %ebp,%edx
  movslq %edx,%rax
  sar    $0x1f,%edx
  imul   $0x10624dd3,%rax,%rax
  sar    $0x25,%rax
  sub    %edx,%eax
  add    %ebp,%eax
  lea    0x1(%rax),%edx
  cmp    %r14d,%eax
  lea    -0x1(%rax),%ebp
  cmovl  %edx,%ebp
  mov    %ebp,%esi
  call   <out@plt>
  mov    %r12d,%edx
  mov    %ebp,%esi
  mov    %rbx,%rdi
  call   <printf@plt>
  cmp    %r14d,%ebp
  jne    L41
  jmp    L22
L80:
  mov    0x8(%r14),%rdi
  lea    D18(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L28
  mov    $0x1,%eax
  cmp    $0x2,%ebx
  je     L32
  mov    0x10(%r14),%rdi
  call   <atoi@plt>
L32:
  mov    %ebp,%r14d
  sub    %eax,%r14d
  mov    $0x0,%eax
  cmovs  %eax,%r14d
  jmp    L9
L28:
  mov    0x8(%r14),%rdi
  call   <all_digits@plt>
  test   %rax,%rax
  je     L22
  mov    0x8(%r14),%rdi
  call   <atoi@plt>
  mov    %eax,%r14d
  cmp    %eax,%r12d
  jge    L9
  jmp    L22
L8:
  mov    0x10(%r14),%rdi
  call   <atoi@plt>
  jmp    L24
```

tool_calls: name: read_data
arguments: data_label: D13
datatype: string
name: read_data
arguments: data_label: D38
datatype: string
name: read_data
arguments: data_label: D2
datatype: string
name: read_data
arguments: data_label: D50
datatype: string
name: read_data
arguments: data_label: D37
datatype: string
name: read_data
arguments: data_label: D18
datatype: string

tool: D13: /sys/class/backlight/intel_backlight/brightness

tool: D38: /sys/class/backlight/intel_backlight/max_brightness

tool: D2: brightness = %d/%d


tool: D50: up

tool: D37: brightness = %d/%d

tool: D18: down

assistant: ```c
int main(int argc, char *argv[]) {
  int max = in("/sys/class/backlight/intel_backlight/max_brightness");
  int curr = in("/sys/class/backlight/intel_backlight/brightness");
  int next = curr;
  if (argc >= 2 && strcmp(argv[1], "up") == 0) {
    int delta = 1;
    if (argc >= 3)
      delta = atoi(argv[2]);
    if (curr + delta <= max)
      next = curr + delta;
    else
      next = max;
  } else if (argc >= 2 && strcmp(argv[1], "down") == 0) {
    int delta = 1;
    if (argc >= 3)
      delta = atoi(argv[2]);
    if (curr - delta >= 0)
      next = curr - delta;
    else
      next = 0;
  } else if (argc >= 2 && all_digits(argv[1])) {
    int req = atoi(argv[1]);
    if (req <= max)
      next = req;
  }
  while (next != curr) {
    curr += (next - curr) / 500;
    if (curr < next)
      ++curr;
    else
      --curr;
    out("/sys/class/backlight/intel_backlight/brightness", curr);
    printf("brightness = %d/%d\r", curr, max);
  }
  printf("brightness = %d/%d\n", in("/sys/class/backlight/intel_backlight/brightness"), max);
  return 0;
}
```