user: 请从给定的汇编指令推导出C源代码:

```asm
<randnorep>:
  endbr64
  push   %r12
  push   %rbp
  push   %rbx
  mov    %edi,%ebx
  mov    %rsi,%r12
  cmpq   $0x0,D113(%rip)
  je     L28
L232:
  cmp    $0xfffffffc,%ebx
  je     L151
  cmp    $0xffffffff,%ebx
  je     L278
  cmp    $0xfffffffe,%ebx
  je     L306
  cmp    $0xfffffffd,%ebx
  jne    L205
  mov    D97(%rip),%esi
  test   %esi,%esi
  je     L41
  mov    (%r12),%ecx
  mov    D113(%rip),%r8
  test   %r8,%r8
  je     L96
  mov    %r8,%rdi
  mov    $0x0,%edx
  jmp    L261
L28:
  mov    $0x10,%edi
  call   <malloc@plt>
  mov    %rax,D53(%rip)
  movq   $0x0,0x8(%rax)
  mov    %rax,D53(%rip)
  jmp    L232
L151:
  cmpl   $0x0,(%r12)
  jle    L396
  mov    D53(%rip),%rax
  mov    0x8(%rax),%rbx
  test   %rbx,%rbx
  je     L90
L392:
  mov    %rbx,%rdi
  mov    0x8(%rbx),%rbx
  call   <free@plt>
  test   %rbx,%rbx
  jne    L392
L90:
  mov    D53(%rip),%rbp
  movq   $0x0,0x8(%rbp)
  mov    (%r12),%eax
  mov    %eax,D198(%rip)
  test   %eax,%eax
  jle    L202
  mov    $0x0,%ebx
L44:
  mov    %ebx,0x0(%rbp)
  mov    $0x10,%edi
  call   <malloc@plt>
  mov    %rbp,%r12
  mov    %rax,%rbp
  mov    %rax,0x8(%r12)
  movq   $0x0,0x8(%rax)
  add    $0x1,%ebx
  cmp    %ebx,D198(%rip)
  jg     L44
L292:
  mov    %rbp,%rdi
  call   <free@plt>
  movq   $0x0,0x8(%r12)
  mov    $0x0,%eax
L18:
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L202:
  mov    $0x0,%r12d
  jmp    L292
L278:
  mov    D198(%rip),%esi
  test   %esi,%esi
  je     L333
  mov    $0x0,%edi
  call   <randmm@plt>
  mov    D53(%rip),%rdi
  test   %eax,%eax
  jle    L140
  mov    $0x0,%edx
L2:
  mov    %rdi,%rcx
  mov    0x8(%rdi),%rdi
  add    $0x1,%edx
  cmp    %edx,%eax
  jne    L2
  mov    (%rdi),%eax
  mov    %eax,(%r12)
  mov    D198(%rip),%eax
  lea    -0x1(%rax),%edx
  mov    %edx,D198(%rip)
  mov    $0x0,%eax
  test   %edx,%edx
  jle    L18
  mov    0x8(%rdi),%rax
  mov    %rax,0x8(%rcx)
L377:
  call   <free@plt>
  mov    $0x0,%eax
  jmp    L18
L306:
  cmpl   $0x0,D198(%rip)
  je     L317
  mov    D53(%rip),%rax
  test   %rax,%rax
  je     L88
  mov    (%rax),%edx
  mov    %edx,(%r12)
  mov    0x8(%rax),%rax
  mov    %rax,D198(%rip)
  mov    $0x0,%eax
  jmp    L18
L88:
  mov    D53(%rip),%rax
  mov    %rax,D198(%rip)
  mov    %ebx,%eax
  jmp    L18
L149:
  mov    %rax,%rdi
L261:
  cmp    %ecx,(%rdi)
  je     L237
  mov    0x8(%rdi),%rax
  mov    %rdi,%rdx
  test   %rax,%rax
  jne    L149
  mov    %ebx,%eax
  jmp    L18
L241:
  mov    0x8(%r8),%rax
  mov    %rax,D198(%rip)
  mov    %rax,D198(%rip)
  jmp    L197
L396:
  mov    $0xfffffffd,%eax
  jmp    L18
L333:
  mov    %ebx,%eax
  jmp    L18
L317:
  mov    %ebx,%eax
  jmp    L18
L205:
  mov    $0xfffffffd,%eax
  jmp    L18
L41:
  mov    $0xffffffff,%eax
  jmp    L18
L96:
  mov    %ebx,%eax
  jmp    L18
L255:
  mov    $0x0,%eax
  jmp    L18
L140:
  mov    (%rdi),%eax
  mov    %eax,(%r12)
  mov    D198(%rip),%eax
  sub    $0x1,%eax
  mov    %eax,D198(%rip)
  test   %eax,%eax
  jle    L255
  mov    0x8(%rdi),%rax
  mov    %rax,D198(%rip)
  mov    %rax,D198(%rip)
  jmp    L377
L237:
  sub    $0x1,%esi
  mov    %esi,D198(%rip)
  mov    $0x0,%eax
  test   %esi,%esi
  jle    L18
  test   %rdx,%rdx
  je     L241
  mov    0x8(%rdi),%rax
  mov    %rax,0x8(%rdx)
L197:
  call   <free@plt>
  mov    $0x0,%eax
  jmp    L18
```

