user: Converte this assembly snippet into its equivalent C code:

```asm
<_prompt_loop>:
  endbr64
  push   %r15
  mov    $0x18,%ecx
  push   %r14
  push   %r13
  lea    D105(%rip),%r13
  push   %r12
  lea    D80(%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    L48
  nopl   (%rax)
L36:
  cmp    %rbp,(%rbx)
  je     L225
L56:
  cmpl   $0x74617473,(%rbx)
  je     L155
L223:
  lea    0xc(%rsp),%r14
  lea    D12(%rip),%rsi
  mov    %rbx,%rdi
  mov    %r14,%rdx
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L202
  mov    0xc(%rsp),%esi
  lea    -0x1(%rsi),%eax
  mov    %eax,0xc(%rsp)
  cmp    $0x2f,%eax
  ja     L95
  cltq
  lea    D76(%rip),%rdx
  lea    D27(%rip),%r15
  mov    0x10(%rsp,%rax,4),%eax
  mov    %r15,%rdi
  test   %eax,%eax
  cmove  %r13,%rdx
  xor    %eax,%eax
  call   <printf@plt>
  nopl   (%rax)
L281:
  lea    D86(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
L48:
  mov    $0x80,%edx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  call   <xreadline@plt>
  test   %rax,%rax
  je     L95
  cmpb   $0x0,0xd0(%rsp)
  je     L281
  cmp    %rbp,(%rbx)
  jne    L36
  cmpl   $0x6e6f20,0x8(%rbx)
  je     L281
  cmp    %rbp,(%rbx)
  jne    L56
L225:
  cmpl   $0x66666f20,0x8(%rbx)
  jne    L56
  cmpb   $0x0,0xc(%rbx)
  je     L281
  cmpl   $0x74617473,(%rbx)
  jne    L223
  nopl   0x0(%rax,%rax,1)
L155:
  cmpw   $0x7375,0x4(%rbx)
  jne    L223
  cmpb   $0x0,0x6(%rbx)
  jne    L223
  xor    %esi,%esi
  movl   $0x0,0xc(%rsp)
  lea    D27(%rip),%r15
  lea    D76(%rip),%r14
  jmp    L206
  nopl   0x0(%rax,%rax,1)
L105:
  mov    %r14,%rdx
L193:
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    0xc(%rsp),%eax
  lea    0x1(%rax),%esi
  mov    %esi,0xc(%rsp)
  cmp    $0x2f,%esi
  jg     L281
L206:
  movslq %esi,%rax
  add    $0x1,%esi
  mov    0x10(%rsp,%rax,4),%edx
  test   %edx,%edx
  jne    L105
  mov    %r13,%rdx
  jmp    L193
  nopl   0x0(%rax)
L202:
  mov    %r14,%rdx
  lea    D52(%rip),%rsi
  mov    %rbx,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L129
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0xc(%rsp)
  cmp    $0x2f,%eax
  ja     L95
  cltq
  movl   $0x1,0x10(%rsp,%rax,4)
  jmp    L281
  xchg   %ax,%ax
L95:
  lea    D91(%rip),%rdi
  xor    %eax,%eax
  call   <printf@plt>
  mov    $0x1,%edi
  call   <exit@plt>
  mov    0x158(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L94
  add    $0x168,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax)
L129:
  mov    %r14,%rdx
  lea    D26(%rip),%rsi
  mov    %rbx,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L43
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0xc(%rsp)
  cmp    $0x2f,%eax
  ja     L95
  cltq
  movl   $0x0,0x10(%rsp,%rax,4)
  jmp    L281
  xchg   %ax,%ax
L43:
  mov    %r14,%rdx
  lea    D102(%rip),%rsi
  mov    %rbx,%rdi
  call   <sscanf@plt>
  cmp    $0x1,%eax
  jne    L95
  mov    0xc(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0xc(%rsp)
  cmp    $0x2f,%eax
  ja     L95
  cltq
  mov    $0x2,%edi
  movl   $0x0,0x10(%rsp,%rax,4)
  call   <sleep@plt>
  movslq 0xc(%rsp),%rax
  movl   $0x1,0x10(%rsp,%rax,4)
  jmp    L281
L94:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D105
datatype: string
name: retrieve_data
arguments: label: D80
datatype: string
name: retrieve_data
arguments: label: D12
datatype: string
name: retrieve_data
arguments: label: D76
datatype: string
name: retrieve_data
arguments: label: D27
datatype: string
name: retrieve_data
arguments: label: D86
datatype: string
name: retrieve_data
arguments: label: D52
datatype: string
name: retrieve_data
arguments: label: D91
datatype: string
name: retrieve_data
arguments: label: D26
datatype: string
name: retrieve_data
arguments: label: D102
datatype: string

tool: D105: off

tool: 

tool: D12: status %d

tool: D76: on

tool: D27: plug %d: %s


tool: D86: swpdu> 

tool: D52: on %d

tool: D91: Error, exiting

tool: D26: off %d

tool: D102: 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);
}
```