int XD_Draw_Vector(Unit, Imp, NPts, X, Y, Value, Mask)
int *Unit, Imp, NPts, *X, *Y, *Mask;
char *Value;
{
  int dx, dy, incr1, incr2, d, x, y;
  int XStart, YStart, XEnd, YEnd, Offset, i, status;
  for (i = 0; i < NPts - 1; i++) {
    Offset = 1;
    XStart = X[i];
    XEnd = X[i + 1];
    YStart = Y[i];
    YEnd = Y[i + 1];
    dx = abs(XEnd - XStart);
    dy = abs(YEnd - YStart);
    if (dx < dy) {
      if (YStart > YEnd) {
        XStart = X[i + 1], XEnd = X[i];
        YStart = Y[i + 1], YEnd = Y[i];
      }
      status = XD_Device_Interface(Unit, 9, Imp, XStart, YStart, Value, Mask);
      if (status != 1)
        break;
      x = XStart;
      if (XStart > XEnd)
        Offset = -1;
      d = 2 * dx - dy;
      incr1 = 2 * dx;
      incr2 = 2 * (dx - dy);
      for (y = YStart + 1; y <= YEnd; y++) {
        if (d < 0) {
          d = d + incr1;
        } else {
          x = x + Offset;
          d = d + incr2;
        }
        status = XD_Device_Interface(Unit, 9, Imp, x, y, Value, Mask);
        if (status != 1)
          break;
      }
    } else {
      if (XStart > XEnd) {
        XStart = X[i + 1], XEnd = X[i];
        YStart = Y[i + 1], YEnd = Y[i];
      }
      status = XD_Device_Interface(Unit, 9, Imp, XStart, YStart, Value, Mask);
      if (status != 1)
        break;
      y = YStart;
      if (YStart > YEnd)
        Offset = -1;
      d = 2 * dy - dx;
      incr1 = 2 * dy;
      incr2 = 2 * (dy - dx);
      for (x = XStart + 1; x <= XEnd; x++) {
        if (d < 0) {
          d = d + incr1;
        } else {
          y = y + Offset;
          d = d + incr2;
        }
        status = XD_Device_Interface(Unit, 9, Imp, x, y, Value, Mask);
        if (status != 1)
          break;
      }
    }
  }
  return (status);
}


