#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 /*<<< orphan*/ GLUT_ELAPSED_TIME;
int GLUT_UP;
int /*<<< orphan*/ glutGet(int /*<<< orphan*/);
int /*<<< orphan*/ glutPostRedisplay();
int /*<<< orphan*/ startMotion(int, int, int, int /*<<< orphan*/);
int /*<<< orphan*/ stopMotion(int, int /*<<< orphan*/);
void mouse(int button, int state, int x, int y) {
  if (state == GLUT_DOWN)
    startMotion(x, y, button, glutGet(GLUT_ELAPSED_TIME));
  else if (state == GLUT_UP)
    stopMotion(button, glutGet(GLUT_ELAPSED_TIME));
  glutPostRedisplay();
}


x86 assembly (clang, -O0):
<mouse>:
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    -0x8(%rbp),%eax
mov    0x2e8a(%rip),%rcx
cmp    (%rcx),%eax
jne    119b <mouse+0x5b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
call   1030 <glutGet@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    %eax,%ecx
call   1060 <startMotion@plt>
jmp    11d0 <mouse+0x90>
mov    -0x8(%rbp),%eax
mov    0x2e2b(%rip),%rcx
cmp    (%rcx),%eax
jne    11cb <mouse+0x8b>
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
call   1030 <glutGet@plt>
mov    -0x20(%rbp),%edi
mov    %eax,%esi
call   1050 <stopMotion@plt>
jmp    11d0 <mouse+0x90>
mov    $0x0,%al
call   1040 <glutPostRedisplay@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mouse>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
mov    0x2e9a(%rip),%rax
cmp    %esi,(%rax)
jne    1174 <mouse+0x34>
mov    %ecx,%ebp
mov    %edx,%ebx
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1030 <glutGet@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %eax,%ecx
call   1060 <startMotion@plt>
jmp    1197 <mouse+0x57>
mov    0x2e55(%rip),%rax
cmp    %esi,(%rax)
jne    1197 <mouse+0x57>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1030 <glutGet@plt>
mov    %r14d,%edi
mov    %eax,%esi
call   1050 <stopMotion@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <glutPostRedisplay@plt>

LLVM IR (-O0):
@GLUT_DOWN = global i32 0
@GLUT_ELAPSED_TIME = global i32 0
@GLUT_UP = global i32 0
define void @mouse(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* %6
%10 = load i32, i32* @GLUT_DOWN
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %19
12: ; preds = %4
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %5
%16 = load i32, i32* @GLUT_ELAPSED_TIME
%17 = call i32 @glutGet(i32 %16)
%18 = call i32 @startMotion(i32 %13, i32 %14, i32 %15, i32 %17)
br label %29
19: ; preds = %4
%20 = load i32, i32* %6
%21 = load i32, i32* @GLUT_UP
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %28
23: ; preds = %19
%24 = load i32, i32* %5
%25 = load i32, i32* @GLUT_ELAPSED_TIME
%26 = call i32 @glutGet(i32 %25)
%27 = call i32 @stopMotion(i32 %24, i32 %26)
br label %28
28: ; preds = %23, %19
br label %29
29: ; preds = %28, %12
%30 = call i32 (...) @glutPostRedisplay()
ret void
}

LLVM IR (-O2):
@GLUT_DOWN = global i32 0
@GLUT_ELAPSED_TIME = global i32 0
@GLUT_UP = global i32 0
define void @mouse(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = load i32, i32* @GLUT_DOWN
%6 = icmp eq i32 %5, %1
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = load i32, i32* @GLUT_ELAPSED_TIME
%9 = tail call i32 @glutGet(i32 %8)
%10 = tail call i32 @startMotion(i32 %2, i32 %3, i32 %0, i32 %9)
br label %18
11: ; preds = %4
%12 = load i32, i32* @GLUT_UP
%13 = icmp eq i32 %12, %1
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* @GLUT_ELAPSED_TIME
%16 = tail call i32 @glutGet(i32 %15)
%17 = tail call i32 @stopMotion(i32 %0, i32 %16)
br label %18
18: ; preds = %11, %14, %7
%19 = tail call i32 (...) @glutPostRedisplay()
ret void
}