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

```asm
<main>:
  endbr64
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  lea    D59(%rip),%rdi
  call   <puts@plt>
  lea    D85(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <fork@plt>
  test   %rax,%rax
  je     L118
  mov    %rax,%rbx
  lea    0x4(%rsp),%rdi
  call   <wait@plt>
  movslq %eax,%rbp
  cmp    %rbp,%rbx
  jne    L152
L138:
  cmpl   $0x2,0x4(%rsp)
  jne    L209
L40:
  mov    0x4(%rsp),%edx
  mov    %rbp,%rsi
  lea    D119(%rip),%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  movl   $0xffffffff,0x4(%rsp)
  lea    0x4(%rsp),%rdi
  call   <wait@plt>
  cmp    $0xffffffff,%eax
  jne    L13
L102:
  mov    $0x0,%eax
  call   <ps@plt>
  lea    D62(%rip),%rdi
  call   <puts@plt>
  lea    D92(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%ebx
  jmp    L98
L118:
  lea    D124(%rip),%rdi
  call   <puts@plt>
  mov    $0x2,%eax
  jmp    L81
L152:
  lea    D33(%rip),%rdi
  call   <puts@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L138
L209:
  lea    D60(%rip),%rdi
  call   <puts@plt>
  mov    $0x2,%edi
  call   <exit@plt>
  jmp    L40
L13:
  lea    D14(%rip),%rdi
  call   <puts@plt>
  mov    $0x4,%edi
  call   <exit@plt>
  jmp    L102
L123:
  mov    $0x0,%eax
  call   <fork@plt>
  test   %rax,%rax
  js     L115
  mov    $0x0,%edi
  call   <exit@plt>
  add    $0x1,%ebx
  cmp    $0x3e8,%ebx
  je     L170
L98:
  movslq %ebx,%rax
  imul   $0x66666667,%rax,%rax
  sar    $0x22,%rax
  mov    %ebx,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  cmp    %eax,%ebx
  jne    L123
  mov    $0x2e,%edi
  call   <putchar@plt>
  jmp    L123
L115:
  lea    D13(%rip),%rdi
  call   <puts@plt>
  test   %ebx,%ebx
  jle    L227
L170:
  lea    D19(%rip),%rbp
  jmp    L160
L128:
  mov    $0x0,%edi
  call   <wait@plt>
  test   %eax,%eax
  js     L0
L106:
  sub    $0x1,%ebx
  je     L227
L160:
  movslq %ebx,%rax
  imul   $0x66666667,%rax,%rax
  sar    $0x22,%rax
  mov    %ebx,%edx
  sar    $0x1f,%edx
  sub    %edx,%eax
  lea    (%rax,%rax,4),%eax
  add    %eax,%eax
  cmp    %eax,%ebx
  jne    L128
  mov    $0x2d,%edi
  call   <putchar@plt>
  jmp    L128
L0:
  mov    %rbp,%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  jmp    L106
L227:
  mov    $0x0,%edi
  call   <wait@plt>
  cmp    $0xffffffff,%eax
  jne    L225
L171:
  lea    D3(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  call   <ps@plt>
  mov    $0x0,%eax
L81:
  mov    0x8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L76
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  ret
L225:
  lea    D102(%rip),%rdi
  call   <puts@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  jmp    L171
L76:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D59
type: string
name: parse_data
arguments: tag: D85
type: string
name: parse_data
arguments: tag: D119
type: string
name: parse_data
arguments: tag: D62
type: string
name: parse_data
arguments: tag: D92
type: string
name: parse_data
arguments: tag: D124
type: string
name: parse_data
arguments: tag: D33
type: string
name: parse_data
arguments: tag: D60
type: string
name: parse_data
arguments: tag: D14
type: string
name: parse_data
arguments: tag: D13
type: string
name: parse_data
arguments: tag: D19
type: string
name: parse_data
arguments: tag: D3
type: string
name: parse_data
arguments: tag: D102
type: string

tool: D59: 
We are in userland

tool: D85: Let's fork(), baby!

tool: D119: OK child %d exited with status: %d


tool: D62: Test OK


tool: D92: fork() stress test

tool: D124: I am the child

tool: D33: fork returned different pid

tool: D60: fork returned different exit status

tool: D14: wait too many

tool: D13: fork returned -1

tool: D19: Wait exit early

tool: D3: Fork test OK

tool: D102: Wait got too many

assistant: ```c
int main() {
  pid_t pid, wp;
  int status;
  printf("\nWe are in userland\n");
  printf("Let's fork(), baby!\n");
  pid = fork();
  if (pid == 0) {
    printf("I am the child\n");
    return 2;
  } else {
    wp = wait(&status);
    if (pid != wp) {
      printf("fork returned different pid\n");
      exit(1);
    }
    if (status != 2) {
      printf("fork returned different exit status\n");
      exit(2);
    }
    printf("OK child %d exited with status: %d\n", wp, status);
  }
  status = -1;
  wp = 0;
  wp = wait(&status);
  if (wp != -1) {
    printf("wait too many\n");
    exit(4);
  }
  ps();
  printf("Test OK\n\n");
  printf("fork() stress test\n");
  int i;
  for (i = 0; i < 1000; i++) {
    if (!(i % 10))
      printf(".");
    pid = fork();
    if (pid < 0) {
      printf("fork returned -1\n");
      break;
    } else {
      exit(0);
    }
  }
  for (; i > 0; i--) {
    if (!(i % 10))
      printf("-");
    if ((pid = wait(NULL)) < 0) {
      printf("Wait exit early\n");
      exit(0);
    }
  }
  if (wait(NULL) != -1) {
    printf("Wait got too many\n");
    exit(0);
  }
  printf("Fork test OK\n");
  ps();
}
```