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

```asm
<gln_linegraphics_draw_line_if>:
  endbr64
  cmp    %r9d,%r8d
  je     L33
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %edi,%ebx
  mov    %esi,%ebp
  mov    %edx,%r15d
  mov    %ecx,%r12d
  mov    %r8d,%r13d
  mov    %r9d,%r14d
  cmp    %edi,%edx
  jl     L123
  sub    %edi,%edx
  movl   $0x1,(%rsp)
L81:
  cmp    %ebp,%r12d
  jl     L130
  mov    %r12d,%eax
  sub    %ebp,%eax
  cmp    %eax,%edx
  jge    L116
  lea    (%rdx,%rdx,1),%ecx
  mov    %ecx,0x4(%rsp)
  mov    %ecx,%r15d
  sub    %eax,%r15d
  add    %eax,%eax
  mov    %eax,0xc(%rsp)
  cmp    %ebp,%r12d
  je     L127
  movl   $0x1,0x8(%rsp)
  jmp    L165
L123:
  mov    %edi,%edx
  sub    %r15d,%edx
  movl   $0xffffffff,(%rsp)
  jmp    L81
L130:
  mov    %ebp,%eax
  sub    %r12d,%eax
  cmp    %eax,%edx
  jl     L118
  movl   $0xffffffff,0xc(%rsp)
L54:
  add    %eax,%eax
  mov    %eax,0x4(%rsp)
  mov    %eax,%r12d
  sub    %edx,%r12d
  lea    (%rdx,%rdx,1),%eax
  mov    %eax,0x8(%rsp)
  cmp    %ebx,%r15d
  jne    L67
L73:
  mov    %r14d,%ecx
  mov    %r13d,%edx
  mov    %ebp,%esi
  mov    %ebx,%edi
  call   <gln_linegraphics_plot_clip@plt>
L169:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L116:
  movl   $0x1,0xc(%rsp)
  jmp    L54
L152:
  add    0x4(%rsp),%r12d
  add    (%rsp),%ebx
  cmp    %ebx,%r15d
  je     L73
L67:
  mov    %r14d,%ecx
  mov    %r13d,%edx
  mov    %ebp,%esi
  mov    %ebx,%edi
  call   <gln_linegraphics_plot_clip@plt>
  test   %r12d,%r12d
  js     L152
  add    0xc(%rsp),%ebp
  sub    0x8(%rsp),%r12d
  jmp    L152
L15:
  add    0x4(%rsp),%r15d
  add    0x8(%rsp),%ebp
  cmp    %ebp,%r12d
  je     L127
L165:
  mov    %r14d,%ecx
  mov    %r13d,%edx
  mov    %ebp,%esi
  mov    %ebx,%edi
  call   <gln_linegraphics_plot_clip@plt>
  test   %r15d,%r15d
  js     L15
  add    (%rsp),%ebx
  sub    0xc(%rsp),%r15d
  jmp    L15
L127:
  mov    %r14d,%ecx
  mov    %r13d,%edx
  mov    %ebp,%esi
  mov    %ebx,%edi
  call   <gln_linegraphics_plot_clip@plt>
  jmp    L169
L118:
  lea    (%rdx,%rdx,1),%esi
  mov    %esi,0x4(%rsp)
  mov    %esi,%r15d
  sub    %eax,%r15d
  add    %eax,%eax
  mov    %eax,0xc(%rsp)
  movl   $0xffffffff,0x8(%rsp)
  jmp    L165
L33:
  ret
```

assistant: ```c
void gln_linegraphics_draw_line_if(int x1, int y1, int x2, int y2, int colour1, int colour2) {
  int x, y, dx, dy, incx, incy, balance;
  if (colour1 == colour2)
    return;
  if (x2 >= x1) {
    dx = x2 - x1;
    incx = 1;
  } else {
    dx = x1 - x2;
    incx = -1;
  }
  if (y2 >= y1) {
    dy = y2 - y1;
    incy = 1;
  } else {
    dy = y1 - y2;
    incy = -1;
  }
  x = x1;
  y = y1;
  if (dx >= dy) {
    dy <<= 1;
    balance = dy - dx;
    dx <<= 1;
    while (x != x2) {
      gln_linegraphics_plot_clip(x, y, colour1, colour2);
      if (balance >= 0) {
        y += incy;
        balance -= dx;
      }
      balance += dy;
      x += incx;
    }
    gln_linegraphics_plot_clip(x, y, colour1, colour2);
  } else {
    dx <<= 1;
    balance = dx - dy;
    dy <<= 1;
    while (y != y2) {
      gln_linegraphics_plot_clip(x, y, colour1, colour2);
      if (balance >= 0) {
        x += incx;
        balance -= dy;
      }
      balance += dx;
      y += incy;
    }
    gln_linegraphics_plot_clip(x, y, colour1, colour2);
  }
}
```