// File: /workspace/github_cpp_makefile_star2_O1/jkingan[P]ladyheather/heather.cpp
// Function: x11_resize_check()
void x11_resize_check()
{
int mach;

   // if X11 screen, check if screen has been re-sized
   mach = 0;
   #ifdef __MACH__
      mach = 0;     // !!!! testing
   #endif

#ifdef USE_X11
   if(have_restore_size == 0) {
      SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);
      restore_width = SCREEN_WIDTH;
      restore_height= SCREEN_HEIGHT;
      have_restore_size = 1;   // size came from initial screen init
      SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);
   }

   if(need_resize && (this_button == 0) && (last_button == 0)) {
if(show_debug_info) printf("resizing screen:%dx%d\n", SCREEN_WIDTH,SCREEN_HEIGHT);
      SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);
if(show_debug_info) printf("RESIZE to %dx%d  now:%dx%d  have_root:%d  mach:%d\n", new_width,new_height, SCREEN_WIDTH,SCREEN_HEIGHT, have_root_info, mach); // zork - show_debug_info
      need_resize = 0;
      if(new_width < MIN_WIDTH) new_width = MIN_WIDTH;
      if(new_width > MAX_WIDTH) new_width = MAX_WIDTH;
      if(new_height < MIN_HEIGHT) new_height = MIN_HEIGHT;


      if(mach || (new_width != SCREEN_WIDTH) || (new_height != SCREEN_HEIGHT)) {
         if(have_root_info && ((unsigned)(new_width+2) < display_width) && ((unsigned) (new_height+0) < display_height)) { // new window size is not near the screen size
            restore_width = new_width;
            restore_height = new_height;
            have_restore_size = 3;  // size came from resize event
            x11_maxed = 0;
if(show_debug_info) printf("new restore size 3: %dx%d\n", restore_width,restore_height); // zork - show_debug_infi
         }

         SCREEN_WIDTH = custom_width = new_width;
         SCREEN_HEIGHT = custom_height = new_height;
if(show_debug_info) printf("Resizing to %d x %d.\n", SCREEN_WIDTH,SCREEN_HEIGHT); // zork - show_debug_info
         screen_type = 'c';
//       strcpy(edit_buffer, "c");
         sprintf(edit_buffer, "%dx%d",SCREEN_WIDTH,SCREEN_HEIGHT);
         if(display) XFlush(display);
         keyboard_cmd = 1;
         edit_screen_res();
         keyboard_cmd = 0;
      }
      else SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);
   }
#endif  // USE_X11
#if USE_SDL
       if(0 == sdl_scaling && need_resize && (this_button == 0) && (last_button == 0)) {
           printf("RESIZE to %dx%d  now:%dx%d  have_root:%d  mach:%d\n", new_width,new_height, SCREEN_WIDTH,SCREEN_HEIGHT, have_root_info, mach); // zork - show_debug_info
           need_resize = 0;
           restore_width = new_width;
           restore_height = new_height;
           have_restore_size = 3;  // size came from resize event
           SCREEN_WIDTH = custom_width = new_width;
           SCREEN_HEIGHT = custom_height = new_height;
           if(show_debug_info) printf("Resizing to %d x %d.\n", SCREEN_WIDTH,SCREEN_HEIGHT); // zork - show_debug_info
           screen_type = 'c';
           sprintf(edit_buffer, "%dx%d",SCREEN_WIDTH,SCREEN_HEIGHT);
           keyboard_cmd = 1;
           edit_screen_res();
           keyboard_cmd = 0;
       }
#endif
}

