#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_TRIANGLES;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glColor3f(float, float, float);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex3f(float, float, float);
void draw_tri(void) {
  glBegin(GL_TRIANGLES);
  glColor3f(1.0f, 0.0f, 0.0f);
  glVertex3f(0.0f, 1.0f, 0.0f);
  glVertex3f(-1.0f, -1.0f, 1.0f);
  glVertex3f(1.0f, -1.0f, 1.0f);
  glColor3f(0.0f, 1.0f, 0.0f);
  glVertex3f(0.0f, 1.0f, 0.0f);
  glVertex3f(-1.0f, -1.0f, -1.0f);
  glVertex3f(1.0f, -1.0f, -1.0f);
  glColor3f(0.0f, 0.0f, 1.0f);
  glVertex3f(0.0f, 1.0f, 0.0f);
  glVertex3f(-1.0f, -1.0f, -1.0f);
  glVertex3f(-1.0f, -1.0f, 1.0f);
  glColor3f(1.0f, 1.0f, 1.0f);
  glVertex3f(0.0f, 1.0f, 0.0f);
  glVertex3f(1.0f, -1.0f, -1.0f);
  glVertex3f(1.0f, -1.0f, 1.0f);
  glEnd();
}


x86 assembly (clang, -O0):
<draw_tri>:
push   %rbp
mov    %rsp,%rbp
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1060 <glBegin@plt>
movss  0xea6(%rip),%xmm0
xorps  %xmm2,%xmm2
movaps %xmm2,%xmm1
call   1050 <glColor3f@plt>
xorps  %xmm2,%xmm2
movss  0xe90(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glVertex3f@plt>
movss  0xe84(%rip),%xmm1
movss  0xe78(%rip),%xmm2
movaps %xmm1,%xmm0
call   1030 <glVertex3f@plt>
movss  0xe68(%rip),%xmm2
movss  0xe64(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glVertex3f@plt>
xorps  %xmm2,%xmm2
movss  0xe4d(%rip),%xmm1
movaps %xmm2,%xmm0
call   1050 <glColor3f@plt>
xorps  %xmm2,%xmm2
movss  0xe3a(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glVertex3f@plt>
movss  0xe2e(%rip),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1030 <glVertex3f@plt>
movss  0xe17(%rip),%xmm0
movss  0xe13(%rip),%xmm2
movaps %xmm2,%xmm1
call   1030 <glVertex3f@plt>
xorps  %xmm1,%xmm1
movss  0xdfc(%rip),%xmm2
movaps %xmm1,%xmm0
call   1050 <glColor3f@plt>
xorps  %xmm2,%xmm2
movss  0xde9(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glVertex3f@plt>
movss  0xddd(%rip),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1030 <glVertex3f@plt>
movss  0xdca(%rip),%xmm1
movss  0xdbe(%rip),%xmm2
movaps %xmm1,%xmm0
call   1030 <glVertex3f@plt>
movss  0xdae(%rip),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1050 <glColor3f@plt>
xorps  %xmm2,%xmm2
movss  0xd98(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glVertex3f@plt>
movss  0xd88(%rip),%xmm0
movss  0xd84(%rip),%xmm2
movaps %xmm2,%xmm1
call   1030 <glVertex3f@plt>
movss  0xd70(%rip),%xmm2
movss  0xd6c(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glVertex3f@plt>
mov    $0x0,%al
call   1040 <glEnd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_tri>:
push   %rax
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1060 <glBegin@plt>
movss  0xea9(%rip),%xmm0
xorps  %xmm1,%xmm1
xorps  %xmm2,%xmm2
call   1050 <glColor3f@plt>
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
movss  0xe90(%rip),%xmm1
call   1030 <glVertex3f@plt>
movss  0xe87(%rip),%xmm0
movaps %xmm0,%xmm1
movss  0xe78(%rip),%xmm2
call   1030 <glVertex3f@plt>
movss  0xe6b(%rip),%xmm0
movss  0xe67(%rip),%xmm1
movaps %xmm0,%xmm2
call   1030 <glVertex3f@plt>
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
movss  0xe4d(%rip),%xmm1
call   1050 <glColor3f@plt>
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
movss  0xe3a(%rip),%xmm1
call   1030 <glVertex3f@plt>
movss  0xe31(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
call   1030 <glVertex3f@plt>
movss  0xe1a(%rip),%xmm0
movss  0xe16(%rip),%xmm1
movaps %xmm1,%xmm2
call   1030 <glVertex3f@plt>
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
movss  0xdfc(%rip),%xmm2
call   1050 <glColor3f@plt>
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
movss  0xde9(%rip),%xmm1
call   1030 <glVertex3f@plt>
movss  0xde0(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
call   1030 <glVertex3f@plt>
movss  0xdcd(%rip),%xmm0
movaps %xmm0,%xmm1
movss  0xdbe(%rip),%xmm2
call   1030 <glVertex3f@plt>
movss  0xdb1(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
call   1050 <glColor3f@plt>
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
movss  0xd98(%rip),%xmm1
call   1030 <glVertex3f@plt>
movss  0xd8b(%rip),%xmm0
movss  0xd87(%rip),%xmm1
movaps %xmm1,%xmm2
call   1030 <glVertex3f@plt>
movss  0xd73(%rip),%xmm0
movss  0xd6f(%rip),%xmm1
movaps %xmm0,%xmm2
call   1030 <glVertex3f@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <glEnd@plt>

LLVM IR (-O0):
@GL_TRIANGLES = global i32 0
define void @draw_tri() {
%1 = load i32, i32* @GL_TRIANGLES
%2 = call i32 @glBegin(i32 %1)
%3 = call i32 @glColor3f(float 1.000000e+00, float 0.000000e+00, float 0.000000e+00)
%4 = call i32 @glVertex3f(float 0.000000e+00, float 1.000000e+00, float 0.000000e+00)
%5 = call i32 @glVertex3f(float -1.000000e+00, float -1.000000e+00, float 1.000000e+00)
%6 = call i32 @glVertex3f(float 1.000000e+00, float -1.000000e+00, float 1.000000e+00)
%7 = call i32 @glColor3f(float 0.000000e+00, float 1.000000e+00, float 0.000000e+00)
%8 = call i32 @glVertex3f(float 0.000000e+00, float 1.000000e+00, float 0.000000e+00)
%9 = call i32 @glVertex3f(float -1.000000e+00, float -1.000000e+00, float -1.000000e+00)
%10 = call i32 @glVertex3f(float 1.000000e+00, float -1.000000e+00, float -1.000000e+00)
%11 = call i32 @glColor3f(float 0.000000e+00, float 0.000000e+00, float 1.000000e+00)
%12 = call i32 @glVertex3f(float 0.000000e+00, float 1.000000e+00, float 0.000000e+00)
%13 = call i32 @glVertex3f(float -1.000000e+00, float -1.000000e+00, float -1.000000e+00)
%14 = call i32 @glVertex3f(float -1.000000e+00, float -1.000000e+00, float 1.000000e+00)
%15 = call i32 @glColor3f(float 1.000000e+00, float 1.000000e+00, float 1.000000e+00)
%16 = call i32 @glVertex3f(float 0.000000e+00, float 1.000000e+00, float 0.000000e+00)
%17 = call i32 @glVertex3f(float 1.000000e+00, float -1.000000e+00, float -1.000000e+00)
%18 = call i32 @glVertex3f(float 1.000000e+00, float -1.000000e+00, float 1.000000e+00)
%19 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_TRIANGLES = global i32 0
define void @draw_tri() {
%1 = load i32, i32* @GL_TRIANGLES
%2 = tail call i32 @glBegin(i32 %1)
%3 = tail call i32 @glColor3f(float 1.000000e+00, float 0.000000e+00, float 0.000000e+00)
%4 = tail call i32 @glVertex3f(float 0.000000e+00, float 1.000000e+00, float 0.000000e+00)
%5 = tail call i32 @glVertex3f(float -1.000000e+00, float -1.000000e+00, float 1.000000e+00)
%6 = tail call i32 @glVertex3f(float 1.000000e+00, float -1.000000e+00, float 1.000000e+00)
%7 = tail call i32 @glColor3f(float 0.000000e+00, float 1.000000e+00, float 0.000000e+00)
%8 = tail call i32 @glVertex3f(float 0.000000e+00, float 1.000000e+00, float 0.000000e+00)
%9 = tail call i32 @glVertex3f(float -1.000000e+00, float -1.000000e+00, float -1.000000e+00)
%10 = tail call i32 @glVertex3f(float 1.000000e+00, float -1.000000e+00, float -1.000000e+00)
%11 = tail call i32 @glColor3f(float 0.000000e+00, float 0.000000e+00, float 1.000000e+00)
%12 = tail call i32 @glVertex3f(float 0.000000e+00, float 1.000000e+00, float 0.000000e+00)
%13 = tail call i32 @glVertex3f(float -1.000000e+00, float -1.000000e+00, float -1.000000e+00)
%14 = tail call i32 @glVertex3f(float -1.000000e+00, float -1.000000e+00, float 1.000000e+00)
%15 = tail call i32 @glColor3f(float 1.000000e+00, float 1.000000e+00, float 1.000000e+00)
%16 = tail call i32 @glVertex3f(float 0.000000e+00, float 1.000000e+00, float 0.000000e+00)
%17 = tail call i32 @glVertex3f(float 1.000000e+00, float -1.000000e+00, float -1.000000e+00)
%18 = tail call i32 @glVertex3f(float 1.000000e+00, float -1.000000e+00, float 1.000000e+00)
%19 = tail call i32 (...) @glEnd()
ret void
}