#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 GLUT_DOWN;
int GLUT_LEFT_BUTTON;
int /*<<< orphan*/ gluiPostRedisplay();
void seleccionColor(int boton, int estado, int x, int y) {
  int kx, ky, color;
  if (boton == GLUT_LEFT_BUTTON && estado == GLUT_DOWN) {
    kx = (x - 6) / 18;
    ky = (y - 6) / 18;
    if (kx < 0 || ky < 0 || kx > 2 || ky > 2)
      return;
    color = kx + (2 - ky) * 3;
    gluiPostRedisplay();
  }
}


x86 assembly (clang, -O0):
<seleccionColor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2eaa(%rip),%rcx
cmp    (%rcx),%eax
jne    11b1 <seleccionColor+0xa1>
mov    -0x8(%rbp),%eax
mov    0x2ea8(%rip),%rcx
cmp    (%rcx),%eax
jne    11b1 <seleccionColor+0xa1>
mov    -0xc(%rbp),%eax
sub    $0x6,%eax
mov    $0x12,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x6,%eax
mov    $0x12,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1192 <seleccionColor+0x82>
cmpl   $0x0,-0x18(%rbp)
jl     1192 <seleccionColor+0x82>
cmpl   $0x2,-0x14(%rbp)
jg     1192 <seleccionColor+0x82>
cmpl   $0x2,-0x18(%rbp)
jle    1197 <seleccionColor+0x87>
jmp    11b1 <seleccionColor+0xa1>
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
sub    -0x18(%rbp),%ecx
imul   $0x3,%ecx,%ecx
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <gluiPostRedisplay@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<seleccionColor>:
mov    0x2ec1(%rip),%rax
cmp    %edi,(%rax)
jne    113d <seleccionColor+0x2d>
mov    0x2ec6(%rip),%rax
cmp    %esi,(%rax)
jne    113d <seleccionColor+0x2d>
add    $0xffffffc4,%edx
cmp    $0xffffffb9,%edx
jb     113d <seleccionColor+0x2d>
add    $0xffffffc4,%ecx
cmp    $0xffffffb9,%ecx
jb     113d <seleccionColor+0x2d>
xor    %eax,%eax
jmp    1030 <gluiPostRedisplay@plt>
ret

LLVM IR (-O0):
@GLUT_LEFT_BUTTON = global i32 0
@GLUT_DOWN = global i32 0
define void @seleccionColor(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load i32, i32* %5
%13 = load i32, i32* @GLUT_LEFT_BUTTON
%14 = icmp eq i32 %12, %13
br i1 %14, label %15, label %45
15: ; preds = %4
%16 = load i32, i32* %6
%17 = load i32, i32* @GLUT_DOWN
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %45
19: ; preds = %15
%20 = load i32, i32* %7
%21 = sub nsw i32 %20, 6
%22 = sdiv i32 %21, 18
store i32 %22, i32* %9
%23 = load i32, i32* %8
%24 = sub nsw i32 %23, 6
%25 = sdiv i32 %24, 18
store i32 %25, i32* %10
%26 = load i32, i32* %9
%27 = icmp slt i32 %26, 0
br i1 %27, label %37, label %28
28: ; preds = %19
%29 = load i32, i32* %10
%30 = icmp slt i32 %29, 0
br i1 %30, label %37, label %31
31: ; preds = %28
%32 = load i32, i32* %9
%33 = icmp sgt i32 %32, 2
br i1 %33, label %37, label %34
34: ; preds = %31
%35 = load i32, i32* %10
%36 = icmp sgt i32 %35, 2
br i1 %36, label %37, label %38
37: ; preds = %34, %31, %28, %19
br label %45
38: ; preds = %34
%39 = load i32, i32* %9
%40 = load i32, i32* %10
%41 = sub nsw i32 2, %40
%42 = mul nsw i32 %41, 3
%43 = add nsw i32 %39, %42
store i32 %43, i32* %11
%44 = call i32 (...) @gluiPostRedisplay()
br label %45
45: ; preds = %37, %38, %15, %4
ret void
}

LLVM IR (-O2):
@GLUT_LEFT_BUTTON = global i32 0
@GLUT_DOWN = global i32 0
define void @seleccionColor(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = load i32, i32* @GLUT_LEFT_BUTTON
%6 = icmp eq i32 %5, %0
%7 = load i32, i32* @GLUT_DOWN
%8 = icmp eq i32 %7, %1
%9 = select i1 %6, i1 %8, i1 false
br i1 %9, label %10, label %18
10: ; preds = %4
%11 = add i32 %2, -60
%12 = icmp ult i32 %11, -71
%13 = add i32 %3, -60
%14 = icmp ult i32 %13, -71
%15 = or i1 %12, %14
br i1 %15, label %18, label %16
16: ; preds = %10
%17 = tail call i32 (...) @gluiPostRedisplay()
br label %18
18: ; preds = %4, %16, %10
ret void
}