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

```asm
<_prompt_loop>:
  endbr64
  push   %r15
  mov    $0x18,%ecx
  push   %r14
  push   %r13
  push   %r12
  lea    D92(%rip),%r12
  push   %rbp
  movabs $0x65676e6172707865,%rbp
  push   %rbx
  sub    $0x168,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x158(%rsp)
  xor    %eax,%eax
  lea    0x10(%rsp),%rdx
  movl   $0x30,0xc(%rsp)
  lea    0xd0(%rsp),%rbx
  mov    %rdx,%rdi
  rep stos %rax,%es:(%rdi)
  jmp    L221
  xchg   %ax,%ax
L54:
  cmp    %rbp,(%rbx)
  je     L194
L19:
  cmpl   $0x74617473,(%rbx)
  je     L95
L22:
  lea    0xc(%rsp),%r13
  lea    D90(%rip),%rsi
  mov    %rbx,%rdi
  mov    %r13,%rdx
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L64
  mov    0xc(%rsp),%esi
  lea    -0x1(%rsi),%eax
  mov    %eax,0xc(%rsp)
  cmp    $0x2f,%eax
  ja     L96
  cltq
  lea    D106(%rip),%rdx
  lea    D20(%rip),%r15
  mov    0x10(%rsp,%rax,4),%eax
  mov    %r15,%rdi
  test   %eax,%eax
  lea    D34(%rip),%rax
  cmove  %rax,%rdx
  xor    %eax,%eax
  call   <printf@plt>
  nopl   0x0(%rax)
L244:
  lea    D68(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L221:
  mov    $0x80,%edx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <xreadline@plt>
  test   %rax,%rax
  je     L96
  cmpb   $0x0,0xd0(%rsp)
  je     L244
  cmp    %rbp,(%rbx)
  jne    L54
  cmpl   $0x6e6f20,0x8(%rbx)
  je     L244
  cmp    %rbp,(%rbx)
  jne    L19
L194:
  cmpl   $0x66666f20,0x8(%rbx)
  jne    L19
  cmpb   $0x0,0xc(%rbx)
  je     L244
  cmpl   $0x74617473,(%rbx)
  jne    L22
  nopl   0x0(%rax,%rax,1)
L95:
  cmpw   $0x7375,0x4(%rbx)
  jne    L22
  cmpb   $0x0,0x6(%rbx)
  jne    L22
  xor    %esi,%esi
  movl   $0x0,0xc(%rsp)
  lea    D20(%rip),%r15
  lea    D106(%rip),%r14
  lea    D34(%rip),%r13
  nopl   (%rax)
L110:
  movslq %esi,%rax
  mov    %r15,%rdi
  mov    0x10(%rsp,%rax,4),%edx
  test   %edx,%edx
  mov    %r13,%rdx
  cmovne %r14,%rdx
  add    $0x1,%esi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0xc(%rsp),%eax
  lea    0x1(%rax),%esi
  mov    %esi,0xc(%rsp)
  cmp    $0x2f,%esi
  jle    L110
  jmp    L244
  nopw   0x0(%rax,%rax,1)
L64:
  mov    %r13,%rdx
  lea    D93(%rip),%rsi
  mov    %rbx,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L148
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0xc(%rsp)
  cmp    $0x2f,%eax
  ja     L96
  cltq
  movl   $0x1,0x10(%rsp,%rax,4)
  jmp    L244
  xchg   %ax,%ax
L96:
  lea    D123(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  mov    0x158(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L12
  add    $0x168,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L148:
  mov    %r13,%rdx
  lea    D3(%rip),%rsi
  mov    %rbx,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L250
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0xc(%rsp)
  cmp    $0x2f,%eax
  ja     L96
  cltq
  movl   $0x0,0x10(%rsp,%rax,4)
  jmp    L244
  xchg   %ax,%ax
L250:
  mov    %r13,%rdx
  lea    D65(%rip),%rsi
  mov    %rbx,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L96
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0xc(%rsp)
  cmp    $0x2f,%eax
  ja     L96
  cltq
  mov    $0x2,%edi
  movl   $0x0,0x10(%rsp,%rax,4)
  call   <sleep@plt>
  movslq 0xc(%rsp),%rax
  movl   $0x1,0x10(%rsp,%rax,4)
  jmp    L244
L12:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D92
type_infered: string
name: retrieve_data
arguments: label: D90
type_infered: string
name: retrieve_data
arguments: label: D106
type_infered: string
name: retrieve_data
arguments: label: D20
type_infered: string
name: retrieve_data
arguments: label: D34
type_infered: string
name: retrieve_data
arguments: label: D68
type_infered: string
name: retrieve_data
arguments: label: D93
type_infered: string
name: retrieve_data
arguments: label: D123
type_infered: string
name: retrieve_data
arguments: label: D3
type_infered: string
name: retrieve_data
arguments: label: D65
type_infered: string

tool: 

tool: D90: status %d

tool: D106: on

tool: D20: plug %d: %s


tool: D34: off

tool: D68: swpdu> 

tool: D93: on %d

tool: D123: Error, exiting

tool: D3: off %d

tool: D65: cycle %d

assistant: ```c
void _prompt_loop(void) {
  int i;
  char buf[128];
  int num_plugs = 48;
  int plug[48];
  int plug_origin = 1;
  for (i = 0; i < num_plugs; i++) {
    plug[i] = 0;
  }
  while (1) {
    if (xreadline("", buf, sizeof(buf)) == NULL)
      break;
    if (strlen(buf) == 0) {
    } else if (!strcmp(buf, "exprange on")) {
    } else if (!strcmp(buf, "exprange off")) {
    } else if (!strcmp(buf, "status")) {
      for (i = 0; i < num_plugs; i++)
        printf("plug %d: %s\n", i + plug_origin, plug[i] ? "on" : "off");
    } else if (sscanf(buf, "status %d", &i) == 1) {
      i -= plug_origin;
      if (i < 0 || i >= num_plugs)
        break;
      printf("plug %d: %s\n", i + plug_origin, plug[i] ? "on" : "off");
    } else if (sscanf(buf, "on %d", &i) == 1) {
      i -= plug_origin;
      if (i < 0 || i >= num_plugs)
        break;
      plug[i] = 1;
    } else if (sscanf(buf, "off %d", &i) == 1) {
      i -= plug_origin;
      if (i < 0 || i >= num_plugs)
        break;
      plug[i] = 0;
    } else if (sscanf(buf, "cycle %d", &i) == 1) {
      i -= plug_origin;
      if (i < 0 || i >= num_plugs)
        break;
      plug[i] = 0;
      sleep(2);
      plug[i] = 1;
    } else
      break;
    printf("swpdu> ");
  }
  printf("Error, exiting");
  exit(1);
}
```