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

```asm
<main>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%r12d
  mov    %rsi,%r13
  lea    D15(%rip),%rdi
  call   <in@plt>
  mov    %eax,%ebp
  lea    D55(%rip),%rdi
  call   <in@plt>
  cmp    $0x1,%r12d
  jle    L111
  mov    %eax,%r14d
  mov    0x8(%r13),%rdi
  lea    D66(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L59
  mov    $0x1,%ebx
  cmp    $0x2,%r12d
  jg     L28
L30:
  add    %r14d,%ebx
  cmp    %ebp,%ebx
  cmovg  %ebp,%ebx
L75:
  cmp    %ebx,%r14d
  je     L111
  lea    D55(%rip),%r13
  lea    D38(%rip),%r12
L15:
  mov    %ebx,%edx
  sub    %r14d,%edx
  movslq %edx,%rax
  imul   $0x10624dd3,%rax,%rax
  sar    $0x25,%rax
  sar    $0x1f,%edx
  sub    %edx,%eax
  add    %r14d,%eax
  lea    0x1(%rax),%edx
  lea    -0x1(%rax),%r14d
  cmp    %ebx,%eax
  cmovl  %edx,%r14d
  mov    %r14d,%esi
  mov    %r13,%rdi
  call   <out@plt>
  mov    %ebp,%edx
  mov    %r14d,%esi
  mov    %r12,%rdi
  call   <printf@plt>
  cmp    %ebx,%r14d
  jne    L15
L111:
  lea    D55(%rip),%rdi
  call   <in@plt>
  mov    %eax,%esi
  mov    %ebp,%edx
  lea    D44(%rip),%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L28:
  mov    0x10(%r13),%rdi
  call   <atoi@plt>
  mov    %eax,%ebx
  jmp    L30
L109:
  mov    $0x1,%eax
  cmp    $0x2,%r12d
  jg     L32
L87:
  mov    %r14d,%ebx
  sub    %eax,%ebx
  mov    $0x0,%eax
  cmovs  %eax,%ebx
  jmp    L75
L32:
  mov    0x10(%r13),%rdi
  call   <atoi@plt>
  jmp    L87
L59:
  mov    0x8(%r13),%rdi
  lea    D59(%rip),%rsi
  call   <strcmp@plt>
  test   %rax,%rax
  je     L109
  mov    0x8(%r13),%rdi
  call   <all_digits@plt>
  test   %rax,%rax
  je     L111
  mov    0x8(%r13),%rdi
  call   <atoi@plt>
  mov    %eax,%ebx
  cmp    %eax,%ebp
  jge    L75
  jmp    L111
```

tool_calls: name: read_data
arguments: tag: D15
type: string
name: read_data
arguments: tag: D55
type: string
name: read_data
arguments: tag: D66
type: string
name: read_data
arguments: tag: D38
type: string
name: read_data
arguments: tag: D44
type: string
name: read_data
arguments: tag: D59
type: string

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

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

tool: D66: up

tool: D38: brightness = %d/%d

tool: D44: brightness = %d/%d


tool: D59: 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;
}
```