user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<getopt>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rdx,%r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    D59(%rip),%rax
  mov    %edi,0x10(%rsp)
  mov    (%rax),%edx
  mov    %rsi,0x8(%rsp)
  test   %edx,%edx
  jne    L59
  movl   $0x1,(%rax)
  mov    $0x1,%edx
  movl   $0x0,D89(%rip)
L59:
  cmp    0x10(%rsp),%edx
  jg     L152
  movslq %edx,%r14
  jmp    L89
  nop
L234:
  cmp    %r14d,D141(%rip)
  je     L75
  mov    %ebp,D141(%rip)
  mov    $0x1,%eax
  movl   $0x0,D141(%rip)
  movq   $0x0,0x18(%rsp)
  movl   $0x0,0x14(%rsp)
L217:
  movsbl (%r15,%rax,1),%r12d
  mov    D0(%rip),%rax
  mov    %r13,%rdi
  mov    %r12d,%esi
  mov    %r12d,(%rax)
  call   <strchr@plt>
  test   %rax,%rax
  je     L97
  cmpb   $0x0,(%rax)
  jne    L45
  mov    D59(%rip),%rax
  add    $0x1,%ebx
  add    $0x1,%r14
  mov    %ebx,(%rax)
  cmp    %r14d,0x10(%rsp)
  jl     L152
L89:
  mov    0x8(%rsp),%rax
  mov    %r14d,%ebx
  mov    %r14d,%ebp
  mov    (%rax,%r14,8),%r15
  test   %r15,%r15
  je     L152
  cmpb   $0x2d,(%r15)
  jne    L152
  movzbl 0x1(%r15),%eax
  test   %al,%al
  je     L152
  cmp    $0x2d,%al
  jne    L234
  cmpb   $0x0,0x2(%r15)
  jne    L234
  mov    D59(%rip),%rax
  add    $0x1,%ebx
  mov    %ebx,(%rax)
  nopl   0x0(%rax,%rax,1)
L152:
  mov    $0xffffffff,%r12d
L61:
  add    $0x28,%rsp
  mov    %r12d,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   0x0(%rax,%rax,1)
L75:
  movslq D141(%rip),%rax
  mov    %eax,0x14(%rsp)
  mov    %rax,0x18(%rsp)
  add    $0x1,%rax
  jmp    L217
  nopl   0x0(%rax)
L97:
  xor    %edi,%edi
  mov    $0x3f,%r12d
  call   <getopterror@plt>
  mov    D59(%rip),%rax
  addl   $0x1,(%rax)
  jmp    L61
  nopl   0x0(%rax)
L45:
  cmpb   $0x3a,0x1(%rax)
  jne    L141
  mov    0x18(%rsp),%rcx
  cmpb   $0x3a,0x2(%rax)
  lea    0x2(%r15,%rcx,1),%rcx
  je     L108
  cmpb   $0x0,(%rcx)
  jne    L108
  mov    0x8(%rsp),%rax
  mov    D149(%rip),%rdx
  add    $0x1,%ebp
  mov    0x8(%rax,%r14,8),%rax
  mov    %rax,(%rdx)
  test   %rax,%rax
  je     L101
L23:
  mov    D59(%rip),%rax
  add    $0x1,%ebp
  mov    %ebp,(%rax)
  jmp    L61
L141:
  mov    0x14(%rsp),%r14d
  add    $0x1,%r14d
  mov    %r14d,D58(%rip)
  jmp    L61
L101:
  mov    D59(%rip),%rax
  mov    $0x3a,%r12d
  mov    %ebp,(%rax)
  cmpb   $0x3a,0x0(%r13)
  je     L61
  mov    $0x1,%edi
  call   <getopterror@plt>
  jmp    L61
L108:
  mov    D149(%rip),%rax
  mov    D59(%rip),%rdx
  mov    %rcx,(%rax)
  cmpb   $0x0,(%rcx)
  mov    (%rdx),%ebp
  jne    L23
  movq   $0x0,(%rax)
  jmp    L23
```

assistant: ```c
int getopt(int argc, char *const argv[], const char *optstring) {
  static int lastidx, lastofs;
  char *tmp;
  if (optind == 0) {
    optind = 1;
    lastidx = 0;
  }
again:
  if (optind > argc || !argv[optind] || *argv[optind] != '-' || argv[optind][1] == 0)
    return -1;
  if (argv[optind][1] == '-' && argv[optind][2] == 0) {
    ++optind;
    return -1;
  }
  if (lastidx != optind) {
    lastidx = optind;
    lastofs = 0;
  }
  optopt = argv[optind][lastofs + 1];
  if ((tmp = strchr(optstring, optopt))) {
    if (*tmp == 0) {
      ++optind;
      goto again;
    }
    if (tmp[1] == ':') {
      if (tmp[2] == ':' || argv[optind][lastofs + 2]) {
        if (!*(optarg = argv[optind] + lastofs + 2))
          optarg = 0;
        goto found;
      }
      optarg = argv[optind + 1];
      if (!optarg) {
        ++optind;
        if (*optstring == ':')
          return ':';
        getopterror(1);
        return ':';
      }
      ++optind;
    } else {
      ++lastofs;
      return optopt;
    }
  found:
    ++optind;
    return optopt;
  } else {
    getopterror(0);
    ++optind;
    return '?';
  }
}
```