user: Please show me the C implementation that matches the assembly code listed below:

```asm
<main>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x28(%rsp)
  xor    %eax,%eax
  movl   $0x2,0x8(%rsp)
  movl   $0x3,0xc(%rsp)
  lea    0x10(%rsp),%rbx
  mov    %rbx,%rdi
  call   <pipe@plt>
  lea    0x18(%rsp),%rdi
  call   <pipe@plt>
  lea    0x20(%rsp),%rdi
  call   <pipe@plt>
  mov    $0x0,%ebp
  lea    0x4(%rsp),%r13
L85:
  mov    $0x0,%eax
  call   <fork@plt>
  test   %rax,%rax
  je     L68
L97:
  add    $0x1,%rbp
  add    $0x8,%rbx
  cmp    $0x2,%rbp
  jne    L85
  lea    0x4(%rsp),%rsi
  lea    D2(%rip),%rdi
  call   <scanf@plt>
  mov    0x10(%rsp),%edi
  call   <close@plt>
  mov    0x18(%rsp),%edi
  call   <close@plt>
  mov    0x1c(%rsp),%edi
  call   <close@plt>
  mov    0x24(%rsp),%edi
  call   <close@plt>
  lea    D7(%rip),%rbp
L76:
  lea    0x4(%rsp),%rbx
  mov    $0x4,%edx
  mov    %rbx,%rsi
  mov    0x14(%rsp),%edi
  call   <write@plt>
  mov    $0x4,%edx
  mov    %rbx,%rsi
  mov    0x20(%rsp),%edi
  call   <read@plt>
  mov    0x4(%rsp),%eax
  lea    -0x5(%rax),%esi
  mov    %esi,0x4(%rsp)
  mov    %rbp,%rdi
  call   <printf@plt>
  cmpl   $0x64,0x4(%rsp)
  jg     L76
  mov    0x14(%rsp),%edi
  call   <close@plt>
  mov    0x20(%rsp),%edi
  call   <close@plt>
  mov    $0x0,%edi
  call   <wait@plt>
  mov    $0x0,%edi
  call   <wait@plt>
  mov    0x28(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L81
  mov    $0x0,%eax
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L68:
  mov    $0x0,%r12d
  lea    0x1(%rbp),%r15d
  jmp    L117
L44:
  add    $0x1,%r12
  cmp    $0x3,%r12
  je     L95
L117:
  mov    %r12d,%r14d
  cmp    %ebp,%r12d
  je     L110
  mov    0x10(%rsp,%r12,8),%edi
  call   <close@plt>
L110:
  cmp    %r15d,%r14d
  je     L44
  mov    0x14(%rsp,%r12,8),%edi
  call   <close@plt>
  jmp    L44
L102:
  mov    0xc(%r12),%edi
  mov    $0x4,%edx
  mov    %r13,%rsi
  call   <write@plt>
  cmpl   $0x64,0x4(%rsp)
  jle    L29
L95:
  mov    %rbx,%r12
  mov    $0x4,%edx
  mov    %r13,%rsi
  mov    (%rbx),%edi
  call   <read@plt>
  mov    0x4(%rsp),%ecx
  mov    0x8(%rsp,%rbp,4),%esi
  mov    %ecx,%eax
  cltd
  idiv   %esi
  test   %edx,%edx
  jne    L102
  mov    %ecx,%eax
  cltd
  idiv   %esi
  mov    %eax,0x4(%rsp)
  jmp    L102
L29:
  mov    (%r12),%edi
  call   <close@plt>
  mov    0xc(%r12),%edi
  call   <close@plt>
  mov    $0x0,%edi
  call   <exit@plt>
  jmp    L97
L81:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D2
type: string
name: extract_symbolic_data
arguments: data_tag: D7
type: string

tool: D2: %d

tool: D7: Father : %d


assistant: ```c
int main() {
  int n, i, j;
  int p[3][2], mod[2] = {2, 3};
  for (i = 0; i < 3; ++i)
    pipe(p[i]);
  for (i = 0; i < 2; ++i)
    if (fork() == 0) {
      int from = i;
      int to = i + 1;
      for (j = 0; j < 3; ++j) {
        if (j != from)
          close(p[j][0]);
        if (j != to)
          close(p[j][1]);
      }
      do {
        read(p[from][0], &n, sizeof(int));
        if (n % mod[i] == 0)
          n /= mod[i];
        write(p[to][1], &n, sizeof(int));
      } while (n > 100);
      close(p[from][0]);
      close(p[to][1]);
      exit(0);
    }
  scanf("%d", &n);
  int from = 2;
  int to = 0;
  for (i = 0; i < 3; ++i) {
    if (i != from)
      close(p[i][0]);
    if (i != to)
      close(p[i][1]);
  }
  do {
    write(p[to][1], &n, sizeof(int));
    read(p[from][0], &n, sizeof(int));
    n -= 5;
    printf("Father : %d\n", n);
  } while (n > 100);
  close(p[to][1]);
  close(p[from][0]);
  wait(0);
  wait(0);
  return 0;
}
```