assistant: ```c
int randnorep(int mode, int *n) {
  struct listnum {
    int num;
    struct listnum *prox;
  };
  static int listqtd = 0;
  static struct listnum *lcab = NULL;
  struct listnum *ln = NULL, *lant = NULL;
  static struct listnum *lista = NULL;
  int j;
  int sort;
  if (lcab == NULL) {
    lcab = (struct listnum *)malloc(sizeof(struct listnum));
    lcab->prox = NULL;
    lista = lcab;
  }
  if (mode == -4) {
    if (*n < 1)
      return -3;
    lant = lcab->prox;
    while (lant != NULL) {
      ln = lant->prox;
      free(lant);
      lant = ln;
    }
    lcab->prox = NULL;
    listqtd = *n;
    ln = lcab;
    for (j = 0; j < listqtd; j++) {
      ln->num = j;
      ln->prox = (struct listnum *)malloc(sizeof(struct listnum));
      lant = ln;
      ln = ln->prox;
      ln->prox = NULL;
    }
    free(ln);
    lant->prox = NULL;
    return 0;
  } else if (mode == -1) {
    if (listqtd == 0)
      return -1;
    sort = randmm(0, listqtd);
    ln = lcab;
    lant = NULL;
    for (j = 0; j < sort; j++) {
      lant = ln;
      ln = ln->prox;
    }
    *n = ln->num;
    listqtd--;
    if (listqtd <= 0)
      return 0;
    if (lant != NULL)
      lant->prox = ln->prox;
    else {
      lcab = lcab->prox;
      lista = lcab;
    }
    free(ln);
    return 0;
  } else if (mode == -2) {
    if (listqtd == 0)
      return -2;
    if (lista == NULL) {
      lista = lcab;
      return -2;
    }
    while (lista != NULL) {
      *n = lista->num;
      lista = lista->prox;
      return 0;
    }
  } else if (mode == -3) {
    if (listqtd == 0)
      return -1;
    sort = *n;
    ln = lcab;
    lant = NULL;
    while (ln != NULL) {
      if (ln->num == sort)
        break;
      lant = ln;
      ln = ln->prox;
    }
    if (ln == NULL)
      return -3;
    listqtd--;
    if (listqtd <= 0)
      return 0;
    if (lant != NULL)
      lant->prox = ln->prox;
    else {
      lcab = lcab->prox;
      lista = lcab;
    }
    free(ln);
    return 0;
  }
  return -3;
}
```