// Assembly:
cmpl $0x0, 0x151343(%rip)    # 0x170eb0
jne 0x1fbcf
movl 0x1f8cb3(%rip), %eax    # 0x218828
testl %eax, %eax
je 0x1fb97
movl 0x1f8c85(%rip), %ecx    # 0x218804
movl %ecx, 0x1f8ca7(%rip)    # 0x21882c
movl 0x1f8c75(%rip), %edx    # 0x218800
movl %edx, 0x1f8c73(%rip)    # 0x218804
movl %ecx, 0x1f8c69(%rip)    # 0x218800
movl 0x1f8c63(%rip), %ecx    # 0x218800
movl %ecx, 0x151311(%rip)    # 0x170eb4
movl 0x1f8c5b(%rip), %edx    # 0x218804
movl %edx, 0x151309(%rip)    # 0x170eb8
movl $0x1, 0x1512f7(%rip)    # 0x170eb0
testl %eax, %eax
je 0x1fbcf
movl %edx, 0x1f8c69(%rip)    # 0x21882c
movl %ecx, 0x1f8c3b(%rip)    # 0x218804
movl %edx, 0x1f8c31(%rip)    # 0x218800
cmpl $0x0, 0x1f8c76(%rip)    # 0x21884c
je 0x1fdf9
cmpl $0x0, 0x1fb679(%rip)    # 0x21b25c
jne 0x1fdf9
cmpl $0x0, 0x1fb670(%rip)    # 0x21b260
jne 0x1fdf9
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
cmpb $0x0, 0x1f8cbf(%rip)    # 0x2188c4
je 0x1fc21
movl 0x1f8bf3(%rip), %esi    # 0x218800
movl 0x1f8bf1(%rip), %edx    # 0x218804
leaq 0xeb830(%rip), %rdi     # 0x10b44a
xorl %eax, %eax
callq 0x9030
cmpl $0x0, 0x1f8c00(%rip)    # 0x218828
je 0x1fc48
movl 0x1f8bd4(%rip), %eax    # 0x218804
movl %eax, 0x1f8bf6(%rip)    # 0x21882c
movl 0x1f8bc4(%rip), %ecx    # 0x218800
movl %ecx, 0x1f8bc2(%rip)    # 0x218804
movl %eax, 0x1f8bb8(%rip)    # 0x218800
cmpb $0x0, 0x1f8c75(%rip)    # 0x2188c4
je 0x1fc86
movl 0x1f8bf9(%rip), %esi    # 0x218850
movl 0x1f8bf7(%rip), %edx    # 0x218854
movl 0x1f8b9d(%rip), %ecx    # 0x218800
movl 0x1f8b9a(%rip), %r8d    # 0x218804
movl 0x15123b(%rip), %r9d    # 0x170eac
movl $0x0, (%rsp)
leaq 0xeb7e2(%rip), %rdi     # 0x10b461
xorl %eax, %eax
callq 0x9030
movl $0x0, 0x1f8bbc(%rip)    # 0x21884c
cmpl $0x13f, 0x1f8bb6(%rip)  # imm = 0x13F
jg 0x1fca6
movl $0x140, 0x1f8baa(%rip)  # imm = 0x140
cmpl $0x1001, 0x1f8ba0(%rip) # imm = 0x1001
jl 0x1fcbc
movl $0x1000, 0x1f8b94(%rip) # imm = 0x1000
cmpl $0x13f, 0x1f8b8e(%rip)  # imm = 0x13F
jg 0x1fcd2
movl $0x140, 0x1f8b82(%rip)  # imm = 0x140
movl 0x1f8b78(%rip), %esi    # 0x218850
movl 0x1f8b22(%rip), %eax    # 0x218800
cmpl %eax, %esi
jne 0x1fd14
movl 0x1f8b1c(%rip), %ecx    # 0x218804
cmpl %ecx, 0x1f8b66(%rip)    # 0x218854
jne 0x1fd14
cmpl $0x0, 0x1f8b31(%rip)    # 0x218828
je 0x1fdf4
movl %ecx, 0x1f8b29(%rip)    # 0x21882c
movl %eax, 0x1f8afb(%rip)    # 0x218804
movl %ecx, 0x1f8af1(%rip)    # 0x218800
jmp 0x1fdf4
cmpl $0x0, 0x151191(%rip)    # 0x170eac
je 0x1fd6d
leal 0x2(%rsi), %eax
cmpl 0x1f8ad2(%rip), %eax    # 0x2187f8
jae 0x1fd6d
movl 0x1f8b26(%rip), %edx    # 0x218854
cmpl 0x1f8ac8(%rip), %edx    # 0x2187fc
jae 0x1fd6d
movl %esi, 0x151178(%rip)    # 0x170eb4
movl %edx, 0x151176(%rip)    # 0x170eb8
movl $0x3, 0x151164(%rip)    # 0x170eb0
movl $0x0, 0x151166(%rip)    # 0x170ebc
cmpb $0x0, 0x1f8b67(%rip)    # 0x2188c4
je 0x1fd6d
leaq 0xeb72e(%rip), %rdi     # 0x10b494
xorl %eax, %eax
callq 0x9030
movl 0x1f8add(%rip), %esi    # 0x218850
movl %esi, 0x1f8a9f(%rip)    # 0x218818
movl %esi, 0x1f8a81(%rip)    # 0x218800
movl 0x1f8acf(%rip), %edx    # 0x218854
movl %edx, 0x1f8a91(%rip)    # 0x21881c
movl %edx, 0x1f8a73(%rip)    # 0x218804
cmpb $0x0, 0x1f8b2c(%rip)    # 0x2188c4
je 0x1fda8
leaq 0xeb70e(%rip), %rdi     # 0x10b4af
xorl %eax, %eax
callq 0x9030
movb $0x63, 0x1f8a82(%rip)   # 0x218831
movl 0x1f8a4b(%rip), %edx    # 0x218800
movl 0x1f8a49(%rip), %ecx    # 0x218804
leaq 0x31f51e(%rip), %rdi    # 0x33f2e0
leaq 0xeaf8f(%rip), %rsi     # 0x10ad58
xorl %eax, %eax
callq 0x9060
movq 0x1510e9(%rip), %rdi    # 0x170ec0
testq %rdi, %rdi
je 0x1fde1
callq 0x95c0
movb $0x1, 0x2ee084(%rip)    # 0x30de6c
callq 0x344ab
movb $0x0, 0x2ee078(%rip)    # 0x30de6c
addq $0x10, %rsp
popq %rbp
retq