user: Converte this assembly snippet into its equivalent C code:

```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    L104
  cmp    %r9w,%si
  jg     L94
L15:
  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)
L30:
  movzwl 0xe(%rsp),%edi
  cmp    %di,0x22(%rsp)
  je     L55
L129:
  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     L133
  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)
L95:
  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    L116
  mov    %esi,%eax
  mov    %edx,%ecx
  mov    %edx,%esi
L116:
  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    L95
  mov    %ebp,%ebx
  mov    %r12d,%ebp
  mov    %r15d,%r12d
L45:
  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     L100
  mov    %ebx,%eax
  mov    %r12d,%r13d
  mov    %r9d,%ebx
  mov    %eax,%r12d
  jmp    L112
  nopl   0x0(%rax)
L39:
  movswl %r13w,%esi
L112:
  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    L156
  mov    %ecx,%eax
  movswl %dx,%edi
  mov    %edx,%ecx
L156:
  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    L39
L100:
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L104:
  cmp    %r9w,%ax
  jle    L30
  mov    %ax,0x22(%rsp)
  mov    %edx,%ebx
  mov    %si,0x28(%rsp)
  mov    %di,0x20(%rsp)
L94:
  movzwl 0x22(%rsp),%eax
  cmp    0x28(%rsp),%r9w
  mov    %ebx,%ecx
  mov    %r8d,%ebx
  mov    %r9w,0x22(%rsp)
  mov    %ax,0xe(%rsp)
  jl     L129
  jmp    L15
  nopl   0x0(%rax)
L55:
  movzwl 0x20(%rsp),%edi
  cmp    %di,%bx
  jle    L22
  mov    %ebx,%eax
  mov    %edi,%ebx
  mov    %ax,0x20(%rsp)
L22:
  cmp    %cx,%bx
  jle    L92
L123:
  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)
L92:
  movzwl 0x20(%rsp),%eax
  cmp    %cx,%ax
  cmovge %eax,%ecx
  mov    %cx,0x20(%rsp)
  mov    %ebx,%ecx
  jmp    L123
  nopl   0x0(%rax)
L133:
  movzwl 0x22(%rsp),%r12d
  jmp    L45
```

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