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

```asm
<prompt_loop>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  lea    D3(%rip),%r12
  push   %rbp
  push   %rbx
  sub    $0xf8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xe8(%rsp)
  xor    %eax,%eax
  movl   $0x0,0x1c(%rsp)
  lea    0x20(%rsp),%rbx
  nopl   0x0(%rax)
L139:
  cltq
  mov    %r12,%rsi
  lea    (%rbx,%rax,4),%rdi
  call   <strcpy@plt>
  mov    0x1c(%rsp),%eax
  add    $0x1,%eax
  mov    %eax,0x1c(%rsp)
  cmp    $0x7,%eax
  jle    L139
  movl   $0x0,0xc(%rsp)
  lea    0x60(%rsp),%r15
  lea    D94(%rip),%rbp
  movabs $0x6d64612068747561,%r14
  movabs $0x6e696d64613a6e69,%r13
  cs nopw 0x0(%rax,%rax,1)
L97:
  mov    $0x80,%edx
  mov    %r15,%rsi
  mov    %rbp,%rdi
  call   <xreadline@plt>
  test   %rax,%rax
  je     L170
  cmpl   $0x706c6568,(%r15)
  je     L1
L52:
  mov    0x8(%r15),%rax
  mov    (%r15),%rdx
  xor    %r13,%rax
  xor    %r14,%rdx
  or     %rdx,%rax
  jne    L46
  cmpb   $0x0,0x10(%r15)
  jne    L46
L31:
  movl   $0x1,0xc(%rsp)
  jmp    L97
  nopl   (%rax)
L46:
  cmpl   $0x746567,(%r15)
  je     L175
  lea    0x40(%rsp),%rcx
  lea    0x1c(%rsp),%rdx
  mov    %r15,%rdi
  lea    D41(%rip),%rsi
  call   <sscanf@plt>
  cmp    $0x2,%eax
  jne    L127
  mov    0xc(%rsp),%eax
  test   %eax,%eax
  jne    L207
  nop
L127:
  lea    D33(%rip),%rdi
  call   <puts@plt>
  jmp    L97
  nopl   0x0(%rax)
L1:
  cmpb   $0x0,0x4(%r15)
  jne    L52
  lea    D88(%rip),%rdi
  call   <puts@plt>
  lea    D72(%rip),%rdi
  call   <puts@plt>
  lea    D69(%rip),%rdi
  call   <puts@plt>
  lea    D63(%rip),%rdi
  call   <puts@plt>
  jmp    L97
  nopl   0x0(%rax)
L175:
  mov    0xc(%rsp),%edx
  test   %edx,%edx
  je     L127
  lea    0x28(%rsp),%rcx
  lea    0x24(%rsp),%rdx
  sub    $0x8,%rsp
  mov    %rbx,%rsi
  lea    0x44(%rsp),%rax
  lea    D75(%rip),%rdi
  push   %rax
  lea    0x48(%rsp),%rax
  push   %rax
  lea    0x4c(%rsp),%rax
  push   %rax
  xor    %eax,%eax
  lea    0x50(%rsp),%r9
  lea    0x4c(%rsp),%r8
  call   <printf@plt>
  add    $0x20,%rsp
  jmp    L97
  nopl   0x0(%rax)
L170:
  mov    0xe8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L49
  add    $0xf8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L207:
  mov    0x1c(%rsp),%eax
  sub    $0x1,%eax
  cmp    $0x7,%eax
  ja     L127
  cmpw   $0x4e4f,0x40(%rsp)
  je     L179
L80:
  cmpl   $0x46464f,0x40(%rsp)
  jne    L127
  cltq
  mov    %r12,%rsi
  lea    (%rbx,%rax,4),%rdi
  call   <strcpy@plt>
L180:
  lea    D39(%rip),%rdi
  call   <puts@plt>
  jmp    L31
L179:
  cmpb   $0x0,0x42(%rsp)
  jne    L80
  cltq
  lea    D29(%rip),%rsi
  lea    (%rbx,%rax,4),%rdi
  call   <strcpy@plt>
  jmp    L180
L49:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: data_tag: D3
datatype: string
name: parse_data
arguments: data_tag: D94
datatype: string
name: parse_data
arguments: data_tag: D41
datatype: string
name: parse_data
arguments: data_tag: D33
datatype: string
name: parse_data
arguments: data_tag: D88
datatype: string
name: parse_data
arguments: data_tag: D72
datatype: string
name: parse_data
arguments: data_tag: D69
datatype: string
name: parse_data
arguments: data_tag: D63
datatype: string
name: parse_data
arguments: data_tag: D75
datatype: string
name: parse_data
arguments: data_tag: D39
datatype: string
name: parse_data
arguments: data_tag: D29
datatype: string

tool: D3: OFF

tool: D94: httppower> 

tool: D41: post outlet %d=%s

tool: D33: Error

tool: D88: Commands are:

tool: D72:  auth admin:admin

tool: D69:  get

tool: D63:  post outlet [1-8]=ON|OFF

tool: {"D75": "<html>\n<head>\n\n<META HTTP-EQUIV=\"Refresh\" CONTENT=\"300\">\n<title>Outlet Control  - Lite Power Controller</title></head>\n\n<body alink=\"#0000FF\" vlink=\"#0000FF\">\n<FONT FACE=\"Arial, Helvetica, Sans-Serif\">\n<table width=\"100%%\" cellspacing=0 cellpadding=0>\n<tr>\n<td valign=top width=\"17%%\" height=\"100%%\">\n\n    <!-- menu -->\n    <table width=\"100%%\" height=\"100%%\" align=center border=0 cellspacing=1 cellpadding=0>\n    <tr><td valign=top bgcolor=\"#F4F4F4\">\n    <table width=\"100%%\" cellpadding=1 cellspacing=5>\n\n    <tr><td align=center>\n    <table><tr><td><a href=\"http://www.webpowerswitch.com/\"><img src=logo.gif width=195 height=65 border=0></a></td>\n    <td><b><font size=-1>Ethernet Power Controller</font></b></td></tr></table>\n    <hr>\n    </td></tr>\n\n\n\n<tr><td nowrap><b><a href=\"/index.htm\">Outlet Control</a></b></td></tr>\n<tr><td nowrap><b><a href=\"/admin.htm\">Setup</a></b></td></tr>\n\n\n\n<tr><td nowrap><b><a href=\"/ap.htm\">AutoPing</a></b></td></tr>\n<tr><td nowrap><b><a href=\"/logout\">Logout</a></b></td></tr>\n<tr><td nowrap><b><a href=\"http://www.digital-loggers.com/lpchelp.html\">Help</a></b></td></tr>\n\n<tr><td><hr></td></tr>\n\n\n<tr><td><b><a href=\"http://www.digital-loggers.com\">Link 1</a></b></td></tr>\n\n<tr><td><b><a href=\"http://www.digital-loggers.com\">Link 2</a></b></td></tr>\n\n<tr><td><b><a href=\"http://www.digital-loggers.com\">Link 3</a></b></td></tr>\n\n<tr><td><b><a href=\"http://www.digital-loggers.com\">Link 4</a></b></td></tr>\n\n\n    </table>\n    </td></tr>\n\n\n    <tr><td valign=bottom height=\"100%%\" bgcolor=\"#F4F4F4\">\n    <small>Version 1.2.1 (Aug 23 2007 / 20:14:33) 1555A5A1-D43E3FC2</small>\n    </td></tr>\n    <tr><td valign=bottom height=\"100%%\" bgcolor=\"#F4F4F4\">\n    <small>S/N:0000130175</small>\n    </td></tr>\n\n    </table>\n    <!-- /menu -->\n\n</td>\n<td valign=top width=\"83%%\">\n\n    <!-- heading table -->\n    <table width=\"100%%\" align=center border=0 cellspacing=1 cellpadding=3>\n\n        <tr>\n        <th bgcolor=\"#DDDDFF\" align=left>\n        Controller: Lite Power Controller\n        </th>\n        </tr>\n\n        <tr bgcolor=\"#FFFFFF\" align=left>\n        <td>\n        Uptime:     0:35:01 <!-- 2101s up -->\n        </td>\n        </tr>\n\n    </table>\n    <!-- /heading table -->\n\n    <br>\n\n    <!-- individual control table -->\n    <table width=\"100%%\" align=center border=0 cellspacing=1 cellpadding=3>\n\n        <tr>\n        <th bgcolor=\"#DDDDFF\" colspan=5 align=left>\n        Individual Control\n        </th>\n        </tr>\n\n        <!-- heading rows -->\n        <tr bgcolor=\"#DDDDDD\">\n        <th>#</th>\n        <th align=left>Name</th>\n        <th align=left>State</th>\n        <th align=left colspan=2>Action</th>\n        </tr>\n        <!-- /heading rows -->\n\n\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>1</td>\n<td>Outlet 1</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?1=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?1=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>2</td>\n<td>Outlet 2</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?2=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?2=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>3</td>\n<td>Outlet 3</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?3=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?3=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>4</td>\n<td>Outlet 4</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?4=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?4=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>5</td>\n<td>Outlet 5</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?5=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?5=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>6</td>\n<td>Outlet 6</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?6=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?6=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>7</td>\n<td>Outlet 7</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?7=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?7=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>8</td>\n<td>Outlet 8</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?8=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?8=CCL>Cycle</a> -->\n</td></tr>\n\n\n    </table>\n    <!-- /individual control table -->\n\n    <br>\n\n<table width=\"100%%\" align=center border=0 cellspacing=1 cellpadding=3>\n<tr><th bgcolor=\"#DDDDFF\" align=left>Master Control</th></tr>\n<tr><td bgcolor=\"#F4F4F4\" align=left><a href=outlet?a=OFF>All outlets OFF</a></td></tr>\n<tr><td bgcolor=\"#F4F4F4\" align=left><a href=outlet?a=ON>All outlets ON</a></td></tr>\n<tr><td bgcolor=\"#F4F4F4\" align=left><a href=outlet?a=CCL>Cycle all outlets</a></td></tr>\n\n<tr><td align=center>Sequence delay: 1 sec.</td></tr>\n\n</table>\n\n\n</td>\n</tr>\n</table>\n\n</body>\n</html>\n"}

tool: D39: <HTML><HEAD>

<META HTTP-EQUIV="refresh" content="0; URL=/index.htm">

</HEAD><BODY></BODY>

tool: D29: ON

assistant: ```c
void prompt_loop(void) {
  char buf[128], tmp[32];
  char plug[8][4];
  int num_plugs = 8;
  int plug_origin = 1;
  int i;
  int authenticated = 0;
  for (i = 0; i < num_plugs; i++)
    strcpy(plug[i], "OFF");
  for (;;) {
    if (xreadline("httppower> ", buf, sizeof(buf)) == NULL)
      break;
    if (!strcmp(buf, "help")) {
      printf("Commands are:\n");
      printf(" auth admin:admin\n");
      printf(" get\n");
      printf(" post outlet [1-8]=ON|OFF\n");
    } else if (!strcmp(buf, "auth admin:admin")) {
      authenticated = 1;
    } else if (!strcmp(buf, "get")) {
      if (!authenticated)
        goto err;
      printf("<html>\n<head>\n\n<META HTTP-EQUIV=\"Refresh\" CONTENT=\"300\">\n<title>Outlet Control  - Lite Power Controller</title></head>\n\n<body alink=\"#0000FF\" vlink=\"#0000FF\">\n<FONT FACE=\"Arial, Helvetica, Sans-Serif\">\n<table width=\"100%%\" cellspacing=0 cellpadding=0>\n<tr>\n<td valign=top width=\"17%%\" height=\"100%%\">\n\n    <!-- menu -->\n    <table width=\"100%%\" height=\"100%%\" align=center border=0 cellspacing=1 cellpadding=0>\n    <tr><td valign=top bgcolor=\"#F4F4F4\">\n    <table width=\"100%%\" cellpadding=1 cellspacing=5>\n\n    <tr><td align=center>\n    <table><tr><td><a href=\"http://www.webpowerswitch.com/\"><img src=logo.gif width=195 height=65 border=0></a></td>\n    <td><b><font size=-1>Ethernet Power Controller</font></b></td></tr></table>\n    <hr>\n    </td></tr>\n\n\n\n<tr><td nowrap><b><a href=\"/index.htm\">Outlet Control</a></b></td></tr>\n<tr><td nowrap><b><a href=\"/admin.htm\">Setup</a></b></td></tr>\n\n\n\n<tr><td nowrap><b><a href=\"/ap.htm\">AutoPing</a></b></td></tr>\n<tr><td nowrap><b><a href=\"/logout\">Logout</a></b></td></tr>\n<tr><td nowrap><b><a href=\"http://www.digital-loggers.com/lpchelp.html\">Help</a></b></td></tr>\n\n<tr><td><hr></td></tr>\n\n\n<tr><td><b><a href=\"http://www.digital-loggers.com\">Link 1</a></b></td></tr>\n\n<tr><td><b><a href=\"http://www.digital-loggers.com\">Link 2</a></b></td></tr>\n\n<tr><td><b><a href=\"http://www.digital-loggers.com\">Link 3</a></b></td></tr>\n\n<tr><td><b><a href=\"http://www.digital-loggers.com\">Link 4</a></b></td></tr>\n\n\n    </table>\n    </td></tr>\n\n\n    <tr><td valign=bottom height=\"100%%\" bgcolor=\"#F4F4F4\">\n    <small>Version 1.2.1 (Aug 23 2007 / 20:14:33) 1555A5A1-D43E3FC2</small>\n    </td></tr>\n    <tr><td valign=bottom height=\"100%%\" bgcolor=\"#F4F4F4\">\n    <small>S/N:0000130175</small>\n    </td></tr>\n\n    </table>\n    <!-- /menu -->\n\n</td>\n<td valign=top width=\"83%%\">\n\n    <!-- heading table -->\n    <table width=\"100%%\" align=center border=0 cellspacing=1 cellpadding=3>\n\n        <tr>\n        <th bgcolor=\"#DDDDFF\" align=left>\n        Controller: Lite Power Controller\n        </th>\n        </tr>\n\n        <tr bgcolor=\"#FFFFFF\" align=left>\n        <td>\n        Uptime:     0:35:01 <!-- 2101s up -->\n        </td>\n        </tr>\n\n    </table>\n    <!-- /heading table -->\n\n    <br>\n\n    <!-- individual control table -->\n    <table width=\"100%%\" align=center border=0 cellspacing=1 cellpadding=3>\n\n        <tr>\n        <th bgcolor=\"#DDDDFF\" colspan=5 align=left>\n        Individual Control\n        </th>\n        </tr>\n\n        <!-- heading rows -->\n        <tr bgcolor=\"#DDDDDD\">\n        <th>#</th>\n        <th align=left>Name</th>\n        <th align=left>State</th>\n        <th align=left colspan=2>Action</th>\n        </tr>\n        <!-- /heading rows -->\n\n\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>1</td>\n<td>Outlet 1</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?1=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?1=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>2</td>\n<td>Outlet 2</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?2=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?2=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>3</td>\n<td>Outlet 3</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?3=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?3=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>4</td>\n<td>Outlet 4</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?4=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?4=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>5</td>\n<td>Outlet 5</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?5=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?5=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>6</td>\n<td>Outlet 6</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?6=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?6=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>7</td>\n<td>Outlet 7</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?7=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?7=CCL>Cycle</a> -->\n</td></tr>\n\n\n<tr bgcolor=\"#F4F4F4\"><td align=center>8</td>\n<td>Outlet 8</td><td>\n<b><font color=red>%s</font></b></td><td>\n<a href=outlet?8=ON>Switch ON</a>\n</td><td>\n<!-- <a href=outlet?8=CCL>Cycle</a> -->\n</td></tr>\n\n\n    </table>\n    <!-- /individual control table -->\n\n    <br>\n\n<table width=\"100%%\" align=center border=0 cellspacing=1 cellpadding=3>\n<tr><th bgcolor=\"#DDDDFF\" align=left>Master Control</th></tr>\n<tr><td bgcolor=\"#F4F4F4\" align=left><a href=outlet?a=OFF>All outlets OFF</a></td></tr>\n<tr><td bgcolor=\"#F4F4F4\" align=left><a href=outlet?a=ON>All outlets ON</a></td></tr>\n<tr><td bgcolor=\"#F4F4F4\" align=left><a href=outlet?a=CCL>Cycle all outlets</a></td></tr>\n\n<tr><td align=center>Sequence delay: 1 sec.</td></tr>\n\n</table>\n\n\n</td>\n</tr>\n</table>\n\n</body>\n</html>\n", plug[0], plug[1], plug[2], plug[3], plug[4], plug[5], plug[6], plug[7]);
    } else if (sscanf(buf, "post outlet %d=%s", &i, tmp) == 2) {
      if (!authenticated)
        goto err;
      if (i < plug_origin || i >= num_plugs + plug_origin)
        goto err;
      if (!strcmp(tmp, "ON"))
        strcpy(plug[i - plug_origin], "ON");
      else if (!strcmp(tmp, "OFF"))
        strcpy(plug[i - plug_origin], "OFF");
      else
        goto err;
      printf("<HTML><HEAD>\n\n<META HTTP-EQUIV=\"refresh\" content=\"0; URL=/index.htm\">\n\n</HEAD><BODY></BODY>\n");
    } else
      goto err;
    continue;
  err:
    printf("Error\n");
  }
}
```