#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*/ GL_COLOR_BUFFER_BIT;
int /*<<< orphan*/ GL_TRIANGLES;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glClearColor(int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ glColor3f(int, int, int);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex2f(double, double);
int /*<<< orphan*/ glutSwapBuffers();
void display(void) {
  glClearColor(0, 0, 0, 0);
  glClear(GL_COLOR_BUFFER_BIT);
  glBegin(GL_TRIANGLES);
  {
    glColor3f(1, 0, 0);
    glVertex2f(0, 0);
    glColor3f(0, 1, 0);
    glVertex2f(.5, 0);
    glColor3f(0, 0, 1);
    glVertex2f(.5, .5);
  }
  glEnd();
  glutSwapBuffers();
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
xor    %ecx,%ecx
mov    %ecx,%edi
mov    %ecx,%esi
mov    %ecx,%edx
call   1060 <glClearColor@plt>
mov    0x2e50(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
call   1090 <glBegin@plt>
mov    $0x1,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1070 <glColor3f@plt>
xorps  %xmm1,%xmm1
movaps %xmm1,%xmm0
call   1080 <glVertex2f@plt>
xor    %edx,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   1070 <glColor3f@plt>
movsd  0xe34(%rip),%xmm0
xorps  %xmm1,%xmm1
call   1080 <glVertex2f@plt>
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1070 <glColor3f@plt>
movsd  0xe16(%rip),%xmm1
movaps %xmm1,%xmm0
call   1080 <glVertex2f@plt>
mov    $0x0,%al
call   1050 <glEnd@plt>
mov    $0x0,%al
call   1040 <glutSwapBuffers@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1060 <glClearColor@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
mov    0x2e4d(%rip),%rax
mov    (%rax),%edi
call   1090 <glBegin@plt>
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1070 <glColor3f@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
call   1080 <glVertex2f@plt>
xor    %edi,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1070 <glColor3f@plt>
movsd  0xe37(%rip),%xmm0
xorps  %xmm1,%xmm1
call   1080 <glVertex2f@plt>
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1070 <glColor3f@plt>
movsd  0xe19(%rip),%xmm0
movaps %xmm0,%xmm1
call   1080 <glVertex2f@plt>
xor    %eax,%eax
call   1050 <glEnd@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <glutSwapBuffers@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_TRIANGLES = global i32 0
define void @display() {
%1 = call i32 @glClearColor(i32 0, i32 0, i32 0, i32 0)
%2 = load i32, i32* @GL_COLOR_BUFFER_BIT
%3 = call i32 @glClear(i32 %2)
%4 = load i32, i32* @GL_TRIANGLES
%5 = call i32 @glBegin(i32 %4)
%6 = call i32 @glColor3f(i32 1, i32 0, i32 0)
%7 = call i32 @glVertex2f(double 0.000000e+00, double 0.000000e+00)
%8 = call i32 @glColor3f(i32 0, i32 1, i32 0)
%9 = call i32 @glVertex2f(double 5.000000e-01, double 0.000000e+00)
%10 = call i32 @glColor3f(i32 0, i32 0, i32 1)
%11 = call i32 @glVertex2f(double 5.000000e-01, double 5.000000e-01)
%12 = call i32 (...) @glEnd()
%13 = call i32 (...) @glutSwapBuffers()
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_TRIANGLES = global i32 0
define void @display() {
%1 = tail call i32 @glClearColor(i32 0, i32 0, i32 0, i32 0)
%2 = load i32, i32* @GL_COLOR_BUFFER_BIT
%3 = tail call i32 @glClear(i32 %2)
%4 = load i32, i32* @GL_TRIANGLES
%5 = tail call i32 @glBegin(i32 %4)
%6 = tail call i32 @glColor3f(i32 1, i32 0, i32 0)
%7 = tail call i32 @glVertex2f(double 0.000000e+00, double 0.000000e+00)
%8 = tail call i32 @glColor3f(i32 0, i32 1, i32 0)
%9 = tail call i32 @glVertex2f(double 5.000000e-01, double 0.000000e+00)
%10 = tail call i32 @glColor3f(i32 0, i32 0, i32 1)
%11 = tail call i32 @glVertex2f(double 5.000000e-01, double 5.000000e-01)
%12 = tail call i32 (...) @glEnd()
%13 = tail call i32 (...) @glutSwapBuffers()
ret void
}