#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ draw_line(float, float, float, float, int);
void draw_filled_quadrilateral(float x1, float y1, float x2, float y2, float x3,
                               float y3, float x4, float y4, int color) {
  float X1 = x1, Y1 = y1, X2 = x2, Y2 = y2, X3 = x3, Y3 = y3, X4 = x4, Y4 = y4,
        AB, AC, AD;
  float m1 = 0, m2 = 0, c1 = 0, c2 = 0, dX1 = 5.0, dX4 = 5.0, dY1 = 5.0,
        dY4 = 5.0;
  int i;
  AB = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
  AC = (x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3);
  AD = (x1 - x4) * (x1 - x4) + (y1 - y4) * (y1 - y4);
  if (AB > AC || AB > AD) {
    X2 = x3;
    Y2 = y3;
    X3 = x2;
    Y3 = y2;
  }
  if (AD > AC || AD > AB) {
    X3 = x4;
    Y3 = y4;
    X4 = x3;
    Y4 = y3;
  }
  if (X1 != X2) {
    m1 = (Y2 - Y1) / (X2 - X1);
    c1 = Y1 - (m1 * X1);
  } else
    m1 = 20;
  if (X3 != X4) {
    m2 = (Y3 - Y4) / (X3 - X4);
    c2 = Y3 - (m2 * X3);
  } else
    m2 = 20;
  for (i = 0; (dX1 >= 1 || dX4 >= 1 || dY1 >= 1 || dY4 >= 1) && (i < 636);
       i++) {
    draw_line(X1, Y1, X4, Y4, color);
    if ((m1 * m1) >= 1) {
      if (dY1 >= 1) {
        if (X1 != X2)
          X1 = (Y1 - c1) / m1;
        if (Y2 > Y1)
          Y1++;
        else
          Y1--;
        dY1 = Y1 - Y2;
      }
    } else {
      if (dX1 >= 1) {
        Y1 = (m1 * X1) + c1;
        if (X2 > X1)
          X1++;
        else
          X1--;
        dX1 = X1 - X2;
      }
    }
    if ((m2 * m2) >= 1) {
      if (dY4 >= 1) {
        if (X4 != X3)
          X4 = (Y4 - c2) / m2;
        if (Y4 > Y3)
          Y4++;
        else
          Y4--;
        dY4 = Y3 - Y4;
      }
    } else {
      if (dX4 >= 1) {
        Y4 = (m2 * X4) + c2;
        if (X3 > X4)
          X4++;
        else
          X4--;
        dX4 = X4 - X3;
      }
    }
  }
}


