user: What is the c source code of the assembly code below?

```asm
<goldensun>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x90,%rsp
  mov    %rdi,-0x78(%rbp)
  mov    %esi,-0x7c(%rbp)
  mov    %rdx,-0x88(%rbp)
  mov    %ecx,-0x80(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rsi
  movl   $0x0,-0x68(%rbp)
  movl   $0x0,-0x64(%rbp)
  movl   $0x1000,-0x44(%rbp)
  mov    -0x44(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x20(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r10
  mov    $0x0,%r11d
  movslq %eax,%rdx
  mov    %rdx,%r8
  mov    $0x0,%r9d
  cltq
  mov    $0x10,%edx
  sub    $0x1,%rdx
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L150:
  cmp    %rdx,%rsp
  je     L231
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L150
L231:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L276
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L276:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x18(%rbp)
  movl   $0x0,-0x60(%rbp)
  movl   $0x0,-0x5c(%rbp)
  movl   $0x0,-0x58(%rbp)
  jmp    L0
L257:
  cmpl   $0x8,-0x58(%rbp)
  jne    L36
  mov    -0x64(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jl     L441
  mov    $0xffffffff,%eax
  jmp    L362
L441:
  mov    -0x64(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x64(%rbp)
  movslq %eax,%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x54(%rbp)
  cmpl   $0x0,-0x54(%rbp)
  jns    L367
  mov    $0xffffffff,%eax
  jmp    L362
L367:
  movl   $0x0,-0x50(%rbp)
  jmp    L303
L21:
  mov    -0x54(%rbp),%eax
  and    $0x80,%eax
  test   %eax,%eax
  setg   %al
  movzbl %al,%eax
  mov    %eax,-0x40(%rbp)
  mov    -0x54(%rbp),%eax
  add    %eax,%eax
  and    $0xff,%eax
  mov    %eax,-0x54(%rbp)
  cmpl   $0x0,-0x54(%rbp)
  je     L49
  cmpl   $0x0,-0x40(%rbp)
  jne    L33
L49:
  mov    $0x1,%ecx
  jmp    L283
L33:
  mov    $0x0,%ecx
L283:
  mov    -0x50(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x50(%rbp)
  mov    %ecx,%edx
  cltq
  mov    %dl,-0x10(%rbp,%rax,1)
L303:
  cmpl   $0x0,-0x54(%rbp)
  jg     L21
  movl   $0x0,-0x58(%rbp)
  jmp    L270
L36:
  addl   $0x1,-0x58(%rbp)
L270:
  mov    -0x58(%rbp),%eax
  cltq
  movzbl -0x10(%rbp,%rax,1),%eax
  test   %al,%al
  je     L394
  mov    -0x64(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x7c(%rbp)
  jg     L426
  mov    $0xffffffff,%eax
  jmp    L362
L426:
  mov    -0x64(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x64(%rbp)
  movslq %eax,%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x38(%rbp)
  mov    -0x64(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x64(%rbp)
  movslq %eax,%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x34(%rbp)
  cmpl   $0x0,-0x34(%rbp)
  jns    L250
  mov    $0xffffffff,%eax
  jmp    L362
L250:
  mov    -0x38(%rbp),%eax
  sar    $0x4,%eax
  mov    %eax,%edx
  mov    -0x34(%rbp),%eax
  shl    $0x4,%eax
  add    %edx,%eax
  mov    %eax,-0x30(%rbp)
  mov    -0x30(%rbp),%eax
  cmp    -0x5c(%rbp),%eax
  jle    L78
  mov    $0xffffffff,%eax
  jmp    L362
L78:
  mov    -0x38(%rbp),%eax
  and    $0xf,%eax
  test   %eax,%eax
  je     L312
  cmp    $0x1,%eax
  je     L461
  jmp    L5
L312:
  mov    -0x64(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jl     L324
  mov    $0xffffffff,%eax
  jmp    L362
L324:
  mov    -0x64(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x64(%rbp)
  movslq %eax,%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jns    L144
  mov    $0xffffffff,%eax
  jmp    L362
L144:
  mov    -0x24(%rbp),%eax
  add    $0x10,%eax
  mov    %eax,-0x4c(%rbp)
  jmp    L234
L461:
  mov    -0x64(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x7c(%rbp)
  jg     L165
  mov    $0xffffffff,%eax
  jmp    L362
L165:
  mov    -0x64(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x64(%rbp)
  movslq %eax,%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x64(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x64(%rbp)
  movslq %eax,%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x28(%rbp)
  cmpl   $0x0,-0x28(%rbp)
  jns    L351
  mov    $0xffffffff,%eax
  jmp    L362
L351:
  mov    -0x2c(%rbp),%eax
  shl    $0x8,%eax
  mov    %eax,%edx
  mov    -0x28(%rbp),%eax
  add    %edx,%eax
  add    $0x110,%eax
  mov    %eax,-0x4c(%rbp)
  jmp    L234
L5:
  mov    -0x38(%rbp),%eax
  and    $0xf,%eax
  mov    %eax,-0x4c(%rbp)
  nop
L234:
  mov    -0x60(%rbp),%edx
  mov    -0x44(%rbp),%eax
  add    %edx,%eax
  sub    -0x30(%rbp),%eax
  mov    %eax,-0x48(%rbp)
  movl   $0x0,-0x6c(%rbp)
  jmp    L31
L100:
  mov    -0x48(%rbp),%eax
  cltd
  idivl  -0x44(%rbp)
  mov    %edx,%eax
  mov    -0x18(%rbp),%rdx
  cltq
  movzbl (%rdx,%rax,1),%eax
  mov    %al,-0x6d(%rbp)
  addl   $0x1,-0x48(%rbp)
  mov    -0x68(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x68(%rbp)
  movslq %eax,%rdx
  mov    -0x88(%rbp),%rax
  add    %rax,%rdx
  movzbl -0x6d(%rbp),%eax
  mov    %al,(%rdx)
  mov    -0x18(%rbp),%rdx
  mov    -0x60(%rbp),%eax
  cltq
  movzbl -0x6d(%rbp),%ecx
  mov    %cl,(%rdx,%rax,1)
  mov    -0x60(%rbp),%eax
  add    $0x1,%eax
  cltd
  idivl  -0x44(%rbp)
  mov    %edx,-0x60(%rbp)
  addl   $0x1,-0x6c(%rbp)
L31:
  mov    -0x6c(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jl     L100
  mov    -0x4c(%rbp),%eax
  add    %eax,-0x5c(%rbp)
  jmp    L0
L394:
  mov    -0x64(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jl     L372
  mov    $0xffffffff,%eax
  jmp    L362
L372:
  mov    -0x64(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x64(%rbp)
  movslq %eax,%rdx
  mov    -0x78(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%eax
  mov    %eax,-0x3c(%rbp)
  cmpl   $0x0,-0x3c(%rbp)
  jns    L434
  mov    $0xffffffff,%eax
  jmp    L362
L434:
  addl   $0x1,-0x5c(%rbp)
  mov    -0x68(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x68(%rbp)
  movslq %eax,%rdx
  mov    -0x88(%rbp),%rax
  add    %rdx,%rax
  mov    -0x3c(%rbp),%edx
  mov    %dl,(%rax)
  mov    -0x3c(%rbp),%eax
  mov    %eax,%ecx
  mov    -0x18(%rbp),%rdx
  mov    -0x60(%rbp),%eax
  cltq
  mov    %cl,(%rdx,%rax,1)
  mov    -0x60(%rbp),%eax
  add    $0x1,%eax
  cltd
  idivl  -0x44(%rbp)
  mov    %edx,-0x60(%rbp)
L0:
  mov    -0x5c(%rbp),%eax
  cmp    -0x80(%rbp),%eax
  jl     L257
  mov    -0x64(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  jge    L321
  mov    -0x64(%rbp),%eax
  and    $0xfffffffc,%eax
  add    $0x4,%eax
  cmp    %eax,-0x7c(%rbp)
  jle    L321
  mov    $0xffffffff,%eax
  jmp    L362
L321:
  mov    -0x68(%rbp),%eax
L362:
  mov    %rsi,%rsp
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L370
  call   <__stack_chk_fail@plt>
L370:
  leave
  ret
```

