#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*/ GLint;
typedef int /*<<< orphan*/ GLfloat;

/* Variables and functions */
int /*<<< orphan*/ GL_3D_COLOR;
int /*<<< orphan*/ GL_COLOR_BUFFER_BIT;
int /*<<< orphan*/ GL_FEEDBACK;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ GL_RENDER;
int /*<<< orphan*/ drawGeometry(int /*<<< orphan*/);
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glClearColor(double, double, double, double);
int /*<<< orphan*/ glFeedbackBuffer(int, int /*<<< orphan*/,
                                    int /*<<< orphan*/ *);
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glOrtho(double, double, double, double, double, double);
int /*<<< orphan*/ glRenderMode(int /*<<< orphan*/);
int /*<<< orphan*/ printBuffer(int /*<<< orphan*/, int /*<<< orphan*/ *);
void display(void) {
  GLfloat feedBuffer[1024];
  GLint size;
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(0.0, 100.0, 0.0, 100.0, 0.0, 1.0);
  glClearColor(0.0, 0.0, 0.0, 0.0);
  glClear(GL_COLOR_BUFFER_BIT);
  drawGeometry(GL_RENDER);
  glFeedbackBuffer(1024, GL_3D_COLOR, feedBuffer);
  (void)glRenderMode(GL_FEEDBACK);
  drawGeometry(GL_FEEDBACK);
  size = glRenderMode(GL_RENDER);
  printBuffer(size, feedBuffer);
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1010,%rsp
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
mov    $0x0,%al
call   1080 <glLoadIdentity@plt>
xorps  %xmm4,%xmm4
movsd  0xe45(%rip),%xmm3
movsd  0xe45(%rip),%xmm5
movaps %xmm4,%xmm0
movaps %xmm3,%xmm1
movaps %xmm4,%xmm2
call   1060 <glOrtho@plt>
xorps  %xmm3,%xmm3
movaps %xmm3,%xmm0
movaps %xmm3,%xmm1
movaps %xmm3,%xmm2
call   1070 <glClearColor@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
call   1040 <glClear@plt>
mov    0x2dd9(%rip),%rax
mov    (%rax),%edi
call   1030 <drawGeometry@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%esi
lea    -0x1000(%rbp),%rdx
mov    $0x400,%edi
call   10b0 <glFeedbackBuffer@plt>
mov    0x2dc9(%rip),%rax
mov    (%rax),%edi
call   1090 <glRenderMode@plt>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
call   1030 <drawGeometry@plt>
mov    0x2d95(%rip),%rax
mov    (%rax),%edi
call   1090 <glRenderMode@plt>
mov    %eax,-0x1004(%rbp)
mov    -0x1004(%rbp),%edi
lea    -0x1000(%rbp),%rsi
call   10a0 <printBuffer@plt>
add    $0x1010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %r15
push   %r14
push   %rbx
sub    $0x1000,%rsp
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
xor    %eax,%eax
call   1080 <glLoadIdentity@plt>
movsd  0xe47(%rip),%xmm1
movsd  0xe47(%rip),%xmm5
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
xorps  %xmm4,%xmm4
movaps %xmm1,%xmm3
call   1060 <glOrtho@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
xorps  %xmm3,%xmm3
call   1070 <glClearColor@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edi
call   1040 <glClear@plt>
mov    0x2dd8(%rip),%r14
mov    (%r14),%edi
call   1030 <drawGeometry@plt>
mov    0x2dd1(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%r15
mov    $0x400,%edi
mov    %r15,%rdx
call   10b0 <glFeedbackBuffer@plt>
mov    0x2dc8(%rip),%rbx
mov    (%rbx),%edi
call   1090 <glRenderMode@plt>
mov    (%rbx),%edi
call   1030 <drawGeometry@plt>
mov    (%r14),%edi
call   1090 <glRenderMode@plt>
mov    %eax,%edi
mov    %r15,%rsi
call   10a0 <printBuffer@plt>
add    $0x1000,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_RENDER = global i32 0
@GL_3D_COLOR = global i32 0
@GL_FEEDBACK = global i32 0
define void @display() {
%1 = alloca [1024 x i32]
%2 = alloca i32
%3 = load i32, i32* @GL_PROJECTION
%4 = call i32 @glMatrixMode(i32 %3)
%5 = call i32 (...) @glLoadIdentity()
%6 = call i32 @glOrtho(double 0.000000e+00, double 1.000000e+02, double 0.000000e+00, double 1.000000e+02, double 0.000000e+00, double 1.000000e+00)
%7 = call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%8 = load i32, i32* @GL_COLOR_BUFFER_BIT
%9 = call i32 @glClear(i32 %8)
%10 = load i32, i32* @GL_RENDER
%11 = call i32 @drawGeometry(i32 %10)
%12 = load i32, i32* @GL_3D_COLOR
%13 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 0
%14 = call i32 @glFeedbackBuffer(i32 1024, i32 %12, i32* %13)
%15 = load i32, i32* @GL_FEEDBACK
%16 = call i32 @glRenderMode(i32 %15)
%17 = load i32, i32* @GL_FEEDBACK
%18 = call i32 @drawGeometry(i32 %17)
%19 = load i32, i32* @GL_RENDER
%20 = call i32 @glRenderMode(i32 %19)
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 0
%23 = call i32 @printBuffer(i32 %21, i32* %22)
ret void
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_RENDER = global i32 0
@GL_3D_COLOR = global i32 0
@GL_FEEDBACK = global i32 0
define void @display() {
%1 = alloca [1024 x i32]
%2 = bitcast [1024 x i32]* %1 to i8*
%3 = load i32, i32* @GL_PROJECTION
%4 = tail call i32 @glMatrixMode(i32 %3)
%5 = tail call i32 (...) @glLoadIdentity()
%6 = tail call i32 @glOrtho(double 0.000000e+00, double 1.000000e+02, double 0.000000e+00, double 1.000000e+02, double 0.000000e+00, double 1.000000e+00)
%7 = tail call i32 @glClearColor(double 0.000000e+00, double 0.000000e+00, double 0.000000e+00, double 0.000000e+00)
%8 = load i32, i32* @GL_COLOR_BUFFER_BIT
%9 = tail call i32 @glClear(i32 %8)
%10 = load i32, i32* @GL_RENDER
%11 = tail call i32 @drawGeometry(i32 %10)
%12 = load i32, i32* @GL_3D_COLOR
%13 = getelementptr inbounds [1024 x i32], [1024 x i32]* %1, i64 0, i64 0
%14 = call i32 @glFeedbackBuffer(i32 1024, i32 %12, i32* %13)
%15 = load i32, i32* @GL_FEEDBACK
%16 = call i32 @glRenderMode(i32 %15)
%17 = load i32, i32* @GL_FEEDBACK
%18 = call i32 @drawGeometry(i32 %17)
%19 = load i32, i32* @GL_RENDER
%20 = call i32 @glRenderMode(i32 %19)
%21 = call i32 @printBuffer(i32 %20, i32* %13)
ret void
}