#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 */
#define GLUT_DOWN 129
#define GLUT_LEFT_BUTTON 128
int /*<<< orphan*/ addPoint(int, int);
int /*<<< orphan*/ onPoint(int, int);
void mousedown(int button, int state, int x, int y) {
  switch (button) {
  case GLUT_LEFT_BUTTON:
    switch (state) {
    case GLUT_DOWN:
      if (x > 0 && x < 800 / 2 && y > 0 && y < 600)
        if (!onPoint(x, 600 - y))
          addPoint(x, 600 - y);
      break;
    }
    break;
  }
}


x86 assembly (clang, -O0):
<mousedown>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x80,%eax
jne    11c0 <mousedown+0xa0>
jmp    1147 <mousedown+0x27>
mov    -0x8(%rbp),%eax
sub    $0x81,%eax
jne    11bb <mousedown+0x9b>
jmp    115a <mousedown+0x3a>
cmpl   $0x0,-0xc(%rbp)
jle    11b6 <mousedown+0x96>
cmpl   $0x190,-0xc(%rbp)
jge    11b6 <mousedown+0x96>
cmpl   $0x0,-0x10(%rbp)
jle    11b6 <mousedown+0x96>
cmpl   $0x258,-0x10(%rbp)
jge    11b6 <mousedown+0x96>
mov    -0xc(%rbp),%edi
mov    $0x258,%esi
sub    -0x10(%rbp),%esi
call   1030 <onPoint@plt>
cmp    $0x0,%eax
jne    11b1 <mousedown+0x91>
mov    -0xc(%rbp),%edi
mov    $0x258,%esi
sub    -0x10(%rbp),%esi
call   1040 <addPoint@plt>
jmp    11b6 <mousedown+0x96>
jmp    11bb <mousedown+0x9b>
jmp    11c0 <mousedown+0xa0>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mousedown>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x80,%edi
jne    115d <mousedown+0x3d>
cmp    $0x81,%esi
jne    115d <mousedown+0x3d>
mov    %edx,%ebx
lea    -0x1(%rbx),%eax
cmp    $0x18e,%eax
ja     115d <mousedown+0x3d>
lea    -0x1(%rcx),%eax
cmp    $0x256,%eax
ja     115d <mousedown+0x3d>
mov    $0x258,%ebp
sub    %ecx,%ebp
mov    %ebx,%edi
mov    %ebp,%esi
call   1030 <onPoint@plt>
test   %eax,%eax
je     1164 <mousedown+0x44>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
mov    %ebx,%edi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <addPoint@plt>

LLVM IR (-O0):
define void @mousedown(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
switch i32 %9, label %38 [
i32 128, label %10
]
10: ; preds = %4
%11 = load i32, i32* %6
switch i32 %11, label %37 [
i32 129, label %12
]
12: ; preds = %10
%13 = load i32, i32* %7
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %36
15: ; preds = %12
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 400
br i1 %17, label %18, label %36
18: ; preds = %15
%19 = load i32, i32* %8
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %36
21: ; preds = %18
%22 = load i32, i32* %8
%23 = icmp slt i32 %22, 600
br i1 %23, label %24, label %36
24: ; preds = %21
%25 = load i32, i32* %7
%26 = load i32, i32* %8
%27 = sub nsw i32 600, %26
%28 = call i32 @onPoint(i32 %25, i32 %27)
%29 = icmp ne i32 %28, 0
br i1 %29, label %35, label %30
30: ; preds = %24
%31 = load i32, i32* %7
%32 = load i32, i32* %8
%33 = sub nsw i32 600, %32
%34 = call i32 @addPoint(i32 %31, i32 %33)
br label %35
35: ; preds = %30, %24
br label %36
36: ; preds = %35, %21, %18, %15, %12
br label %37
37: ; preds = %10, %36
br label %38
38: ; preds = %4, %37
ret void
}

LLVM IR (-O2):
define void @mousedown(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %0, 128
%6 = icmp eq i32 %1, 129
%7 = and i1 %5, %6
br i1 %7, label %8, label %20
8: ; preds = %4
%9 = add i32 %2, -1
%10 = icmp ult i32 %9, 399
%11 = add i32 %3, -1
%12 = icmp ult i32 %11, 599
%13 = and i1 %10, %12
br i1 %13, label %14, label %20
14: ; preds = %8
%15 = sub nuw nsw i32 600, %3
%16 = tail call i32 @onPoint(i32 %2, i32 %15)
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = tail call i32 @addPoint(i32 %2, i32 %15)
br label %20
20: ; preds = %14, %18, %8, %4
ret void
}