x86 assembly (clang, -O0):
<XD_Draw_Vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    -0x10(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    147c <XD_Draw_Vector+0x35c>
movl   $0x1,-0x58(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x50(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x54(%rbp)
mov    -0x50(%rbp),%edi
sub    -0x48(%rbp),%edi
call   1040 <abs@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x54(%rbp),%edi
sub    -0x4c(%rbp),%edi
call   1040 <abs@plt>
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    131a <XD_Draw_Vector+0x1fa>
mov    -0x4c(%rbp),%eax
cmp    -0x54(%rbp),%eax
jle    1219 <XD_Draw_Vector+0xf9>
mov    -0x18(%rbp),%rax
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x50(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x54(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x48(%rbp),%ecx
mov    -0x4c(%rbp),%r8d
mov    -0x28(%rbp),%r9
mov    0x10(%rbp),%rax
mov    $0x9,%esi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <XD_Device_Interface@plt>
mov    %eax,-0x60(%rbp)
cmpl   $0x1,-0x60(%rbp)
je     1251 <XD_Draw_Vector+0x131>
jmp    147c <XD_Draw_Vector+0x35c>
mov    -0x48(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x50(%rbp),%eax
jle    126a <XD_Draw_Vector+0x14a>
movl   $0xffffffff,-0x58(%rbp)
mov    -0x2c(%rbp),%eax
shl    $0x1,%eax
sub    -0x30(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x2c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
sub    -0x30(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x54(%rbp),%eax
jg     1315 <XD_Draw_Vector+0x1f5>
cmpl   $0x0,-0x3c(%rbp)
jge    12b8 <XD_Draw_Vector+0x198>
mov    -0x3c(%rbp),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    12ca <XD_Draw_Vector+0x1aa>
mov    -0x40(%rbp),%eax
add    -0x58(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
add    -0x38(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x40(%rbp),%ecx
mov    -0x44(%rbp),%r8d
mov    -0x28(%rbp),%r9
mov    0x10(%rbp),%rax
mov    $0x9,%esi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <XD_Device_Interface@plt>
mov    %eax,-0x60(%rbp)
cmpl   $0x1,-0x60(%rbp)
je     1302 <XD_Draw_Vector+0x1e2>
jmp    1315 <XD_Draw_Vector+0x1f5>
jmp    1307 <XD_Draw_Vector+0x1e7>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1294 <XD_Draw_Vector+0x174>
jmp    1469 <XD_Draw_Vector+0x349>
mov    -0x48(%rbp),%eax
cmp    -0x50(%rbp),%eax
jle    1368 <XD_Draw_Vector+0x248>
mov    -0x18(%rbp),%rax
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x50(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x5c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x54(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x48(%rbp),%ecx
mov    -0x4c(%rbp),%r8d
mov    -0x28(%rbp),%r9
mov    0x10(%rbp),%rax
mov    $0x9,%esi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <XD_Device_Interface@plt>
mov    %eax,-0x60(%rbp)
cmpl   $0x1,-0x60(%rbp)
je     13a0 <XD_Draw_Vector+0x280>
jmp    147c <XD_Draw_Vector+0x35c>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x54(%rbp),%eax
jle    13b9 <XD_Draw_Vector+0x299>
movl   $0xffffffff,-0x58(%rbp)
mov    -0x30(%rbp),%eax
shl    $0x1,%eax
sub    -0x2c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x30(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
sub    -0x2c(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x50(%rbp),%eax
jg     1464 <XD_Draw_Vector+0x344>
cmpl   $0x0,-0x3c(%rbp)
jge    1407 <XD_Draw_Vector+0x2e7>
mov    -0x3c(%rbp),%eax
add    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    1419 <XD_Draw_Vector+0x2f9>
mov    -0x44(%rbp),%eax
add    -0x58(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x3c(%rbp),%eax
add    -0x38(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x40(%rbp),%ecx
mov    -0x44(%rbp),%r8d
mov    -0x28(%rbp),%r9
mov    0x10(%rbp),%rax
mov    $0x9,%esi
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <XD_Device_Interface@plt>
mov    %eax,-0x60(%rbp)
cmpl   $0x1,-0x60(%rbp)
je     1451 <XD_Draw_Vector+0x331>
jmp    1464 <XD_Draw_Vector+0x344>
jmp    1456 <XD_Draw_Vector+0x336>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    13e3 <XD_Draw_Vector+0x2c3>
jmp    1469 <XD_Draw_Vector+0x349>
jmp    146e <XD_Draw_Vector+0x34e>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1149 <XD_Draw_Vector+0x29>
mov    -0x60(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XD_Draw_Vector>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %r9,0x30(%rsp)
mov    %rcx,0x40(%rsp)
mov    %esi,0x8(%rsp)
mov    %rdi,0x28(%rsp)
mov    %rdx,0x38(%rsp)
cmp    $0x2,%edx
jl     13ff <XD_Draw_Vector+0x2ef>
mov    0x38(%rsp),%rax
add    $0xffffffff,%eax
mov    %rax,0x38(%rsp)
xor    %ebx,%ebx
mov    %r8,0x10(%rsp)
jmp    1179 <XD_Draw_Vector+0x69>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x18(%rsp),%rbx
mov    0x10(%rsp),%r8
add    $0x1,%rbx
cmp    0x38(%rsp),%rbx
je     13ff <XD_Draw_Vector+0x2ef>
mov    0x40(%rsp),%rax
mov    (%rax,%rbx,4),%r15d
mov    0x4(%rax,%rbx,4),%ecx
mov    (%r8,%rbx,4),%esi
mov    0x4(%r8,%rbx,4),%eax
mov    %ecx,%edx
sub    %r15d,%edx
mov    %edx,%r13d
neg    %r13d
cmovs  %edx,%r13d
mov    %eax,%edx
sub    %esi,%edx
mov    %edx,%r12d
neg    %r12d
cmovs  %edx,%r12d
mov    %r13d,%r14d
sub    %r12d,%r14d
jae    11d0 <XD_Draw_Vector+0xc0>
mov    %rbx,0x18(%rsp)
cmp    %esi,%eax
jge    11f0 <XD_Draw_Vector+0xe0>
mov    %rsi,0x20(%rsp)
mov    %ecx,%ebp
mov    %eax,%ebx
jmp    11fd <XD_Draw_Vector+0xed>
nopl   0x0(%rax,%rax,1)
mov    %rsi,0x20(%rsp)
cmp    %r15d,%ecx
jge    12e0 <XD_Draw_Vector+0x1d0>
mov    %ecx,%r14d
mov    %eax,%ebp
jmp    12f2 <XD_Draw_Vector+0x1e2>
nopl   0x0(%rax,%rax,1)
mov    %r15d,%ebp
mov    %esi,%ebx
mov    %ecx,%r15d
mov    %rax,0x20(%rsp)
mov    0x80(%rsp),%rax
mov    %rax,(%rsp)
mov    0x28(%rsp),%rdi
mov    $0x9,%esi
mov    0x8(%rsp),%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    0x30(%rsp),%r9
xor    %eax,%eax
call   1030 <XD_Device_Interface@plt>
cmp    $0x1,%eax
jne    13ff <XD_Draw_Vector+0x2ef>
xor    %edx,%edx
cmp    %r15d,%ebp
setle  %cl
mov    $0x1,%eax
mov    0x20(%rsp),%rsi
cmp    %esi,%ebx
jge    1160 <XD_Draw_Vector+0x50>
mov    %cl,%dl
lea    (%rdx,%rdx,1),%eax
add    $0xffffffff,%eax
mov    %eax,0xc(%rsp)
add    %r13d,%r13d
add    %r14d,%r14d
mov    %r13d,%r15d
sub    %r12d,%r15d
neg    %esi
add    $0x1,%ebx
mov    %rsi,%r12
nopl   0x0(%rax,%rax,1)
mov    %ebp,%eax
test   %r15d,%r15d
mov    0xc(%rsp),%ebp
mov    $0x0,%ecx
cmovs  %ecx,%ebp
add    %eax,%ebp
mov    0x80(%rsp),%rax
mov    %rax,(%rsp)
mov    0x28(%rsp),%rdi
mov    $0x9,%esi
mov    0x8(%rsp),%edx
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    0x30(%rsp),%r9
xor    %eax,%eax
call   1030 <XD_Device_Interface@plt>
cmp    $0x1,%eax
jne    13f0 <XD_Draw_Vector+0x2e0>
test   %r15d,%r15d
mov    %r14d,%eax
cmovs  %r13d,%eax
add    %eax,%r15d
lea    (%r12,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1270 <XD_Draw_Vector+0x160>
jmp    13d3 <XD_Draw_Vector+0x2c3>
nopl   0x0(%rax)
mov    %r15d,%r14d
mov    0x20(%rsp),%rdx
mov    %edx,%ebp
mov    %ecx,%r15d
mov    %rax,0x20(%rsp)
mov    0x80(%rsp),%rax
mov    %rax,(%rsp)
mov    0x28(%rsp),%rdi
mov    $0x9,%esi
mov    0x8(%rsp),%edx
mov    %r14d,%ecx
mov    %ebp,%r8d
mov    0x30(%rsp),%r9
xor    %eax,%eax
call   1030 <XD_Device_Interface@plt>
cmp    $0x1,%eax
jne    13ff <XD_Draw_Vector+0x2ef>
xor    %edx,%edx
cmp    0x20(%rsp),%ebp
setle  %cl
mov    $0x1,%eax
mov    %r15,%rsi
cmp    %esi,%r14d
jge    1165 <XD_Draw_Vector+0x55>
mov    %rbx,0x18(%rsp)
mov    %cl,%dl
lea    (%rdx,%rdx,1),%eax
add    $0xffffffff,%eax
mov    %eax,0xc(%rsp)
lea    (%r12,%r12,1),%r15d
sub    %r13d,%r12d
add    %r12d,%r12d
mov    %r15d,%ebx
sub    %r13d,%ebx
neg    %esi
add    $0x1,%r14d
mov    %rsi,%r13
nopl   0x0(%rax,%rax,1)
mov    %ebp,%eax
test   %ebx,%ebx
mov    0xc(%rsp),%ebp
mov    $0x0,%ecx
cmovs  %ecx,%ebp
add    %eax,%ebp
mov    0x80(%rsp),%rax
mov    %rax,(%rsp)
mov    0x28(%rsp),%rdi
mov    $0x9,%esi
mov    0x8(%rsp),%edx
mov    %r14d,%ecx
mov    %ebp,%r8d
mov    0x30(%rsp),%r9
xor    %eax,%eax
call   1030 <XD_Device_Interface@plt>
cmp    $0x1,%eax
jne    13f0 <XD_Draw_Vector+0x2e0>
test   %ebx,%ebx
mov    %r12d,%eax
cmovs  %r15d,%eax
add    %eax,%ebx
lea    (%r14,%r13,1),%eax
add    $0x1,%eax
mov    %r14d,%ecx
add    $0x1,%ecx
mov    %ecx,%r14d
cmp    $0x1,%eax
jne    1370 <XD_Draw_Vector+0x260>
mov    0x10(%rsp),%r8
mov    0x18(%rsp),%rbx
mov    $0x1,%eax
jmp    116a <XD_Draw_Vector+0x5a>
nopw   0x0(%rax,%rax,1)
mov    0x10(%rsp),%r8
mov    0x18(%rsp),%rbx
jmp    116a <XD_Draw_Vector+0x5a>
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @XD_Draw_Vector(i32* %0, i32 %1, i32 %2, i32* %3, i32* %4, i8* %5, i32* %6) {
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i8*
%14 = alloca i32*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
store i32* %0, i32** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32* %3, i32** %11
store i32* %4, i32** %12
store i8* %5, i8** %13
store i32* %6, i32** %14
store i32 0, i32* %27
br label %29
29: ; preds = %251, %7
%30 = load i32, i32* %27
%31 = load i32, i32* %10
%32 = sub nsw i32 %31, 1
%33 = icmp slt i32 %30, %32
br i1 %33, label %34, label %254
34: ; preds = %29
store i32 1, i32* %26
%35 = load i32*, i32** %11
%36 = load i32, i32* %27
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i32, i32* %35, i64 %37
%39 = load i32, i32* %38
store i32 %39, i32* %22
%40 = load i32*, i32** %11
%41 = load i32, i32* %27
%42 = add nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %40, i64 %43
%45 = load i32, i32* %44
store i32 %45, i32* %24
%46 = load i32*, i32** %12
%47 = load i32, i32* %27
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i32, i32* %46, i64 %48
%50 = load i32, i32* %49
store i32 %50, i32* %23
%51 = load i32*, i32** %12
%52 = load i32, i32* %27
%53 = add nsw i32 %52, 1
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i32, i32* %51, i64 %54
%56 = load i32, i32* %55
store i32 %56, i32* %25
%57 = load i32, i32* %24
%58 = load i32, i32* %22
%59 = sub nsw i32 %57, %58
%60 = call i32 @abs(i32 %59)
store i32 %60, i32* %15
%61 = load i32, i32* %25
%62 = load i32, i32* %23
%63 = sub nsw i32 %61, %62
%64 = call i32 @abs(i32 %63)
store i32 %64, i32* %16
%65 = load i32, i32* %15
%66 = load i32, i32* %16
%67 = icmp slt i32 %65, %66
br i1 %67, label %68, label %159
68: ; preds = %34
%69 = load i32, i32* %23
%70 = load i32, i32* %25
%71 = icmp sgt i32 %69, %70
br i1 %71, label %72, label %95
72: ; preds = %68
%73 = load i32*, i32** %11
%74 = load i32, i32* %27
%75 = add nsw i32 %74, 1
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32, i32* %73, i64 %76
%78 = load i32, i32* %77
store i32 %78, i32* %22
%79 = load i32*, i32** %11
%80 = load i32, i32* %27
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i32, i32* %79, i64 %81
%83 = load i32, i32* %82
store i32 %83, i32* %24
%84 = load i32*, i32** %12
%85 = load i32, i32* %27
%86 = add nsw i32 %85, 1
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds i32, i32* %84, i64 %87
%89 = load i32, i32* %88
store i32 %89, i32* %23
%90 = load i32*, i32** %12
%91 = load i32, i32* %27
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds i32, i32* %90, i64 %92
%94 = load i32, i32* %93
store i32 %94, i32* %25
br label %95
95: ; preds = %72, %68
%96 = load i32*, i32** %8
%97 = load i32, i32* %9
%98 = load i32, i32* %22
%99 = load i32, i32* %23
%100 = load i8*, i8** %13
%101 = load i32*, i32** %14
%102 = call i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...) bitcast (i32 (...)* @XD_Device_Interface to i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...)*)(i32* %96, i32 9, i32 %97, i32 %98, i32 %99, i8* %100, i32* %101)
store i32 %102, i32* %28
%103 = load i32, i32* %28
%104 = icmp ne i32 %103, 1
br i1 %104, label %105, label %106
105: ; preds = %95
br label %254
106: ; preds = %95
%107 = load i32, i32* %22
store i32 %107, i32* %20
%108 = load i32, i32* %22
%109 = load i32, i32* %24
%110 = icmp sgt i32 %108, %109
br i1 %110, label %111, label %112
111: ; preds = %106
store i32 -1, i32* %26
br label %112
112: ; preds = %111, %106
%113 = load i32, i32* %15
%114 = mul nsw i32 2, %113
%115 = load i32, i32* %16
%116 = sub nsw i32 %114, %115
store i32 %116, i32* %19
%117 = load i32, i32* %15
%118 = mul nsw i32 2, %117
store i32 %118, i32* %17
%119 = load i32, i32* %15
%120 = load i32, i32* %16
%121 = sub nsw i32 %119, %120
%122 = mul nsw i32 2, %121
store i32 %122, i32* %18
%123 = load i32, i32* %23
%124 = add nsw i32 %123, 1
store i32 %124, i32* %21
br label %125
125: ; preds = %155, %112
%126 = load i32, i32* %21
%127 = load i32, i32* %25
%128 = icmp sle i32 %126, %127
br i1 %128, label %129, label %158
129: ; preds = %125
%130 = load i32, i32* %19
%131 = icmp slt i32 %130, 0
br i1 %131, label %132, label %136
132: ; preds = %129
%133 = load i32, i32* %19
%134 = load i32, i32* %17
%135 = add nsw i32 %133, %134
store i32 %135, i32* %19
br label %143
136: ; preds = %129
%137 = load i32, i32* %20
%138 = load i32, i32* %26
%139 = add nsw i32 %137, %138
store i32 %139, i32* %20
%140 = load i32, i32* %19
%141 = load i32, i32* %18
%142 = add nsw i32 %140, %141
store i32 %142, i32* %19
br label %143
143: ; preds = %136, %132
%144 = load i32*, i32** %8
%145 = load i32, i32* %9
%146 = load i32, i32* %20
%147 = load i32, i32* %21
%148 = load i8*, i8** %13
%149 = load i32*, i32** %14
%150 = call i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...) bitcast (i32 (...)* @XD_Device_Interface to i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...)*)(i32* %144, i32 9, i32 %145, i32 %146, i32 %147, i8* %148, i32* %149)
store i32 %150, i32* %28
%151 = load i32, i32* %28
%152 = icmp ne i32 %151, 1
br i1 %152, label %153, label %154
153: ; preds = %143
br label %158
154: ; preds = %143
br label %155
155: ; preds = %154
%156 = load i32, i32* %21
%157 = add nsw i32 %156, 1
store i32 %157, i32* %21
br label %125
158: ; preds = %153, %125
br label %250
159: ; preds = %34
%160 = load i32, i32* %22
%161 = load i32, i32* %24
%162 = icmp sgt i32 %160, %161
br i1 %162, label %163, label %186
163: ; preds = %159
%164 = load i32*, i32** %11
%165 = load i32, i32* %27
%166 = add nsw i32 %165, 1
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds i32, i32* %164, i64 %167
%169 = load i32, i32* %168
store i32 %169, i32* %22
%170 = load i32*, i32** %11
%171 = load i32, i32* %27
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds i32, i32* %170, i64 %172
%174 = load i32, i32* %173
store i32 %174, i32* %24
%175 = load i32*, i32** %12
%176 = load i32, i32* %27
%177 = add nsw i32 %176, 1
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds i32, i32* %175, i64 %178
%180 = load i32, i32* %179
store i32 %180, i32* %23
%181 = load i32*, i32** %12
%182 = load i32, i32* %27
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds i32, i32* %181, i64 %183
%185 = load i32, i32* %184
store i32 %185, i32* %25
br label %186
186: ; preds = %163, %159
%187 = load i32*, i32** %8
%188 = load i32, i32* %9
%189 = load i32, i32* %22
%190 = load i32, i32* %23
%191 = load i8*, i8** %13
%192 = load i32*, i32** %14
%193 = call i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...) bitcast (i32 (...)* @XD_Device_Interface to i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...)*)(i32* %187, i32 9, i32 %188, i32 %189, i32 %190, i8* %191, i32* %192)
store i32 %193, i32* %28
%194 = load i32, i32* %28
%195 = icmp ne i32 %194, 1
br i1 %195, label %196, label %197
196: ; preds = %186
br label %254
197: ; preds = %186
%198 = load i32, i32* %23
store i32 %198, i32* %21
%199 = load i32, i32* %23
%200 = load i32, i32* %25
%201 = icmp sgt i32 %199, %200
br i1 %201, label %202, label %203
202: ; preds = %197
store i32 -1, i32* %26
br label %203
203: ; preds = %202, %197
%204 = load i32, i32* %16
%205 = mul nsw i32 2, %204
%206 = load i32, i32* %15
%207 = sub nsw i32 %205, %206
store i32 %207, i32* %19
%208 = load i32, i32* %16
%209 = mul nsw i32 2, %208
store i32 %209, i32* %17
%210 = load i32, i32* %16
%211 = load i32, i32* %15
%212 = sub nsw i32 %210, %211
%213 = mul nsw i32 2, %212
store i32 %213, i32* %18
%214 = load i32, i32* %22
%215 = add nsw i32 %214, 1
store i32 %215, i32* %20
br label %216
216: ; preds = %246, %203
%217 = load i32, i32* %20
%218 = load i32, i32* %24
%219 = icmp sle i32 %217, %218
br i1 %219, label %220, label %249
220: ; preds = %216
%221 = load i32, i32* %19
%222 = icmp slt i32 %221, 0
br i1 %222, label %223, label %227
223: ; preds = %220
%224 = load i32, i32* %19
%225 = load i32, i32* %17
%226 = add nsw i32 %224, %225
store i32 %226, i32* %19
br label %234
227: ; preds = %220
%228 = load i32, i32* %21
%229 = load i32, i32* %26
%230 = add nsw i32 %228, %229
store i32 %230, i32* %21
%231 = load i32, i32* %19
%232 = load i32, i32* %18
%233 = add nsw i32 %231, %232
store i32 %233, i32* %19
br label %234
234: ; preds = %227, %223
%235 = load i32*, i32** %8
%236 = load i32, i32* %9
%237 = load i32, i32* %20
%238 = load i32, i32* %21
%239 = load i8*, i8** %13
%240 = load i32*, i32** %14
%241 = call i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...) bitcast (i32 (...)* @XD_Device_Interface to i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...)*)(i32* %235, i32 9, i32 %236, i32 %237, i32 %238, i8* %239, i32* %240)
store i32 %241, i32* %28
%242 = load i32, i32* %28
%243 = icmp ne i32 %242, 1
br i1 %243, label %244, label %245
244: ; preds = %234
br label %249
245: ; preds = %234
br label %246
246: ; preds = %245
%247 = load i32, i32* %20
%248 = add nsw i32 %247, 1
store i32 %248, i32* %20
br label %216
249: ; preds = %244, %216
br label %250
250: ; preds = %249, %158
br label %251
251: ; preds = %250
%252 = load i32, i32* %27
%253 = add nsw i32 %252, 1
store i32 %253, i32* %27
br label %29
254: ; preds = %196, %105, %29
%255 = load i32, i32* %28
ret i32 %255
}

LLVM IR (-O2):
define i32 @XD_Draw_Vector(i32* %0, i32 %1, i32 %2, i32* nocapture %3, i32* nocapture %4, i8* %5, i32* %6) {
%8 = icmp sgt i32 %2, 1
br i1 %8, label %9, label %97
9: ; preds = %7
%10 = add nsw i32 %2, -1
%11 = zext i32 %10 to i64
br label %12
12: ; preds = %9, %94
%13 = phi i64 [ 0, %9 ], [ %16, %94 ]
%14 = getelementptr inbounds i32, i32* %3, i64 %13
%15 = load i32, i32* %14
%16 = add nuw nsw i64 %13, 1
%17 = getelementptr inbounds i32, i32* %3, i64 %16
%18 = load i32, i32* %17
%19 = getelementptr inbounds i32, i32* %4, i64 %13
%20 = load i32, i32* %19
%21 = getelementptr inbounds i32, i32* %4, i64 %16
%22 = load i32, i32* %21
%23 = sub nsw i32 %18, %15
%24 = tail call i32 @llvm.abs.i32(i32 %23, i1 true)
%25 = sub nsw i32 %22, %20
%26 = tail call i32 @llvm.abs.i32(i32 %25, i1 true)
%27 = icmp ult i32 %24, %26
br i1 %27, label %28, label %61
28: ; preds = %12
%29 = icmp slt i32 %22, %20
br i1 %29, label %30, label %31
30: ; preds = %28
br label %31
31: ; preds = %30, %28
%32 = phi i32 [ %18, %30 ], [ %15, %28 ]
%33 = phi i32 [ %22, %30 ], [ %20, %28 ]
%34 = phi i32 [ %15, %30 ], [ %18, %28 ]
%35 = phi i32 [ %20, %30 ], [ %22, %28 ]
%36 = tail call i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...) bitcast (i32 (...)* @XD_Device_Interface to i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...)*)(i32* %0, i32 9, i32 %1, i32 %32, i32 %33, i8* %5, i32* %6)
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %97
38: ; preds = %31
%39 = icmp sgt i32 %32, %34
%40 = select i1 %39, i32 -1, i32 1
%41 = shl nuw nsw i32 %24, 1
%42 = sub nsw i32 %24, %26
%43 = shl nsw i32 %42, 1
%44 = icmp slt i32 %33, %35
br i1 %44, label %45, label %94
45: ; preds = %38
%46 = sub nsw i32 %41, %26
br label %47
47: ; preds = %45, %57
%48 = phi i32 [ %51, %57 ], [ %33, %45 ]
%49 = phi i32 [ %54, %57 ], [ %32, %45 ]
%50 = phi i32 [ %59, %57 ], [ %46, %45 ]
%51 = add nsw i32 %48, 1
%52 = icmp slt i32 %50, 0
%53 = select i1 %52, i32 0, i32 %40
%54 = add nsw i32 %53, %49
%55 = tail call i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...) bitcast (i32 (...)* @XD_Device_Interface to i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...)*)(i32* %0, i32 9, i32 %1, i32 %54, i32 %51, i8* %5, i32* %6)
%56 = icmp eq i32 %55, 1
br i1 %56, label %57, label %94
57: ; preds = %47
%58 = select i1 %52, i32 %41, i32 %43
%59 = add nsw i32 %58, %50
%60 = icmp eq i32 %51, %35
br i1 %60, label %94, label %47
61: ; preds = %12
%62 = icmp slt i32 %18, %15
br i1 %62, label %63, label %64
63: ; preds = %61
br label %64
64: ; preds = %63, %61
%65 = phi i32 [ %18, %63 ], [ %15, %61 ]
%66 = phi i32 [ %22, %63 ], [ %20, %61 ]
%67 = phi i32 [ %15, %63 ], [ %18, %61 ]
%68 = phi i32 [ %20, %63 ], [ %22, %61 ]
%69 = tail call i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...) bitcast (i32 (...)* @XD_Device_Interface to i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...)*)(i32* %0, i32 9, i32 %1, i32 %65, i32 %66, i8* %5, i32* %6)
%70 = icmp eq i32 %69, 1
br i1 %70, label %71, label %97
71: ; preds = %64
%72 = icmp sgt i32 %66, %68
%73 = select i1 %72, i32 -1, i32 1
%74 = shl nuw nsw i32 %26, 1
%75 = sub nsw i32 %26, %24
%76 = shl nsw i32 %75, 1
%77 = icmp slt i32 %65, %67
br i1 %77, label %78, label %94
78: ; preds = %71
%79 = sub nsw i32 %74, %24
br label %80
80: ; preds = %78, %90
%81 = phi i32 [ %84, %90 ], [ %65, %78 ]
%82 = phi i32 [ %87, %90 ], [ %66, %78 ]
%83 = phi i32 [ %92, %90 ], [ %79, %78 ]
%84 = add nsw i32 %81, 1
%85 = icmp slt i32 %83, 0
%86 = select i1 %85, i32 0, i32 %73
%87 = add nsw i32 %82, %86
%88 = tail call i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...) bitcast (i32 (...)* @XD_Device_Interface to i32 (i32*, i32, i32, i32, i32, i8*, i32*, ...)*)(i32* %0, i32 9, i32 %1, i32 %84, i32 %87, i8* %5, i32* %6)
%89 = icmp eq i32 %88, 1
br i1 %89, label %90, label %94
90: ; preds = %80
%91 = select i1 %85, i32 %74, i32 %76
%92 = add nsw i32 %91, %83
%93 = icmp eq i32 %84, %67
br i1 %93, label %94, label %80
94: ; preds = %90, %80, %57, %47, %71, %38
%95 = phi i32 [ 1, %38 ], [ 1, %71 ], [ 1, %57 ], [ %55, %47 ], [ 1, %90 ], [ %88, %80 ]
%96 = icmp eq i64 %16, %11
br i1 %96, label %97, label %12
97: ; preds = %94, %31, %64, %7
%98 = phi i32 [ undef, %7 ], [ %69, %64 ], [ %36, %31 ], [ %95, %94 ]
ret i32 %98
}