// File: /workspace/github_cpp_makefile_star2_O3/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, 0x151373(%rip)    # 0x170eb0
jne 0x1fb94
cmpl $0x0, 0x1f8ce2(%rip)    # 0x218828
je 0x1fb72
movl 0x1f8cb6(%rip), %eax    # 0x218804
movl 0x1f8cac(%rip), %ecx    # 0x218800
movl %eax, 0x15135a(%rip)    # 0x170eb4
movl %ecx, 0x151358(%rip)    # 0x170eb8
movl $0x1, 0x151346(%rip)    # 0x170eb0
movl %ecx, 0x1f8cbc(%rip)    # 0x21882c
jmp 0x1fb94
movl 0x1f8c88(%rip), %eax    # 0x218800
movl %eax, 0x151336(%rip)    # 0x170eb4
movl 0x1f8c80(%rip), %eax    # 0x218804
movl %eax, 0x15132e(%rip)    # 0x170eb8
movl $0x1, 0x15131c(%rip)    # 0x170eb0
cmpl $0x0, 0x1f8cb1(%rip)    # 0x21884c
je 0x1fdb9
cmpl $0x0, 0x1fb6b4(%rip)    # 0x21b25c
jne 0x1fdb9
cmpl $0x0, 0x1fb6ab(%rip)    # 0x21b260
jne 0x1fdb9
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
cmpb $0x0, 0x1f8cfa(%rip)    # 0x2188c4
je 0x1fbe6
movl 0x1f8c2e(%rip), %esi    # 0x218800
movl 0x1f8c2c(%rip), %edx    # 0x218804
leaq 0xeb87b(%rip), %rdi     # 0x10b45a
xorl %eax, %eax
callq 0x9030
cmpl $0x0, 0x1f8c3b(%rip)    # 0x218828
je 0x1fc0d
movl 0x1f8c0f(%rip), %eax    # 0x218804
movl %eax, 0x1f8c31(%rip)    # 0x21882c
movl 0x1f8bff(%rip), %ecx    # 0x218800
movl %ecx, 0x1f8bfd(%rip)    # 0x218804
movl %eax, 0x1f8bf3(%rip)    # 0x218800
cmpb $0x0, 0x1f8cb0(%rip)    # 0x2188c4
je 0x1fc4b
movl 0x1f8c34(%rip), %esi    # 0x218850
movl 0x1f8c32(%rip), %edx    # 0x218854
movl 0x1f8bd8(%rip), %ecx    # 0x218800
movl 0x1f8bd5(%rip), %r8d    # 0x218804
movl 0x151276(%rip), %r9d    # 0x170eac
movl $0x0, (%rsp)
leaq 0xeb82d(%rip), %rdi     # 0x10b471
xorl %eax, %eax
callq 0x9030
movl $0x0, 0x1f8bf7(%rip)    # 0x21884c
movl 0x1f8bf5(%rip), %edx    # 0x218850
movl $0x140, %eax            # imm = 0x140
cmpl $0x140, %edx            # imm = 0x140
jl 0x1fc75
movl $0x1000, %eax           # imm = 0x1000
cmpl $0x1001, %edx           # imm = 0x1001
jb 0x1fc7d
movl %eax, 0x1f8bd5(%rip)    # 0x218850
movl %eax, %edx
movl 0x1f8bd1(%rip), %ecx    # 0x218854
cmpl $0x13f, %ecx            # imm = 0x13F
jg 0x1fc9a
movl $0x140, 0x1f8bbf(%rip)  # imm = 0x140
movl $0x140, %ecx            # imm = 0x140
cmpl 0x1f8b60(%rip), %edx    # 0x218800
jne 0x1fcce
cmpl 0x1f8b5c(%rip), %ecx    # 0x218804
jne 0x1fcce
cmpl $0x0, 0x1f8b77(%rip)    # 0x218828
je 0x1fdb4
movl %ecx, 0x1f8b6f(%rip)    # 0x21882c
movl %edx, 0x1f8b41(%rip)    # 0x218804
movl %ecx, 0x1f8b37(%rip)    # 0x218800
jmp 0x1fdb4
cmpl $0x0, 0x1511d7(%rip)    # 0x170eac
je 0x1fd35
leal 0x2(%rdx), %eax
cmpl 0x1f8b18(%rip), %eax    # 0x2187f8
jae 0x1fd35
cmpl 0x1f8b14(%rip), %ecx    # 0x2187fc
jae 0x1fd35
movl %edx, 0x1511c4(%rip)    # 0x170eb4
movl %ecx, 0x1511c2(%rip)    # 0x170eb8
movl $0x3, 0x1511b0(%rip)    # 0x170eb0
movl $0x0, 0x1511b2(%rip)    # 0x170ebc
cmpb $0x0, 0x1f8bb3(%rip)    # 0x2188c4
je 0x1fdba
leaq 0xeb786(%rip), %rdi     # 0x10b4a4
movl %edx, %esi
movl %ecx, %edx
xorl %eax, %eax
callq 0x9030
movl 0x1f8b21(%rip), %edx    # 0x218850
movl 0x1f8b1f(%rip), %ecx    # 0x218854
cmpb $0x0, 0x1f8b88(%rip)    # 0x2188c4
movl %edx, 0x1f8ad6(%rip)    # 0x218818
movl %edx, 0x1f8ab8(%rip)    # 0x218800
movl %ecx, 0x1f8ace(%rip)    # 0x21881c
movl %ecx, 0x1f8ab0(%rip)    # 0x218804
je 0x1fd74
leaq 0xeb762(%rip), %rdi     # 0x10b4bf
movl %edx, %esi
movl %ecx, %edx
xorl %eax, %eax
callq 0x9030
movl 0x1f8a92(%rip), %edx    # 0x218800
movl 0x1f8a90(%rip), %ecx    # 0x218804
movb $0x63, 0x1f8ab6(%rip)   # 0x218831
leaq 0x31f55e(%rip), %rdi    # 0x33f2e0
leaq 0xeafdf(%rip), %rsi     # 0x10ad68
xorl %eax, %eax
callq 0x9060
movq 0x151129(%rip), %rdi    # 0x170ec0
testq %rdi, %rdi
je 0x1fda1
callq 0x95c0
movb $0x1, 0x2ee0c4(%rip)    # 0x30de6c
callq 0x345c8
movb $0x0, 0x2ee0b8(%rip)    # 0x30de6c
addq $0x10, %rsp
popq %rbp
retq
movl %edx, 0x1f8a58(%rip)    # 0x218818
movl %edx, 0x1f8a3a(%rip)    # 0x218800
movl %ecx, 0x1f8a50(%rip)    # 0x21881c
movl %ecx, 0x1f8a32(%rip)    # 0x218804
jmp 0x1fd74