#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 size_t GLint;
typedef scalar_t__ GLfloat;

/* Variables and functions */
scalar_t__ GL_LINE_RESET_TOKEN;
scalar_t__ GL_LINE_TOKEN;
scalar_t__ GL_PASS_THROUGH_TOKEN;
scalar_t__ GL_POINT_TOKEN;
int /*<<< orphan*/ print3DcolorVertex(size_t, size_t *, scalar_t__ *);
int /*<<< orphan*/ printf(char *, ...);
void printBuffer(GLint size, GLfloat *buffer) {
  GLint count;
  GLfloat token;
  count = size;
  while (count) {
    token = buffer[size - count];
    count--;
    if (token == GL_PASS_THROUGH_TOKEN) {
      printf("GL_PASS_THROUGH_TOKEN\n");
      printf("  %4.2f\n", buffer[size - count]);
      count--;
    } else if (token == GL_POINT_TOKEN) {
      printf("GL_POINT_TOKEN\n");
      print3DcolorVertex(size, &count, buffer);
    } else if (token == GL_LINE_TOKEN) {
      printf("GL_LINE_TOKEN\n");
      print3DcolorVertex(size, &count, buffer);
      print3DcolorVertex(size, &count, buffer);
    } else if (token == GL_LINE_RESET_TOKEN) {
      printf("GL_LINE_RESET_TOKEN\n");
      print3DcolorVertex(size, &count, buffer);
      print3DcolorVertex(size, &count, buffer);
    }
  }
}


x86 assembly (clang, -O0):
<printBuffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     128d <printBuffer+0x16d>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    0x2e62(%rip),%rcx
cmp    (%rcx),%rax
jne    11b4 <printBuffer+0x94>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    1288 <printBuffer+0x168>
mov    -0x20(%rbp),%rax
mov    0x2e21(%rip),%rcx
cmp    (%rcx),%rax
jne    11ec <printBuffer+0xcc>
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rsi
call   1040 <print3DcolorVertex@plt>
jmp    1283 <printBuffer+0x163>
mov    -0x20(%rbp),%rax
mov    0x2dd1(%rip),%rcx
cmp    (%rcx),%rax
jne    1235 <printBuffer+0x115>
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rsi
call   1040 <print3DcolorVertex@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rsi
call   1040 <print3DcolorVertex@plt>
jmp    127e <printBuffer+0x15e>
mov    -0x20(%rbp),%rax
mov    0x2da8(%rip),%rcx
cmp    (%rcx),%rax
jne    1279 <printBuffer+0x159>
lea    0xdef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rsi
call   1040 <print3DcolorVertex@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rsi
call   1040 <print3DcolorVertex@plt>
jmp    127e <printBuffer+0x15e>
jmp    1283 <printBuffer+0x163>
jmp    1288 <printBuffer+0x168>
jmp    1138 <printBuffer+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printBuffer>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     1236 <printBuffer+0x106>
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x2e7f(%rip),%r13
lea    0xea8(%rip),%r12
mov    0x2e81(%rip),%r15
mov    %rsp,%rbp
mov    %rdi,%rax
jmp    11a6 <printBuffer+0x76>
nopw   0x0(%rax,%rax,1)
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rax
sub    (%rsp),%rax
mov    (%r14,%rax,8),%rsi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,(%rsp)
test   %rax,%rax
je     1236 <printBuffer+0x106>
mov    %rbx,%rcx
sub    %rax,%rcx
mov    (%r14,%rcx,8),%rcx
add    $0xffffffffffffffff,%rax
mov    %rax,(%rsp)
cmp    0x0(%r13),%rcx
je     1170 <printBuffer+0x40>
cmp    (%r15),%rcx
jne    11e0 <printBuffer+0xb0>
lea    0xe61(%rip),%rdi
call   1030 <puts@plt>
jmp    121b <printBuffer+0xeb>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x2de1(%rip),%rax
cmp    (%rax),%rcx
jne    11f5 <printBuffer+0xc5>
lea    0xe2a(%rip),%rdi
jmp    1208 <printBuffer+0xd8>
mov    0x2dec(%rip),%rax
cmp    (%rax),%rcx
jne    1229 <printBuffer+0xf9>
lea    0xe01(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1050 <print3DcolorVertex@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1050 <print3DcolorVertex@plt>
mov    (%rsp),%rax
test   %rax,%rax
jne    11a6 <printBuffer+0x76>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@GL_PASS_THROUGH_TOKEN = global i64 0
@.str = [23 x i8] c"GL_PASS_THROUGH_TOKEN\0A\00"
@.str.1 = [9 x i8] c" %4.2f\0A\00"
@GL_POINT_TOKEN = global i64 0
@.str.2 = [16 x i8] c"GL_POINT_TOKEN\0A\00"
@GL_LINE_TOKEN = global i64 0
@.str.3 = [15 x i8] c"GL_LINE_TOKEN\0A\00"
@GL_LINE_RESET_TOKEN = global i64 0
@.str.4 = [21 x i8] c"GL_LINE_RESET_TOKEN\0A\00"
define void @printBuffer(i64 %0, i64* %1) {
%3 = alloca i64
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %3
store i64* %1, i64** %4
%7 = load i64, i64* %3
store i64 %7, i64* %5
br label %8
8: ; preds = %70, %2
%9 = load i64, i64* %5
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %71
11: ; preds = %8
%12 = load i64*, i64** %4
%13 = load i64, i64* %3
%14 = load i64, i64* %5
%15 = sub i64 %13, %14
%16 = getelementptr inbounds i64, i64* %12, i64 %15
%17 = load i64, i64* %16
store i64 %17, i64* %6
%18 = load i64, i64* %5
%19 = add i64 %18, -1
store i64 %19, i64* %5
%20 = load i64, i64* %6
%21 = load i64, i64* @GL_PASS_THROUGH_TOKEN
%22 = icmp eq i64 %20, %21
br i1 %22, label %23, label %34
23: ; preds = %11
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%25 = load i64*, i64** %4
%26 = load i64, i64* %3
%27 = load i64, i64* %5
%28 = sub i64 %26, %27
%29 = getelementptr inbounds i64, i64* %25, i64 %28
%30 = load i64, i64* %29
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %30)
%32 = load i64, i64* %5
%33 = add i64 %32, -1
store i64 %33, i64* %5
br label %70
34: ; preds = %11
%35 = load i64, i64* %6
%36 = load i64, i64* @GL_POINT_TOKEN
%37 = icmp eq i64 %35, %36
br i1 %37, label %38, label %43
38: ; preds = %34
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%40 = load i64, i64* %3
%41 = load i64*, i64** %4
%42 = call i32 @print3DcolorVertex(i64 %40, i64* %5, i64* %41)
br label %69
43: ; preds = %34
%44 = load i64, i64* %6
%45 = load i64, i64* @GL_LINE_TOKEN
%46 = icmp eq i64 %44, %45
br i1 %46, label %47, label %55
47: ; preds = %43
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%49 = load i64, i64* %3
%50 = load i64*, i64** %4
%51 = call i32 @print3DcolorVertex(i64 %49, i64* %5, i64* %50)
%52 = load i64, i64* %3
%53 = load i64*, i64** %4
%54 = call i32 @print3DcolorVertex(i64 %52, i64* %5, i64* %53)
br label %68
55: ; preds = %43
%56 = load i64, i64* %6
%57 = load i64, i64* @GL_LINE_RESET_TOKEN
%58 = icmp eq i64 %56, %57
br i1 %58, label %59, label %67
59: ; preds = %55
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%61 = load i64, i64* %3
%62 = load i64*, i64** %4
%63 = call i32 @print3DcolorVertex(i64 %61, i64* %5, i64* %62)
%64 = load i64, i64* %3
%65 = load i64*, i64** %4
%66 = call i32 @print3DcolorVertex(i64 %64, i64* %5, i64* %65)
br label %67
67: ; preds = %59, %55
br label %68
68: ; preds = %67, %47
br label %69
69: ; preds = %68, %38
br label %70
70: ; preds = %69, %23
br label %8
71: ; preds = %8
ret void
}

