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

```asm
<fillTriangle>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x50,%rsp
  mov    %ecx,%eax
  mov    %r8d,%r10d
  mov    %r9d,%r8d
  mov    0x10(%rbp),%ecx
  mov    %di,-0x34(%rbp)
  mov    %si,-0x38(%rbp)
  mov    %dx,-0x3c(%rbp)
  mov    %ax,-0x40(%rbp)
  mov    %r10d,%eax
  mov    %ax,-0x44(%rbp)
  mov    %r8d,%eax
  mov    %ax,-0x48(%rbp)
  mov    %ecx,%eax
  mov    %ax,-0x4c(%rbp)
  movzwl -0x38(%rbp),%eax
  cmp    -0x40(%rbp),%ax
  jle    L29
  movzwl -0x38(%rbp),%eax
  mov    %ax,-0x24(%rbp)
  movzwl -0x40(%rbp),%eax
  mov    %ax,-0x38(%rbp)
  movzwl -0x24(%rbp),%eax
  mov    %ax,-0x40(%rbp)
  movzwl -0x34(%rbp),%eax
  mov    %ax,-0x22(%rbp)
  movzwl -0x3c(%rbp),%eax
  mov    %ax,-0x34(%rbp)
  movzwl -0x22(%rbp),%eax
  mov    %ax,-0x3c(%rbp)
L29:
  movzwl -0x40(%rbp),%eax
  cmp    -0x48(%rbp),%ax
  jle    L173
  movzwl -0x48(%rbp),%eax
  mov    %ax,-0x20(%rbp)
  movzwl -0x40(%rbp),%eax
  mov    %ax,-0x48(%rbp)
  movzwl -0x20(%rbp),%eax
  mov    %ax,-0x40(%rbp)
  movzwl -0x44(%rbp),%eax
  mov    %ax,-0x1e(%rbp)
  movzwl -0x3c(%rbp),%eax
  mov    %ax,-0x44(%rbp)
  movzwl -0x1e(%rbp),%eax
  mov    %ax,-0x3c(%rbp)
L173:
  movzwl -0x38(%rbp),%eax
  cmp    -0x40(%rbp),%ax
  jle    L57
  movzwl -0x38(%rbp),%eax
  mov    %ax,-0x1c(%rbp)
  movzwl -0x40(%rbp),%eax
  mov    %ax,-0x38(%rbp)
  movzwl -0x1c(%rbp),%eax
  mov    %ax,-0x40(%rbp)
  movzwl -0x34(%rbp),%eax
  mov    %ax,-0x1a(%rbp)
  movzwl -0x3c(%rbp),%eax
  mov    %ax,-0x34(%rbp)
  movzwl -0x1a(%rbp),%eax
  mov    %ax,-0x3c(%rbp)
L57:
  movzwl -0x38(%rbp),%eax
  cmp    -0x48(%rbp),%ax
  jne    L141
  movzwl -0x34(%rbp),%eax
  mov    %ax,-0x2a(%rbp)
  movzwl -0x2a(%rbp),%eax
  mov    %ax,-0x2c(%rbp)
  movzwl -0x3c(%rbp),%eax
  cmp    -0x2c(%rbp),%ax
  jge    L77
  movzwl -0x3c(%rbp),%eax
  mov    %ax,-0x2c(%rbp)
  jmp    L127
L77:
  movzwl -0x3c(%rbp),%eax
  cmp    -0x2a(%rbp),%ax
  jle    L127
  movzwl -0x3c(%rbp),%eax
  mov    %ax,-0x2a(%rbp)
L127:
  movzwl -0x44(%rbp),%eax
  cmp    -0x2c(%rbp),%ax
  jge    L35
  movzwl -0x44(%rbp),%eax
  mov    %ax,-0x2c(%rbp)
  jmp    L151
L35:
  movzwl -0x44(%rbp),%eax
  cmp    -0x2a(%rbp),%ax
  jle    L151
  movzwl -0x44(%rbp),%eax
  mov    %ax,-0x2a(%rbp)
L151:
  movswl -0x4c(%rbp),%ecx
  movzwl -0x2a(%rbp),%eax
  movzwl -0x2c(%rbp),%edx
  sub    %edx,%eax
  add    $0x1,%eax
  movswl %ax,%edx
  movswl -0x38(%rbp),%esi
  movswl -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <writeFastHLine@plt>
  jmp    L17
L141:
  movzwl -0x3c(%rbp),%eax
  movzwl -0x34(%rbp),%edx
  sub    %edx,%eax
  mov    %ax,-0x18(%rbp)
  movzwl -0x40(%rbp),%eax
  movzwl -0x38(%rbp),%edx
  sub    %edx,%eax
  mov    %ax,-0x16(%rbp)
  movzwl -0x44(%rbp),%eax
  movzwl -0x34(%rbp),%edx
  sub    %edx,%eax
  mov    %ax,-0x14(%rbp)
  movzwl -0x48(%rbp),%eax
  movzwl -0x38(%rbp),%edx
  sub    %edx,%eax
  mov    %ax,-0x12(%rbp)
  movzwl -0x44(%rbp),%eax
  movzwl -0x3c(%rbp),%edx
  sub    %edx,%eax
  mov    %ax,-0x10(%rbp)
  movzwl -0x48(%rbp),%eax
  movzwl -0x40(%rbp),%edx
  sub    %edx,%eax
  mov    %ax,-0xe(%rbp)
  movl   $0x0,-0x8(%rbp)
  movl   $0x0,-0x4(%rbp)
  movzwl -0x40(%rbp),%eax
  cmp    -0x48(%rbp),%ax
  jne    L67
  movzwl -0x40(%rbp),%eax
  mov    %ax,-0x26(%rbp)
  jmp    L93
L67:
  movzwl -0x40(%rbp),%eax
  sub    $0x1,%eax
  mov    %ax,-0x26(%rbp)
L93:
  movzwl -0x38(%rbp),%eax
  mov    %ax,-0x28(%rbp)
  jmp    L183
L55:
  movswl -0x16(%rbp),%edi
  mov    -0x8(%rbp),%eax
  cltd
  idiv   %edi
  mov    %eax,%edx
  movzwl -0x34(%rbp),%eax
  add    %edx,%eax
  mov    %ax,-0x2c(%rbp)
  movswl -0x12(%rbp),%edi
  mov    -0x4(%rbp),%eax
  cltd
  idiv   %edi
  mov    %eax,%edx
  movzwl -0x34(%rbp),%eax
  add    %edx,%eax
  mov    %ax,-0x2a(%rbp)
  movswl -0x18(%rbp),%eax
  add    %eax,-0x8(%rbp)
  movswl -0x14(%rbp),%eax
  add    %eax,-0x4(%rbp)
  movzwl -0x2c(%rbp),%eax
  cmp    -0x2a(%rbp),%ax
  jle    L168
  movzwl -0x2c(%rbp),%eax
  mov    %ax,-0xa(%rbp)
  movzwl -0x2a(%rbp),%eax
  mov    %ax,-0x2c(%rbp)
  movzwl -0xa(%rbp),%eax
  mov    %ax,-0x2a(%rbp)
L168:
  movswl -0x4c(%rbp),%ecx
  movzwl -0x2a(%rbp),%eax
  movzwl -0x2c(%rbp),%edx
  sub    %edx,%eax
  add    $0x1,%eax
  movswl %ax,%edx
  movswl -0x28(%rbp),%esi
  movswl -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <writeFastHLine@plt>
  movzwl -0x28(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0x28(%rbp)
L183:
  movzwl -0x28(%rbp),%eax
  cmp    -0x26(%rbp),%ax
  jle    L55
  movswl -0x10(%rbp),%eax
  movswl -0x28(%rbp),%edx
  movswl -0x40(%rbp),%ecx
  sub    %ecx,%edx
  imul   %edx,%eax
  mov    %eax,-0x8(%rbp)
  movswl -0x14(%rbp),%eax
  movswl -0x28(%rbp),%edx
  movswl -0x38(%rbp),%ecx
  sub    %ecx,%edx
  imul   %edx,%eax
  mov    %eax,-0x4(%rbp)
  jmp    L117
L176:
  movswl -0xe(%rbp),%edi
  mov    -0x8(%rbp),%eax
  cltd
  idiv   %edi
  mov    %eax,%edx
  movzwl -0x3c(%rbp),%eax
  add    %edx,%eax
  mov    %ax,-0x2c(%rbp)
  movswl -0x12(%rbp),%esi
  mov    -0x4(%rbp),%eax
  cltd
  idiv   %esi
  mov    %eax,%edx
  movzwl -0x34(%rbp),%eax
  add    %edx,%eax
  mov    %ax,-0x2a(%rbp)
  movswl -0x10(%rbp),%eax
  add    %eax,-0x8(%rbp)
  movswl -0x14(%rbp),%eax
  add    %eax,-0x4(%rbp)
  movzwl -0x2c(%rbp),%eax
  cmp    -0x2a(%rbp),%ax
  jle    L7
  movzwl -0x2c(%rbp),%eax
  mov    %ax,-0xc(%rbp)
  movzwl -0x2a(%rbp),%eax
  mov    %ax,-0x2c(%rbp)
  movzwl -0xc(%rbp),%eax
  mov    %ax,-0x2a(%rbp)
L7:
  movswl -0x4c(%rbp),%ecx
  movzwl -0x2a(%rbp),%eax
  movzwl -0x2c(%rbp),%edx
  sub    %edx,%eax
  add    $0x1,%eax
  movswl %ax,%edx
  movswl -0x28(%rbp),%esi
  movswl -0x2c(%rbp),%eax
  mov    %eax,%edi
  call   <writeFastHLine@plt>
  movzwl -0x28(%rbp),%eax
  add    $0x1,%eax
  mov    %ax,-0x28(%rbp)
L117:
  movzwl -0x28(%rbp),%eax
  cmp    -0x48(%rbp),%ax
  jle    L176
L17:
  leave
  ret
```

