#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, 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(x, y, button, glutGet(GLUT_ELAPSED_TIME));
  glutPostRedisplay();
}


x86 assembly (clang, -O0):
<mouse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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    11e2 <mouse+0xa2>
mov    -0x8(%rbp),%eax
mov    0x2e2b(%rip),%rcx
cmp    (%rcx),%eax
jne    11dd <mouse+0x9d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
call   1030 <glutGet@plt>
mov    -0x28(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    %eax,%ecx
call   1050 <stopMotion@plt>
jmp    11e2 <mouse+0xa2>
mov    $0x0,%al
call   1040 <glutPostRedisplay@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mouse>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %edi,%ebp
mov    0x2e96(%rip),%rax
cmp    %esi,(%rax)
jne    1174 <mouse+0x34>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1030 <glutGet@plt>
mov    %ebx,%edi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %eax,%ecx
call   1060 <startMotion@plt>
jmp    119b <mouse+0x5b>
mov    0x2e55(%rip),%rax
cmp    %esi,(%rax)
jne    119b <mouse+0x5b>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1030 <glutGet@plt>
mov    %ebx,%edi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %eax,%ecx
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 %31
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 %30
23: ; preds = %19
%24 = load i32, i32* %7
%25 = load i32, i32* %8
%26 = load i32, i32* %5
%27 = load i32, i32* @GLUT_ELAPSED_TIME
%28 = call i32 @glutGet(i32 %27)
%29 = call i32 @stopMotion(i32 %24, i32 %25, i32 %26, i32 %28)
br label %30
30: ; preds = %23, %19
br label %31
31: ; preds = %30, %12
%32 = 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 %2, i32 %3, i32 %0, i32 %16)
br label %18
18: ; preds = %11, %14, %7
%19 = tail call i32 (...) @glutPostRedisplay()
ret void
}