#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_POLYGON;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glVertex2f(float, float);
void graphic_draw_rectangle(float xc, float yc, float width, float height,
                            int filled) {
  if (filled == 1)
    glBegin(GL_POLYGON);
  else
    glBegin(GL_LINE_LOOP);
  glVertex2f(xc + width / 2, yc + height / 2);
  glVertex2f(xc - width / 2, yc + height / 2);
  glVertex2f(xc - width / 2, yc - height / 2);
  glVertex2f(xc + width / 2, yc - height / 2);
  glEnd();
}


x86 assembly (clang, -O0):
<graphic_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    %edi,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    116c <graphic_draw_rectangle+0x3c>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1050 <glBegin@plt>
jmp    117a <graphic_draw_rectangle+0x4a>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1050 <glBegin@plt>
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  0xe74(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movss  0xe5a(%rip),%xmm3
divss  %xmm3,%xmm2
addss  %xmm2,%xmm1
call   1040 <glVertex2f@plt>
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  0xe3b(%rip),%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movss  0xe21(%rip),%xmm3
divss  %xmm3,%xmm2
addss  %xmm2,%xmm1
call   1040 <glVertex2f@plt>
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  0xe02(%rip),%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movss  0xde8(%rip),%xmm3
divss  %xmm3,%xmm2
subss  %xmm2,%xmm1
call   1040 <glVertex2f@plt>
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
movss  0xdc9(%rip),%xmm2
divss  %xmm2,%xmm1
addss  %xmm1,%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
movss  0xdaf(%rip),%xmm3
divss  %xmm3,%xmm2
subss  %xmm2,%xmm1
call   1040 <glVertex2f@plt>
mov    $0x0,%al
call   1030 <glEnd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<graphic_draw_rectangle>:
sub    $0x18,%rsp
movss  %xmm3,0xc(%rsp)
movss  %xmm2,0x8(%rsp)
movss  %xmm1,0x4(%rsp)
movss  %xmm0,(%rsp)
cmp    $0x1,%edi
jne    1159 <graphic_draw_rectangle+0x29>
mov    0x2ea1(%rip),%rax
jmp    1160 <graphic_draw_rectangle+0x30>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
call   1050 <glBegin@plt>
movss  0xe91(%rip),%xmm1
movss  0x8(%rsp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,0x8(%rsp)
addss  (%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
movss  0xc(%rsp),%xmm2
mulss  %xmm1,%xmm2
movss  %xmm2,0xc(%rsp)
movaps %xmm2,%xmm1
addss  0x4(%rsp),%xmm1
movss  %xmm1,0x10(%rsp)
call   1040 <glVertex2f@plt>
movss  (%rsp),%xmm0
subss  0x8(%rsp),%xmm0
movss  %xmm0,(%rsp)
movss  0x10(%rsp),%xmm1
call   1040 <glVertex2f@plt>
movss  0x4(%rsp),%xmm1
subss  0xc(%rsp),%xmm1
movss  %xmm1,0x4(%rsp)
movss  (%rsp),%xmm0
call   1040 <glVertex2f@plt>
movss  0x14(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
call   1040 <glVertex2f@plt>
xor    %eax,%eax
add    $0x18,%rsp
jmp    1030 <glEnd@plt>

LLVM IR (-O0):
@GL_POLYGON = global i32 0
@GL_LINE_LOOP = global i32 0
define void @graphic_draw_rectangle(float %0, float %1, float %2, float %3, i32 %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i32
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store i32 %4, i32* %10
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %16
13: ; preds = %5
%14 = load i32, i32* @GL_POLYGON
%15 = call i32 @glBegin(i32 %14)
br label %19
16: ; preds = %5
%17 = load i32, i32* @GL_LINE_LOOP
%18 = call i32 @glBegin(i32 %17)
br label %19
19: ; preds = %16, %13
%20 = load float, float* %6
%21 = load float, float* %8
%22 = fdiv float %21, 2.000000e+00
%23 = fadd float %20, %22
%24 = load float, float* %7
%25 = load float, float* %9
%26 = fdiv float %25, 2.000000e+00
%27 = fadd float %24, %26
%28 = call i32 @glVertex2f(float %23, float %27)
%29 = load float, float* %6
%30 = load float, float* %8
%31 = fdiv float %30, 2.000000e+00
%32 = fsub float %29, %31
%33 = load float, float* %7
%34 = load float, float* %9
%35 = fdiv float %34, 2.000000e+00
%36 = fadd float %33, %35
%37 = call i32 @glVertex2f(float %32, float %36)
%38 = load float, float* %6
%39 = load float, float* %8
%40 = fdiv float %39, 2.000000e+00
%41 = fsub float %38, %40
%42 = load float, float* %7
%43 = load float, float* %9
%44 = fdiv float %43, 2.000000e+00
%45 = fsub float %42, %44
%46 = call i32 @glVertex2f(float %41, float %45)
%47 = load float, float* %6
%48 = load float, float* %8
%49 = fdiv float %48, 2.000000e+00
%50 = fadd float %47, %49
%51 = load float, float* %7
%52 = load float, float* %9
%53 = fdiv float %52, 2.000000e+00
%54 = fsub float %51, %53
%55 = call i32 @glVertex2f(float %50, float %54)
%56 = call i32 (...) @glEnd()
ret void
}

LLVM IR (-O2):
@GL_POLYGON = global i32 0
@GL_LINE_LOOP = global i32 0
define void @graphic_draw_rectangle(float %0, float %1, float %2, float %3, i32 %4) {
%6 = icmp eq i32 %4, 1
%7 = load i32, i32* @GL_POLYGON
%8 = load i32, i32* @GL_LINE_LOOP
%9 = select i1 %6, i32 %7, i32 %8
%10 = tail call i32 @glBegin(i32 %9)
%11 = fmul float %2, 5.000000e-01
%12 = fadd float %11, %0
%13 = fmul float %3, 5.000000e-01
%14 = fadd float %13, %1
%15 = tail call i32 @glVertex2f(float %12, float %14)
%16 = fsub float %0, %11
%17 = tail call i32 @glVertex2f(float %16, float %14)
%18 = fsub float %1, %13
%19 = tail call i32 @glVertex2f(float %16, float %18)
%20 = tail call i32 @glVertex2f(float %12, float %18)
%21 = tail call i32 (...) @glEnd()
ret void
}