#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 */
typedef int /*<<< orphan*/ GLdouble;
typedef int /*<<< orphan*/ GLUtesselator;

/* Variables and functions */
int /*<<< orphan*/ GLU_TESS_BEGIN;
int /*<<< orphan*/ GLU_TESS_END;
int /*<<< orphan*/ GLU_TESS_VERTEX;
scalar_t__ glBegin;
scalar_t__ glEnd;
scalar_t__ glVertex3dv;
int /*<<< orphan*/ gluDeleteTess(int /*<<< orphan*/ *);
int /*<<< orphan*/ *gluNewTess();
int /*<<< orphan*/ gluTessBeginContour(int /*<<< orphan*/ *);
int /*<<< orphan*/ gluTessBeginPolygon(int /*<<< orphan*/ *,
                                       int /*<<< orphan*/);
int /*<<< orphan*/ gluTessCallback(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                   void *);
int /*<<< orphan*/ gluTessEndContour(int /*<<< orphan*/ *);
int /*<<< orphan*/ gluTessEndPolygon(int /*<<< orphan*/ *);
int /*<<< orphan*/ gluTessVertex(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                 int /*<<< orphan*/ *);
void drawFace3D(int count, GLdouble **coords) {
  int i;
  GLUtesselator *tess = gluNewTess();
  gluTessCallback(tess, GLU_TESS_VERTEX, (void *)glVertex3dv);
  gluTessCallback(tess, GLU_TESS_BEGIN, (void *)glBegin);
  gluTessCallback(tess, GLU_TESS_END, (void *)glEnd);
  gluTessBeginPolygon(tess, 0);
  gluTessBeginContour(tess);
  for (i = 0; i < count; i++) {
    gluTessVertex(tess, coords[i], coords[i]);
  }
  gluTessEndContour(tess);
  gluTessEndPolygon(tess);
  gluDeleteTess(tess);
}


x86 assembly (clang, -O0):
<drawFace3D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <gluNewTess@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2e3b(%rip),%rax
mov    (%rax),%esi
mov    0x2e22(%rip),%rax
mov    (%rax),%rdx
call   10a0 <gluTessCallback@plt>
mov    -0x20(%rbp),%rdi
mov    0x2df7(%rip),%rax
mov    (%rax),%esi
mov    0x2e26(%rip),%rax
mov    (%rax),%rdx
call   10a0 <gluTessCallback@plt>
mov    -0x20(%rbp),%rdi
mov    0x2de3(%rip),%rax
mov    (%rax),%esi
mov    0x2de2(%rip),%rax
mov    (%rax),%rdx
call   10a0 <gluTessCallback@plt>
mov    -0x20(%rbp),%rdi
xor    %esi,%esi
call   1090 <gluTessBeginPolygon@plt>
mov    -0x20(%rbp),%rdi
call   1070 <gluTessBeginContour@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1244 <drawFace3D+0xc4>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
call   1040 <gluTessVertex@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1209 <drawFace3D+0x89>
mov    -0x20(%rbp),%rdi
call   1050 <gluTessEndContour@plt>
mov    -0x20(%rbp),%rdi
call   1080 <gluTessEndPolygon@plt>
mov    -0x20(%rbp),%rdi
call   1060 <gluDeleteTess@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawFace3D>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <gluNewTess@plt>
mov    %rax,%r15
mov    0x2e43(%rip),%rax
mov    (%rax),%esi
mov    0x2e2a(%rip),%rax
mov    (%rax),%rdx
mov    %r15,%rdi
call   10a0 <gluTessCallback@plt>
mov    0x2e00(%rip),%rax
mov    (%rax),%esi
mov    0x2e2f(%rip),%rax
mov    (%rax),%rdx
mov    %r15,%rdi
call   10a0 <gluTessCallback@plt>
mov    0x2ded(%rip),%rax
mov    (%rax),%esi
mov    0x2dec(%rip),%rax
mov    (%rax),%rdx
mov    %r15,%rdi
call   10a0 <gluTessCallback@plt>
mov    %r15,%rdi
xor    %esi,%esi
call   1090 <gluTessBeginPolygon@plt>
mov    %r15,%rdi
call   1070 <gluTessBeginContour@plt>
test   %ebp,%ebp
jle    1228 <drawFace3D+0xa8>
mov    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdx
mov    %r15,%rdi
mov    %rdx,%rsi
call   1040 <gluTessVertex@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1210 <drawFace3D+0x90>
mov    %r15,%rdi
call   1050 <gluTessEndContour@plt>
mov    %r15,%rdi
call   1080 <gluTessEndPolygon@plt>
mov    %r15,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <gluDeleteTess@plt>

