user: Please show me the C implementation that matches the assembly code listed below:

```asm
<graph_fill_polygon>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x1000,%rsp
  orq    $0x0,(%rsp)
  sub    $0x10,%rsp
  mov    %rdi,-0xfe8(%rbp)
  mov    %esi,-0xfec(%rbp)
  mov    %ecx,%eax
  mov    %r8d,%esi
  mov    %r9d,%ecx
  mov    %dl,-0xff0(%rbp)
  mov    %al,-0xff4(%rbp)
  mov    %esi,%eax
  mov    %al,-0xff8(%rbp)
  mov    %ecx,%eax
  mov    %al,-0xffc(%rbp)
  mov    0x10(%rbp),%rax
  mov    %rax,-0x1008(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x1869f,-0xfc8(%rbp)
  movl   $0x1869f,-0xfc4(%rbp)
  movl   $0xfffe7961,-0xfc0(%rbp)
  movl   $0xfffe7961,-0xfbc(%rbp)
  movl   $0x0,-0xfd8(%rbp)
  jmp    L179
L271:
  mov    -0xfd8(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xfe8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0xfd0(%rbp)
  mov    -0xfd8(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0xfe8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    %eax,-0xfcc(%rbp)
  cmpl   $0x270f,-0xfd0(%rbp)
  je     L185
  cmpl   $0x270f,-0xfcc(%rbp)
  je     L185
  mov    -0xfd0(%rbp),%eax
  cmp    -0xfc8(%rbp),%eax
  jge    L86
  mov    -0xfd0(%rbp),%eax
  mov    %eax,-0xfc8(%rbp)
L86:
  mov    -0xfcc(%rbp),%eax
  cmp    -0xfc4(%rbp),%eax
  jge    L381
  mov    -0xfcc(%rbp),%eax
  mov    %eax,-0xfc4(%rbp)
L381:
  mov    -0xfd0(%rbp),%eax
  cmp    -0xfc0(%rbp),%eax
  jle    L23
  mov    -0xfd0(%rbp),%eax
  mov    %eax,-0xfc0(%rbp)
L23:
  mov    -0xfcc(%rbp),%eax
  cmp    -0xfbc(%rbp),%eax
  jle    L225
  mov    -0xfcc(%rbp),%eax
  mov    %eax,-0xfbc(%rbp)
  jmp    L225
L185:
  nop
L225:
  addl   $0x1,-0xfd8(%rbp)
L179:
  mov    -0xfd8(%rbp),%eax
  cmp    %eax,-0xfec(%rbp)
  ja     L271
  cmpl   $0x0,-0xfc8(%rbp)
  jns    L228
  movl   $0x0,-0xfc8(%rbp)
L228:
  cmpl   $0x0,-0xfc4(%rbp)
  jns    L97
  movl   $0x0,-0xfc4(%rbp)
L97:
  mov    -0xfc0(%rbp),%eax
  cmp    %eax,0x18(%rbp)
  ja     L107
  mov    0x18(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0xfc0(%rbp)
L107:
  mov    -0xfbc(%rbp),%eax
  cmp    %eax,0x20(%rbp)
  ja     L130
  mov    0x20(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0xfbc(%rbp)
L130:
  mov    -0xfc4(%rbp),%eax
  mov    %eax,-0xfcc(%rbp)
  jmp    L319
L340:
  movl   $0x0,-0xfdc(%rbp)
  mov    -0xfec(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0xfd4(%rbp)
  movl   $0x0,-0xfd8(%rbp)
  jmp    L189
L108:
  mov    -0xfd8(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0xfe8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0xfcc(%rbp)
  jle    L374
  mov    -0xfd4(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0xfe8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0xfcc(%rbp)
  jle    L385
L374:
  mov    -0xfd4(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0xfe8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0xfcc(%rbp)
  jle    L291
  mov    -0xfd8(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0xfe8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    %eax,-0xfcc(%rbp)
  jg     L291
L385:
  mov    -0xfd8(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xfe8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%esi
  mov    -0xfd8(%rbp),%eax
  add    %eax,%eax
  cltq
  add    $0x1,%rax
  lea    0x0(,%rax,4),%rdx
  mov    -0xfe8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%edx
  mov    -0xfcc(%rbp),%eax
  sub    %edx,%eax
  mov    %eax,%ecx
  mov    -0xfd4(%rbp),%eax
  add    %eax,%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0xfe8(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  mov    -0xfd8(%rbp),%edx
  add    %edx,%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rdi
  mov    -0xfe8(%rbp),%rdx
  add    %rdi,%rdx
  mov    (%rdx),%edx
  sub    %edx,%eax
  imul   %ecx,%eax
  mov    -0xfd4(%rbp),%edx
  add    %edx,%edx
  movslq %edx,%rdx
  add    $0x1,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0xfe8(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rdx),%edx
  mov    -0xfd8(%rbp),%ecx
  add    %ecx,%ecx
  movslq %ecx,%rcx
  add    $0x1,%rcx
  lea    0x0(,%rcx,4),%rdi
  mov    -0xfe8(%rbp),%rcx
  add    %rdi,%rcx
  mov    (%rcx),%ecx
  mov    %edx,%edi
  sub    %ecx,%edi
  cltd
  idiv   %edi
  mov    %eax,%ecx
  mov    -0xfdc(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0xfdc(%rbp)
  lea    (%rsi,%rcx,1),%edx
  cltq
  mov    %edx,-0xfb0(%rbp,%rax,4)
L291:
  mov    -0xfd8(%rbp),%eax
  mov    %eax,-0xfd4(%rbp)
  cmpl   $0x3e8,-0xfdc(%rbp)
  je     L10
  addl   $0x1,-0xfd8(%rbp)
L189:
  mov    -0xfd8(%rbp),%eax
  cmp    %eax,-0xfec(%rbp)
  ja     L108
  jmp    L89
L10:
  nop
L89:
  movl   $0x0,-0xfd8(%rbp)
  jmp    L85
L365:
  mov    -0xfd8(%rbp),%eax
  cltq
  mov    -0xfb0(%rbp,%rax,4),%edx
  mov    -0xfd8(%rbp),%eax
  add    $0x1,%eax
  cltq
  mov    -0xfb0(%rbp,%rax,4),%eax
  cmp    %eax,%edx
  jle    L300
  mov    -0xfd8(%rbp),%eax
  cltq
  mov    -0xfb0(%rbp,%rax,4),%eax
  mov    %eax,-0xfb4(%rbp)
  mov    -0xfd8(%rbp),%eax
  add    $0x1,%eax
  cltq
  mov    -0xfb0(%rbp,%rax,4),%edx
  mov    -0xfd8(%rbp),%eax
  cltq
  mov    %edx,-0xfb0(%rbp,%rax,4)
  mov    -0xfd8(%rbp),%eax
  add    $0x1,%eax
  cltq
  mov    -0xfb4(%rbp),%edx
  mov    %edx,-0xfb0(%rbp,%rax,4)
  cmpl   $0x0,-0xfd8(%rbp)
  je     L85
  subl   $0x1,-0xfd8(%rbp)
  jmp    L85
L300:
  addl   $0x1,-0xfd8(%rbp)
L85:
  mov    -0xfdc(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0xfd8(%rbp)
  jl     L365
  movl   $0x0,-0xfd8(%rbp)
  jmp    L333
L55:
  mov    -0xfd8(%rbp),%eax
  cltq
  mov    -0xfb0(%rbp,%rax,4),%eax
  cmp    %eax,-0xfc0(%rbp)
  jle    L281
  mov    -0xfd8(%rbp),%eax
  add    $0x1,%eax
  cltq
  mov    -0xfb0(%rbp,%rax,4),%eax
  cmp    %eax,-0xfc8(%rbp)
  jge    L201
  mov    -0xfd8(%rbp),%eax
  cltq
  mov    -0xfb0(%rbp,%rax,4),%eax
  cmp    %eax,-0xfc8(%rbp)
  jl     L43
  mov    -0xfc8(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0xfd8(%rbp),%eax
  cltq
  mov    %edx,-0xfb0(%rbp,%rax,4)
L43:
  mov    -0xfd8(%rbp),%eax
  add    $0x1,%eax
  cltq
  mov    -0xfb0(%rbp,%rax,4),%eax
  cmp    %eax,-0xfc0(%rbp)
  jg     L392
  mov    -0xfd8(%rbp),%eax
  lea    0x1(%rax),%ecx
  mov    -0xfc0(%rbp),%eax
  lea    -0x1(%rax),%edx
  movslq %ecx,%rax
  mov    %edx,-0xfb0(%rbp,%rax,4)
L392:
  mov    -0xfd8(%rbp),%eax
  cltq
  mov    -0xfb0(%rbp,%rax,4),%eax
  mov    %eax,-0xfd0(%rbp)
  jmp    L186
L206:
  mov    -0xfcc(%rbp),%eax
  imul   0x18(%rbp),%eax
  mov    %eax,%edx
  mov    -0xfd0(%rbp),%eax
  add    %eax,%edx
  mov    %edx,%eax
  add    %eax,%eax
  add    %edx,%eax
  mov    %eax,-0xfb8(%rbp)
  cmpb   $0x0,-0xffc(%rbp)
  jne    L17
  mov    -0xfb8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1008(%rbp),%rax
  add    %rax,%rdx
  movzbl -0xff8(%rbp),%eax
  mov    %al,(%rdx)
  mov    -0xfb8(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x1008(%rbp),%rax
  add    %rax,%rdx
  movzbl -0xff4(%rbp),%eax
  mov    %al,(%rdx)
  mov    -0xfb8(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x1008(%rbp),%rax
  add    %rax,%rdx
  movzbl -0xff0(%rbp),%eax
  mov    %al,(%rdx)
  jmp    L255
L17:
  movzbl -0xff8(%rbp),%eax
  movzbl -0xffc(%rbp),%ecx
  mov    $0xff,%edx
  sub    %ecx,%edx
  imul   %edx,%eax
  mov    %eax,%ecx
  mov    -0xfb8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1008(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  movzbl -0xffc(%rbp),%eax
  imul   %edx,%eax
  add    %ecx,%eax
  lea    0xff(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x8,%eax
  mov    %eax,%ecx
  mov    -0xfb8(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x1008(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  movzbl -0xff4(%rbp),%eax
  movzbl -0xffc(%rbp),%ecx
  mov    $0xff,%edx
  sub    %ecx,%edx
  imul   %edx,%eax
  mov    %eax,%ecx
  mov    -0xfb8(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x1008(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  movzbl -0xffc(%rbp),%eax
  imul   %edx,%eax
  add    %ecx,%eax
  lea    0xff(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x8,%eax
  mov    %eax,%ecx
  mov    -0xfb8(%rbp),%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x1008(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
  movzbl -0xff0(%rbp),%eax
  movzbl -0xffc(%rbp),%ecx
  mov    $0xff,%edx
  sub    %ecx,%edx
  imul   %edx,%eax
  mov    %eax,%ecx
  mov    -0xfb8(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x1008(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movzbl %al,%edx
  movzbl -0xffc(%rbp),%eax
  imul   %edx,%eax
  add    %ecx,%eax
  lea    0xff(%rax),%edx
  test   %eax,%eax
  cmovs  %edx,%eax
  sar    $0x8,%eax
  mov    %eax,%ecx
  mov    -0xfb8(%rbp),%eax
  cltq
  lea    0x2(%rax),%rdx
  mov    -0x1008(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
L255:
  addl   $0x1,-0xfd0(%rbp)
L186:
  mov    -0xfd8(%rbp),%eax
  add    $0x1,%eax
  cltq
  mov    -0xfb0(%rbp,%rax,4),%eax
  cmp    %eax,-0xfd0(%rbp)
  jl     L206
L201:
  addl   $0x2,-0xfd8(%rbp)
L333:
  mov    -0xfd8(%rbp),%eax
  cmp    -0xfdc(%rbp),%eax
  jl     L55
  jmp    L261
L281:
  nop
L261:
  addl   $0x1,-0xfcc(%rbp)
L319:
  mov    -0xfcc(%rbp),%eax
  cmp    -0xfbc(%rbp),%eax
  jle    L340
  nop
  mov    -0x8(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L51
  call   <__stack_chk_fail@plt>
L51:
  leave
  ret
```

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;
          }
        }
      }
    }
  }
}
```