// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0xd395(%rip), %rdi      # 0x14638
callq 0x45c0
orl 0xd412(%rip), %eax      # 0x146c0
je 0x73f3
leaq 0x8(%rsp), %r15
leaq 0x6e30(%rip), %r13      # 0xe0f0
leaq 0x7(%rsp), %r12
leaq 0x6e50(%rip), %rbp      # 0xe11c
movq 0xd365(%rip), %rdi      # 0x14638
movq %r15, %rsi
callq 0x4340
movl 0x8(%rsp), %eax
leal -0x2(%rax), %ecx
cmpl $0xa, %ecx
ja 0x7335
movslq (%r13,%rcx,4), %rax
addq %r13, %rax
jmpq *%rax
movq %r15, %rdi
movq %r12, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x40e0
cmpl $0x1, %eax
jne 0x73ca
movzbl 0x7(%rsp), %eax
cmpl $0x48, %eax
jg 0x736d
cmpl $0x20, %eax
je 0x7397
cmpl $0x43, %eax
je 0x73e9
cmpl $0x3, %eax
jne 0x73ca
jmp 0x74f0
cmpl $0x12, %eax
je 0x73c0
cmpl $0x13, %eax
jne 0x73ca
movl $0x0, 0xd36f(%rip)      # 0x146c0
jmp 0x73ca
cmpl $0x0, 0x40(%rsp)
jne 0x73ca
jmp 0x74d0
movq 0x48(%rsp), %rax
movq %rax, 0xd34d(%rip)      # 0x146b8
jmp 0x73ca
leal -0x49(%rax), %ecx
cmpl $0x9, %ecx
jbe 0x738d
leal -0x69(%rax), %ecx
cmpl $0x9, %ecx
ja 0x73e4
leaq 0x6dc0(%rip), %rdx      # 0xe144
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movslq (%rbp,%rcx,4), %rax
addq %rbp, %rax
jmpq *%rax
movq 0xd29a(%rip), %rdi      # 0x14638
movq 0xd29b(%rip), %rsi      # 0x14640
movl 0xd2cd(%rip), %edx      # 0x14678
callq 0x41f0
jmp 0x73ca
movq 0xd27f(%rip), %rdi      # 0x14638
xorl %esi, %esi
callq 0x4140
movl $0x1, 0xd2f6(%rip)      # 0x146c0
movq 0xd267(%rip), %rdi      # 0x14638
callq 0x45c0
orl 0xd2e4(%rip), %eax      # 0x146c0
jne 0x72cc
jmp 0x73f3
cmpl $0x63, %eax
jne 0x73ca
callq 0x5dc4
jmp 0x7347
xorl %eax, %eax
cmpq $0x0, 0xd2db(%rip)      # 0x146d8
je 0x7412
cmpq $0x0, 0xd2e1(%rip)      # 0x146e8
je 0x7412
movb $0x51, (%r14)
movl $0x1, %eax
cmpl $0x0, 0xd2a7(%rip)      # 0x146c0
jne 0x7470
movl 0xd297(%rip), %ecx      # 0x146b8
addl %ecx, %ecx
leal (%rcx,%rcx,4), %ecx
movslq %ecx, %rcx
imulq $-0x6db6db6d, %rcx, %rdx # imm = 0x92492493
shrq $0x20, %rdx
addl %edx, %ecx
movl %ecx, %edx
sarl $0x2, %edx
shrl $0x1f, %ecx
addl %edx, %ecx
addl $0x32, %ecx
movl %ecx, (%rbx)
movl 0xd271(%rip), %ecx      # 0x146bc
addl %ecx, %ecx
leal (%rcx,%rcx,4), %ecx
movslq %ecx, %rcx
imulq $-0x6db6db6d, %rcx, %rdx # imm = 0x92492493
shrq $0x20, %rdx
addl %edx, %ecx
movl %ecx, %edx
sarl $0x2, %edx
shrl $0x1f, %ecx
addl %edx, %ecx
addl $0x32, %ecx
movl %ecx, 0x4(%rbx)
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x48(%rsp), %rax
movq %rax, 0xd22a(%rip)      # 0x146b8
movl 0x5c(%rsp), %eax
leal 0x40(%rax), %ecx
movb %cl, (%r14)
leaq 0xd231(%rip), %rcx      # 0x146d0
movq $0x0, (%rcx,%rax,8)
jmp 0x7505
movq 0x48(%rsp), %rax
movq %rax, 0xd203(%rip)      # 0x146b8
movl 0x5c(%rsp), %eax
leal 0x60(%rax), %ecx
movb %cl, (%r14)
leaq 0xd20a(%rip), %rcx      # 0x146d0
movq $0x1, (%rcx,%rax,8)
jmp 0x7505
cmpl $0x0, 0xd1e9(%rip)      # 0x146c0
jne 0x74de
callq 0x5dc4
movq 0x30(%rsp), %rax
movq %rax, 0xd1ce(%rip)      # 0x146b8
movb $0x52, (%r14)
jmp 0x7505
movb $0x51, %al
jmp 0x74f6
movb $0x52, %al
movb %al, (%r14)
movq 0x48(%rsp), %rax
movq %rax, 0xd1b3(%rip)      # 0x146b8
movl $0x1, %eax
jmp 0x73f5