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

```asm
<render_line_2D_WALA>:
  endbr64
  pxor   %xmm4,%xmm4
  pxor   %xmm3,%xmm3
  pxor   %xmm8,%xmm8
  mov    %rdi,%rsi
  cvtsi2sd %r9d,%xmm4
  pxor   %xmm7,%xmm7
  movaps %xmm0,%xmm1
  movq   D18(%rip),%xmm0
  cvtsi2sd %ecx,%xmm3
  cvtsi2sdl 0x8(%rsp),%xmm8
  cvtsi2sd %r8d,%xmm7
  movapd %xmm4,%xmm5
  subsd  %xmm3,%xmm5
  movapd %xmm8,%xmm6
  subsd  %xmm7,%xmm6
  movapd %xmm5,%xmm2
  andpd  %xmm0,%xmm2
  andpd  %xmm6,%xmm0
  comisd %xmm0,%xmm2
  jbe    L50
  cmp    %ecx,%r9d
  jge    L43
L3:
  divsd  %xmm5,%xmm6
  movapd %xmm4,%xmm0
  pxor   %xmm2,%xmm2
  mov    %edx,%eax
  movsd  D1(%rip),%xmm5
  cvtss2sd %xmm1,%xmm1
  pxor   %xmm10,%xmm10
  addsd  %xmm5,%xmm0
  addsd  %xmm3,%xmm5
  cvttsd2si %xmm0,%ecx
  subsd  %xmm0,%xmm0
  cvtsi2sd %ecx,%xmm2
  subsd  %xmm4,%xmm2
  movsd  D20(%rip),%xmm4
  movapd %xmm4,%xmm9
  subsd  %xmm0,%xmm9
  mulsd  %xmm6,%xmm2
  addsd  %xmm8,%xmm2
  pxor   %xmm8,%xmm8
  cvttsd2si %xmm2,%r8d
  movapd %xmm2,%xmm0
  addsd  %xmm6,%xmm2
  cvtsi2sd %r8d,%xmm8
  imul   %r8d,%eax
  subsd  %xmm8,%xmm0
  movapd %xmm4,%xmm8
  lea    (%rcx,%rax,1),%edi
  add    %edx,%eax
  movslq %edi,%rdi
  add    %ecx,%eax
  add    $0x1,%ecx
  lea    (%rsi,%rdi,4),%rdi
  cltq
  subsd  %xmm0,%xmm8
  mulsd  %xmm9,%xmm0
  cvtss2sd (%rdi),%xmm10
  lea    (%rsi,%rax,4),%rax
  mulsd  %xmm9,%xmm8
  mulsd  %xmm1,%xmm0
  mulsd  %xmm1,%xmm8
  addsd  %xmm10,%xmm8
  cvtsd2ss %xmm8,%xmm8
  movss  %xmm8,(%rdi)
  pxor   %xmm8,%xmm8
  cvttsd2si %xmm5,%edi
  cvtss2sd (%rax),%xmm8
  addsd  %xmm8,%xmm0
  subsd  %xmm5,%xmm5
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%rax)
  pxor   %xmm0,%xmm0
  mov    %edx,%eax
  cvtsi2sd %edi,%xmm0
  subsd  %xmm3,%xmm0
  pxor   %xmm3,%xmm3
  mulsd  %xmm6,%xmm0
  addsd  %xmm7,%xmm0
  pxor   %xmm7,%xmm7
  cvttsd2si %xmm0,%r9d
  cvtsi2sd %r9d,%xmm3
  imul   %r9d,%eax
  subsd  %xmm3,%xmm0
  movapd %xmm4,%xmm3
  lea    (%rdi,%rax,1),%r8d
  add    %edx,%eax
  movslq %r8d,%r8
  add    %edi,%eax
  lea    (%rsi,%r8,4),%r8
  cltq
  subsd  %xmm0,%xmm3
  mulsd  %xmm5,%xmm0
  cvtss2sd (%r8),%xmm7
  lea    (%rsi,%rax,4),%rax
  mulsd  %xmm5,%xmm3
  mulsd  %xmm1,%xmm0
  mulsd  %xmm1,%xmm3
  addsd  %xmm7,%xmm3
  cvtsd2ss %xmm3,%xmm3
  movss  %xmm3,(%r8)
  pxor   %xmm3,%xmm3
  cvtss2sd (%rax),%xmm3
  addsd  %xmm3,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%rax)
  cmp    %ecx,%edi
  jle    L78
  nopl   0x0(%rax)
L27:
  cvttsd2si %xmm2,%r9d
  pxor   %xmm0,%xmm0
  movapd %xmm2,%xmm3
  pxor   %xmm5,%xmm5
  addsd  %xmm6,%xmm2
  cvtsi2sd %r9d,%xmm0
  mov    %r9d,%eax
  imul   %edx,%eax
  subsd  %xmm0,%xmm3
  movapd %xmm4,%xmm0
  lea    (%rax,%rcx,1),%r8d
  add    %edx,%eax
  movslq %r8d,%r8
  add    %ecx,%eax
  add    $0x1,%ecx
  lea    (%rsi,%r8,4),%r8
  cltq
  subsd  %xmm3,%xmm0
  mulsd  %xmm1,%xmm3
  cvtss2sd (%r8),%xmm5
  lea    (%rsi,%rax,4),%rax
  mulsd  %xmm1,%xmm0
  addsd  %xmm5,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%r8)
  pxor   %xmm0,%xmm0
  cvtss2sd (%rax),%xmm0
  addsd  %xmm3,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%rax)
  cmp    %ecx,%edi
  jne    L27
  ret
  nopw   0x0(%rax,%rax,1)
L50:
  cmp    %r8d,0x8(%rsp)
  jl     L37
  movq   %xmm4,%rax
  movapd %xmm3,%xmm4
  movq   %rax,%xmm3
  movq   %xmm8,%rax
  movapd %xmm7,%xmm8
  movq   %rax,%xmm7
L37:
  divsd  %xmm6,%xmm5
  movsd  D1(%rip),%xmm6
  pxor   %xmm2,%xmm2
  movapd %xmm8,%xmm0
  cvtss2sd %xmm1,%xmm1
  pxor   %xmm10,%xmm10
  addsd  %xmm6,%xmm0
  addsd  %xmm7,%xmm6
  cvttsd2si %xmm0,%edi
  subsd  %xmm0,%xmm0
  cvtsi2sd %edi,%xmm2
  mov    %edi,%ecx
  add    $0x1,%edi
  imul   %edx,%ecx
  subsd  %xmm8,%xmm2
  pxor   %xmm8,%xmm8
  mulsd  %xmm5,%xmm2
  addsd  %xmm4,%xmm2
  movsd  D20(%rip),%xmm4
  movapd %xmm4,%xmm9
  cvttsd2si %xmm2,%eax
  subsd  %xmm0,%xmm9
  movapd %xmm2,%xmm0
  addsd  %xmm5,%xmm2
  cvtsi2sd %eax,%xmm8
  lea    (%rcx,%rax,1),%r8d
  add    %edx,%ecx
  movslq %r8d,%r8
  add    %ecx,%eax
  lea    (%rsi,%r8,4),%r8
  cltq
  cvtss2sd (%r8),%xmm10
  lea    (%rsi,%rax,4),%rax
  subsd  %xmm8,%xmm0
  movapd %xmm4,%xmm8
  subsd  %xmm0,%xmm8
  mulsd  %xmm9,%xmm0
  mulsd  %xmm9,%xmm8
  mulsd  %xmm1,%xmm0
  mulsd  %xmm1,%xmm8
  addsd  %xmm10,%xmm8
  cvtsd2ss %xmm8,%xmm8
  movss  %xmm8,(%r8)
  pxor   %xmm8,%xmm8
  cvttsd2si %xmm6,%r8d
  cvtss2sd (%rax),%xmm8
  addsd  %xmm8,%xmm0
  subsd  %xmm6,%xmm6
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%rax)
  pxor   %xmm0,%xmm0
  mov    %r8d,%eax
  cvtsi2sd %r8d,%xmm0
  imul   %edx,%eax
  subsd  %xmm7,%xmm0
  pxor   %xmm7,%xmm7
  mulsd  %xmm5,%xmm0
  addsd  %xmm3,%xmm0
  pxor   %xmm3,%xmm3
  cvttsd2si %xmm0,%r9d
  cvtsi2sd %r9d,%xmm3
  lea    (%rax,%r9,1),%r10d
  add    %edx,%eax
  movslq %r10d,%r10
  add    %r9d,%eax
  lea    (%rsi,%r10,4),%r10
  cltq
  cvtss2sd (%r10),%xmm7
  lea    (%rsi,%rax,4),%rax
  subsd  %xmm3,%xmm0
  movapd %xmm4,%xmm3
  subsd  %xmm0,%xmm3
  mulsd  %xmm6,%xmm0
  mulsd  %xmm6,%xmm3
  mulsd  %xmm1,%xmm0
  mulsd  %xmm1,%xmm3
  addsd  %xmm7,%xmm3
  cvtsd2ss %xmm3,%xmm3
  movss  %xmm3,(%r10)
  pxor   %xmm3,%xmm3
  cvtss2sd (%rax),%xmm3
  addsd  %xmm3,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%rax)
  cmp    %r8d,%edi
  jge    L78
  nopl   0x0(%rax,%rax,1)
L64:
  cvttsd2si %xmm2,%r10d
  pxor   %xmm0,%xmm0
  movapd %xmm2,%xmm3
  add    $0x1,%edi
  pxor   %xmm6,%xmm6
  addsd  %xmm5,%xmm2
  cvtsi2sd %r10d,%xmm0
  lea    (%rcx,%r10,1),%eax
  add    %edx,%ecx
  cltq
  shl    $0x2,%rax
  lea    (%rsi,%rax,1),%r9
  lea    0x4(%rsi,%rax,1),%rax
  subsd  %xmm0,%xmm3
  movapd %xmm4,%xmm0
  cvtss2sd (%r9),%xmm6
  subsd  %xmm3,%xmm0
  mulsd  %xmm1,%xmm3
  mulsd  %xmm1,%xmm0
  addsd  %xmm6,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%r9)
  pxor   %xmm0,%xmm0
  cvtss2sd (%rax),%xmm0
  addsd  %xmm3,%xmm0
  cvtsd2ss %xmm0,%xmm0
  movss  %xmm0,(%rax)
  cmp    %edi,%r8d
  jne    L64
L78:
  ret
  nopw   0x0(%rax,%rax,1)
L43:
  movq   %xmm8,%rax
  movapd %xmm7,%xmm8
  movq   %rax,%xmm7
  movq   %xmm4,%rax
  movapd %xmm3,%xmm4
  movq   %rax,%xmm3
  jmp    L3
```