x86 assembly (clang, -O0):
<draw_filled_quadrilateral>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
movss  %xmm6,-0x1c(%rbp)
movss  %xmm7,-0x20(%rbp)
mov    %edi,-0x24(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x54(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x5c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x60(%rbp)
movss  0xe42(%rip),%xmm0
movss  %xmm0,-0x64(%rbp)
movss  0xe35(%rip),%xmm0
movss  %xmm0,-0x68(%rbp)
movss  0xe28(%rip),%xmm0
movss  %xmm0,-0x6c(%rbp)
movss  0xe1b(%rip),%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
subss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
subss  -0x10(%rbp),%xmm1
movss  -0x8(%rbp),%xmm3
subss  -0x10(%rbp),%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
subss  -0x14(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
subss  -0x18(%rbp),%xmm1
movss  -0x8(%rbp),%xmm3
subss  -0x18(%rbp),%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x1c(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
subss  -0x1c(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
subss  -0x20(%rbp),%xmm1
movss  -0x8(%rbp),%xmm3
subss  -0x20(%rbp),%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x48(%rbp),%xmm0
ucomiss -0x4c(%rbp),%xmm0
ja     12b3 <draw_filled_quadrilateral+0x1a3>
movss  -0x48(%rbp),%xmm0
ucomiss -0x50(%rbp),%xmm0
jbe    12db <draw_filled_quadrilateral+0x1cb>
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x50(%rbp),%xmm0
ucomiss -0x4c(%rbp),%xmm0
ja     12f9 <draw_filled_quadrilateral+0x1e9>
movss  -0x50(%rbp),%xmm0
ucomiss -0x48(%rbp),%xmm0
jbe    1321 <draw_filled_quadrilateral+0x211>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x28(%rbp),%xmm0
ucomiss -0x30(%rbp),%xmm0
jne    133b <draw_filled_quadrilateral+0x22b>
jp     133b <draw_filled_quadrilateral+0x22b>
jmp    1386 <draw_filled_quadrilateral+0x276>
movss  -0x34(%rbp),%xmm0
subss  -0x2c(%rbp),%xmm0
movss  -0x30(%rbp),%xmm1
subss  -0x28(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x54(%rbp)
movss  -0x2c(%rbp),%xmm1
movss  -0x54(%rbp),%xmm0
movss  -0x28(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x5c(%rbp)
jmp    1393 <draw_filled_quadrilateral+0x283>
movss  0xc76(%rip),%xmm0
movss  %xmm0,-0x54(%rbp)
movss  -0x38(%rbp),%xmm0
ucomiss -0x40(%rbp),%xmm0
jne    13ad <draw_filled_quadrilateral+0x29d>
jp     13ad <draw_filled_quadrilateral+0x29d>
jmp    13f8 <draw_filled_quadrilateral+0x2e8>
movss  -0x3c(%rbp),%xmm0
subss  -0x44(%rbp),%xmm0
movss  -0x38(%rbp),%xmm1
subss  -0x40(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x58(%rbp)
movss  -0x3c(%rbp),%xmm1
movss  -0x58(%rbp),%xmm0
movss  -0x38(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x60(%rbp)
jmp    1405 <draw_filled_quadrilateral+0x2f5>
movss  0xc04(%rip),%xmm0
movss  %xmm0,-0x58(%rbp)
movl   $0x0,-0x74(%rbp)
movss  -0x64(%rbp),%xmm0
movss  0xbef(%rip),%xmm1
ucomiss %xmm1,%xmm0
jae    1469 <draw_filled_quadrilateral+0x359>
movss  -0x68(%rbp),%xmm0
movss  0xbd9(%rip),%xmm1
ucomiss %xmm1,%xmm0
jae    1469 <draw_filled_quadrilateral+0x359>
movss  -0x6c(%rbp),%xmm0
movss  0xbc3(%rip),%xmm1
ucomiss %xmm1,%xmm0
jae    1469 <draw_filled_quadrilateral+0x359>
movss  -0x70(%rbp),%xmm0
xor    %eax,%eax
movss  0xbab(%rip),%xmm1
ucomiss %xmm1,%xmm0
mov    %al,-0x75(%rbp)
jb     1476 <draw_filled_quadrilateral+0x366>
cmpl   $0x27c,-0x74(%rbp)
setl   %al
mov    %al,-0x75(%rbp)
mov    -0x75(%rbp),%al
test   $0x1,%al
jne    1486 <draw_filled_quadrilateral+0x376>
jmp    1707 <draw_filled_quadrilateral+0x5f7>
movss  -0x28(%rbp),%xmm0
movss  -0x2c(%rbp),%xmm1
movss  -0x40(%rbp),%xmm2
movss  -0x44(%rbp),%xmm3
mov    -0x24(%rbp),%edi
call   1030 <draw_line@plt>
movss  -0x54(%rbp),%xmm0
mulss  -0x54(%rbp),%xmm0
movss  0xb54(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     154d <draw_filled_quadrilateral+0x43d>
movss  -0x6c(%rbp),%xmm0
movss  0xb3e(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1548 <draw_filled_quadrilateral+0x438>
movss  -0x28(%rbp),%xmm0
ucomiss -0x30(%rbp),%xmm0
jne    14ed <draw_filled_quadrilateral+0x3dd>
jp     14ed <draw_filled_quadrilateral+0x3dd>
jmp    1501 <draw_filled_quadrilateral+0x3f1>
movss  -0x2c(%rbp),%xmm0
subss  -0x5c(%rbp),%xmm0
divss  -0x54(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x34(%rbp),%xmm0
ucomiss -0x2c(%rbp),%xmm0
jbe    1527 <draw_filled_quadrilateral+0x417>
movss  0xaf0(%rip),%xmm0
addss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
jmp    1539 <draw_filled_quadrilateral+0x429>
movss  0xadd(%rip),%xmm0
addss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x2c(%rbp),%xmm0
subss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x6c(%rbp)
jmp    15cb <draw_filled_quadrilateral+0x4bb>
movss  -0x64(%rbp),%xmm0
movss  0xaae(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     15c6 <draw_filled_quadrilateral+0x4b6>
movss  -0x54(%rbp),%xmm0
movss  -0x28(%rbp),%xmm2
movss  -0x5c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x30(%rbp),%xmm0
ucomiss -0x28(%rbp),%xmm0
jbe    15a5 <draw_filled_quadrilateral+0x495>
movss  0xa72(%rip),%xmm0
addss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
jmp    15b7 <draw_filled_quadrilateral+0x4a7>
movss  0xa5f(%rip),%xmm0
addss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x28(%rbp),%xmm0
subss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x64(%rbp)
jmp    15cb <draw_filled_quadrilateral+0x4bb>
movss  -0x58(%rbp),%xmm0
mulss  -0x58(%rbp),%xmm0
movss  0xa2b(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1676 <draw_filled_quadrilateral+0x566>
movss  -0x70(%rbp),%xmm0
movss  0xa15(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1671 <draw_filled_quadrilateral+0x561>
movss  -0x40(%rbp),%xmm0
ucomiss -0x38(%rbp),%xmm0
jne    1616 <draw_filled_quadrilateral+0x506>
jp     1616 <draw_filled_quadrilateral+0x506>
jmp    162a <draw_filled_quadrilateral+0x51a>
movss  -0x44(%rbp),%xmm0
subss  -0x60(%rbp),%xmm0
divss  -0x58(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x44(%rbp),%xmm0
ucomiss -0x3c(%rbp),%xmm0
jbe    1650 <draw_filled_quadrilateral+0x540>
movss  0x9c7(%rip),%xmm0
addss  -0x44(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
jmp    1662 <draw_filled_quadrilateral+0x552>
movss  0x9b4(%rip),%xmm0
addss  -0x44(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x3c(%rbp),%xmm0
subss  -0x44(%rbp),%xmm0
movss  %xmm0,-0x70(%rbp)
jmp    16f4 <draw_filled_quadrilateral+0x5e4>
movss  -0x68(%rbp),%xmm0
movss  0x985(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     16ef <draw_filled_quadrilateral+0x5df>
movss  -0x58(%rbp),%xmm0
movss  -0x40(%rbp),%xmm2
movss  -0x60(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x44(%rbp)
movss  -0x38(%rbp),%xmm0
ucomiss -0x40(%rbp),%xmm0
jbe    16ce <draw_filled_quadrilateral+0x5be>
movss  0x949(%rip),%xmm0
addss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
jmp    16e0 <draw_filled_quadrilateral+0x5d0>
movss  0x936(%rip),%xmm0
addss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
subss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x68(%rbp)
jmp    16f4 <draw_filled_quadrilateral+0x5e4>
jmp    16f9 <draw_filled_quadrilateral+0x5e9>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    140c <draw_filled_quadrilateral+0x2fc>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_filled_quadrilateral>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
mov    %edi,%r15d
movaps %xmm4,%xmm11
movaps %xmm0,%xmm10
shufps $0x0,%xmm0,%xmm10
movaps %xmm2,%xmm4
unpcklps %xmm11,%xmm4
subps  %xmm4,%xmm10
movaps %xmm1,%xmm8
shufps $0x0,%xmm1,%xmm8
movaps %xmm3,0x30(%rsp)
unpcklps %xmm5,%xmm3
subps  %xmm3,%xmm8
mulps  %xmm8,%xmm8
mulps  %xmm10,%xmm10
addps  %xmm8,%xmm10
movaps %xmm10,%xmm8
shufps $0x55,%xmm10,%xmm8
movaps %xmm0,%xmm9
subss  %xmm6,%xmm9
movaps %xmm1,%xmm3
subss  %xmm7,%xmm3
mulss  %xmm3,%xmm3
mulss  %xmm9,%xmm9
addss  %xmm3,%xmm9
ucomiss %xmm8,%xmm10
ja     11a6 <draw_filled_quadrilateral+0x96>
ucomiss %xmm9,%xmm10
ja     11a6 <draw_filled_quadrilateral+0x96>
movaps 0x30(%rsp),%xmm3
movss  %xmm3,0x10(%rsp)
movaps %xmm11,%xmm4
movaps %xmm5,0x30(%rsp)
jmp    11b3 <draw_filled_quadrilateral+0xa3>
movss  %xmm5,0x10(%rsp)
movaps %xmm2,%xmm4
movaps %xmm11,%xmm2
shufps $0x0,%xmm9,%xmm9
cmpltps %xmm9,%xmm10
unpcklps %xmm10,%xmm10
movmskpd %xmm10,%eax
test   %eax,%eax
je     11d4 <draw_filled_quadrilateral+0xc4>
movaps %xmm6,%xmm4
movaps %xmm7,0x30(%rsp)
jmp    11db <draw_filled_quadrilateral+0xcb>
movaps %xmm6,%xmm11
movaps %xmm7,%xmm5
xorps  %xmm3,%xmm3
movss  %xmm3,0x14(%rsp)
movss  0xe14(%rip),%xmm3
ucomiss %xmm0,%xmm2
movss  %xmm3,0x8(%rsp)
movss  %xmm3,0x4(%rsp)
xorps  %xmm3,%xmm3
movaps %xmm3,0x70(%rsp)
jne    1207 <draw_filled_quadrilateral+0xf7>
jnp    1235 <draw_filled_quadrilateral+0x125>
movss  0x10(%rsp),%xmm6
subss  %xmm1,%xmm6
movaps %xmm2,%xmm3
subss  %xmm0,%xmm3
divss  %xmm3,%xmm6
movss  %xmm6,0x4(%rsp)
movaps %xmm6,%xmm3
mulss  %xmm0,%xmm3
movaps %xmm1,%xmm6
subss  %xmm3,%xmm6
movaps %xmm6,0x70(%rsp)
ucomiss %xmm11,%xmm4
jne    123d <draw_filled_quadrilateral+0x12d>
jnp    126c <draw_filled_quadrilateral+0x15c>
movaps 0x30(%rsp),%xmm6
movaps %xmm6,%xmm7
subss  %xmm5,%xmm7
movaps %xmm4,%xmm3
subss  %xmm11,%xmm3
divss  %xmm3,%xmm7
movss  %xmm7,0x8(%rsp)
movaps %xmm7,%xmm3
mulss  %xmm4,%xmm3
subss  %xmm3,%xmm6
movss  %xmm6,0x14(%rsp)
movss  0x4(%rsp),%xmm3
mulss  %xmm3,%xmm3
movss  %xmm3,0x2c(%rsp)
movss  0x8(%rsp),%xmm3
mulss  %xmm3,%xmm3
movss  %xmm3,0x28(%rsp)
movss  0xd70(%rip),%xmm3
xor    %ebp,%ebp
mov    $0x1,%r13b
mov    $0x1,%r14b
mov    $0x1,%r12b
mov    $0x1,%bl
movss  %xmm3,0x18(%rsp)
movss  %xmm3,0x20(%rsp)
movss  %xmm3,0x24(%rsp)
movss  %xmm3,0x1c(%rsp)
movaps %xmm2,0x90(%rsp)
movss  %xmm4,0xc(%rsp)
nopw   0x0(%rax,%rax,1)
movaps %xmm0,0x40(%rsp)
movaps %xmm1,0x80(%rsp)
movaps %xmm11,0x50(%rsp)
movaps %xmm11,%xmm2
movaps %xmm5,0x60(%rsp)
movaps %xmm5,%xmm3
mov    %r15d,%edi
call   1030 <draw_line@plt>
movss  0xd09(%rip),%xmm6
movss  0x2c(%rsp),%xmm0
ucomiss %xmm6,%xmm0
jae    1370 <draw_filled_quadrilateral+0x260>
test   $0x1,%bl
movaps 0x90(%rsp),%xmm2
je     13e0 <draw_filled_quadrilateral+0x2d0>
movss  0x4(%rsp),%xmm1
movaps 0x40(%rsp),%xmm0
mulss  %xmm0,%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm2
seta   %al
addss  0x70(%rsp),%xmm1
lea    0xccd(%rip),%rcx
addss  (%rcx,%rax,4),%xmm0
movaps %xmm0,%xmm3
subss  %xmm2,%xmm3
movss  %xmm3,0x1c(%rsp)
movaps 0x60(%rsp),%xmm5
movaps 0x50(%rsp),%xmm11
jmp    13f8 <draw_filled_quadrilateral+0x2e8>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   $0x1,%r14b
movaps 0x90(%rsp),%xmm2
je     13e0 <draw_filled_quadrilateral+0x2d0>
movaps 0x40(%rsp),%xmm0
ucomiss %xmm2,%xmm0
movaps 0x80(%rsp),%xmm1
movaps 0x60(%rsp),%xmm5
movaps 0x50(%rsp),%xmm11
movss  0xc(%rsp),%xmm4
jne    13a3 <draw_filled_quadrilateral+0x293>
jnp    13b2 <draw_filled_quadrilateral+0x2a2>
movaps %xmm1,%xmm0
subss  0x70(%rsp),%xmm0
divss  0x4(%rsp),%xmm0
xor    %eax,%eax
movss  0x10(%rsp),%xmm3
ucomiss %xmm1,%xmm3
seta   %al
lea    0xc45(%rip),%rcx
addss  (%rcx,%rax,4),%xmm1
movaps %xmm1,%xmm7
subss  %xmm3,%xmm7
movss  %xmm7,0x18(%rsp)
jmp    13fe <draw_filled_quadrilateral+0x2ee>
nopl   0x0(%rax,%rax,1)
movaps 0x80(%rsp),%xmm1
movaps 0x60(%rsp),%xmm5
movaps 0x50(%rsp),%xmm11
movaps 0x40(%rsp),%xmm0
movss  0xc(%rsp),%xmm4
movss  0x28(%rsp),%xmm3
ucomiss %xmm6,%xmm3
jae    1450 <draw_filled_quadrilateral+0x340>
test   $0x1,%r12b
je     1493 <draw_filled_quadrilateral+0x383>
movss  0x8(%rsp),%xmm5
mulss  %xmm11,%xmm5
xor    %eax,%eax
ucomiss %xmm11,%xmm4
seta   %al
addss  0x14(%rsp),%xmm5
lea    0xbd8(%rip),%rcx
addss  (%rcx,%rax,4),%xmm11
movaps %xmm11,%xmm3
subss  %xmm4,%xmm3
movss  %xmm3,0x20(%rsp)
jmp    1493 <draw_filled_quadrilateral+0x383>
nopw   0x0(%rax,%rax,1)
test   $0x1,%r13b
je     1493 <draw_filled_quadrilateral+0x383>
ucomiss %xmm4,%xmm11
jne    145e <draw_filled_quadrilateral+0x34e>
jnp    1470 <draw_filled_quadrilateral+0x360>
movaps %xmm5,%xmm11
subss  0x14(%rsp),%xmm11
divss  0x8(%rsp),%xmm11
xor    %eax,%eax
movaps 0x30(%rsp),%xmm3
ucomiss %xmm3,%xmm5
seta   %al
lea    0xb88(%rip),%rcx
addss  (%rcx,%rax,4),%xmm5
subss  %xmm5,%xmm3
movss  %xmm3,0x24(%rsp)
movss  0x1c(%rsp),%xmm3
ucomiss %xmm6,%xmm3
setae  %bl
movss  0x20(%rsp),%xmm3
ucomiss %xmm6,%xmm3
setae  %r12b
mov    %ebx,%eax
or     %r12b,%al
movss  0x18(%rsp),%xmm3
ucomiss %xmm6,%xmm3
setae  %r14b
movss  0x24(%rsp),%xmm3
ucomiss %xmm6,%xmm3
setae  %r13b
mov    %r14d,%ecx
or     %r13b,%cl
or     %al,%cl
cmp    $0x1,%cl
jne    14e9 <draw_filled_quadrilateral+0x3d9>
lea    0x1(%rbp),%eax
cmp    $0x27b,%ebp
mov    %eax,%ebp
jb     12d0 <draw_filled_quadrilateral+0x1c0>
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @draw_filled_quadrilateral(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, i32 %8) {
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca i32
%19 = alloca float
%20 = alloca float
%21 = alloca float
%22 = alloca float
%23 = alloca float
%24 = alloca float
%25 = alloca float
%26 = alloca float
%27 = alloca float
%28 = alloca float
%29 = alloca float
%30 = alloca float
%31 = alloca float
%32 = alloca float
%33 = alloca float
%34 = alloca float
%35 = alloca float
%36 = alloca float
%37 = alloca float
%38 = alloca i32
store float %0, float* %10
store float %1, float* %11
store float %2, float* %12
store float %3, float* %13
store float %4, float* %14
store float %5, float* %15
store float %6, float* %16
store float %7, float* %17
store i32 %8, i32* %18
%39 = load float, float* %10
store float %39, float* %19
%40 = load float, float* %11
store float %40, float* %20
%41 = load float, float* %12
store float %41, float* %21
%42 = load float, float* %13
store float %42, float* %22
%43 = load float, float* %14
store float %43, float* %23
%44 = load float, float* %15
store float %44, float* %24
%45 = load float, float* %16
store float %45, float* %25
%46 = load float, float* %17
store float %46, float* %26
store float 0.000000e+00, float* %30
store float 0.000000e+00, float* %31
store float 0.000000e+00, float* %32
store float 0.000000e+00, float* %33
store float 5.000000e+00, float* %34
store float 5.000000e+00, float* %35
store float 5.000000e+00, float* %36
store float 5.000000e+00, float* %37
%47 = load float, float* %10
%48 = load float, float* %12
%49 = fsub float %47, %48
%50 = load float, float* %10
%51 = load float, float* %12
%52 = fsub float %50, %51
%53 = load float, float* %11
%54 = load float, float* %13
%55 = fsub float %53, %54
%56 = load float, float* %11
%57 = load float, float* %13
%58 = fsub float %56, %57
%59 = fmul float %55, %58
%60 = call float @llvm.fmuladd.f32(float %49, float %52, float %59)
store float %60, float* %27
%61 = load float, float* %10
%62 = load float, float* %14
%63 = fsub float %61, %62
%64 = load float, float* %10
%65 = load float, float* %14
%66 = fsub float %64, %65
%67 = load float, float* %11
%68 = load float, float* %15
%69 = fsub float %67, %68
%70 = load float, float* %11
%71 = load float, float* %15
%72 = fsub float %70, %71
%73 = fmul float %69, %72
%74 = call float @llvm.fmuladd.f32(float %63, float %66, float %73)
store float %74, float* %28
%75 = load float, float* %10
%76 = load float, float* %16
%77 = fsub float %75, %76
%78 = load float, float* %10
%79 = load float, float* %16
%80 = fsub float %78, %79
%81 = load float, float* %11
%82 = load float, float* %17
%83 = fsub float %81, %82
%84 = load float, float* %11
%85 = load float, float* %17
%86 = fsub float %84, %85
%87 = fmul float %83, %86
%88 = call float @llvm.fmuladd.f32(float %77, float %80, float %87)
store float %88, float* %29
%89 = load float, float* %27
%90 = load float, float* %28
%91 = fcmp ogt float %89, %90
br i1 %91, label %96, label %92
92: ; preds = %9
%93 = load float, float* %27
%94 = load float, float* %29
%95 = fcmp ogt float %93, %94
br i1 %95, label %96, label %101
96: ; preds = %92, %9
%97 = load float, float* %14
store float %97, float* %21
%98 = load float, float* %15
store float %98, float* %22
%99 = load float, float* %12
store float %99, float* %23
%100 = load float, float* %13
store float %100, float* %24
br label %101
101: ; preds = %96, %92
%102 = load float, float* %29
%103 = load float, float* %28
%104 = fcmp ogt float %102, %103
br i1 %104, label %109, label %105
105: ; preds = %101
%106 = load float, float* %29
%107 = load float, float* %27
%108 = fcmp ogt float %106, %107
br i1 %108, label %109, label %114
109: ; preds = %105, %101
%110 = load float, float* %16
store float %110, float* %23
%111 = load float, float* %17
store float %111, float* %24
%112 = load float, float* %14
store float %112, float* %25
%113 = load float, float* %15
store float %113, float* %26
br label %114
114: ; preds = %109, %105
%115 = load float, float* %19
%116 = load float, float* %21
%117 = fcmp une float %115, %116
br i1 %117, label %118, label %131
118: ; preds = %114
%119 = load float, float* %22
%120 = load float, float* %20
%121 = fsub float %119, %120
%122 = load float, float* %21
%123 = load float, float* %19
%124 = fsub float %122, %123
%125 = fdiv float %121, %124
store float %125, float* %30
%126 = load float, float* %20
%127 = load float, float* %30
%128 = load float, float* %19
%129 = fneg float %127
%130 = call float @llvm.fmuladd.f32(float %129, float %128, float %126)
store float %130, float* %32
br label %132
131: ; preds = %114
store float 2.000000e+01, float* %30
br label %132
132: ; preds = %131, %118
%133 = load float, float* %23
%134 = load float, float* %25
%135 = fcmp une float %133, %134
br i1 %135, label %136, label %149
136: ; preds = %132
%137 = load float, float* %24
%138 = load float, float* %26
%139 = fsub float %137, %138
%140 = load float, float* %23
%141 = load float, float* %25
%142 = fsub float %140, %141
%143 = fdiv float %139, %142
store float %143, float* %31
%144 = load float, float* %24
%145 = load float, float* %31
%146 = load float, float* %23
%147 = fneg float %145
%148 = call float @llvm.fmuladd.f32(float %147, float %146, float %144)
store float %148, float* %33
br label %150
149: ; preds = %132
store float 2.000000e+01, float* %31
br label %150
150: ; preds = %149, %136
store i32 0, i32* %38
br label %151
151: ; preds = %285, %150
%152 = load float, float* %34
%153 = fcmp oge float %152, 1.000000e+00
br i1 %153, label %163, label %154
154: ; preds = %151
%155 = load float, float* %35
%156 = fcmp oge float %155, 1.000000e+00
br i1 %156, label %163, label %157
157: ; preds = %154
%158 = load float, float* %36
%159 = fcmp oge float %158, 1.000000e+00
br i1 %159, label %163, label %160
160: ; preds = %157
%161 = load float, float* %37
%162 = fcmp oge float %161, 1.000000e+00
br i1 %162, label %163, label %166
163: ; preds = %160, %157, %154, %151
%164 = load i32, i32* %38
%165 = icmp slt i32 %164, 636
br label %166
166: ; preds = %163, %160
%167 = phi i1 [ false, %160 ], [ %165, %163 ]
br i1 %167, label %168, label %288
168: ; preds = %166
%169 = load float, float* %19
%170 = load float, float* %20
%171 = load float, float* %25
%172 = load float, float* %26
%173 = load i32, i32* %18
%174 = call i32 @draw_line(float %169, float %170, float %171, float %172, i32 %173)
%175 = load float, float* %30
%176 = load float, float* %30
%177 = fmul float %175, %176
%178 = fcmp oge float %177, 1.000000e+00
br i1 %178, label %179, label %207
179: ; preds = %168
%180 = load float, float* %36
%181 = fcmp oge float %180, 1.000000e+00
br i1 %181, label %182, label %206
182: ; preds = %179
%183 = load float, float* %19
%184 = load float, float* %21
%185 = fcmp une float %183, %184
br i1 %185, label %186, label %192
186: ; preds = %182
%187 = load float, float* %20
%188 = load float, float* %32
%189 = fsub float %187, %188
%190 = load float, float* %30
%191 = fdiv float %189, %190
store float %191, float* %19
br label %192
192: ; preds = %186, %182
%193 = load float, float* %22
%194 = load float, float* %20
%195 = fcmp ogt float %193, %194
br i1 %195, label %196, label %199
196: ; preds = %192
%197 = load float, float* %20
%198 = fadd float %197, 1.000000e+00
store float %198, float* %20
br label %202
199: ; preds = %192
%200 = load float, float* %20
%201 = fadd float %200, -1.000000e+00
store float %201, float* %20
br label %202
202: ; preds = %199, %196
%203 = load float, float* %20
%204 = load float, float* %22
%205 = fsub float %203, %204
store float %205, float* %36
br label %206
206: ; preds = %202, %179
br label %229
207: ; preds = %168
%208 = load float, float* %34
%209 = fcmp oge float %208, 1.000000e+00
br i1 %209, label %210, label %228
210: ; preds = %207
%211 = load float, float* %30
%212 = load float, float* %19
%213 = load float, float* %32
%214 = call float @llvm.fmuladd.f32(float %211, float %212, float %213)
store float %214, float* %20
%215 = load float, float* %21
%216 = load float, float* %19
%217 = fcmp ogt float %215, %216
br i1 %217, label %218, label %221
218: ; preds = %210
%219 = load float, float* %19
%220 = fadd float %219, 1.000000e+00
store float %220, float* %19
br label %224
221: ; preds = %210
%222 = load float, float* %19
%223 = fadd float %222, -1.000000e+00
store float %223, float* %19
br label %224
224: ; preds = %221, %218
%225 = load float, float* %19
%226 = load float, float* %21
%227 = fsub float %225, %226
store float %227, float* %34
br label %228
228: ; preds = %224, %207
br label %229
229: ; preds = %228, %206
%230 = load float, float* %31
%231 = load float, float* %31
%232 = fmul float %230, %231
%233 = fcmp oge float %232, 1.000000e+00
br i1 %233, label %234, label %262
234: ; preds = %229
%235 = load float, float* %37
%236 = fcmp oge float %235, 1.000000e+00
br i1 %236, label %237, label %261
237: ; preds = %234
%238 = load float, float* %25
%239 = load float, float* %23
%240 = fcmp une float %238, %239
br i1 %240, label %241, label %247
241: ; preds = %237
%242 = load float, float* %26
%243 = load float, float* %33
%244 = fsub float %242, %243
%245 = load float, float* %31
%246 = fdiv float %244, %245
store float %246, float* %25
br label %247
247: ; preds = %241, %237
%248 = load float, float* %26
%249 = load float, float* %24
%250 = fcmp ogt float %248, %249
br i1 %250, label %251, label %254
251: ; preds = %247
%252 = load float, float* %26
%253 = fadd float %252, 1.000000e+00
store float %253, float* %26
br label %257
254: ; preds = %247
%255 = load float, float* %26
%256 = fadd float %255, -1.000000e+00
store float %256, float* %26
br label %257
257: ; preds = %254, %251
%258 = load float, float* %24
%259 = load float, float* %26
%260 = fsub float %258, %259
store float %260, float* %37
br label %261
261: ; preds = %257, %234
br label %284
262: ; preds = %229
%263 = load float, float* %35
%264 = fcmp oge float %263, 1.000000e+00
br i1 %264, label %265, label %283
265: ; preds = %262
%266 = load float, float* %31
%267 = load float, float* %25
%268 = load float, float* %33
%269 = call float @llvm.fmuladd.f32(float %266, float %267, float %268)
store float %269, float* %26
%270 = load float, float* %23
%271 = load float, float* %25
%272 = fcmp ogt float %270, %271
br i1 %272, label %273, label %276
273: ; preds = %265
%274 = load float, float* %25
%275 = fadd float %274, 1.000000e+00
store float %275, float* %25
br label %279
276: ; preds = %265
%277 = load float, float* %25
%278 = fadd float %277, -1.000000e+00
store float %278, float* %25
br label %279
279: ; preds = %276, %273
%280 = load float, float* %25
%281 = load float, float* %23
%282 = fsub float %280, %281
store float %282, float* %35
br label %283
283: ; preds = %279, %262
br label %284
284: ; preds = %283, %261
br label %285
285: ; preds = %284
%286 = load i32, i32* %38
%287 = add nsw i32 %286, 1
store i32 %287, i32* %38
br label %151
288: ; preds = %166
ret void
}

LLVM IR (-O2):
define void @draw_filled_quadrilateral(float %0, float %1, float %2, float %3, float %4, float %5, float %6, float %7, i32 %8) {
%10 = insertelement <2 x float> poison, float %0, i64 0
%11 = shufflevector <2 x float> %10, <2 x float> poison, <2 x i32> zeroinitializer
%12 = insertelement <2 x float> poison, float %2, i64 0
%13 = insertelement <2 x float> %12, float %4, i64 1
%14 = fsub <2 x float> %11, %13
%15 = insertelement <2 x float> poison, float %1, i64 0
%16 = shufflevector <2 x float> %15, <2 x float> poison, <2 x i32> zeroinitializer
%17 = insertelement <2 x float> poison, float %3, i64 0
%18 = insertelement <2 x float> %17, float %5, i64 1
%19 = fsub <2 x float> %16, %18
%20 = fmul <2 x float> %19, %19
%21 = call <2 x float> @llvm.fmuladd.v2f32(<2 x float> %14, <2 x float> %14, <2 x float> %20)
%22 = fsub float %0, %6
%23 = fsub float %1, %7
%24 = fmul float %23, %23
%25 = tail call float @llvm.fmuladd.f32(float %22, float %22, float %24)
%26 = extractelement <2 x float> %21, i64 0
%27 = extractelement <2 x float> %21, i64 1
%28 = fcmp ogt float %26, %27
%29 = fcmp ogt float %26, %25
%30 = select i1 %28, i1 true, i1 %29
br i1 %30, label %31, label %32
31: ; preds = %9
br label %32
32: ; preds = %9, %31
%33 = phi float [ %5, %31 ], [ %3, %9 ]
%34 = phi float [ %2, %31 ], [ %4, %9 ]
%35 = phi float [ %3, %31 ], [ %5, %9 ]
%36 = phi float [ %4, %31 ], [ %2, %9 ]
%37 = insertelement <2 x float> poison, float %25, i64 0
%38 = shufflevector <2 x float> %37, <2 x float> poison, <2 x i32> zeroinitializer
%39 = fcmp ogt <2 x float> %38, %21
%40 = extractelement <2 x i1> %39, i64 0
%41 = extractelement <2 x i1> %39, i64 1
%42 = select i1 %41, i1 true, i1 %40
br i1 %42, label %43, label %44
43: ; preds = %32
br label %44
44: ; preds = %32, %43
%45 = phi float [ %6, %43 ], [ %34, %32 ]
%46 = phi float [ %7, %43 ], [ %35, %32 ]
%47 = phi float [ %4, %43 ], [ %6, %32 ]
%48 = phi float [ %5, %43 ], [ %7, %32 ]
%49 = fcmp une float %36, %0
br i1 %49, label %50, label %56
50: ; preds = %44
%51 = fsub float %33, %1
%52 = fsub float %36, %0
%53 = fdiv float %51, %52
%54 = fneg float %53
%55 = tail call float @llvm.fmuladd.f32(float %54, float %0, float %1)
br label %56
56: ; preds = %44, %50
%57 = phi float [ %53, %50 ], [ 2.000000e+01, %44 ]
%58 = phi float [ %55, %50 ], [ 0.000000e+00, %44 ]
%59 = fcmp une float %45, %47
br i1 %59, label %60, label %66
60: ; preds = %56
%61 = fsub float %46, %48
%62 = fsub float %45, %47
%63 = fdiv float %61, %62
%64 = fneg float %63
%65 = tail call float @llvm.fmuladd.f32(float %64, float %45, float %46)
br label %66
66: ; preds = %56, %60
%67 = phi float [ %63, %60 ], [ 2.000000e+01, %56 ]
%68 = phi float [ %65, %60 ], [ 0.000000e+00, %56 ]
%69 = fmul float %57, %57
%70 = fcmp ult float %69, 1.000000e+00
%71 = fmul float %67, %67
%72 = fcmp ult float %71, 1.000000e+00
br label %73
73: ; preds = %66, %131
%74 = phi i1 [ true, %66 ], [ %142, %131 ]
%75 = phi i1 [ true, %66 ], [ %140, %131 ]
%76 = phi i1 [ true, %66 ], [ %138, %131 ]
%77 = phi i1 [ true, %66 ], [ %137, %131 ]
%78 = phi i32 [ 0, %66 ], [ %136, %131 ]
%79 = phi float [ 5.000000e+00, %66 ], [ %135, %131 ]
%80 = phi float [ 5.000000e+00, %66 ], [ %111, %131 ]
%81 = phi float [ 5.000000e+00, %66 ], [ %134, %131 ]
%82 = phi float [ 5.000000e+00, %66 ], [ %110, %131 ]
%83 = phi float [ %0, %66 ], [ %109, %131 ]
%84 = phi float [ %1, %66 ], [ %108, %131 ]
%85 = phi float [ %48, %66 ], [ %133, %131 ]
%86 = phi float [ %47, %66 ], [ %132, %131 ]
%87 = tail call i32 @draw_line(float %83, float %84, float %86, float %85, i32 %8)
br i1 %70, label %100, label %88
88: ; preds = %73
br i1 %75, label %89, label %107
89: ; preds = %88
%90 = fcmp une float %83, %36
br i1 %90, label %91, label %94
91: ; preds = %89
%92 = fsub float %84, %58
%93 = fdiv float %92, %57
br label %94
94: ; preds = %91, %89
%95 = phi float [ %93, %91 ], [ %83, %89 ]
%96 = fcmp ogt float %33, %84
%97 = select i1 %96, float 1.000000e+00, float -1.000000e+00
%98 = fadd float %84, %97
%99 = fsub float %98, %33
br label %107
100: ; preds = %73
br i1 %77, label %101, label %107
101: ; preds = %100
%102 = tail call float @llvm.fmuladd.f32(float %57, float %83, float %58)
%103 = fcmp ogt float %36, %83
%104 = select i1 %103, float 1.000000e+00, float -1.000000e+00
%105 = fadd float %83, %104
%106 = fsub float %105, %36
br label %107
107: ; preds = %100, %101, %88, %94
%108 = phi float [ %98, %94 ], [ %84, %88 ], [ %102, %101 ], [ %84, %100 ]
%109 = phi float [ %95, %94 ], [ %83, %88 ], [ %105, %101 ], [ %83, %100 ]
%110 = phi float [ %82, %94 ], [ %82, %88 ], [ %106, %101 ], [ %82, %100 ]
%111 = phi float [ %99, %94 ], [ %80, %88 ], [ %80, %101 ], [ %80, %100 ]
br i1 %72, label %124, label %112
112: ; preds = %107
br i1 %74, label %113, label %131
113: ; preds = %112
%114 = fcmp une float %86, %45
br i1 %114, label %115, label %118
115: ; preds = %113
%116 = fsub float %85, %68
%117 = fdiv float %116, %67
br label %118
118: ; preds = %115, %113
%119 = phi float [ %117, %115 ], [ %86, %113 ]
%120 = fcmp ogt float %85, %46
%121 = select i1 %120, float 1.000000e+00, float -1.000000e+00
%122 = fadd float %85, %121
%123 = fsub float %46, %122
br label %131
124: ; preds = %107
br i1 %76, label %125, label %131
125: ; preds = %124
%126 = tail call float @llvm.fmuladd.f32(float %67, float %86, float %68)
%127 = fcmp ogt float %45, %86
%128 = select i1 %127, float 1.000000e+00, float -1.000000e+00
%129 = fadd float %86, %128
%130 = fsub float %129, %45
br label %131
131: ; preds = %118, %112, %125, %124
%132 = phi float [ %119, %118 ], [ %86, %112 ], [ %129, %125 ], [ %86, %124 ]
%133 = phi float [ %122, %118 ], [ %85, %112 ], [ %126, %125 ], [ %85, %124 ]
%134 = phi float [ %81, %118 ], [ %81, %112 ], [ %130, %125 ], [ %81, %124 ]
%135 = phi float [ %123, %118 ], [ %79, %112 ], [ %79, %125 ], [ %79, %124 ]
%136 = add nuw nsw i32 %78, 1
%137 = fcmp oge float %110, 1.000000e+00
%138 = fcmp oge float %134, 1.000000e+00
%139 = select i1 %137, i1 true, i1 %138
%140 = fcmp oge float %111, 1.000000e+00
%141 = select i1 %139, i1 true, i1 %140
%142 = fcmp oge float %135, 1.000000e+00
%143 = select i1 %141, i1 true, i1 %142
%144 = icmp ult i32 %78, 635
%145 = select i1 %143, i1 %144, i1 false
br i1 %145, label %73, label %146
146: ; preds = %131
ret void
}