user: 下面的汇编指令对应的C源代码是什么:

```asm
<roll_check>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  movslq %edi,%rbx
  imul   $0x55555556,%rbx,%rbx
  sub    $0x20,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x18(%rsp)
  xor    %eax,%eax
  mov    %edi,%eax
  shr    $0x20,%rbx
  movl   $0x0,0x10(%rsp)
  movq   $0x0,0x8(%rsp)
  sar    $0x1f,%eax
  sub    %eax,%ebx
  xor    %eax,%eax
  cmp    $0xfffffffe,%edi
  jl     L254
  lea    (%rbx,%rbx,2),%edx
  mov    %edi,%eax
  sub    %edx,%eax
  lea    0x1(%rax,%rax,1),%r12d
  jne    L397
  cmp    $0x2,%edi
  jg     L292
  movl   $0x0,0x8(%rsp)
L262:
  mov    0xc(%rsp),%eax
  add    0x8(%rsp),%eax
  add    0x10(%rsp),%eax
L254:
  mov    0x18(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L335
  add    $0x20,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L292:
  mov    $0x6,%edi
  call   <randval@plt>
  lea    0x1(%rax),%ebp
  mov    %ebp,0x8(%rsp)
  cmp    $0x1,%ebx
  jne    L288
  movl   $0x0,0xc(%rsp)
  jmp    L262
L288:
  mov    $0x6,%edi
  call   <randval@plt>
  lea    0x1(%rax),%r12d
  mov    %r12d,0xc(%rsp)
  cmp    $0x2,%ebx
  jne    L102
  movl   $0x0,0x10(%rsp)
  jmp    L262
  nopw   0x0(%rax,%rax,1)
L102:
  mov    $0x6,%edi
  call   <randval@plt>
  lea    0x1(%rax),%r13d
  xor    %eax,%eax
  mov    %r13d,0x10(%rsp)
  cmp    $0x3,%ebx
  jne    L283
L359:
  cmp    %eax,%ebp
  jl     L59
  mov    %ebp,%edx
  mov    %eax,%ebp
  mov    %edx,%eax
L59:
  mov    %eax,0x8(%rsp)
  cmp    %ebp,%r12d
  jge    L420
L103:
  mov    %ebp,0xc(%rsp)
  cmp    %r12d,%r13d
  jl     L389
L139:
  cmp    $0x3,%ebx
  je     L262
  mov    $0x4,%ebp
L193:
  xor    %eax,%eax
  cmp    %ebp,%ebx
  jle    L204
  mov    $0x6,%edi
  call   <randval@plt>
  add    $0x1,%eax
L204:
  mov    0x8(%rsp),%edx
  cmp    %eax,%edx
  jge    L285
L43:
  mov    %eax,0x8(%rsp)
  mov    0xc(%rsp),%eax
  cmp    %edx,%eax
  jge    L425
L45:
  mov    %edx,0xc(%rsp)
  cmp    0x10(%rsp),%eax
  jle    L19
  mov    %eax,0x10(%rsp)
L19:
  add    $0x1,%rbp
  cmp    %ebp,%ebx
  jge    L193
  jmp    L262
  nopw   0x0(%rax,%rax,1)
L397:
  cmp    $0x2,%edi
  jg     L85
  mov    %r12d,%edi
  call   <randval@plt>
  add    $0x1,%eax
  mov    %eax,0x8(%rsp)
  jmp    L262
  nopl   0x0(%rax)
L85:
  mov    $0x6,%edi
  call   <randval@plt>
  lea    0x1(%rax),%ebp
  mov    %ebp,0x8(%rsp)
  cmp    $0x1,%ebx
  jne    L132
  mov    %r12d,%edi
  call   <randval@plt>
  add    $0x1,%eax
  mov    %eax,0xc(%rsp)
  jmp    L262
  nopw   0x0(%rax,%rax,1)
L283:
  mov    $0x6,%edi
  call   <randval@plt>
  add    $0x1,%eax
  jmp    L359
  nopw   0x0(%rax,%rax,1)
L132:
  mov    $0x6,%edi
  call   <randval@plt>
  lea    0x1(%rax),%r13d
  mov    %r13d,0xc(%rsp)
  cmp    $0x2,%ebx
  jne    L242
  mov    %r12d,%edi
  call   <randval@plt>
  add    $0x1,%eax
  mov    %eax,0x10(%rsp)
  jmp    L262
  nopl   0x0(%rax)
L242:
  mov    $0x6,%edi
  call   <randval@plt>
  lea    0x1(%rax),%r14d
  mov    %r14d,0x10(%rsp)
  cmp    $0x3,%ebx
  jne    L100
  mov    %r12d,%edi
  call   <randval@plt>
  add    $0x1,%eax
L240:
  cmp    %eax,%ebp
  jge    L308
  mov    %eax,%edx
  mov    %ebp,%eax
  mov    %edx,%ebp
L308:
  mov    %ebp,0x8(%rsp)
  cmp    %eax,%r13d
  jl     L228
L203:
  mov    %r13d,0xc(%rsp)
  cmp    %eax,%r14d
  jge    L309
  mov    %eax,0x10(%rsp)
L309:
  cmp    $0x3,%ebx
  je     L262
  mov    $0x4,%ebp
L62:
  cmp    %ebp,%ebx
  jg     L257
  mov    %r12d,%edi
  call   <randval@plt>
  add    $0x1,%eax
  nopl   (%rax)
L13:
  mov    0x8(%rsp),%edx
  cmp    %eax,%edx
  jge    L154
  mov    %eax,%ecx
  mov    %edx,%eax
  mov    %ecx,%edx
L154:
  mov    %edx,0x8(%rsp)
  mov    0xc(%rsp),%edx
  cmp    %edx,%eax
  jle    L8
  mov    %eax,%ecx
  mov    %edx,%eax
  mov    %ecx,%edx
L8:
  mov    %edx,0xc(%rsp)
  cmp    0x10(%rsp),%eax
  jle    L368
  mov    %eax,0x10(%rsp)
L368:
  add    $0x1,%rbp
  cmp    %ebp,%ebx
  jge    L62
  jmp    L262
L389:
  mov    %r12d,0x10(%rsp)
  jmp    L139
L420:
  mov    %r12d,%eax
  mov    %ebp,%r12d
  mov    %eax,%ebp
  jmp    L103
L425:
  mov    %eax,%ecx
  mov    %edx,%eax
  mov    %ecx,%edx
  jmp    L45
L285:
  mov    %edx,%ecx
  mov    %eax,%edx
  mov    %ecx,%eax
  jmp    L43
L228:
  mov    %eax,%edx
  mov    %r13d,%eax
  mov    %edx,%r13d
  jmp    L203
L257:
  mov    $0x6,%edi
  call   <randval@plt>
  add    $0x1,%eax
  jmp    L13
  nopw   0x0(%rax,%rax,1)
L100:
  mov    $0x6,%edi
  call   <randval@plt>
  add    $0x1,%eax
  jmp    L240
L335:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int roll_check(int skill) {
  int dice = skill / 3;
  int total = 0;
  int roll[3] = {0, 0, 0};
  for (int i = 0; i < dice + 1; i++) {
    int newroll = 0;
    if (i < dice)
      newroll = randval(6) + 1;
    else if (skill % 3)
      newroll = randval((skill % 3) * 2 + 1) + 1;
    if (i < 3)
      roll[i] = newroll;
    else
      for (int j = 0; j < 3; j++)
        if (newroll > roll[j]) {
          int temp = roll[j];
          roll[j] = newroll;
          newroll = temp;
        }
  }
  for (int i = 0; i < 3; i++)
    total += roll[i];
  return total;
}
```