// File: /workspace/github_cpp_makefile_star2_O2/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, 0x13c6cc(%rip)    # 0x15aeb0
jne 0x1e82f
cmpl $0x0, 0x1e403b(%rip)    # 0x202828
movl 0x1e400d(%rip), %eax    # 0x202800
movl 0x1e400b(%rip), %ecx    # 0x202804
je 0x1e819
movl %ecx, 0x13c6b3(%rip)    # 0x15aeb4
movl %eax, 0x13c6b1(%rip)    # 0x15aeb8
movl $0x1, 0x13c69f(%rip)    # 0x15aeb0
movl %eax, 0x1e4015(%rip)    # 0x20282c
jmp 0x1e82f
movl %eax, 0x13c695(%rip)    # 0x15aeb4
movl %ecx, 0x13c693(%rip)    # 0x15aeb8
movl $0x1, 0x13c681(%rip)    # 0x15aeb0
cmpl $0x0, 0x1e4016(%rip)    # 0x20284c
je 0x1ea50
cmpl $0x0, 0x1e6a19(%rip)    # 0x20525c
jne 0x1ea50
cmpl $0x0, 0x1e6a10(%rip)    # 0x205260
jne 0x1ea50
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
cmpb $0x0, 0x1e405f(%rip)    # 0x2028c4
je 0x1e881
movl 0x1e3f93(%rip), %esi    # 0x202800
movl 0x1e3f91(%rip), %edx    # 0x202804
leaq 0xd6c5b(%rip), %rdi     # 0xf54d5
xorl %eax, %eax
callq 0x9030
cmpl $0x0, 0x1e3fa0(%rip)    # 0x202828
je 0x1e8a8
movl 0x1e3f74(%rip), %eax    # 0x202804
movl %eax, 0x1e3f96(%rip)    # 0x20282c
movl 0x1e3f64(%rip), %ecx    # 0x202800
movl %ecx, 0x1e3f62(%rip)    # 0x202804
movl %eax, 0x1e3f58(%rip)    # 0x202800
cmpb $0x0, 0x1e4015(%rip)    # 0x2028c4
je 0x1e8e3
movl 0x1e3f99(%rip), %esi    # 0x202850
movl 0x1e3f97(%rip), %edx    # 0x202854
movl 0x1e3f3d(%rip), %ecx    # 0x202800
movl 0x1e3f3a(%rip), %r8d    # 0x202804
movl 0x13c5db(%rip), %r9d    # 0x15aeac
andl $0x0, (%rsp)
leaq 0xd6c10(%rip), %rdi     # 0xf54ec
xorl %eax, %eax
callq 0x9030
andl $0x0, 0x1e3f62(%rip)    # 0x20284c
movl 0x1e3f60(%rip), %edx    # 0x202850
movl $0x140, %eax            # imm = 0x140
cmpl $0x140, %edx            # imm = 0x140
jl 0x1e90a
movl $0x1000, %eax           # imm = 0x1000
cmpl $0x1001, %edx           # imm = 0x1001
jb 0x1e912
movl %eax, 0x1e3f40(%rip)    # 0x202850
movl %eax, %edx
movl 0x1e3f3c(%rip), %ecx    # 0x202854
cmpl $0x13f, %ecx            # imm = 0x13F
jg 0x1e92f
movl $0x140, 0x1e3f2a(%rip)  # imm = 0x140
movl $0x140, %ecx            # imm = 0x140
cmpl 0x1e3ecb(%rip), %edx    # 0x202800
jne 0x1e963
cmpl 0x1e3ec7(%rip), %ecx    # 0x202804
jne 0x1e963
cmpl $0x0, 0x1e3ee2(%rip)    # 0x202828
je 0x1ea4b
movl %ecx, 0x1e3eda(%rip)    # 0x20282c
movl %edx, 0x1e3eac(%rip)    # 0x202804
movl %ecx, 0x1e3ea2(%rip)    # 0x202800
jmp 0x1ea4b
cmpl $0x0, 0x13c542(%rip)    # 0x15aeac
je 0x1e9c7
leal 0x2(%rdx), %eax
cmpl 0x1e3e83(%rip), %eax    # 0x2027f8
jae 0x1e9c7
cmpl 0x1e3e7f(%rip), %ecx    # 0x2027fc
jae 0x1e9c7
movl %edx, 0x13c52f(%rip)    # 0x15aeb4
andl $0x0, 0x13c530(%rip)    # 0x15aebc
movl %ecx, 0x13c526(%rip)    # 0x15aeb8
movl $0x3, 0x13c514(%rip)    # 0x15aeb0
cmpb $0x0, 0x1e3f21(%rip)    # 0x2028c4
je 0x1ea51
leaq 0xd6b6f(%rip), %rdi     # 0xf551f
movl %edx, %esi
movl %ecx, %edx
xorl %eax, %eax
callq 0x9030
movl 0x1e3e8f(%rip), %edx    # 0x202850
movl 0x1e3e8d(%rip), %ecx    # 0x202854
cmpb $0x0, 0x1e3ef6(%rip)    # 0x2028c4
sete %al
movl %edx, 0x1e3e41(%rip)    # 0x202818
movl %edx, 0x1e3e23(%rip)    # 0x202800
movl %ecx, 0x1e3e39(%rip)    # 0x20281c
movl %ecx, 0x1e3e1b(%rip)    # 0x202804
testb %al, %al
jne 0x1ea0b
leaq 0xd6b46(%rip), %rdi     # 0xf553a
movl %edx, %esi
movl %ecx, %edx
xorl %eax, %eax
callq 0x9030
movl 0x1e3dfb(%rip), %edx    # 0x202800
movl 0x1e3df9(%rip), %ecx    # 0x202804
movb $0x63, 0x1e3e1f(%rip)   # 0x202831
leaq 0x30a8c7(%rip), %rdi    # 0x3292e0
leaq 0xd63c3(%rip), %rsi     # 0xf4de3
xorl %eax, %eax
callq 0x9060
movq 0x13c492(%rip), %rdi    # 0x15aec0
testq %rdi, %rdi
je 0x1ea38
callq 0x95c0
movb $0x1, 0x2d942d(%rip)    # 0x2f7e6c
callq 0x317fd
movb $0x0, 0x2d9421(%rip)    # 0x2f7e6c
addq $0x10, %rsp
popq %rbp
retq
movb $0x1, %al
jmp 0x1e9d1