#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_LINES;
int /*<<< orphan*/ GL_LINE_STRIP;
int /*<<< orphan*/ glBegin(int /*<<< orphan*/);
int /*<<< orphan*/ glColor3f(double, double, double);
int /*<<< orphan*/ glEnd();
int /*<<< orphan*/ glLineWidth(double);
int /*<<< orphan*/ glVertex2i(int, int);
void ButtonDrag(int bx, int by) {
  int tx = bx + 16;
  int ty = by + 16;
  int i = 0;
  glLineWidth(1.0);
  glColor3f(1.0, 1.0, 1.0);
  glBegin(GL_LINE_STRIP);
  glVertex2i(tx, ty);
  glVertex2i(tx, by);
  glVertex2i(bx, by);
  glVertex2i(bx, ty);
  glVertex2i(tx, ty);
  glEnd();
  by += 4;
  for (i = 1; i < 5; i++) {
    glBegin(GL_LINES);
    glVertex2i(bx + 2, by);
    glVertex2i(bx + 15, by);
    glEnd();
    by += 3;
  }
}


x86 assembly (clang, -O0):
<ButtonDrag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movsd  0xe81(%rip),%xmm0
call   1030 <glLineWidth@plt>
movsd  0xe74(%rip),%xmm2
movaps %xmm2,%xmm0
movaps %xmm2,%xmm1
call   1060 <glColor3f@plt>
mov    0x2e42(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <glVertex2i@plt>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <glVertex2i@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <glVertex2i@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <glVertex2i@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <glVertex2i@plt>
mov    $0x0,%al
call   1050 <glEnd@plt>
mov    -0x8(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x8(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x5,-0x14(%rbp)
jge    1245 <ButtonDrag+0xf5>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
mov    -0x4(%rbp),%edi
add    $0x2,%edi
mov    -0x8(%rbp),%esi
call   1040 <glVertex2i@plt>
mov    -0x4(%rbp),%edi
add    $0xf,%edi
mov    -0x8(%rbp),%esi
call   1040 <glVertex2i@plt>
mov    $0x0,%al
call   1050 <glEnd@plt>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f3 <ButtonDrag+0xa3>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ButtonDrag>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebx
lea    0x10(%rbx),%r15d
lea    0x10(%r14),%ebp
movsd  0xe93(%rip),%xmm0
call   1030 <glLineWidth@plt>
movsd  0xe86(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm2
call   1060 <glColor3f@plt>
mov    0x2e54(%rip),%rax
mov    (%rax),%edi
call   1070 <glBegin@plt>
mov    %r15d,%edi
mov    %ebp,%esi
call   1040 <glVertex2i@plt>
mov    %r15d,%edi
mov    %r14d,%esi
call   1040 <glVertex2i@plt>
mov    %ebx,%edi
mov    %r14d,%esi
call   1040 <glVertex2i@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <glVertex2i@plt>
mov    %r15d,%edi
mov    %ebp,%esi
call   1040 <glVertex2i@plt>
xor    %eax,%eax
call   1050 <glEnd@plt>
lea    0x4(%r14),%ebp
lea    0x2(%rbx),%r15d
add    $0xf,%ebx
mov    0x2e12(%rip),%r12
mov    (%r12),%edi
call   1070 <glBegin@plt>
mov    %r15d,%edi
mov    %ebp,%esi
call   1040 <glVertex2i@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <glVertex2i@plt>
xor    %eax,%eax
call   1050 <glEnd@plt>
lea    0x7(%r14),%ebp
mov    (%r12),%edi
call   1070 <glBegin@plt>
mov    %r15d,%edi
mov    %ebp,%esi
call   1040 <glVertex2i@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <glVertex2i@plt>
xor    %eax,%eax
call   1050 <glEnd@plt>
lea    0xa(%r14),%ebp
mov    (%r12),%edi
call   1070 <glBegin@plt>
mov    %r15d,%edi
mov    %ebp,%esi
call   1040 <glVertex2i@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <glVertex2i@plt>
xor    %eax,%eax
call   1050 <glEnd@plt>
add    $0xd,%r14d
mov    (%r12),%edi
call   1070 <glBegin@plt>
mov    %r15d,%edi
mov    %r14d,%esi
call   1040 <glVertex2i@plt>
mov    %ebx,%edi
mov    %r14d,%esi
call   1040 <glVertex2i@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <glEnd@plt>

LLVM IR (-O0):
@GL_LINE_STRIP = global i32 0
@GL_LINES = global i32 0
define void @ButtonDrag(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 16
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 16
store i32 %11, i32* %6
store i32 0, i32* %7
%12 = call i32 @glLineWidth(double 1.000000e+00)
%13 = call i32 @glColor3f(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
%14 = load i32, i32* @GL_LINE_STRIP
%15 = call i32 @glBegin(i32 %14)
%16 = load i32, i32* %5
%17 = load i32, i32* %6
%18 = call i32 @glVertex2i(i32 %16, i32 %17)
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = call i32 @glVertex2i(i32 %19, i32 %20)
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call i32 @glVertex2i(i32 %22, i32 %23)
%25 = load i32, i32* %3
%26 = load i32, i32* %6
%27 = call i32 @glVertex2i(i32 %25, i32 %26)
%28 = load i32, i32* %5
%29 = load i32, i32* %6
%30 = call i32 @glVertex2i(i32 %28, i32 %29)
%31 = call i32 (...) @glEnd()
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 4
store i32 %33, i32* %4
store i32 1, i32* %7
br label %34
34: ; preds = %51, %2
%35 = load i32, i32* %7
%36 = icmp slt i32 %35, 5
br i1 %36, label %37, label %54
37: ; preds = %34
%38 = load i32, i32* @GL_LINES
%39 = call i32 @glBegin(i32 %38)
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 2
%42 = load i32, i32* %4
%43 = call i32 @glVertex2i(i32 %41, i32 %42)
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 15
%46 = load i32, i32* %4
%47 = call i32 @glVertex2i(i32 %45, i32 %46)
%48 = call i32 (...) @glEnd()
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 3
store i32 %50, i32* %4
br label %51
51: ; preds = %37
%52 = load i32, i32* %7
%53 = add nsw i32 %52, 1
store i32 %53, i32* %7
br label %34
54: ; preds = %34
ret void
}

LLVM IR (-O2):
@GL_LINE_STRIP = global i32 0
@GL_LINES = global i32 0
define void @ButtonDrag(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 16
%4 = add nsw i32 %1, 16
%5 = tail call i32 @glLineWidth(double 1.000000e+00)
%6 = tail call i32 @glColor3f(double 1.000000e+00, double 1.000000e+00, double 1.000000e+00)
%7 = load i32, i32* @GL_LINE_STRIP
%8 = tail call i32 @glBegin(i32 %7)
%9 = tail call i32 @glVertex2i(i32 %3, i32 %4)
%10 = tail call i32 @glVertex2i(i32 %3, i32 %1)
%11 = tail call i32 @glVertex2i(i32 %0, i32 %1)
%12 = tail call i32 @glVertex2i(i32 %0, i32 %4)
%13 = tail call i32 @glVertex2i(i32 %3, i32 %4)
%14 = tail call i32 (...) @glEnd()
%15 = add nsw i32 %1, 4
%16 = add nsw i32 %0, 2
%17 = add nsw i32 %0, 15
%18 = load i32, i32* @GL_LINES
%19 = tail call i32 @glBegin(i32 %18)
%20 = tail call i32 @glVertex2i(i32 %16, i32 %15)
%21 = tail call i32 @glVertex2i(i32 %17, i32 %15)
%22 = tail call i32 (...) @glEnd()
%23 = add nsw i32 %1, 7
%24 = load i32, i32* @GL_LINES
%25 = tail call i32 @glBegin(i32 %24)
%26 = tail call i32 @glVertex2i(i32 %16, i32 %23)
%27 = tail call i32 @glVertex2i(i32 %17, i32 %23)
%28 = tail call i32 (...) @glEnd()
%29 = add nsw i32 %1, 10
%30 = load i32, i32* @GL_LINES
%31 = tail call i32 @glBegin(i32 %30)
%32 = tail call i32 @glVertex2i(i32 %16, i32 %29)
%33 = tail call i32 @glVertex2i(i32 %17, i32 %29)
%34 = tail call i32 (...) @glEnd()
%35 = add nsw i32 %1, 13
%36 = load i32, i32* @GL_LINES
%37 = tail call i32 @glBegin(i32 %36)
%38 = tail call i32 @glVertex2i(i32 %16, i32 %35)
%39 = tail call i32 @glVertex2i(i32 %17, i32 %35)
%40 = tail call i32 (...) @glEnd()
ret void
}