LLVM IR (-O0):
@GLU_TESS_VERTEX = global i32 0
@glVertex3dv = global i64 0
@GLU_TESS_BEGIN = global i32 0
@glBegin = global i64 0
@GLU_TESS_END = global i32 0
@glEnd = global i64 0
define void @drawFace3D(i32 %0, i32** %1) {
%3 = alloca i32
%4 = alloca i32**
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %3
store i32** %1, i32*** %4
%7 = call i32* (...) @gluNewTess()
store i32* %7, i32** %6
%8 = load i32*, i32** %6
%9 = load i32, i32* @GLU_TESS_VERTEX
%10 = load i64, i64* @glVertex3dv
%11 = inttoptr i64 %10 to i8*
%12 = call i32 @gluTessCallback(i32* %8, i32 %9, i8* %11)
%13 = load i32*, i32** %6
%14 = load i32, i32* @GLU_TESS_BEGIN
%15 = load i64, i64* @glBegin
%16 = inttoptr i64 %15 to i8*
%17 = call i32 @gluTessCallback(i32* %13, i32 %14, i8* %16)
%18 = load i32*, i32** %6
%19 = load i32, i32* @GLU_TESS_END
%20 = load i64, i64* @glEnd
%21 = inttoptr i64 %20 to i8*
%22 = call i32 @gluTessCallback(i32* %18, i32 %19, i8* %21)
%23 = load i32*, i32** %6
%24 = call i32 @gluTessBeginPolygon(i32* %23, i32 0)
%25 = load i32*, i32** %6
%26 = call i32 @gluTessBeginContour(i32* %25)
store i32 0, i32* %5
br label %27
27: ; preds = %44, %2
%28 = load i32, i32* %5
%29 = load i32, i32* %3
%30 = icmp slt i32 %28, %29
br i1 %30, label %31, label %47
31: ; preds = %27
%32 = load i32*, i32** %6
%33 = load i32**, i32*** %4
%34 = load i32, i32* %5
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32*, i32** %33, i64 %35
%37 = load i32*, i32** %36
%38 = load i32**, i32*** %4
%39 = load i32, i32* %5
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i32*, i32** %38, i64 %40
%42 = load i32*, i32** %41
%43 = call i32 @gluTessVertex(i32* %32, i32* %37, i32* %42)
br label %44
44: ; preds = %31
%45 = load i32, i32* %5
%46 = add nsw i32 %45, 1
store i32 %46, i32* %5
br label %27
47: ; preds = %27
%48 = load i32*, i32** %6
%49 = call i32 @gluTessEndContour(i32* %48)
%50 = load i32*, i32** %6
%51 = call i32 @gluTessEndPolygon(i32* %50)
%52 = load i32*, i32** %6
%53 = call i32 @gluDeleteTess(i32* %52)
ret void
}

LLVM IR (-O2):
@GLU_TESS_VERTEX = global i32 0
@glVertex3dv = global i64 0
@GLU_TESS_BEGIN = global i32 0
@glBegin = global i64 0
@GLU_TESS_END = global i32 0
@glEnd = global i64 0
define void @drawFace3D(i32 %0, i32** nocapture %1) {
%3 = tail call i32* (...) @gluNewTess()
%4 = load i32, i32* @GLU_TESS_VERTEX
%5 = load i64, i64* @glVertex3dv
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 @gluTessCallback(i32* %3, i32 %4, i8* %6)
%8 = load i32, i32* @GLU_TESS_BEGIN
%9 = load i64, i64* @glBegin
%10 = inttoptr i64 %9 to i8*
%11 = tail call i32 @gluTessCallback(i32* %3, i32 %8, i8* %10)
%12 = load i32, i32* @GLU_TESS_END
%13 = load i64, i64* @glEnd
%14 = inttoptr i64 %13 to i8*
%15 = tail call i32 @gluTessCallback(i32* %3, i32 %12, i8* %14)
%16 = tail call i32 @gluTessBeginPolygon(i32* %3, i32 0)
%17 = tail call i32 @gluTessBeginContour(i32* %3)
%18 = icmp sgt i32 %0, 0
br i1 %18, label %19, label %28
19: ; preds = %2
%20 = zext i32 %0 to i64
br label %21
21: ; preds = %19, %21
%22 = phi i64 [ 0, %19 ], [ %26, %21 ]
%23 = getelementptr inbounds i32*, i32** %1, i64 %22
%24 = load i32*, i32** %23
%25 = tail call i32 @gluTessVertex(i32* %3, i32* %24, i32* %24)
%26 = add nuw nsw i64 %22, 1
%27 = icmp eq i64 %26, %20
br i1 %27, label %28, label %21
28: ; preds = %21, %2
%29 = tail call i32 @gluTessEndContour(i32* %3)
%30 = tail call i32 @gluTessEndPolygon(i32* %3)
%31 = tail call i32 @gluDeleteTess(i32* %3)
ret void
}