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

```asm
<luminousarc>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,%r13
  mov    %esi,%r14d
  mov    %rdx,-0x48(%rbp)
  mov    %ecx,-0x4c(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    -0x1000(%rsp),%rax
L41:
  cmp    %rax,%rsp
  je     L82
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L41
L82:
  sub    $0x10,%rsp
  orq    $0x0,0x8(%rsp)
  mov    %rsp,%rsi
  cmpl   $0x0,-0x4c(%rbp)
  jle    L171
  mov    $0x3,%r9d
  mov    $0x0,%r10d
  mov    $0x0,%r11d
  mov    $0x0,%eax
  mov    $0x0,%edi
  mov    $0x0,%r8d
  jmp    L328
L128:
  cmp    %edi,%r14d
  jle    L163
  movslq %edi,%rdx
  movzbl 0x0(%r13,%rdx,1),%r10d
  lea    0x1(%rdi),%edi
  mov    $0xc0,%r9d
  jmp    L332
L45:
  mov    $0xffffffff,%r8d
  jmp    L302
L52:
  cmp    %r14d,%edi
  jge    L122
  lea    0x1(%rdi),%ecx
  movslq %edi,%rdx
  movzbl 0x0(%r13,%rdx,1),%edx
  lea    0x1(%r8),%ebx
  movslq %r8d,%r12
  mov    -0x48(%rbp),%r15
  mov    %dl,(%r15,%r12,1)
  movslq %eax,%r12
  mov    %dl,(%rsi,%r12,1)
  add    $0x1,%eax
  movslq %eax,%rdx
  imul   $0x7fe007ff,%rdx,%rdx
  sar    $0x2b,%rdx
  mov    %eax,%r12d
  sar    $0x1f,%r12d
  sub    %r12d,%edx
  imul   $0x1004,%edx,%r12d
  sub    %r12d,%eax
  mov    %eax,%edx
  cmp    %r14d,%ecx
  jge    L362
  lea    0x2(%rdi),%r12d
  movslq %ecx,%rcx
  movzbl 0x0(%r13,%rcx,1),%eax
  lea    0x2(%r8),%ecx
  movslq %ebx,%rbx
  mov    %al,(%r15,%rbx,1)
  movslq %edx,%rbx
  mov    %al,(%rsi,%rbx,1)
  add    $0x1,%edx
  movslq %edx,%rax
  imul   $0x7fe007ff,%rax,%rax
  sar    $0x2b,%rax
  mov    %edx,%ebx
  sar    $0x1f,%ebx
  sub    %ebx,%eax
  imul   $0x1004,%eax,%ebx
  mov    %edx,%eax
  sub    %ebx,%eax
  cmp    %r14d,%r12d
  jge    L233
  add    $0x3,%edi
  movslq %r12d,%r12
  movzbl 0x0(%r13,%r12,1),%edx
  add    $0x3,%r11d
  add    $0x3,%r8d
  movslq %ecx,%rcx
  mov    -0x48(%rbp),%rbx
  mov    %dl,(%rbx,%rcx,1)
  movslq %eax,%rcx
  mov    %dl,(%rsi,%rcx,1)
  lea    0x1(%rax),%edx
  movslq %edx,%rax
  imul   $0x7fe007ff,%rax,%rax
  sar    $0x2b,%rax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0x1004,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  jmp    L199
L184:
  lea    0x1(%rdi),%edx
  cmp    %r14d,%edx
  jge    L252
  movslq %edi,%rcx
  movzbl 0x0(%r13,%rcx,1),%ecx
  add    $0x2,%edi
  movslq %edx,%rdx
  movzbl 0x0(%r13,%rdx,1),%edx
  mov    %edx,%r15d
  sar    $0x4,%r15d
  mov    %r15d,-0x50(%rbp)
  lea    0x3(%r15),%ebx
  mov    %ebx,-0x54(%rbp)
  shl    $0x8,%edx
  and    $0xf00,%edx
  or     %ecx,%edx
  add    $0x5,%edx
  cmp    %r11d,%edx
  jg     L249
  lea    0x1004(%rax),%ecx
  sub    %edx,%ecx
  movslq %r8d,%rbx
  add    -0x48(%rbp),%rbx
  lea    0x3(%r15,%rcx,1),%r12d
L248:
  movslq %ecx,%rdx
  imul   $0x7fe007ff,%rdx,%rdx
  sar    $0x2b,%rdx
  mov    %ecx,%r15d
  sar    $0x1f,%r15d
  sub    %r15d,%edx
  imul   $0x1004,%edx,%edx
  mov    %ecx,%r15d
  sub    %edx,%r15d
  movslq %r15d,%rdx
  movzbl (%rsi,%rdx,1),%edx
  add    $0x1,%ecx
  mov    %dl,(%rbx)
  movslq %eax,%r15
  mov    %dl,(%rsi,%r15,1)
  lea    0x1(%rax),%edx
  movslq %edx,%rax
  imul   $0x7fe007ff,%rax,%rax
  sar    $0x2b,%rax
  mov    %edx,%r15d
  sar    $0x1f,%r15d
  sub    %r15d,%eax
  imul   $0x1004,%eax,%r15d
  mov    %edx,%eax
  sub    %r15d,%eax
  add    $0x1,%rbx
  cmp    %r12d,%ecx
  jne    L248
  mov    -0x50(%rbp),%ebx
  lea    0x3(%rbx,%r8,1),%r8d
  add    -0x54(%rbp),%r11d
  jmp    L199
L17:
  cmp    %r14d,%edi
  jge    L216
  movslq %edi,%rdx
  movzbl 0x0(%r13,%rdx,1),%edx
  add    $0x1,%r11d
  movslq %r8d,%rcx
  mov    -0x48(%rbp),%rbx
  mov    %dl,(%rbx,%rcx,1)
  movslq %eax,%rcx
  mov    %dl,(%rsi,%rcx,1)
  lea    0x1(%rax),%edx
  movslq %edx,%rax
  imul   $0x7fe007ff,%rax,%rax
  sar    $0x2b,%rax
  mov    %edx,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%eax
  imul   $0x1004,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  lea    0x1(%rdi),%edi
  lea    0x1(%r8),%r8d
L199:
  cmp    %r11d,-0x4c(%rbp)
  jle    L69
L328:
  cmp    $0x3,%r9d
  je     L128
  sar    $0x2,%r9d
  sar    $0x2,%r10d
L332:
  mov    %r10d,%edx
  and    $0x3,%edx
  cmp    $0x2,%edx
  je     L17
  jg     L52
  test   %edx,%edx
  je     L184
  cmp    $0x1,%edx
  jne    L45
  cmp    %r14d,%edi
  jge    L46
  lea    0x1(%rdi),%ebx
  mov    %ebx,-0x50(%rbp)
  movslq %edi,%rdi
  movzbl 0x0(%r13,%rdi,1),%edx
  movzbl %dl,%r12d
  sar    $0x2,%r12d
  lea    0x2(%r12),%ebx
  mov    %ebx,-0x54(%rbp)
  and    $0x3,%edx
  lea    0x1(%rdx),%edx
  cmp    %r11d,%edx
  jg     L152
  lea    0x1004(%rax),%ecx
  sub    %edx,%ecx
  movslq %r8d,%rdi
  add    -0x48(%rbp),%rdi
  lea    0x2(%r12,%rcx,1),%ebx
L232:
  movslq %ecx,%rdx
  imul   $0x7fe007ff,%rdx,%rdx
  sar    $0x2b,%rdx
  mov    %ecx,%r15d
  sar    $0x1f,%r15d
  sub    %r15d,%edx
  imul   $0x1004,%edx,%edx
  mov    %ecx,%r15d
  sub    %edx,%r15d
  movslq %r15d,%rdx
  movzbl (%rsi,%rdx,1),%edx
  add    $0x1,%ecx
  mov    %dl,(%rdi)
  movslq %eax,%r15
  mov    %dl,(%rsi,%r15,1)
  lea    0x1(%rax),%edx
  movslq %edx,%rax
  imul   $0x7fe007ff,%rax,%rax
  sar    $0x2b,%rax
  mov    %edx,%r15d
  sar    $0x1f,%r15d
  sub    %r15d,%eax
  imul   $0x1004,%eax,%r15d
  mov    %edx,%eax
  sub    %r15d,%eax
  add    $0x1,%rdi
  cmp    %ebx,%ecx
  jne    L232
  lea    0x2(%r12,%r8,1),%r8d
  add    -0x54(%rbp),%r11d
  mov    -0x50(%rbp),%edi
  jmp    L199
L171:
  mov    $0x0,%edi
  mov    $0x0,%r8d
L69:
  cmp    %edi,%r14d
  jle    L302
  and    $0xfffffffc,%edi
  lea    0x4(%rdi),%eax
  cmp    %r14d,%eax
  mov    $0xffffffff,%eax
  cmovl  %eax,%r8d
  jmp    L302
L163:
  mov    $0xffffffff,%r8d
  jmp    L302
L122:
  mov    $0xffffffff,%r8d
L302:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L331
  mov    %r8d,%eax
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L252:
  mov    $0xffffffff,%r8d
  jmp    L302
L249:
  mov    $0xffffffff,%r8d
  jmp    L302
L46:
  mov    $0xffffffff,%r8d
  jmp    L302
L152:
  mov    $0xffffffff,%r8d
  jmp    L302
L216:
  mov    $0xffffffff,%r8d
  jmp    L302
L362:
  mov    $0xffffffff,%r8d
  jmp    L302
L233:
  mov    $0xffffffff,%r8d
  jmp    L302
L331:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int luminousarc(unsigned char *instream, int inLength, unsigned char *outstream, int decompressedSize) {
  int i, o = 0;
  int readBytes = 0;
  int bufferLength = 0xFFF + 5;
  unsigned char buffer[bufferLength];
  int bufferOffset = 0;
  int currentOutSize = 0;
  int flags = 0, mask = 3;
  while (currentOutSize < decompressedSize) {
    if (mask == 3) {
      if (readBytes >= inLength)
        return (-1);
      flags = instream[readBytes++];
      if (flags < 0)
        return (-1);
      mask = 0xC0;
    } else {
      mask >>= 2;
      flags >>= 2;
    }
    switch (flags & 0x3) {
    case 0: {
      if (readBytes + 1 >= inLength) {
        return (-1);
      }
      int byte1 = instream[readBytes++];
      int byte2 = instream[readBytes++];
      if (byte2 < 0)
        return (-1);
      int length = byte2 >> 4;
      length += 3;
      int disp = ((byte2 & 0x0F) << 8) | byte1;
      disp += 5;
      if (disp > currentOutSize)
        return (-1);
      int bufIdx = bufferOffset + bufferLength - disp;
      for (i = 0; i < length; i++) {
        unsigned char next = buffer[bufIdx % bufferLength];
        bufIdx++;
        outstream[o++] = next;
        buffer[bufferOffset] = next;
        bufferOffset = (bufferOffset + 1) % bufferLength;
      }
      currentOutSize += length;
      break;
    }
    case 1: {
      if (readBytes >= inLength) {
        return (-1);
      }
      int b = instream[readBytes++];
      if (b < 0)
        return (-1);
      int length = b >> 2;
      length += 2;
      int disp = (b & 0x03);
      disp += 1;
      if (disp > currentOutSize)
        return (-1);
      int bufIdx = bufferOffset + bufferLength - disp;
      for (i = 0; i < length; i++) {
        unsigned char next = buffer[bufIdx % bufferLength];
        bufIdx++;
        outstream[o++] = next;
        buffer[bufferOffset] = next;
        bufferOffset = (bufferOffset + 1) % bufferLength;
      }
      currentOutSize += length;
      break;
    }
    case 2: {
      if (readBytes >= inLength)
        return (-1);
      int next = instream[readBytes++];
      if (next < 0)
        return (-1);
      currentOutSize++;
      outstream[o++] = next;
      buffer[bufferOffset] = (unsigned char)next;
      bufferOffset = (bufferOffset + 1) % bufferLength;
      break;
    }
    case 3: {
      for (i = 0; i < 3; i++) {
        if (readBytes >= inLength)
          return (-1);
        int next = instream[readBytes++];
        if (next < 0)
          return (-1);
        currentOutSize++;
        outstream[o++] = next;
        buffer[bufferOffset] = (unsigned char)next;
        bufferOffset = (bufferOffset + 1) % bufferLength;
      }
      break;
    }
    default:
      return (-1);
    }
  }
  if (readBytes < inLength) {
    if ((readBytes ^ (readBytes & 3)) + 4 < inLength)
      return (-1);
  }
  return (o);
}
```