user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<main>:
  endbr64
  push   %r12
  push   %rbp
  sub    $0x18,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x8(%rsp)
  xor    %eax,%eax
  call   <fork@plt>
  mov    %eax,%ebp
  cmp    $0xffffffff,%eax
  je     L33
  lea    0x4(%rsp),%r12
  test   %eax,%eax
  jne    L34
L18:
  lea    D115(%rip),%rdi
  lea    0x4(%rsp),%r12
  call   <puts@plt>
  xor    %eax,%eax
  call   <getpid@plt>
  lea    D96(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  xor    %eax,%eax
  call   <getppid@plt>
  lea    D73(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D14(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %r12,%rsi
  lea    D114(%rip),%rdi
  call   <scanf@plt>
  lea    D59(%rip),%rdi
  call   <puts@plt>
  mov    0x4(%rsp),%edi
  call   <exit@plt>
L34:
  lea    D62(%rip),%rdi
  call   <puts@plt>
  xor    %eax,%eax
  call   <getpid@plt>
  lea    D29(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    %ebp,%esi
  lea    D56(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D87(%rip),%rdi
  call   <puts@plt>
  mov    %r12,%rdi
  call   <wait@plt>
  mov    0x4(%rsp),%edi
  call   <WEXITSTATUS@plt>
  lea    D45(%rip),%rdi
  mov    %eax,%esi
  xor    %eax,%eax
  call   <printf@plt>
  lea    D0(%rip),%rdi
  call   <puts@plt>
  mov    0x8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L15
  add    $0x18,%rsp
  xor    %eax,%eax
  pop    %rbp
  pop    %r12
  ret
L33:
  lea    D63(%rip),%rdi
  call   <perror@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  jmp    L18
L15:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: tag: D115
type_guessed: string
name: unpack_data
arguments: tag: D96
type_guessed: string
name: unpack_data
arguments: tag: D73
type_guessed: string
name: unpack_data
arguments: tag: D14
type_guessed: string
name: unpack_data
arguments: tag: D114
type_guessed: string
name: unpack_data
arguments: tag: D59
type_guessed: string
name: unpack_data
arguments: tag: D62
type_guessed: string
name: unpack_data
arguments: tag: D29
type_guessed: string
name: unpack_data
arguments: tag: D56
type_guessed: string
name: unpack_data
arguments: tag: D87
type_guessed: string
name: unpack_data
arguments: tag: D45
type_guessed: string
name: unpack_data
arguments: tag: D0
type_guessed: string
name: unpack_data
arguments: tag: D63
type_guessed: string

tool: D115:  CHILD: This is the child process!

tool: D96:  CHILD: My PID is %d


tool: D73:  CHILD: My parent's PID is %d


tool: D14:  CHILD: Enter my exit status (make it small): 

tool: D114:  %d

tool: D59:  CHILD: I'm outta here!

tool: D62: PARENT: This is the parent process!

tool: D29: PARENT: My PID is %d


tool: D56: PARENT: My child's PID is %d


tool: D87: PARENT: I'm now waiting for my child to exit()...

tool: D45: PARENT: My child's exit status is: %d


tool: D0: PARENT: I'm outta here!

tool: D63: fork

assistant: ```c
int main(void) {
  pid_t pid;
  int rv;
  switch (pid = fork()) {
  case -1:
    perror("fork");
    exit(1);
  case 0:
    printf(" CHILD: This is the child process!\n");
    printf(" CHILD: My PID is %d\n", getpid());
    printf(" CHILD: My parent's PID is %d\n", getppid());
    printf(" CHILD: Enter my exit status (make it small): ");
    scanf(" %d", &rv);
    printf(" CHILD: I'm outta here!\n");
    exit(rv);
  default:
    printf("PARENT: This is the parent process!\n");
    printf("PARENT: My PID is %d\n", getpid());
    printf("PARENT: My child's PID is %d\n", pid);
    printf("PARENT: I'm now waiting for my child to exit()...\n");
    wait(&rv);
    printf("PARENT: My child's exit status is: %d\n", WEXITSTATUS(rv));
    printf("PARENT: I'm outta here!\n");
  }
  return 0;
}
```