assistant: ```c
int goldensun(unsigned char *instream, int inLength, unsigned char *outstream, int decompressedSize) {
  int i, o = 0;
  int readBytes = 0;
  int bufferLength = 0x1000;
  unsigned char buffer[bufferLength];
  int bufferOffset = 0;
  int currentOutSize = 0;
  int currentBlock = 0;
  unsigned char expandedFlags[8];
  while (currentOutSize < decompressedSize) {
    if (currentBlock == 8) {
      if (readBytes >= inLength)
        return (-1);
      int flags = instream[readBytes++];
      if (flags < 0)
        return (-1);
      int b = 0;
      while (flags > 0) {
        int bit = (flags & 0x80) > 0;
        flags = (flags & 0x7F) << 1;
        expandedFlags[b++] = (flags == 0) || !bit;
      }
      currentBlock = 0;
    } else {
      currentBlock++;
    }
    if (expandedFlags[currentBlock]) {
      if (readBytes + 1 >= inLength) {
        return (-1);
      }
      int byte1 = instream[readBytes++];
      int byte2 = instream[readBytes++];
      if (byte2 < 0)
        return (-1);
      int disp, length;
      disp = (byte1 >> 4) + (byte2 << 4);
      if (disp > currentOutSize)
        return (-1);
      switch (byte1 & 0x0F) {
      case 0: {
        if (readBytes >= inLength)
          return (-1);
        int byte3 = instream[readBytes++];
        if (byte3 < 0)
          return (-1);
        length = byte3 + 0x10;
        break;
      }
      case 1: {
        if (readBytes + 1 >= inLength)
          return (-1);
        int byte3 = instream[readBytes++];
        int byte4 = instream[readBytes++];
        if (byte4 < 0)
          return (-1);
        length = ((byte3 << 8) + byte4) + 0x110;
        break;
      }
      default: {
        length = byte1 & 0x0F;
        break;
      }
      }
      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;
    } else {
      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;
    }
  }
  if (readBytes < inLength) {
    if ((readBytes ^ (readBytes & 3)) + 4 < inLength)
      return (-1);
  }
  return (o);
}
```