// File: /workspace/github_c_makefile_star2_O0/jrrk[P]cbzone/c_gpr.c
// Function: gprcondeventwait
Bool gprcondeventwait(key, posn)
     char* key;
     Position_t *posn;
{
  static unsigned long flag[16]={0};
  XEvent ev;
  char keystr;
  Bool return_val = False;
  Bool motion = False;

  while (XPending(d) || paused) {
    XNextEvent(d, &ev);
    switch(ev.type) {
    case Expose:
      if (((XExposeEvent*) &ev)->count) break;
      if (!paused)
        grabpointer();
      mouse_posn.x = ev.xexpose.x;
      mouse_posn.y = ev.xexpose.y;
      *key = 'R';
      return_val = True;
      break;
    case UnmapNotify:
      paused = True;
      break;
    case MapNotify:
      paused = False;
      break;
    case KeyPress:
      if (XLookupString(&ev.xkey,&keystr,1,(KeySym *) 0,
                        (XComposeStatus *) 0) == 1)
        switch (keystr) {
        case 'p': case 'P':
          ungrabpointer();
          paused = True;
          break;
        case 'c': case 'C':
          grabpointer();
          paused = False;
          break;
        case 'i': case 'I': case ' ':
          XIconifyWindow(d, w, screen_num);
          break;
        case 'r': case 'R':
          *key = 'R';
          return_val = True;
          break;
        case '\003': case 'q': case 'Q':
          *key = 'Q';
          return_val = True;
          break;
        }
      if (return_val) {
        mouse_posn.x = ev.xkey.x;
        mouse_posn.y = ev.xkey.y;
      }
      break;
    case MotionNotify:
      motion = True;
      mouse_posn.x = ev.xmotion.x;
      mouse_posn.y = ev.xmotion.y;
      break;
    case ButtonPress:
      mouse_posn.x = ev.xbutton.x;
      mouse_posn.y = ev.xbutton.y;
      *key = ev.xbutton.button + 'a' - 1;
      flag[ev.xbutton.button]=1;
      return_val = True;
      break;
    case ButtonRelease:
      mouse_posn.x = ev.xbutton.x;
      mouse_posn.y = ev.xbutton.y;
      *key = ev.xbutton.button + 'A' - 1;
      flag[ev.xbutton.button]=0;
      return_val = True;
      break;
    }
    if (return_val)
      break;
  }
  if(flag[1]&&flag[3]) {
    *key = 'Q';
    return_val = True;
  }
  if (!paused) {
    posn->x = mouse_posn.x*XD/XM + XOFF;
    posn->y = mouse_posn.y*YD/YM + YOFF;
  }
  return return_val;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0xd8(%rbp)
movl $0x0, -0xdc(%rbp)
movq 0x1006a(%rip), %rdi     # 0x19a98
callq 0x55a0
movl %eax, %ecx
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0xdd(%rbp)
jne 0x9a52
cmpl $0x0, 0x100d7(%rip)     # 0x19b20
setne %al
movb %al, -0xdd(%rbp)
movb -0xdd(%rbp), %al
testb $0x1, %al
jne 0x9a61
jmp 0x9cb6
movq 0x10030(%rip), %rdi     # 0x19a98
leaq -0xd0(%rbp), %rsi
callq 0x5330
movl -0xd0(%rbp), %eax
addl $-0x2, %eax
movl %eax, %ecx
movq %rcx, -0xe8(%rbp)
subl $0x11, %eax
ja 0x9ca6
movq -0xe8(%rbp), %rax
leaq 0xa603(%rip), %rcx      # 0x140a0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x0, -0x98(%rbp)
je 0x9ab4
jmp 0x9ca6
cmpl $0x0, 0x10065(%rip)     # 0x19b20
jne 0x9ac2
callq 0x7fe0
movl -0xa8(%rbp), %eax
movl %eax, 0x1004a(%rip)     # 0x19b18
movl -0xa4(%rbp), %eax
movl %eax, 0x10042(%rip)     # 0x19b1c
movq -0x8(%rbp), %rax
movb $0x52, (%rax)
movl $0x1, -0xd8(%rbp)
jmp 0x9ca6
movl $0x1, 0x10026(%rip)     # 0x19b20
jmp 0x9ca6
movl $0x0, 0x10017(%rip)     # 0x19b20
jmp 0x9ca6
leaq -0xd0(%rbp), %rdi
leaq -0xd1(%rbp), %rsi
movl $0x1, %edx
xorl %eax, %eax
movl %eax, %r8d
movq %r8, %rcx
callq 0x50d0
cmpl $0x1, %eax
jne 0x9bc9
movsbl -0xd1(%rbp), %eax
addl $-0x3, %eax
movl %eax, %ecx
movq %rcx, -0xf0(%rbp)
subl $0x6f, %eax
ja 0x9bc7
movq -0xf0(%rbp), %rax
leaq 0xa58b(%rip), %rcx      # 0x140e8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x8040
movl $0x1, 0xffab(%rip)      # 0x19b20
jmp 0x9bc7
callq 0x7fe0
movl $0x0, 0xff9a(%rip)      # 0x19b20
jmp 0x9bc7
movq 0xff09(%rip), %rdi      # 0x19a98
movq 0xff0a(%rip), %rsi      # 0x19aa0
movl 0xff3c(%rip), %edx      # 0x19ad8
callq 0x51e0
jmp 0x9bc7
movq -0x8(%rbp), %rax
movb $0x52, (%rax)
movl $0x1, -0xd8(%rbp)
jmp 0x9bc7
movq -0x8(%rbp), %rax
movb $0x51, (%rax)
movl $0x1, -0xd8(%rbp)
jmp 0x9bc9
cmpl $0x0, -0xd8(%rbp)
je 0x9bea
movl -0x90(%rbp), %eax
movl %eax, 0xff3a(%rip)      # 0x19b18
movl -0x8c(%rbp), %eax
movl %eax, 0xff32(%rip)      # 0x19b1c
jmp 0x9ca6
movl $0x1, -0xdc(%rbp)
movl -0x90(%rbp), %eax
movl %eax, 0xff13(%rip)      # 0x19b18
movl -0x8c(%rbp), %eax
movl %eax, 0xff0b(%rip)      # 0x19b1c
jmp 0x9ca6
movl -0x90(%rbp), %eax
movl %eax, 0xfef6(%rip)      # 0x19b18
movl -0x8c(%rbp), %eax
movl %eax, 0xfeee(%rip)      # 0x19b1c
movl -0x7c(%rbp), %eax
addl $0x61, %eax
subl $0x1, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movl -0x7c(%rbp), %eax
movl %eax, %ecx
leaq 0xfee5(%rip), %rax      # 0x19b30
movq $0x1, (%rax,%rcx,8)
movl $0x1, -0xd8(%rbp)
jmp 0x9ca6
movl -0x90(%rbp), %eax
movl %eax, 0xfead(%rip)      # 0x19b18
movl -0x8c(%rbp), %eax
movl %eax, 0xfea5(%rip)      # 0x19b1c
movl -0x7c(%rbp), %eax
addl $0x41, %eax
subl $0x1, %eax
movb %al, %cl
movq -0x8(%rbp), %rax
movb %cl, (%rax)
movl -0x7c(%rbp), %eax
movl %eax, %ecx
leaq 0xfe9c(%rip), %rax      # 0x19b30
movq $0x0, (%rax,%rcx,8)
movl $0x1, -0xd8(%rbp)
cmpl $0x0, -0xd8(%rbp)
je 0x9cb1
jmp 0x9cb6
jmp 0x9a27
cmpq $0x0, 0xfe7a(%rip)      # 0x19b38
je 0x9cdb
cmpq $0x0, 0xfe80(%rip)      # 0x19b48
je 0x9cdb
movq -0x8(%rbp), %rax
movb $0x51, (%rax)
movl $0x1, -0xd8(%rbp)
cmpl $0x0, 0xfe3e(%rip)      # 0x19b20
jne 0x9d19
imull $0xa, 0xfe2d(%rip), %eax # 0x19b18
movl $0x7, %ecx
cltd
idivl %ecx
movl %eax, %ecx
addl $0x32, %ecx
movq -0x10(%rbp), %rax
movl %ecx, (%rax)
imull $0xa, 0xfe17(%rip), %eax # 0x19b1c
movl $0x7, %ecx
cltd
idivl %ecx
movl %eax, %ecx
addl $0x32, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x4(%rax)
movl -0xd8(%rbp), %eax
addq $0xf0, %rsp
popq %rbp
retq
nopl (%rax,%rax)