#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*/ 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*/ glRectf(float, float, float, float);
int /*<<< orphan*/ glVertex2f(float, float);
void draw_rectangle(float x1, float y1, float x2, float y2,
                    const float color[4]) {
  glColor4fv(color);
  glRectf(x1, y1, x2, y2);
  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, y1);
  glVertex2f(x2, y2);
  glVertex2f(x1, y2);
  glEnd();
}


x86 assembly (clang, -O0):
<draw_rectangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <glColor4fv@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
call   1060 <glRectf@plt>
movss  0xe56(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movss  0xe45(%rip),%xmm0
mulss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  0xe35(%rip),%xmm1
mulss  0x4(%rax),%xmm1
mov    -0x18(%rbp),%rax
movss  0xe24(%rip),%xmm2
mulss  0x8(%rax),%xmm2
movsd  0xe0f(%rip),%xmm3
call   1040 <glColor4f@plt>
movsd  0xdfa(%rip),%xmm0
call   1030 <glLineWidth@plt>
mov    0x2dd6(%rip),%rax
mov    (%rax),%edi
call   1090 <glBegin@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1080 <glVertex2f@plt>
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1080 <glVertex2f@plt>
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1080 <glVertex2f@plt>
movss  -0x4(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1080 <glVertex2f@plt>
mov    $0x0,%al
call   1070 <glEnd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_rectangle>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movss  %xmm3,0xc(%rsp)
movss  %xmm2,0x4(%rsp)
movss  %xmm1,(%rsp)
movss  %xmm0,0x8(%rsp)
call   1050 <glColor4fv@plt>
movss  0x8(%rsp),%xmm0
movss  (%rsp),%xmm1
movss  0x4(%rsp),%xmm2
movss  0xc(%rsp),%xmm3
call   1060 <glRectf@plt>
movss  0xe48(%rip),%xmm2
movss  (%rbx),%xmm0
mulss  %xmm2,%xmm0
movss  0x4(%rbx),%xmm1
mulss  %xmm2,%xmm1
mulss  0x8(%rbx),%xmm2
movsd  0xe32(%rip),%xmm3
call   1040 <glColor4f@plt>
movsd  0xe2d(%rip),%xmm0
call   1030 <glLineWidth@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
call   1090 <glBegin@plt>
movss  0x8(%rsp),%xmm0
movss  (%rsp),%xmm1
call   1080 <glVertex2f@plt>
movss  0x4(%rsp),%xmm0
movss  (%rsp),%xmm1
call   1080 <glVertex2f@plt>
movss  0x4(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1080 <glVertex2f@plt>
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
call   1080 <glVertex2f@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1070 <glEnd@plt>

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

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