assistant: ```c
void fillTriangle(short x0, short y0, short x1, short y1, short x2, short y2, short color) {
  short a, b, y, last, dx01, dy01, dx02, dy02, dx12, dy12;
  int sa, sb;
  if (y0 > y1) {
    {
      short temp;
      temp = y0;
      y0 = y1;
      y1 = temp;
    };
    {
      short temp;
      temp = x0;
      x0 = x1;
      x1 = temp;
    };
  }
  if (y1 > y2) {
    {
      short temp;
      temp = y2;
      y2 = y1;
      y1 = temp;
    };
    {
      short temp;
      temp = x2;
      x2 = x1;
      x1 = temp;
    };
  }
  if (y0 > y1) {
    {
      short temp;
      temp = y0;
      y0 = y1;
      y1 = temp;
    };
    {
      short temp;
      temp = x0;
      x0 = x1;
      x1 = temp;
    };
  }
  if (y0 == y2) {
    a = b = x0;
    if (x1 < a)
      a = x1;
    else if (x1 > b)
      b = x1;
    if (x2 < a)
      a = x2;
    else if (x2 > b)
      b = x2;
    writeFastHLine(a, y0, b - a + 1, color);
    return;
  }
  dx01 = x1 - x0;
  dy01 = y1 - y0;
  dx02 = x2 - x0;
  dy02 = y2 - y0;
  dx12 = x2 - x1;
  dy12 = y2 - y1;
  sa = 0;
  sb = 0;
  if (y1 == y2)
    last = y1;
  else
    last = y1 - 1;
  for (y = y0; y <= last; y++) {
    a = x0 + sa / dy01;
    b = x0 + sb / dy02;
    sa += dx01;
    sb += dx02;
    if (a > b) {
      short temp;
      temp = a;
      a = b;
      b = temp;
    };
    writeFastHLine(a, y, b - a + 1, color);
  }
  sa = dx12 * (y - y1);
  sb = dx02 * (y - y0);
  for (; y <= y2; y++) {
    a = x1 + sa / dy12;
    b = x0 + sb / dy02;
    sa += dx12;
    sb += dx02;
    if (a > b) {
      short temp;
      temp = a;
      a = b;
      b = temp;
    };
    writeFastHLine(a, y, b - a + 1, color);
  }
}
```