#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_LINE_LOOP;
int /*<<< orphan*/ GL_TRIANGLES;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glColor4f(float const, float const, float const, double);
int /*<<< orphan*/ glColor4fv(float const *);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glLineWidth(double);
int /*<<< orphan*/ glVertex2f(float, float);
void draw_triangle(float x1, float y1, float x2, float y2, float x3, float y3,
                   const float color[4]) {
  glColor4fv(color);
  glBegin(GL_TRIANGLES);
  glVertex2f(x1, y1);
  glVertex2f(x2, y2);
  glVertex2f(x3, y3);
  glEnd();
  const float dark = 0.2;
  glColor4f(dark * color[0], dark * color[1], dark * color[2], 1.0);
  glLineWidth(2.0);
  glBegin(GL_LINE_LOOP);
  glVertex2f(x1, y1);
  glVertex2f(x2, y2);
  glVertex2f(x3, y3);
  glEnd();
}


x86 assembly (clang, -O0):
<draw_triangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  %xmm5,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1050 <glColor4fv@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1070 <glVertex2f@plt>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1070 <glVertex2f@plt>
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
call   1070 <glVertex2f@plt>
mov    $0x0,%al
call   1060 <glEnd@plt>
movss  0xe33(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x20(%rbp),%rax
movss  0xe22(%rip),%xmm0
mulss  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movss  0xe12(%rip),%xmm1
mulss  0x4(%rax),%xmm1
mov    -0x20(%rbp),%rax
movss  0xe01(%rip),%xmm2
mulss  0x8(%rax),%xmm2
movsd  0xdec(%rip),%xmm3
call   1040 <glColor4f@plt>
movsd  0xdd7(%rip),%xmm0
call   1030 <glLineWidth@plt>
mov    0x2db3(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1070 <glVertex2f@plt>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1070 <glVertex2f@plt>
movss  -0x14(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
call   1070 <glVertex2f@plt>
mov    $0x0,%al
call   1060 <glEnd@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_triangle>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
movss  %xmm5,0x1c(%rsp)
movss  %xmm4,0x18(%rsp)
movss  %xmm3,0x14(%rsp)
movss  %xmm2,0x10(%rsp)
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
call   1050 <glColor4fv@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1070 <glVertex2f@plt>
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
call   1070 <glVertex2f@plt>
movss  0x18(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
call   1070 <glVertex2f@plt>
xor    %eax,%eax
call   1060 <glEnd@plt>
movss  0xe1f(%rip),%xmm2
movss  (%rbx),%xmm0
mulss  %xmm2,%xmm0
movss  0x4(%rbx),%xmm1
mulss  %xmm2,%xmm1
mulss  0x8(%rbx),%xmm2
movsd  0xe09(%rip),%xmm3
call   1040 <glColor4f@plt>
movsd  0xe04(%rip),%xmm0
call   1030 <glLineWidth@plt>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
call   1080 <glBegin@plt>
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1070 <glVertex2f@plt>
movss  0x10(%rsp),%xmm0
movss  0x14(%rsp),%xmm1
call   1070 <glVertex2f@plt>
movss  0x18(%rsp),%xmm0
movss  0x1c(%rsp),%xmm1
call   1070 <glVertex2f@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
jmp    1060 <glEnd@plt>

LLVM IR (-O0):
@GL_TRIANGLES = global i32 0
@GL_LINE_LOOP = global i32 0
define void @draw_triangle(float %0, float %1, float %2, float %3, float %4, float %5, float* %6) {
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float*
%15 = alloca float
store float %0, float* %8
store float %1, float* %9
store float %2, float* %10
store float %3, float* %11
store float %4, float* %12
store float %5, float* %13
store float* %6, float** %14
%16 = load float*, float** %14
%17 = call i32 @glColor4fv(float* %16)
%18 = load i32, i32* @GL_TRIANGLES
%19 = call i32 @glBegin(i32 %18)
%20 = load float, float* %8
%21 = load float, float* %9
%22 = call i32 @glVertex2f(float %20, float %21)
%23 = load float, float* %10
%24 = load float, float* %11
%25 = call i32 @glVertex2f(float %23, float %24)
%26 = load float, float* %12
%27 = load float, float* %13
%28 = call i32 @glVertex2f(float %26, float %27)
%29 = call i32 (...) @glEnd()
store float 0x3FC99999A0000000, float* %15
%30 = load float*, float** %14
%31 = getelementptr inbounds float, float* %30, i64 0
%32 = load float, float* %31
%33 = fmul float 0x3FC99999A0000000, %32
%34 = load float*, float** %14
%35 = getelementptr inbounds float, float* %34, i64 1
%36 = load float, float* %35
%37 = fmul float 0x3FC99999A0000000, %36
%38 = load float*, float** %14
%39 = getelementptr inbounds float, float* %38, i64 2
%40 = load float, float* %39
%41 = fmul float 0x3FC99999A0000000, %40
%42 = call i32 @glColor4f(float %33, float %37, float %41, double 1.000000e+00)
%43 = call i32 @glLineWidth(double 2.000000e+00)
%44 = load i32, i32* @GL_LINE_LOOP
%45 = call i32 @glBegin(i32 %44)
%46 = load float, float* %8
%47 = load float, float* %9
%48 = call i32 @glVertex2f(float %46, float %47)
%49 = load float, float* %10
%50 = load float, float* %11
%51 = call i32 @glVertex2f(float %49, float %50)
%52 = load float, float* %12
%53 = load float, float* %13
%54 = call i32 @glVertex2f(float %52, float %53)
%55 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_TRIANGLES = global i32 0
@GL_LINE_LOOP = global i32 0
define void @draw_triangle(float %0, float %1, float %2, float %3, float %4, float %5, float* %6) {
%8 = tail call i32 @glColor4fv(float* %6)
%9 = load i32, i32* @GL_TRIANGLES
%10 = tail call i32 @glBegin(i32 %9)
%11 = tail call i32 @glVertex2f(float %0, float %1)
%12 = tail call i32 @glVertex2f(float %2, float %3)
%13 = tail call i32 @glVertex2f(float %4, float %5)
%14 = tail call i32 (...) @glEnd()
%15 = load float, float* %6
%16 = fmul float %15, 0x3FC99999A0000000
%17 = getelementptr inbounds float, float* %6, i64 1
%18 = load float, float* %17
%19 = fmul float %18, 0x3FC99999A0000000
%20 = getelementptr inbounds float, float* %6, i64 2
%21 = load float, float* %20
%22 = fmul float %21, 0x3FC99999A0000000
%23 = tail call i32 @glColor4f(float %16, float %19, float %22, double 1.000000e+00)
%24 = tail call i32 @glLineWidth(double 2.000000e+00)
%25 = load i32, i32* @GL_LINE_LOOP
%26 = tail call i32 @glBegin(i32 %25)
%27 = tail call i32 @glVertex2f(float %0, float %1)
%28 = tail call i32 @glVertex2f(float %2, float %3)
%29 = tail call i32 @glVertex2f(float %4, float %5)
%30 = tail call i32 (...) @glEnd()
ret void
}