LLVM IR (-O2):
@GL_PASS_THROUGH_TOKEN = global i64 0
@.str.1 = [9 x i8] c" %4.2f\0A\00"
@GL_POINT_TOKEN = global i64 0
@GL_LINE_TOKEN = global i64 0
@GL_LINE_RESET_TOKEN = global i64 0
@str = [20 x i8] c"GL_LINE_RESET_TOKEN\00"
@str.5 = [14 x i8] c"GL_LINE_TOKEN\00"
@str.6 = [15 x i8] c"GL_POINT_TOKEN\00"
@str.7 = [22 x i8] c"GL_PASS_THROUGH_TOKEN\00"
define void @printBuffer(i64 %0, i64* %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = icmp eq i64 %0, 0
br i1 %5, label %47, label %6
6: ; preds = %2, %44
%7 = phi i64 [ %45, %44 ], [ %0, %2 ]
%8 = sub i64 %0, %7
%9 = getelementptr inbounds i64, i64* %1, i64 %8
%10 = load i64, i64* %9
%11 = add i64 %7, -1
store i64 %11, i64* %3
%12 = load i64, i64* @GL_PASS_THROUGH_TOKEN
%13 = icmp eq i64 %10, %12
br i1 %13, label %14, label %23
14: ; preds = %6
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.7, i64 0, i64 0))
%16 = load i64, i64* %3
%17 = sub i64 %0, %16
%18 = getelementptr inbounds i64, i64* %1, i64 %17
%19 = load i64, i64* %18
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i64 %19)
%21 = load i64, i64* %3
%22 = add i64 %21, -1
store i64 %22, i64* %3
br label %44
23: ; preds = %6
%24 = load i64, i64* @GL_POINT_TOKEN
%25 = icmp eq i64 %10, %24
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.6, i64 0, i64 0))
br label %40
28: ; preds = %23
%29 = load i64, i64* @GL_LINE_TOKEN
%30 = icmp eq i64 %10, %29
br i1 %30, label %31, label %34
31: ; preds = %28
%32 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.5, i64 0, i64 0))
%33 = call i32 @print3DcolorVertex(i64 %0, i64* %3, i64* %1)
br label %40
34: ; preds = %28
%35 = load i64, i64* @GL_LINE_RESET_TOKEN
%36 = icmp eq i64 %10, %35
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%39 = call i32 @print3DcolorVertex(i64 %0, i64* %3, i64* %1)
br label %40
40: ; preds = %26, %37, %31
%41 = call i32 @print3DcolorVertex(i64 %0, i64* %3, i64* %1)
br label %42
42: ; preds = %40, %34
%43 = load i64, i64* %3
br label %44
44: ; preds = %42, %14
%45 = phi i64 [ %43, %42 ], [ %22, %14 ]
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %6
47: ; preds = %44, %2
ret void
}