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

```asm
<graph_fill_polygon>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x8,%rsp
  mov    %rdi,%r10
  mov    %esi,0x38(%rsp)
  mov    %edx,%r15d
  mov    %ecx,%r14d
  mov    %r8d,%r13d
  mov    %r9d,%r12d
  mov    0x1040(%rsp),%rcx
  mov    %dl,0x45(%rsp)
  mov    %r14b,0x46(%rsp)
  mov    %r8b,0x47(%rsp)
  mov    %r9d,%ebx
  mov    %fs:0x28,%rax
  mov    %rax,0xff8(%rsp)
  xor    %eax,%eax
  test   %esi,%esi
  je     L239
  mov    %rdi,%rdx
  lea    -0x1(%rsi),%eax
  lea    0x8(%rdi,%rax,8),%r11
  mov    $0xfffe7961,%eax
  mov    $0xfffe7961,%ebp
  mov    $0x1869f,%r9d
  mov    $0x1869f,%r8d
  jmp    L290
L181:
  add    $0x8,%rdx
  cmp    %r11,%rdx
  je     L150
L290:
  mov    (%rdx),%esi
  mov    0x4(%rdx),%edi
  cmp    $0x270f,%esi
  je     L181
  cmp    $0x270f,%edi
  je     L181
  cmp    %esi,%r8d
  cmovg  %esi,%r8d
  cmp    %edi,%r9d
  cmovg  %edi,%r9d
  cmp    %esi,%ebp
  cmovl  %esi,%ebp
  cmp    %edi,%eax
  cmovl  %edi,%eax
  jmp    L181
L239:
  mov    $0xfffe7961,%eax
  mov    $0xfffe7961,%ebp
  mov    $0x1869f,%r9d
  mov    $0x1869f,%r8d
L150:
  test   %r8d,%r8d
  mov    $0x0,%edx
  mov    %edx,%edi
  cmovns %r8d,%edi
  mov    %edi,0x8(%rsp)
  test   %r9d,%r9d
  cmovs  %edx,%r9d
  mov    0x1048(%rsp),%esi
  lea    -0x1(%rsi),%edx
  cmp    %esi,%ebp
  cmovae %edx,%ebp
  mov    0x1050(%rsp),%esi
  lea    -0x1(%rsi),%edx
  cmp    %esi,%eax
  cmovae %edx,%eax
  cmp    %eax,%r9d
  jg     L45
  movzbl %r12b,%r8d
  mov    $0xff,%edx
  sub    %r8d,%edx
  movzbl %r13b,%r13d
  imul   %edx,%r13d
  mov    %r13d,0xc(%rsp)
  movzbl %r14b,%esi
  imul   %edx,%esi
  mov    %esi,0x10(%rsp)
  movzbl %r15b,%esi
  imul   %edx,%esi
  mov    %esi,0x14(%rsp)
  mov    %r9d,%esi
  imul   0x1048(%rsp),%esi
  mov    %esi,0x20(%rsp)
  add    $0x1,%eax
  mov    %eax,0x40(%rsp)
  mov    0x38(%rsp),%eax
  sub    $0x1,%eax
  mov    %eax,0x3c(%rsp)
  lea    0x50(%rsp),%rax
  mov    %rax,0x18(%rsp)
  lea    0x5c(%rsp),%rax
  mov    %rax,0x48(%rsp)
  lea    -0x1(%rbp),%eax
  mov    %eax,0x30(%rsp)
  lea    0x1(%rdi),%eax
  mov    %eax,0x34(%rsp)
  jmp    L264
L203:
  lea    (%rdx,%rdx,1),%eax
  cltq
  cmp    %r9d,0x4(%r10,%rax,4)
  jge    L242
L296:
  add    %edx,%edx
  movslq %edx,%rdx
  movslq %edi,%r13
  mov    (%r10,%rdx,4),%eax
  sub    (%r10,%rsi,8),%eax
  mov    %r9d,%r15d
  sub    %r14d,%r15d
  imul   %r15d,%eax
  mov    0x4(%r10,%rdx,4),%r15d
  sub    %r14d,%r15d
  cltd
  idiv   %r15d
  add    (%r10,%rsi,8),%eax
  mov    %eax,0x50(%rsp,%r13,4)
  lea    0x1(%rdi),%edi
L242:
  cmp    $0x3e8,%edi
  je     L276
  lea    0x1(%rsi),%rax
  cmp    %r12,%rsi
  je     L276
  mov    %rax,%rsi
L110:
  mov    %r11d,%edx
  mov    %esi,%r11d
  mov    0x4(%r10,%rsi,8),%r14d
  cmp    %r9d,%r14d
  jge    L203
  lea    (%rdx,%rdx,1),%eax
  cltq
  cmp    %r9d,0x4(%r10,%rax,4)
  jge    L296
  jmp    L242
L187:
  mov    $0x0,%edi
L276:
  mov    $0x0,%edx
  lea    -0x1(%rdi),%r13d
L38:
  movslq %edx,%rax
  mov    0x18(%rsp),%rsi
  lea    (%rsi,%rax,4),%rax
L145:
  cmp    %edx,%r13d
  jle    L157
  mov    (%rax),%r11d
  lea    0x1(%rdx),%esi
  add    $0x4,%rax
  mov    (%rax),%r12d
  cmp    %r12d,%r11d
  jg     L9
  mov    %esi,%edx
  jmp    L145
L9:
  movslq %edx,%rax
  mov    %r12d,0x50(%rsp,%rax,4)
  movslq %esi,%rsi
  mov    %r11d,0x50(%rsp,%rsi,4)
  cmp    $0x1,%edx
  adc    $0xffffffff,%edx
  jmp    L38
L157:
  test   %edi,%edi
  jle    L106
  lea    0x54(%rsp),%rsi
  sub    $0x1,%edi
  shr    %edi
  mov    %edi,%eax
  mov    0x48(%rsp),%rdi
  lea    (%rdi,%rax,8),%r13
  mov    %r9d,0x24(%rsp)
  mov    %r10,0x28(%rsp)
  movzbl 0x45(%rsp),%r11d
  movzbl 0x46(%rsp),%r12d
  movzbl 0x47(%rsp),%r14d
  jmp    L198
L259:
  movslq %eax,%rdi
  lea    (%rcx,%rdi,1),%r9
  movzbl (%r9),%edx
  imul   %r8d,%edx
  add    0xc(%rsp),%edx
  lea    0xff(%rdx),%r15d
  cmovs  %r15d,%edx
  movzbl %dh,%edx
  mov    %dl,(%r9)
  lea    0x1(%rcx,%rdi,1),%r9
  movzbl (%r9),%edx
  imul   %r8d,%edx
  add    0x10(%rsp),%edx
  lea    0xff(%rdx),%r15d
  cmovs  %r15d,%edx
  movzbl %dh,%edx
  mov    %dl,(%r9)
  lea    0x2(%rcx,%rdi,1),%rdi
  movzbl (%rdi),%edx
  imul   %r8d,%edx
  add    0x14(%rsp),%edx
  lea    0xff(%rdx),%r9d
  cmovs  %r9d,%edx
  movzbl %dh,%edx
  mov    %dl,(%rdi)
L185:
  add    $0x3,%eax
  cmp    %r10d,%eax
  je     L22
L129:
  test   %bl,%bl
  jne    L259
  movslq %eax,%rdx
  mov    %r14b,(%rcx,%rdx,1)
  mov    %r12b,0x1(%rcx,%rdx,1)
  mov    %r11b,0x2(%rcx,%rdx,1)
  jmp    L185
L22:
  add    $0x8,%rsi
  cmp    %r13,%rsi
  je     L40
L198:
  mov    %rsi,%rdi
  mov    -0x4(%rsi),%eax
  cmp    %ebp,%eax
  jge    L241
  mov    (%rsi),%edx
  cmp    %edx,0x8(%rsp)
  jge    L22
  cmp    %eax,0x8(%rsp)
  jl     L75
  mov    0x34(%rsp),%eax
  mov    %eax,-0x4(%rsi)
L75:
  cmp    %ebp,%edx
  jl     L182
  mov    0x30(%rsp),%eax
  mov    %eax,(%rdi)
L182:
  mov    -0x4(%rdi),%eax
  mov    (%rdi),%edx
  cmp    %edx,%eax
  jge    L22
  mov    0x20(%rsp),%edi
  add    %edi,%eax
  lea    (%rax,%rax,2),%eax
  add    %edi,%edx
  lea    (%rdx,%rdx,2),%r10d
  jmp    L129
L40:
  mov    0x24(%rsp),%r9d
  mov    0x28(%rsp),%r10
  jmp    L106
L241:
  mov    0x24(%rsp),%r9d
  mov    0x28(%rsp),%r10
L106:
  add    $0x1,%r9d
  mov    0x1048(%rsp),%edi
  add    %edi,0x20(%rsp)
  cmp    0x40(%rsp),%r9d
  je     L45
L264:
  mov    0x3c(%rsp),%eax
  mov    %eax,%r11d
  cmpl   $0x0,0x38(%rsp)
  je     L187
  mov    %eax,%r12d
  mov    $0x0,%esi
  mov    $0x0,%edi
  jmp    L110
L45:
  mov    0xff8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L146
  add    $0x1008,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L146:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
void graph_fill_polygon(int *points, unsigned int no_of_points, unsigned char r, unsigned char g, unsigned char b, unsigned char transparency, unsigned char *buffer, unsigned int img_width, unsigned int img_height) {
  int nodes, nodeX[1000], i, j, swap, n, x, y;
  int min_x = 99999, min_y = 99999;
  int max_x = -99999, max_y = -99999;
  for (i = 0; i < no_of_points; i++) {
    x = points[i * 2];
    y = points[i * 2 + 1];
    if ((x == 9999) || (y == 9999))
      continue;
    if (x < min_x)
      min_x = x;
    if (y < min_y)
      min_y = y;
    if (x > max_x)
      max_x = x;
    if (y > max_y)
      max_y = y;
  }
  if (min_x < 0)
    min_x = 0;
  if (min_y < 0)
    min_y = 0;
  if (max_x >= img_width)
    max_x = img_width - 1;
  if (max_y >= img_height)
    max_y = img_height - 1;
  for (y = min_y; y <= max_y; y++) {
    nodes = 0;
    j = no_of_points - 1;
    for (i = 0; i < no_of_points; i++) {
      if (((points[i * 2 + 1] < y) && (points[j * 2 + 1] >= y)) || ((points[j * 2 + 1] < y) && (points[i * 2 + 1] >= y))) {
        nodeX[nodes++] = points[i * 2] + (y - points[i * 2 + 1]) * (points[j * 2] - points[i * 2]) / (points[j * 2 + 1] - points[i * 2 + 1]);
      }
      j = i;
      if (nodes == 1000)
        break;
    }
    i = 0;
    while (i < nodes - 1) {
      if (nodeX[i] > nodeX[i + 1]) {
        swap = nodeX[i];
        nodeX[i] = nodeX[i + 1];
        nodeX[i + 1] = swap;
        if (i)
          i--;
      } else {
        i++;
      }
    }
    for (i = 0; i < nodes; i += 2) {
      if (nodeX[i] >= max_x)
        break;
      if (nodeX[i + 1] > min_x) {
        if (nodeX[i] <= min_x)
          nodeX[i] = min_x + 1;
        if (nodeX[i + 1] >= max_x)
          nodeX[i + 1] = max_x - 1;
        for (x = nodeX[i]; x < nodeX[i + 1]; x++) {
          n = ((y * img_width) + x) * 3;
          if (transparency == 0) {
            buffer[n] = b;
            buffer[n + 1] = g;
            buffer[n + 2] = r;
          } else {
            buffer[n] = ((b * (255 - transparency)) + (buffer[n] * transparency)) / 256;
            buffer[n + 1] = ((g * (255 - transparency)) + (buffer[n + 1] * transparency)) / 256;
            buffer[n + 2] = ((r * (255 - transparency)) + (buffer[n + 2] * transparency)) / 256;
          }
        }
      }
    }
  }
}
```