tool_calls: name: retrieve_data
arguments: label: D18
data_type: qword
name: retrieve_data
arguments: label: D1
data_type: f64
name: retrieve_data
arguments: label: D20
data_type: f64

tool: D18: 9223372036854775807

tool: D1: 0.5

tool: D20: 1

assistant: ```c
void render_line_2D_WALA(float *mat, int wy, int wx, int x1, int y1, int x2, int y2, float val) {
  double dx = (double)x2 - (double)x1;
  double dy = (double)y2 - (double)y1;
  if (fabs(dx) > fabs(dy)) {
    if (x2 < x1) {
      do {
        __typeof__(x1) tmp;
        tmp = x1;
        x1 = x2;
        x2 = tmp;
      } while (0);
      do {
        __typeof__(y1) tmp;
        tmp = y1;
        y1 = y2;
        y2 = tmp;
      } while (0);
    }
    double gradient = dy / dx;
    double xend = ((int)(((double)(x1)) + 0.5));
    double yend = y1 + gradient * (xend - x1);
    double xgap = (1.0 - ((double)(x1 + 0.5) - (double)((int)x1 + 0.5)));
    int xpxl1 = xend;
    int ypxl1 = ((int)yend);
    mat[ypxl1 * wx + xpxl1] += ((1.0 - ((double)(yend) - (double)((int)yend))) * xgap * val);
    mat[(ypxl1 + 1) * wx + xpxl1] += (((double)(yend) - (double)((int)yend)) * xgap * val);
    double intery = yend + gradient;
    xend = ((int)(((double)(x2)) + 0.5));
    yend = y2 + gradient * (xend - x2);
    xgap = ((double)(x2 + 0.5) - (double)((int)x2 + 0.5));
    int xpxl2 = xend;
    int ypxl2 = ((int)yend);
    mat[ypxl2 * wx + xpxl2] += ((1.0 - ((double)(yend) - (double)((int)yend))) * xgap * val);
    mat[(ypxl2 + 1) * wx + xpxl2] += (((double)(yend) - (double)((int)yend)) * xgap * val);
    int x;
    for (x = xpxl1 + 1; x <= (xpxl2 - 1); x++) {
      mat[((int)intery) * wx + x] += ((1.0 - ((double)(intery) - (double)((int)intery))) * val);
      mat[(((int)intery) + 1) * wx + x] += (((double)(intery) - (double)((int)intery)) * val);
      intery += gradient;
    }
  } else {
    if (y2 < y1) {
      do {
        __typeof__(x1) tmp;
        tmp = x1;
        x1 = x2;
        x2 = tmp;
      } while (0);
      do {
        __typeof__(y1) tmp;
        tmp = y1;
        y1 = y2;
        y2 = tmp;
      } while (0);
    }
    double gradient = dx / dy;
    double yend = ((int)(((double)(y1)) + 0.5));
    double xend = x1 + gradient * (yend - y1);
    double ygap = (1.0 - ((double)(y1 + 0.5) - (double)((int)y1 + 0.5)));
    int ypxl1 = yend;
    int xpxl1 = ((int)xend);
    mat[ypxl1 * wx + xpxl1] += ((1.0 - ((double)(xend) - (double)((int)xend))) * ygap * val);
    mat[(ypxl1 + 1) * wx + xpxl1] += (((double)(xend) - (double)((int)xend)) * ygap * val);
    double interx = xend + gradient;
    yend = ((int)(((double)(y2)) + 0.5));
    xend = x2 + gradient * (yend - y2);
    ygap = ((double)(y2 + 0.5) - (double)((int)y2 + 0.5));
    int ypxl2 = yend;
    int xpxl2 = ((int)xend);
    mat[ypxl2 * wx + xpxl2] += ((1.0 - ((double)(xend) - (double)((int)xend))) * ygap * val);
    mat[(ypxl2 + 1) * wx + xpxl2] += (((double)(xend) - (double)((int)xend)) * ygap * val);
    int y;
    for (y = ypxl1 + 1; y <= (ypxl2 - 1); y++) {
      mat[y * wx + ((int)interx)] += ((1.0 - ((double)(interx) - (double)((int)interx))) * val);
      mat[y * wx + ((int)interx) + 1] += (((double)(interx) - (double)((int)interx)) * val);
      interx += gradient;
    }
  }
}
```