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

```asm
<fillTriangle>:
  endbr64
  push   %r15
  mov    %ecx,%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    0x70(%rsp),%ebx
  mov    %cx,0x28(%rsp)
  mov    %r8d,%ecx
  mov    %si,0x22(%rsp)
  mov    %ebx,0x24(%rsp)
  mov    %edi,%ebx
  mov    %dx,0x20(%rsp)
  mov    %r9w,0xe(%rsp)
  cmp    %ax,%si
  jle    L67
  cmp    %r9w,%si
  jg     L115
L39:
  movzwl 0x22(%rsp),%eax
  movzwl 0x28(%rsp),%esi
  mov    %ax,0x28(%rsp)
  mov    %ebx,%eax
  movzwl 0x20(%rsp),%ebx
  mov    %si,0x22(%rsp)
  mov    %ax,0x20(%rsp)
L72:
  movzwl 0xe(%rsp),%edi
  cmp    %di,0x22(%rsp)
  je     L12
L33:
  movzwl 0x20(%rsp),%r8d
  movzwl 0x28(%rsp),%eax
  mov    %ecx,%ebp
  movzwl 0xe(%rsp),%esi
  movzwl 0x22(%rsp),%r10d
  sub    %ebx,%ebp
  sub    %r8d,%ecx
  mov    %eax,%edx
  mov    %r8d,%r12d
  movswl %bp,%ebp
  mov    %esi,%edi
  mov    %cx,0x2c(%rsp)
  mov    %esi,%ecx
  sub    %eax,%esi
  mov    %si,0x2e(%rsp)
  mov    %eax,%esi
  sub    %r10d,%edi
  xor    %eax,%eax
  sub    %ebx,%r12d
  sub    %r10d,%edx
  cmp    %cx,%si
  mov    %di,0x2a(%rsp)
  setne  %al
  sub    %eax,%esi
  mov    %si,0x10(%rsp)
  cmp    %r10w,%si
  jl     L0
  movswl %dx,%eax
  movswl 0x24(%rsp),%r13d
  xor    %r14d,%r14d
  mov    %r10d,%r15d
  mov    %eax,0x14(%rsp)
  movswl %di,%eax
  mov    %eax,0x18(%rsp)
  movswl %r12w,%eax
  mov    %ebp,%r12d
  mov    %eax,0x1c(%rsp)
  mov    %ebx,%eax
  mov    %r13d,%ebx
  mov    %r14d,%r13d
  mov    %eax,%ebp
  cs nopw 0x0(%rax,%rax,1)
L69:
  mov    %r13d,%eax
  add    0x1c(%rsp),%r13d
  cltd
  idivl  0x14(%rsp)
  lea    0x0(%rbp,%rax,1),%esi
  mov    %r14d,%eax
  add    %r12d,%r14d
  cltd
  mov    %esi,%ecx
  idivl  0x18(%rsp)
  add    %ebp,%eax
  mov    %eax,%edx
  cmp    %ax,%si
  jle    L84
  mov    %esi,%eax
  mov    %edx,%ecx
  mov    %edx,%esi
L84:
  lea    0x1(%rax),%edx
  movswl %cx,%edi
  mov    %ebx,%ecx
  mov    %edx,%eax
  sub    %esi,%eax
  movswl %r15w,%esi
  add    $0x1,%r15d
  movswl %ax,%edx
  call   <writeFastHLine@plt>
  cmp    %r15w,0x10(%rsp)
  jge    L69
  mov    %ebp,%ebx
  mov    %r12d,%ebp
  mov    %r15d,%r12d
L65:
  movswl 0x28(%rsp),%eax
  movswl %r12w,%esi
  movswl 0x2c(%rsp),%edi
  mov    %esi,%r10d
  mov    %esi,%r9d
  movswl 0x24(%rsp),%r15d
  sub    %eax,%r10d
  movswl 0x22(%rsp),%eax
  mov    %edi,0x10(%rsp)
  imul   %edi,%r10d
  sub    %eax,%r9d
  movswl 0x2a(%rsp),%eax
  imul   %ebp,%r9d
  mov    %eax,0x14(%rsp)
  movswl 0x2e(%rsp),%eax
  mov    %r10d,%r14d
  mov    %eax,0x18(%rsp)
  cmp    %r12w,0xe(%rsp)
  jl     L61
  mov    %ebx,%eax
  mov    %r12d,%r13d
  mov    %r9d,%ebx
  mov    %eax,%r12d
  jmp    L27
  nopl   0x0(%rax)
L37:
  movswl %r13w,%esi
L27:
  mov    %r14d,%eax
  movzwl 0x20(%rsp),%ecx
  add    0x10(%rsp),%r14d
  cltd
  idivl  0x18(%rsp)
  add    %eax,%ecx
  mov    %ebx,%eax
  add    %ebp,%ebx
  cltd
  movswl %cx,%edi
  idivl  0x14(%rsp)
  add    %r12d,%eax
  mov    %eax,%edx
  cmp    %ax,%cx
  jle    L50
  mov    %ecx,%eax
  movswl %dx,%edi
  mov    %edx,%ecx
L50:
  lea    0x1(%rax),%edx
  add    $0x1,%r13d
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %r15d,%ecx
  movswl %ax,%edx
  call   <writeFastHLine@plt>
  cmp    %r13w,0xe(%rsp)
  jge    L37
L61:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L67:
  cmp    %r9w,%ax
  jle    L72
  mov    %ax,0x22(%rsp)
  mov    %edx,%ebx
  mov    %si,0x28(%rsp)
  mov    %di,0x20(%rsp)
L115:
  movzwl 0x22(%rsp),%eax
  cmp    0x28(%rsp),%r9w
  mov    %ebx,%ecx
  mov    %r8d,%ebx
  mov    %r9w,0x22(%rsp)
  mov    %ax,0xe(%rsp)
  jl     L33
  jmp    L39
  nopl   0x0(%rax)
L12:
  movzwl 0x20(%rsp),%edi
  cmp    %di,%bx
  jle    L89
  mov    %ebx,%eax
  mov    %edi,%ebx
  mov    %ax,0x20(%rsp)
L89:
  cmp    %cx,%bx
  jle    L10
L125:
  movzwl 0x20(%rsp),%edx
  movswl 0x24(%rsp),%r8d
  movswl %cx,%edi
  movswl 0x22(%rsp),%esi
  add    $0x38,%rsp
  add    $0x1,%edx
  pop    %rbx
  pop    %rbp
  sub    %ecx,%edx
  pop    %r12
  mov    %r8d,%ecx
  pop    %r13
  movswl %dx,%edx
  pop    %r14
  pop    %r15
  jmp    1050 <writeFastHLine@plt>
  nopl   0x0(%rax)
L10:
  movzwl 0x20(%rsp),%eax
  cmp    %cx,%ax
  cmovge %eax,%ecx
  mov    %cx,0x20(%rsp)
  mov    %ebx,%ecx
  jmp    L125
  nopl   0x0(%rax)
L0:
  mov    %r10d,%r12d
  jmp    L65
```

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