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

```asm
<ifconf>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  mov    %rsi,%rbx
  mov    %rdi,%rsi
  lea    D42(%rip),%rdi
  sub    $0x50,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  call   <ssystem@plt>
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  xor    %eax,%eax
  lea    D49(%rip),%rdi
  call   <ssystem@plt>
  movsbl (%rbx),%eax
  pxor   %xmm0,%xmm0
  movaps %xmm0,(%rsp)
  movaps %xmm0,0x10(%rsp)
  test   %al,%al
  je     L180
  cmp    $0x2f,%al
  je     L180
  lea    0x1(%rbx),%rcx
  xor    %r8d,%r8d
  xor    %edx,%edx
  xor    %esi,%esi
  jmp    L242
  nopw   0x0(%rax,%rax,1)
L236:
  lea    -0x30(%rax),%edx
  and    $0xdf,%eax
  movslq %esi,%rdi
  sub    $0x37,%eax
  cmp    $0x9,%edx
  cmovg  %eax,%edx
  mov    (%rsp,%rdi,4),%eax
  add    $0x1,%rcx
  shl    $0x4,%eax
  add    %edx,%eax
  xor    %edx,%edx
  mov    %eax,(%rsp,%rdi,4)
  movsbl -0x1(%rcx),%eax
  cmp    $0x2f,%al
  je     L109
L278:
  test   %al,%al
  je     L109
L242:
  cmp    $0x3a,%al
  jne    L236
  test   %edx,%edx
  cmovne %esi,%r8d
  add    $0x1,%esi
  cmp    $0x7,%esi
  jg     L109
  movsbl (%rcx),%eax
  add    $0x1,%rcx
  mov    $0x1,%edx
  cmp    $0x2f,%al
  jne    L278
  nopl   0x0(%rax,%rax,1)
L109:
  mov    $0x8,%eax
  sub    %esi,%eax
  test   %eax,%eax
  jle    L218
  cmp    %r8d,%esi
  jle    L21
  movslq %esi,%rdx
  mov    (%rsp,%rdx,4),%ecx
  mov    %ecx,0x1c(%rsp)
  movl   $0x0,(%rsp,%rdx,4)
L126:
  cmp    $0x1,%eax
  je     L218
  lea    -0x1(%rsi),%edx
  cmp    %edx,%r8d
  jge    L82
  movslq %edx,%rdx
  mov    (%rsp,%rdx,4),%ecx
  mov    %ecx,0x18(%rsp)
  movl   $0x0,(%rsp,%rdx,4)
L287:
  cmp    $0x2,%eax
  je     L218
  lea    -0x2(%rsi),%edx
  cmp    %r8d,%edx
  jle    L315
  movslq %edx,%rdx
  mov    (%rsp,%rdx,4),%ecx
  mov    %ecx,0x14(%rsp)
  movl   $0x0,(%rsp,%rdx,4)
L272:
  cmp    $0x3,%eax
  je     L218
  lea    -0x3(%rsi),%edx
  cmp    %r8d,%edx
  jle    L187
  movslq %edx,%rdx
  mov    (%rsp,%rdx,4),%ecx
  mov    %ecx,0x10(%rsp)
  movl   $0x0,(%rsp,%rdx,4)
L226:
  cmp    $0x4,%eax
  je     L218
  lea    -0x4(%rsi),%edx
  cmp    %r8d,%edx
  jle    L85
  movslq %edx,%rdx
  mov    (%rsp,%rdx,4),%ecx
  mov    %ecx,0xc(%rsp)
  movl   $0x0,(%rsp,%rdx,4)
L168:
  cmp    $0x5,%eax
  je     L218
  lea    -0x5(%rsi),%edx
  cmp    %r8d,%edx
  jle    L284
  movslq %edx,%rdx
  mov    (%rsp,%rdx,4),%ecx
  mov    %ecx,0x8(%rsp)
  movl   $0x0,(%rsp,%rdx,4)
L7:
  cmp    $0x6,%eax
  je     L218
  lea    -0x6(%rsi),%edx
  cmp    %r8d,%edx
  jle    L32
  movslq %edx,%rdx
  mov    (%rsp,%rdx,4),%ecx
  mov    %ecx,0x4(%rsp)
  movl   $0x0,(%rsp,%rdx,4)
L239:
  cmp    $0x8,%eax
  jne    L218
  sub    $0x7,%esi
  cmp    %r8d,%esi
  jg     L70
  nopw   0x0(%rax,%rax,1)
L218:
  mov    0x4(%rsp),%edx
  lea    0x20(%rsp),%r12
  mov    0x1c(%rsp),%r9d
  lea    D7(%rip),%rsi
  mov    0xc(%rsp),%r8d
  mov    0x8(%rsp),%ecx
  mov    %r12,%rdi
  and    $0xfefd,%edx
  call   <sprintf@plt>
  xor    %eax,%eax
  mov    %r12,%rdx
  mov    %rbp,%rsi
  lea    D12(%rip),%rdi
  call   <ssystem@plt>
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L210
  add    $0x50,%rsp
  mov    %rbp,%rsi
  lea    D22(%rip),%rdi
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  jmp    1080 <ssystem@plt>
  nopl   (%rax)
L21:
  movl   $0x0,0x1c(%rsp)
  jmp    L126
L180:
  movl   $0x0,0x1c(%rsp)
  mov    $0x8,%eax
  xor    %esi,%esi
  xor    %r8d,%r8d
  nopw   0x0(%rax,%rax,1)
L82:
  movl   $0x0,0x18(%rsp)
  jmp    L287
  nopl   (%rax)
L315:
  movl   $0x0,0x14(%rsp)
  jmp    L272
  nopl   (%rax)
L187:
  movl   $0x0,0x10(%rsp)
  jmp    L226
  nopl   (%rax)
L85:
  movl   $0x0,0xc(%rsp)
  jmp    L168
  nopl   (%rax)
L284:
  movl   $0x0,0x8(%rsp)
  jmp    L7
  nopl   (%rax)
L32:
  movl   $0x0,0x4(%rsp)
  jmp    L239
  nopl   (%rax)
L70:
  movslq %esi,%rsi
  movl   $0x0,(%rsp,%rsi,4)
  jmp    L218
L210:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D42
data_type: string
name: disassemble_data
arguments: tag: D49
data_type: string
name: disassemble_data
arguments: tag: D7
data_type: string
name: disassemble_data
arguments: tag: D12
data_type: string
name: disassemble_data
arguments: tag: D22
data_type: string

tool: D42: ifconfig %s inet `hostname` up

tool: D49: ifconfig %s add %s

tool: D7: fe80::%x:%x:%x:%x

tool: D12: ifconfig %s add %s/64

tool: D22: ifconfig %s


assistant: ```c
void ifconf(char *tundev, char *ipaddr) {
  ssystem("ifconfig %s inet `hostname` up", tundev);
  ssystem("ifconfig %s add %s", tundev, ipaddr);
  {
    char lladdr[40];
    char c, *ptr = (char *)ipaddr;
    uint16_t digit, ai, a[8], cc, scc, i;
    for (ai = 0; ai < 8; ai++) {
      a[ai] = 0;
    }
    ai = 0;
    cc = scc = 0;
    while (c = *ptr++) {
      if (c == '/')
        break;
      if (c == ':') {
        if (cc)
          scc = ai;
        cc = 1;
        if (++ai > 7)
          break;
      } else {
        cc = 0;
        digit = c - '0';
        if (digit > 9)
          digit = 10 + (c & 0xdf) - 'A';
        a[ai] = (a[ai] << 4) + digit;
      }
    }
    cc = 8 - ai;
    for (i = 0; i < cc; i++) {
      if ((8 - i - cc) <= scc) {
        a[7 - i] = 0;
      } else {
        a[7 - i] = a[8 - i - cc];
        a[8 - i - cc] = 0;
      }
    }
    sprintf(lladdr, "fe80::%x:%x:%x:%x", a[1] & 0xfefd, a[2], a[3], a[7]);
    ssystem("ifconfig %s add %s/64", tundev, lladdr);
  }
  ssystem("ifconfig %s\n", tundev);
}
```