#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*/ vfdlib_drawLineUnclipped(char *, int, int, int, int, char);
void vfdlib_drawOutlinePolygonUnclipped(char *buffer, int *coordsData,
                                        int numPoints, char shade) {
  int x0, y0, x1, y1;
  int lastIndex = (numPoints - 1) << 1;
  int currIndex;
  int prevX = coordsData[lastIndex];
  int prevY = coordsData[lastIndex + 1];
  for (currIndex = 0; currIndex <= lastIndex;) {
    x0 = prevX;
    y0 = prevY;
    prevX = x1 = coordsData[currIndex++];
    prevY = y1 = coordsData[currIndex++];
    vfdlib_drawLineUnclipped(buffer, x0, y0, x1, y1, shade);
  }
}


x86 assembly (clang, -O0):
<vfdlib_drawOutlinePolygonUnclipped>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %al,-0x15(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
shl    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x38(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jg     11ca <vfdlib_drawOutlinePolygonUnclipped+0xba>
mov    -0x34(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x38(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x30(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x24(%rbp)
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x30(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x30(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x28(%rbp)
mov    %eax,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
movsbl -0x15(%rbp),%r9d
call   1030 <vfdlib_drawLineUnclipped@plt>
jmp    115c <vfdlib_drawOutlinePolygonUnclipped+0x4c>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vfdlib_drawOutlinePolygonUnclipped>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
add    %edx,%edx
mov    %edx,%eax
add    $0xfffffffe,%eax
mov    %eax,0x4(%rsp)
js     1178 <vfdlib_drawOutlinePolygonUnclipped+0x68>
mov    %rsi,%r12
mov    %rdi,%r13
add    $0xffffffff,%edx
movslq %edx,%rax
mov    (%rsi,%rax,4),%edx
mov    0x4(%rsp),%eax
mov    (%rsi,%rax,4),%esi
xor    %r14d,%r14d
movsbl %cl,%r15d
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r12,%r14,4),%ebp
mov    0x4(%r12,%r14,4),%ebx
add    $0x2,%r14
mov    %r13,%rdi
mov    %ebp,%ecx
mov    %ebx,%r8d
mov    %r15d,%r9d
call   1030 <vfdlib_drawLineUnclipped@plt>
mov    %ebx,%edx
mov    %ebp,%esi
cmp    %r14d,0x4(%rsp)
jge    1150 <vfdlib_drawOutlinePolygonUnclipped+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @vfdlib_drawOutlinePolygonUnclipped(i8* %0, i32* %1, i32 %2, i8 signext %3) {
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i8 %3, i8* %8
%17 = load i32, i32* %7
%18 = sub nsw i32 %17, 1
%19 = shl i32 %18, 1
store i32 %19, i32* %13
%20 = load i32*, i32** %6
%21 = load i32, i32* %13
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %20, i64 %22
%24 = load i32, i32* %23
store i32 %24, i32* %15
%25 = load i32*, i32** %6
%26 = load i32, i32* %13
%27 = add nsw i32 %26, 1
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %25, i64 %28
%30 = load i32, i32* %29
store i32 %30, i32* %16
store i32 0, i32* %14
br label %31
31: ; preds = %35, %4
%32 = load i32, i32* %14
%33 = load i32, i32* %13
%34 = icmp sle i32 %32, %33
br i1 %34, label %35, label %57
35: ; preds = %31
%36 = load i32, i32* %15
store i32 %36, i32* %9
%37 = load i32, i32* %16
store i32 %37, i32* %10
%38 = load i32*, i32** %6
%39 = load i32, i32* %14
%40 = add nsw i32 %39, 1
store i32 %40, i32* %14
%41 = sext i32 %39 to i64
%42 = getelementptr inbounds i32, i32* %38, i64 %41
%43 = load i32, i32* %42
store i32 %43, i32* %11
store i32 %43, i32* %15
%44 = load i32*, i32** %6
%45 = load i32, i32* %14
%46 = add nsw i32 %45, 1
store i32 %46, i32* %14
%47 = sext i32 %45 to i64
%48 = getelementptr inbounds i32, i32* %44, i64 %47
%49 = load i32, i32* %48
store i32 %49, i32* %12
store i32 %49, i32* %16
%50 = load i8*, i8** %5
%51 = load i32, i32* %9
%52 = load i32, i32* %10
%53 = load i32, i32* %11
%54 = load i32, i32* %12
%55 = load i8, i8* %8
%56 = call i32 @vfdlib_drawLineUnclipped(i8* %50, i32 %51, i32 %52, i32 %53, i32 %54, i8 signext %55)
br label %31
57: ; preds = %31
ret void
}

LLVM IR (-O2):
define void @vfdlib_drawOutlinePolygonUnclipped(i8* %0, i32* nocapture %1, i32 %2, i8 signext %3) {
%5 = shl i32 %2, 1
%6 = add i32 %5, -2
%7 = icmp slt i32 %6, 0
br i1 %7, label %29, label %8
8: ; preds = %4
%9 = add i32 %5, -1
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i32, i32* %1, i64 %10
%12 = load i32, i32* %11
%13 = zext i32 %6 to i64
%14 = getelementptr inbounds i32, i32* %1, i64 %13
%15 = load i32, i32* %14
br label %16
16: ; preds = %8, %16
%17 = phi i64 [ 0, %8 ], [ %23, %16 ]
%18 = phi i32 [ %12, %8 ], [ %25, %16 ]
%19 = phi i32 [ %15, %8 ], [ %22, %16 ]
%20 = or i64 %17, 1
%21 = getelementptr inbounds i32, i32* %1, i64 %17
%22 = load i32, i32* %21
%23 = add nuw i64 %17, 2
%24 = getelementptr inbounds i32, i32* %1, i64 %20
%25 = load i32, i32* %24
%26 = tail call i32 @vfdlib_drawLineUnclipped(i8* %0, i32 %19, i32 %18, i32 %22, i32 %25, i8 signext %3)
%27 = trunc i64 %23 to i32
%28 = icmp slt i32 %6, %27
br i1 %28, label %29, label %16
29: ; preds = %16, %4
ret void
}