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

```asm
<luminousarc>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  mov    %rdi,%r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  mov    %esi,-0x4c(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %ecx,-0x50(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  lea    -0x1000(%rsp),%rax
  cmp    %rax,%rsp
  je     L54
L136:
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  cmp    %rax,%rsp
  jne    L136
L54:
  sub    $0x10,%rsp
  orq    $0x0,0x8(%rsp)
  mov    -0x50(%rbp),%eax
  mov    %rsp,%rdi
  test   %eax,%eax
  jle    L33
  mov    %rdi,-0x48(%rbp)
  mov    $0x3,%ebx
  xor    %r15d,%r15d
  xor    %r11d,%r11d
  xor    %eax,%eax
  xor    %r12d,%r12d
  xor    %r10d,%r10d
  mov    $0xffc00ffd,%esi
  nopw   0x0(%rax,%rax,1)
L22:
  cmp    $0x3,%ebx
  je     L267
  sar    $0x2,%r15d
  sar    $0x2,%ebx
  mov    %r15d,%edx
  and    $0x3,%edx
  cmp    $0x2,%edx
  je     L177
L144:
  cmp    $0x3,%edx
  je     L101
  cmp    $0x1,%edx
  je     L240
  lea    0x1(%r12),%edx
  cmp    -0x4c(%rbp),%edx
  jge    L214
  movslq %edx,%rdx
  movslq %r12d,%rcx
  add    $0x2,%r12d
  movzbl (%r14,%rdx,1),%edx
  movzbl (%r14,%rcx,1),%ecx
  mov    %edx,%r9d
  shl    $0x8,%edx
  and    $0xf00,%edx
  sar    $0x4,%r9d
  or     %ecx,%edx
  lea    0x3(%r9),%edi
  mov    %r9d,-0x5c(%rbp)
  add    $0x5,%edx
  mov    %edi,-0x60(%rbp)
  cmp    %edx,%r11d
  jl     L214
  lea    0x1004(%rax),%ecx
  movslq %r10d,%r9
  add    -0x58(%rbp),%r9
  sub    %edx,%ecx
  lea    (%rdi,%rcx,1),%r13d
  mov    -0x48(%rbp),%rdi
  nopl   0x0(%rax,%rax,1)
L4:
  mov    %ecx,%edx
  mov    %ecx,%r8d
  add    $0x1,%ecx
  add    $0x1,%r9
  imul   %rsi,%rdx
  shr    $0x2c,%rdx
  imul   $0x1004,%edx,%edx
  sub    %edx,%r8d
  movslq %r8d,%rdx
  movslq %eax,%r8
  add    $0x1,%eax
  movzbl (%rdi,%rdx,1),%edx
  mov    %dl,(%rdi,%r8,1)
  mov    %dl,-0x1(%r9)
  mov    %rax,%rdx
  imul   %rsi,%rax
  shr    $0x2c,%rax
  imul   $0x1004,%eax,%r8d
  mov    %edx,%eax
  sub    %r8d,%eax
  cmp    %ecx,%r13d
  jne    L4
  mov    %rdi,-0x48(%rbp)
  mov    -0x5c(%rbp),%edi
  add    -0x60(%rbp),%r11d
  lea    0x3(%rdi,%r10,1),%r10d
L228:
  cmp    -0x50(%rbp),%r11d
  jl     L22
L159:
  mov    -0x4c(%rbp),%ebx
  cmp    %ebx,%r12d
  jl     L9
  nopl   0x0(%rax)
L60:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L135
  lea    -0x28(%rbp),%rsp
  mov    %r10d,%eax
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
  nopl   (%rax)
L267:
  cmp    %r12d,-0x4c(%rbp)
  jle    L214
  movslq %r12d,%rdx
  mov    $0xc0,%ebx
  add    $0x1,%r12d
  movzbl (%r14,%rdx,1),%r15d
  mov    %r15d,%edx
  and    $0x3,%edx
  cmp    $0x2,%edx
  jne    L144
L177:
  cmp    -0x4c(%rbp),%r12d
  jge    L214
  movslq %r12d,%rdx
  mov    -0x58(%rbp),%rdi
  movslq %r10d,%rcx
  add    $0x1,%r11d
  movzbl (%r14,%rdx,1),%edx
  add    $0x1,%r12d
  add    $0x1,%r10d
  mov    %dl,(%rdi,%rcx,1)
  mov    -0x48(%rbp),%rdi
  movslq %eax,%rcx
  add    $0x1,%eax
  mov    %dl,(%rdi,%rcx,1)
  mov    %rax,%rdx
  imul   %rsi,%rax
  shr    $0x2c,%rax
  imul   $0x1004,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  jmp    L228
  nopl   0x0(%rax)
L240:
  cmp    -0x4c(%rbp),%r12d
  jge    L214
  lea    0x1(%r12),%edi
  movslq %r12d,%r12
  movzbl (%r14,%r12,1),%r13d
  mov    %edi,-0x5c(%rbp)
  mov    %r13d,%edx
  sar    $0x2,%r13d
  and    $0x3,%edx
  lea    0x2(%r13),%edi
  add    $0x1,%edx
  mov    %edi,-0x60(%rbp)
  cmp    %edx,%r11d
  jl     L214
  lea    0x1004(%rax),%ecx
  movslq %r10d,%r9
  add    -0x58(%rbp),%r9
  sub    %edx,%ecx
  lea    (%rdi,%rcx,1),%r12d
  mov    -0x48(%rbp),%rdi
  cs nopw 0x0(%rax,%rax,1)
L8:
  mov    %ecx,%edx
  mov    %ecx,%r8d
  add    $0x1,%ecx
  add    $0x1,%r9
  imul   %rsi,%rdx
  shr    $0x2c,%rdx
  imul   $0x1004,%edx,%edx
  sub    %edx,%r8d
  movslq %r8d,%rdx
  movslq %eax,%r8
  add    $0x1,%eax
  movzbl (%rdi,%rdx,1),%edx
  mov    %dl,(%rdi,%r8,1)
  mov    %dl,-0x1(%r9)
  mov    %rax,%rdx
  imul   %rsi,%rax
  shr    $0x2c,%rax
  imul   $0x1004,%eax,%r8d
  mov    %edx,%eax
  sub    %r8d,%eax
  cmp    %ecx,%r12d
  jne    L8
  mov    %rdi,-0x48(%rbp)
  mov    -0x5c(%rbp),%r12d
  lea    0x2(%r13,%r10,1),%r10d
  add    -0x60(%rbp),%r11d
  jmp    L228
  nopl   0x0(%rax)
L101:
  mov    -0x4c(%rbp),%r13d
  cmp    %r13d,%r12d
  jge    L214
  lea    0x1(%r10),%edi
  movslq %r12d,%rdx
  movslq %r10d,%rcx
  mov    -0x48(%rbp),%r9
  movzbl (%r14,%rdx,1),%edx
  mov    %edi,-0x5c(%rbp)
  lea    0x1(%r12),%r8d
  mov    -0x58(%rbp),%rdi
  mov    %dl,(%rdi,%rcx,1)
  movslq %eax,%rcx
  mov    %dl,(%r9,%rcx,1)
  lea    0x1(%rax),%edx
  mov    %rdx,%rax
  imul   %rsi,%rdx
  shr    $0x2c,%rdx
  imul   $0x1004,%edx,%ecx
  sub    %ecx,%eax
  mov    %eax,%edx
  cmp    %r8d,%r13d
  jle    L214
  movslq %r8d,%r8
  lea    0x2(%r10),%r9d
  lea    0x2(%r12),%ecx
  movzbl (%r14,%r8,1),%eax
  mov    -0x48(%rbp),%r8
  mov    %r9d,-0x60(%rbp)
  movslq -0x5c(%rbp),%r9
  mov    %al,(%rdi,%r9,1)
  movslq %edx,%r9
  mov    %al,(%r8,%r9,1)
  lea    0x1(%rdx),%eax
  mov    %rax,%rdx
  imul   %rsi,%rax
  shr    $0x2c,%rax
  imul   $0x1004,%eax,%r9d
  mov    %edx,%eax
  sub    %r9d,%eax
  cmp    %ecx,%r13d
  jle    L214
  movslq %ecx,%rcx
  movslq -0x60(%rbp),%r8
  add    $0x3,%r12d
  add    $0x3,%r11d
  movzbl (%r14,%rcx,1),%edx
  movslq %eax,%rcx
  add    $0x1,%eax
  add    $0x3,%r10d
  mov    %dl,(%rdi,%r8,1)
  mov    -0x48(%rbp),%rdi
  mov    %dl,(%rdi,%rcx,1)
  mov    %rax,%rdx
  imul   %rsi,%rax
  shr    $0x2c,%rax
  imul   $0x1004,%eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  jmp    L228
L9:
  and    $0xfffffffc,%r12d
  lea    0x4(%r12),%eax
  cmp    %ebx,%eax
  jge    L60
  nopw   0x0(%rax,%rax,1)
L214:
  mov    $0xffffffff,%r10d
  jmp    L60
L33:
  xor    %r12d,%r12d
  xor    %r10d,%r10d
  jmp    L159
L135:
  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);
}
```