user: Demonstrate the C code that generates the assembly output below:

```asm
<main>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  lea    D38(%rip),%rax
  mov    %rax,%rdi
  call   <in@plt>
  mov    %eax,-0x8(%rbp)
  lea    D46(%rip),%rax
  mov    %rax,%rdi
  call   <in@plt>
  mov    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  cmpl   $0x1,-0x24(%rbp)
  jle    L103
  mov    -0x30(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  lea    D4(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L103
  movl   $0x1,-0x10(%rbp)
  cmpl   $0x2,-0x24(%rbp)
  jle    L181
  mov    -0x30(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0x10(%rbp)
L181:
  mov    -0x18(%rbp),%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  cmp    %eax,-0x8(%rbp)
  jl     L132
  mov    -0x18(%rbp),%edx
  mov    -0x10(%rbp),%eax
  add    %edx,%eax
  mov    %eax,-0x14(%rbp)
  jmp    L164
L132:
  mov    -0x8(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  jmp    L164
L103:
  cmpl   $0x1,-0x24(%rbp)
  jle    L4
  mov    -0x30(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  lea    D75(%rip),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L4
  movl   $0x1,-0xc(%rbp)
  cmpl   $0x2,-0x24(%rbp)
  jle    L2
  mov    -0x30(%rbp),%rax
  add    $0x10,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0xc(%rbp)
L2:
  mov    -0x18(%rbp),%eax
  sub    -0xc(%rbp),%eax
  test   %eax,%eax
  js     L9
  mov    -0x18(%rbp),%eax
  sub    -0xc(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  jmp    L164
L9:
  movl   $0x0,-0x14(%rbp)
  jmp    L164
L4:
  cmpl   $0x1,-0x24(%rbp)
  jle    L149
  mov    -0x30(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <all_digits@plt>
  test   %rax,%rax
  je     L149
  mov    -0x30(%rbp),%rax
  add    $0x8,%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    %eax,-0x4(%rbp)
  mov    -0x4(%rbp),%eax
  cmp    -0x8(%rbp),%eax
  jg     L149
  mov    -0x4(%rbp),%eax
  mov    %eax,-0x14(%rbp)
L164:
  jmp    L149
L184:
  mov    -0x14(%rbp),%eax
  sub    -0x18(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x10624dd3,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x5,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  add    %eax,-0x18(%rbp)
  mov    -0x18(%rbp),%eax
  cmp    -0x14(%rbp),%eax
  jge    L48
  addl   $0x1,-0x18(%rbp)
  jmp    L75
L48:
  subl   $0x1,-0x18(%rbp)
L75:
  mov    -0x18(%rbp),%eax
  mov    %eax,%esi
  lea    D46(%rip),%rax
  mov    %rax,%rdi
  call   <out@plt>
  mov    -0x8(%rbp),%edx
  mov    -0x18(%rbp),%eax
  mov    %eax,%esi
  lea    D1(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
L149:
  mov    -0x14(%rbp),%eax
  cmp    -0x18(%rbp),%eax
  jne    L184
  lea    D46(%rip),%rax
  mov    %rax,%rdi
  call   <in@plt>
  mov    %eax,%ecx
  mov    -0x8(%rbp),%eax
  mov    %eax,%edx
  mov    %ecx,%esi
  lea    D52(%rip),%rax
  mov    %rax,%rdi
  call   <printf@plt>
  mov    $0x0,%eax
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D38
data_type: string
name: unpack_data
arguments: data_label: D46
data_type: string
name: unpack_data
arguments: data_label: D4
data_type: string
name: unpack_data
arguments: data_label: D75
data_type: string
name: unpack_data
arguments: data_label: D1
data_type: string
name: unpack_data
arguments: data_label: D52
data_type: string

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

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

tool: D4: up

tool: D75: down

tool: D1: brightness = %d/%d

tool: D52: brightness = %d/%d


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;
}
```