// File: jkingan[P]ladyheather/heather.cpp
// Function: init_screen(int)
void init_screen(int why)
{
Cursor cur;
unsigned char *vfx_font;
int font_height;
int i;
unsigned int j;
int old_sw, old_sh;

struct DECO_HINTS {  // stuff for disabling window decorations
   u32 flags;
   u32 functions;
   u32 decorations;
   u32 input_mode;
   u32 status;
} deco_hints;
Atom deco;

   // Initialize the graphics screen
printf("\nInit screen %d: %dx%d (potentially rotated)\n", why, SCREEN_WIDTH,SCREEN_HEIGHT);

   config_screen(3);  // initialize screen rendering variables for potentially rotated size
// VFX_io_done = 1;
   kill_screen();    // release any screen data structures currently in use

   old_sw = SCREEN_WIDTH;
   old_sh = SCREEN_HEIGHT;
   SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);  // physical screen size
printf("Physical screen size: %dx%d\n", SCREEN_WIDTH,SCREEN_HEIGHT);

   // setup text drawing using WIN_VFX fonts
   if(user_font_size == 0)  {
      if(big_plot && (ebolt == 0)) {
         vfx_font = &h_medium_font[0];
         user_font_size = 14;
      }
      else {
         vfx_font = &h_font_12[0];
         user_font_size = 12;
      }
   }
   else if(user_font_size <= 8)  {
      vfx_font = &h_small_font[0];
      user_font_size = 8;
   }
   else if(user_font_size <= 12) {
      vfx_font = &h_font_12[0];
      user_font_size = 12;
   }
   else if(user_font_size <= 14) {
      vfx_font = &h_medium_font[0];
      user_font_size = 14;
   }
   else if(user_font_size <= 16) {
      vfx_font = &h_large_font[0];
      user_font_size = 16;
   }
   else {
      vfx_font = &h_font_12[0];
      user_font_size = 12;
   }

   font_height = user_font_size;
   TEXT_HEIGHT = font_height;
   TEXT_WIDTH  = 8;  // !!!!!!!
   if(font_height <= 12) {
      small_font = 2;
   }
   else small_font = 0;

   dot_font = (unsigned char *) (void *) vfx_font;



   /*  Window variables  */

   int          x, y;
   unsigned int width, height;
   char *window_name;
   char *icon_name;

   if(luxor) {
      window_name = "Luxor X11";
      icon_name   = "Luxor";
   }
   else {
      window_name = &szAppName[0];  // "Lady Heather X11";
      icon_name   = "Heather";
   }


   /*  Display variables  */

   char *       display_name = NULL;


   /*  Miscellaneous X11 variables  */

   XTextProperty windowName, iconName;
   XGCValues     values;

   if(luxor) appname = "LUXOR";  // !!!argv[0];
   else      appname = "HEATHER";  // !!!argv[0];


   /*  Allocate memory for X11 structures  */

   if ( !( size_hints  = XAllocSizeHints() ) ||
        !( wm_hints    = XAllocWMHints()   ) ||
        !( class_hints = XAllocClassHint() )    ) {
       sprintf(out, "%s: couldn't allocate memory.\n", appname);
       error_exit(10005, out);
   }


   /*  Connect to X11 server  */

   display = XOpenDisplay(display_name);
   if(display == NULL) {
      sprintf(out, "%s: couldn't connect to X server %s\n", appname, display_name);
      error_exit(10006, out);
   }


   /*  Get screen size from display structure macro  */

   screen_num     = DefaultScreen(display);
   display_width  = DisplayWidth(display, screen_num);
   display_height = DisplayHeight(display, screen_num);
   have_root_info = 1;

printf("Config disp: %dx%d  screen:%dx%d  kill_decorations:%d  go_full:%d\n", display_width,display_height, SCREEN_WIDTH,SCREEN_HEIGHT, kill_deco, go_fullscreen);
   if(go_fullscreen && (display_width >= MIN_WIDTH) && (display_height >= MIN_HEIGHT)) {
      SCREEN_WIDTH  = display_width;
      SCREEN_HEIGHT = display_height;
      go_fullscreen = 0;
   }
if(kill_deco) go_fullscreen = 1;
printf("Display size: %dx%d  screen:%dx%d  kill_decorations:%d  go_full:%d\n", display_width,display_height, SCREEN_WIDTH,SCREEN_HEIGHT, kill_deco, go_fullscreen);


   if(!RESTORE_MAXED_WINDOW) ; // don't attempt to restore maximized window size
   else if(((unsigned) SCREEN_WIDTH >= display_width) || ((unsigned) SCREEN_HEIGHT >= display_height)) {  // request for large screen
      if(x11_maxed) {
         if(have_restore_size) {
            SCREEN_WIDTH = restore_width;   //1024;
            SCREEN_HEIGHT = restore_height; // 768
         }
         x11_maxed = 0;
printf("have restore size %d: %d %d   new:%d %d\n", have_restore_size, restore_width,restore_height, new_width,new_height);
      }
      else {
         x11_maxed = 1;
printf("maximize window\n");
      }
   }




   /*  Set initial window size and position, and create it  */

   x = x11_left;
   y = x11_top;
   width  = SCREEN_WIDTH;
   height = SCREEN_HEIGHT;
printf("creating %dx%d simple window at %d,%d\n", width,height, x,y);
   screen = XCreateSimpleWindow(display, RootWindow(display,screen_num),
                             x,y, width,height, 0,
                             WhitePixel(display, screen_num),
                             BlackPixel(display, screen_num));

   if(screen == 0) {
       error_exit(10010, "Could not create X11 simple window");
   }

printf("Get window attributes\n");
   XGetWindowAttributes(display,screen, &wattr);  // winz
   x11_left = wattr.x;
   x11_top = wattr.y;
   if(x11_left < 0) x11_left = 0;
   if(x11_top < 0) x11_top = 0;
printf("Window color depth: %d  left/top:%dx%d\n", wattr.depth, x11_left,x11_top);


   // setup screen palette
   memset(palette,0xff,sizeof(palette));
   setup_palette();

//for(xx=0; xx<16; xx++) printf("pal %2d: %08lX\n", xx,palette[xx]);
//printf("white:  %08lX\n", WhitePixel(display,screen_num));

printf("Palette setup\n");
   /*  Set hints for window manager before mapping window  */

   if(XStringListToTextProperty(&window_name, 1, &windowName) == 0 ) {
      sprintf(out, "%s: structure allocation for windowName failed.\n", appname);
      error_exit(10007, out);
   }
printf("Text properties set.\n");
   if(XStringListToTextProperty(&icon_name, 1, &iconName) == 0 ) {
      sprintf(out, "%s: structure allocation for iconName failed.\n", appname);
      error_exit(10008, out);
   }
printf("Icon name set\n");
   /*  Create graphics context  */
printf("creating gc\n");
fflush(stdout);
   gc = XCreateGC(display,screen, 0, &values); // winz
   if(gc == 0) {
      sprintf(out, "Could not create graphics context");
      error_exit(10018, out);
   }

   // Create the icon pixmap
   i = read_pixmap_file();
   if(i) {  // XPM pixmap not loaded, try a monochrome XBM bitmap
      if(luxor) i = XReadBitmapFile(display,screen, "luxor.xbm", &j,&j, &icon_map, &i,&i);
      else      i = XReadBitmapFile(display,screen, "heather.xbm", &j,&j, &icon_map, &i,&i);
   }
   else {  // XPM pixmap created
      i = BitmapSuccess;
   }

   if(i != BitmapSuccess) {
printf("No icon image found.\n");
      icon_map = 0;
   }

   size_hints->flags       = PPosition | PSize | PMinSize;
   size_hints->min_width   = MIN_WIDTH;
   size_hints->min_height  = MIN_HEIGHT;

   if(icon_map) wm_hints->flags = StateHint | InputHint | IconPixmapHint;
   else         wm_hints->flags = StateHint | InputHint;
   wm_hints->initial_state = NormalState;
   wm_hints->input         = True;
   wm_hints->icon_pixmap   = icon_map;

   class_hints->res_name   = appname;
   if(luxor) class_hints->res_class  = "luxor";
   else      class_hints->res_class  = "heather";
printf("setting properties\n");
   XSetWMProperties(display,screen, &windowName, &iconName, 0,0, // winz- argv, argc,
                    size_hints, wm_hints, class_hints);

   wmDeleteMessage = XInternAtom(display, "WM_DELETE_WINDOW",  0);
   XSetWMProtocols(display,screen, &wmDeleteMessage, 1);


   if(kill_deco) {  // disable window decorations to get a full screen display
      deco_hints.flags = 2;
      deco_hints.functions = 0;
      deco_hints.decorations = 0;
      deco_hints.input_mode = 0;
      deco_hints.status = 0;

      deco = XInternAtom(display, "_MOTIF_WM_HINTS", 1);

      if(deco) {
printf("Killing window decorations!\n");
         touch_screen = 1;  // make sure virtual keyboard is available.
                            // If the window size does not match the monitor size
                            // you can lose access to the real keyboard.
         XChangeProperty(display,screen, deco,deco, 32, PropModeReplace, (unsigned char *) &deco_hints, 5);
      }
   }


   /*  Choose which events we want to handle  */

   XSelectInput(display,screen, ExposureMask | KeyPressMask | PointerMotionMask |
                ButtonPressMask | ButtonReleaseMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask);   // winz


   cur = XCreateFontCursor(display, 132);
   if(cur) XDefineCursor(display,screen, cur);    // winz


   XSetForeground(display,gc, WhitePixel(display, screen_num));


   /*  Display Window  */

   XMapWindow(display,screen);  // winz
printf("window mapped    Pixmap wh:%dx%d\n", width,height);
   pix_map = XCreatePixmap(display,screen, width,height, wattr.depth); // winz
   if(pix_map == 0) {
      error_exit(30000, "Could not create pix_map");
   }
printf("pixmap created\n");
   Sleep(X11_sleep);
   XFlush(display);

printf("Display size2: %dx%d\n", SCREEN_WIDTH,SCREEN_HEIGHT);
   SWAP(SCREEN_WIDTH,SCREEN_HEIGHT);
//SCREEN_WIDTH = old_sw;   //piss
//SCREEN_HEIGHT = old_sh;
   config_screen(why);  // re-initialize screen rendering variables
                        // to reflect any changes due to font size
   XFlush(display);

   #ifdef BUFFER_LLA
//lla clear_lla_points(0);
   #endif

printf("screen configured. why=%d  %dx%d (potentially rotated)\n", why, SCREEN_WIDTH,SCREEN_HEIGHT);
   erase_rectangle(0,0, SCREEN_WIDTH,SCREEN_HEIGHT);
printf("screen init done\n\n");
fflush(stdout);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movl %edi, -0x4(%rbp)
movl -0x4(%rbp), %esi
movl 0x26a599(%rip), %edx    # 0x2779e0
movl 0x26a597(%rip), %ecx    # 0x2779e4
leaq 0x162612(%rip), %rdi    # 0x16fa66
movb $0x0, %al
callq 0x9030
movl $0x3, %edi
callq 0xeaf0
callq 0xdff0
movl 0x26a570(%rip), %eax    # 0x2779e0
movl %eax, -0x28(%rbp)
movl 0x26a56b(%rip), %eax    # 0x2779e4
movl %eax, -0x2c(%rbp)
cmpl $0x0, 0x26a585(%rip)    # 0x277a08
je 0xd4a9
movl 0x26a559(%rip), %eax    # 0x2779e4
movl %eax, 0x26a57b(%rip)    # 0x277a0c
movl 0x26a549(%rip), %eax    # 0x2779e0
movl %eax, 0x26a547(%rip)    # 0x2779e4
movl 0x26a569(%rip), %eax    # 0x277a0c
movl %eax, 0x26a537(%rip)    # 0x2779e0
movl 0x26a531(%rip), %esi    # 0x2779e0
movl 0x26a52f(%rip), %edx    # 0x2779e4
leaq 0x1625d8(%rip), %rdi    # 0x16fa94
movb $0x0, %al
callq 0x9030
movzbl 0x26a56e(%rip), %eax    # 0x277a38
cmpl $0x0, %eax
jne 0xd50c
cmpb $0x0, 0x26a53a(%rip)    # 0x277a10
je 0xd4f5
cmpl $0x0, 0x290c25(%rip)    # 0x29e104
jne 0xd4f5
leaq 0x1a76f8(%rip), %rax    # 0x1b4be0
movq %rax, -0x18(%rbp)
movb $0xe, 0x26a545(%rip)    # 0x277a38
jmp 0xd507
leaq 0x1a42d4(%rip), %rax    # 0x1b17d0
movq %rax, -0x18(%rbp)
movb $0xc, 0x26a531(%rip)    # 0x277a38
jmp 0xd5a6
movzbl 0x26a525(%rip), %eax    # 0x277a38
cmpl $0x8, %eax
jg 0xd52c
leaq 0x1a1ea1(%rip), %rax    # 0x1af3c0
movq %rax, -0x18(%rbp)
movb $0x8, 0x26a50e(%rip)    # 0x277a38
jmp 0xd5a4
movzbl 0x26a505(%rip), %eax    # 0x277a38
cmpl $0xc, %eax
jg 0xd54c
leaq 0x1a4291(%rip), %rax    # 0x1b17d0
movq %rax, -0x18(%rbp)
movb $0xc, 0x26a4ee(%rip)    # 0x277a38
jmp 0xd5a2
movzbl 0x26a4e5(%rip), %eax    # 0x277a38
cmpl $0xe, %eax
jg 0xd56c
leaq 0x1a7681(%rip), %rax    # 0x1b4be0
movq %rax, -0x18(%rbp)
movb $0xe, 0x26a4ce(%rip)    # 0x277a38
jmp 0xd5a0
movzbl 0x26a4c5(%rip), %eax    # 0x277a38
cmpl $0x10, %eax
jg 0xd58c
leaq 0x1ab271(%rip), %rax    # 0x1b87f0
movq %rax, -0x18(%rbp)
movb $0x10, 0x26a4ae(%rip)   # 0x277a38
jmp 0xd59e
leaq 0x1a423d(%rip), %rax    # 0x1b17d0
movq %rax, -0x18(%rbp)
movb $0xc, 0x26a49a(%rip)    # 0x277a38
jmp 0xd5a0
jmp 0xd5a2
jmp 0xd5a4
jmp 0xd5a6
movzbl 0x26a48b(%rip), %eax    # 0x277a38
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, 0x26a43b(%rip)    # 0x2779f4
movl $0x8, 0x26a42d(%rip)    # 0x2779f0
cmpl $0xc, -0x1c(%rbp)
jg 0xd5d2
movb $0x2, 0x26a469(%rip)    # 0x277a39
jmp 0xd5d9
movb $0x0, 0x26a460(%rip)    # 0x277a39
movq -0x18(%rbp), %rax
movq %rax, 0x391ae4(%rip)    # 0x39f0c8
cmpb $0x0, 0x290b33(%rip)    # 0x29e11e
je 0xd605
leaq 0x1624bd(%rip), %rax    # 0x16fab1
movq %rax, -0x60(%rbp)
leaq 0x18329a(%rip), %rax    # 0x190899
movq %rax, -0x68(%rbp)
jmp 0xd61b
leaq 0x1af5f4(%rip), %rax    # 0x1bcc00
movq %rax, -0x60(%rbp)
leaq 0x1624a4(%rip), %rax    # 0x16fabb
movq %rax, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
cmpb $0x0, 0x290af4(%rip)    # 0x29e11e
je 0xd63c
leaq 0x162490(%rip), %rax    # 0x16fac3
movq %rax, 0x1c2a96(%rip)    # 0x1d00d0
jmp 0xd64a
leaq 0x162486(%rip), %rax    # 0x16fac9
movq %rax, 0x1c2a86(%rip)    # 0x1d00d0
callq 0x9070
movq %rax, 0x391ae2(%rip)    # 0x39f138
cmpq $0x0, %rax
je 0xd680
callq 0x9290
movq %rax, 0x391ad8(%rip)    # 0x39f140
cmpq $0x0, %rax
je 0xd680
callq 0x9590
movq %rax, 0x391ace(%rip)    # 0x39f148
cmpq $0x0, %rax
jne 0xd6ad
movq 0x1c2a49(%rip), %rdx    # 0x1d00d0
leaq 0x38dd72(%rip), %rdi    # 0x39b400
leaq 0x16243c(%rip), %rsi    # 0x16fad1
movb $0x0, %al
callq 0x9060
movl $0x2715, %edi           # imm = 0x2715
leaq 0x38dd58(%rip), %rsi    # 0x39b400
callq 0xc050
movq -0x70(%rbp), %rdi
callq 0x94e0
movq %rax, 0x1c29e3(%rip)    # 0x1d00a0
cmpq $0x0, 0x1c29db(%rip)    # 0x1d00a0
jne 0xd6f8
movq 0x1c2a02(%rip), %rdx    # 0x1d00d0
movq -0x70(%rbp), %rcx
leaq 0x38dd27(%rip), %rdi    # 0x39b400
leaq 0x162410(%rip), %rsi    # 0x16faf0
movb $0x0, %al
callq 0x9060
movl $0x2716, %edi           # imm = 0x2716
leaq 0x38dd0d(%rip), %rsi    # 0x39b400
callq 0xc050
movq 0x1c29a1(%rip), %rax    # 0x1d00a0
movl 0xe0(%rax), %eax
movl %eax, 0x1c29bd(%rip)    # 0x1d00c8
movq 0x1c298e(%rip), %rax    # 0x1d00a0
movq 0xe8(%rax), %rax
movslq 0x1c29a8(%rip), %rcx    # 0x1d00c8
shlq $0x7, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
movl %eax, 0x26a2a8(%rip)    # 0x2779d8
movq 0x1c2969(%rip), %rax    # 0x1d00a0
movq 0xe8(%rax), %rax
movslq 0x1c2983(%rip), %rcx    # 0x1d00c8
shlq $0x7, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
movl %eax, 0x26a287(%rip)    # 0x2779dc
movl $0x1, 0x1c292d(%rip)    # 0x1d008c
movl 0x26a273(%rip), %esi    # 0x2779d8
movl 0x26a271(%rip), %edx    # 0x2779dc
movl 0x26a26f(%rip), %ecx    # 0x2779e0
movl 0x26a26c(%rip), %r8d    # 0x2779e4
movl 0x26a285(%rip), %r9d    # 0x277a04
movl 0x26a23b(%rip), %eax    # 0x2779c0
leaq 0x162389(%rip), %rdi    # 0x16fb15
movl %eax, (%rsp)
movb $0x0, %al
callq 0x9030
cmpl $0x0, 0x26a223(%rip)    # 0x2779c0
je 0xd7d9
cmpl $0x140, 0x26a22f(%rip)  # imm = 0x140
jb 0xd7d9
cmpl $0x140, 0x26a227(%rip)  # imm = 0x140
jb 0xd7d9
movl 0x26a21b(%rip), %eax    # 0x2779d8
movl %eax, 0x26a21d(%rip)    # 0x2779e0
movl 0x26a213(%rip), %eax    # 0x2779dc
movl %eax, 0x26a215(%rip)    # 0x2779e4
movl $0x0, 0x26a1e7(%rip)    # 0x2779c0
cmpl $0x0, 0x26a224(%rip)    # 0x277a04
je 0xd7ec
movl $0x1, 0x26a1d4(%rip)    # 0x2779c0
movl 0x26a1e6(%rip), %esi    # 0x2779d8
movl 0x26a1e4(%rip), %edx    # 0x2779dc
movl 0x26a1e2(%rip), %ecx    # 0x2779e0
movl 0x26a1df(%rip), %r8d    # 0x2779e4
movl 0x26a1f8(%rip), %r9d    # 0x277a04
movl 0x26a1ae(%rip), %eax    # 0x2779c0
leaq 0x16233f(%rip), %rdi    # 0x16fb58
movl %eax, (%rsp)
movb $0x0, %al
callq 0x9030
movl 0x26a1b7(%rip), %eax    # 0x2779e0
cmpl 0x26a1a9(%rip), %eax    # 0x2779d8
jae 0xd83f
movl 0x26a1ad(%rip), %eax    # 0x2779e4
cmpl 0x26a19f(%rip), %eax    # 0x2779dc
jb 0xd8bd
cmpl $0x0, 0x1c2856(%rip)    # 0x1d009c
je 0xd8a3
cmpl $0x0, 0x1c2841(%rip)    # 0x1d0090
je 0xd869
movl 0x1c283d(%rip), %eax    # 0x1d0094
movl %eax, 0x26a183(%rip)    # 0x2779e0
movl 0x1c2835(%rip), %eax    # 0x1d0098
movl %eax, 0x26a17b(%rip)    # 0x2779e4
movl $0x0, 0x1c2829(%rip)    # 0x1d009c
movl 0x1c2817(%rip), %esi    # 0x1d0090
movl 0x1c2815(%rip), %edx    # 0x1d0094
movl 0x1c2813(%rip), %ecx    # 0x1d0098
movl 0x26a1a4(%rip), %r8d    # 0x277a30
movl 0x26a1a1(%rip), %r9d    # 0x277a34
leaq 0x162302(%rip), %rdi    # 0x16fb9c
movb $0x0, %al
callq 0x9030
jmp 0xd8bb
movl $0x1, 0x1c27ef(%rip)    # 0x1d009c
leaq 0x162311(%rip), %rdi    # 0x16fbc5
movb $0x0, %al
callq 0x9030
jmp 0xd8bd
movl 0x1c2815(%rip), %eax    # 0x1d00d8
movl %eax, -0x4c(%rbp)
movl 0x1c2810(%rip), %eax    # 0x1d00dc
movl %eax, -0x50(%rbp)
movl 0x26a10b(%rip), %eax    # 0x2779e0
movl %eax, -0x54(%rbp)
movl 0x26a106(%rip), %eax    # 0x2779e4
movl %eax, -0x58(%rbp)
movl -0x54(%rbp), %esi
movl -0x58(%rbp), %edx
movl -0x4c(%rbp), %ecx
movl -0x50(%rbp), %r8d
leaq 0x1622e1(%rip), %rdi    # 0x16fbd6
movb $0x0, %al
callq 0x9030
movq 0x1c279d(%rip), %rdi    # 0x1d00a0
movq 0x1c2796(%rip), %rax    # 0x1d00a0
movq 0xe8(%rax), %rax
movslq 0x1c27b0(%rip), %rcx    # 0x1d00c8
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rsi
movl -0x4c(%rbp), %edx
movl -0x50(%rbp), %ecx
movl -0x54(%rbp), %r8d
movl -0x58(%rbp), %r9d
movq 0x1c2768(%rip), %rax    # 0x1d00a0
movq 0xe8(%rax), %rax
movslq 0x1c2782(%rip), %r10    # 0x1d00c8
shlq $0x7, %r10
addq %r10, %rax
movq 0x58(%rax), %r10
movq 0x1c2748(%rip), %rax    # 0x1d00a0
movq 0xe8(%rax), %rax
movslq 0x1c2762(%rip), %r11    # 0x1d00c8
shlq $0x7, %r11
addq %r11, %rax
movq 0x60(%rax), %rax
xorl %r11d, %r11d
movl $0x0, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x90c0
movq %rax, 0x1c2717(%rip)    # 0x1d00a8
cmpq $0x0, 0x1c270f(%rip)    # 0x1d00a8
jne 0xd9ac
movl $0x271a, %edi           # imm = 0x271A
leaq 0x162256(%rip), %rsi    # 0x16fbfd
callq 0xc050
leaq 0x16226d(%rip), %rdi    # 0x16fc20
movb $0x0, %al
callq 0x9030
movq 0x1c26df(%rip), %rdi    # 0x1d00a0
movq 0x1c26e0(%rip), %rsi    # 0x1d00a8
leaq 0x391781(%rip), %rdx    # 0x39f150
callq 0x96b0
movl 0x391776(%rip), %eax    # 0x39f150
movl %eax, 0x1c26f8(%rip)    # 0x1d00d8
movl 0x39176e(%rip), %eax    # 0x39f154
movl %eax, 0x1c26f0(%rip)    # 0x1d00dc
cmpl $0x0, 0x1c26e5(%rip)    # 0x1d00d8
jge 0xd9ff
movl $0x0, 0x1c26d9(%rip)    # 0x1d00d8
cmpl $0x0, 0x1c26d6(%rip)    # 0x1d00dc
jge 0xda12
movl $0x0, 0x1c26ca(%rip)    # 0x1d00dc
movl 0x39174c(%rip), %esi    # 0x39f164
movl 0x1c26ba(%rip), %edx    # 0x1d00d8
movl 0x1c26b8(%rip), %ecx    # 0x1d00dc
leaq 0x16220c(%rip), %rdi    # 0x16fc37
movb $0x0, %al
callq 0x9030
leaq 0x1c2727(%rip), %rdi    # 0x1d0160
movl $0xff, %esi
movl $0x40, %edx
callq 0x91a0
callq 0xf0c0
leaq 0x16220b(%rip), %rdi    # 0x16fc5f
movb $0x0, %al
callq 0x9030
leaq -0x60(%rbp), %rdi
movl $0x1, %esi
leaq -0x90(%rbp), %rdx
callq 0x9390
cmpl $0x0, %eax
jne 0xdaa2
movq 0x1c2654(%rip), %rdx    # 0x1d00d0
leaq 0x38d97d(%rip), %rdi    # 0x39b400
leaq 0x1621e4(%rip), %rsi    # 0x16fc6e
movb $0x0, %al
callq 0x9060
movl $0x2717, %edi           # imm = 0x2717
leaq 0x38d963(%rip), %rsi    # 0x39b400
callq 0xc050
leaq 0x1621f6(%rip), %rdi    # 0x16fc9f
movb $0x0, %al
callq 0x9030
leaq -0x68(%rbp), %rdi
movl $0x1, %esi
leaq -0xb0(%rbp), %rdx
callq 0x9390
cmpl $0x0, %eax
jne 0xdaf7
movq 0x1c25ff(%rip), %rdx    # 0x1d00d0
leaq 0x38d928(%rip), %rdi    # 0x39b400
leaq 0x1621d6(%rip), %rsi    # 0x16fcb5
movb $0x0, %al
callq 0x9060
movl $0x2718, %edi           # imm = 0x2718
leaq 0x38d90e(%rip), %rsi    # 0x39b400
callq 0xc050
leaq 0x1621e6(%rip), %rdi    # 0x16fce4
movb $0x0, %al
callq 0x9030
leaq 0x1621e7(%rip), %rdi    # 0x16fcf3
movb $0x0, %al
callq 0x9030
movq 0x1a14b6(%rip), %rax    # 0x1aefd0
movq (%rax), %rdi
callq 0x9430
movq 0x1c2577(%rip), %rdi    # 0x1d00a0
movq 0x1c2578(%rip), %rsi    # 0x1d00a8
xorl %eax, %eax
movl %eax, %edx
leaq -0x130(%rbp), %rcx
callq 0x9180
movq %rax, 0x1c2579(%rip)    # 0x1d00c0
cmpq $0x0, 0x1c2571(%rip)    # 0x1d00c0
jne 0xdb77
leaq 0x38d8a8(%rip), %rdi    # 0x39b400
leaq 0x1621a1(%rip), %rsi    # 0x16fd00
movb $0x0, %al
callq 0x9060
movl $0x2722, %edi           # imm = 0x2722
leaq 0x38d88e(%rip), %rsi    # 0x39b400
callq 0xc050
callq 0xe160
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0xdc02
cmpb $0x0, 0x290592(%rip)    # 0x29e11e
je 0xdbc8
movq 0x1c250b(%rip), %rdi    # 0x1d00a0
movq 0x1c250c(%rip), %rsi    # 0x1d00a8
leaq 0x16217f(%rip), %rdx    # 0x16fd22
leaq -0x24(%rbp), %r8
leaq 0x1c250a(%rip), %r9     # 0x1d00b8
leaq -0x20(%rbp), %rax
movq %r8, %rcx
movq %rax, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x9650
movl %eax, -0x20(%rbp)
jmp 0xdc00
movq 0x1c24d1(%rip), %rdi    # 0x1d00a0
movq 0x1c24d2(%rip), %rsi    # 0x1d00a8
leaq 0x16214f(%rip), %rdx    # 0x16fd2c
leaq -0x24(%rbp), %r8
leaq 0x1c24d0(%rip), %r9     # 0x1d00b8
leaq -0x20(%rbp), %rax
movq %r8, %rcx
movq %rax, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x9650
movl %eax, -0x20(%rbp)
jmp 0xdc09
movl $0x0, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
je 0xdc28
leaq 0x162122(%rip), %rdi    # 0x16fd38
movb $0x0, %al
callq 0x9030
movq $0x0, 0x1c2490(%rip) # 0x1d00b8
movq 0x391509(%rip), %rax    # 0x39f138
movq $0x1c, (%rax)
movq 0x3914fb(%rip), %rax    # 0x39f138
movl $0x140, 0x18(%rax)      # imm = 0x140
movq 0x3914ed(%rip), %rax    # 0x39f138
movl $0x140, 0x1c(%rax)      # imm = 0x140
cmpq $0x0, 0x1c245e(%rip)    # 0x1d00b8
je 0xdc6c
movq 0x3914dd(%rip), %rax    # 0x39f140
movq $0x7, (%rax)
jmp 0xdc7a
movq 0x3914cd(%rip), %rax    # 0x39f140
movq $0x3, (%rax)
movq 0x3914bf(%rip), %rax    # 0x39f140
movl $0x1, 0xc(%rax)
movq 0x3914b1(%rip), %rax    # 0x39f140
movl $0x1, 0x8(%rax)
movq 0x1c241b(%rip), %rcx    # 0x1d00b8
movq 0x39149c(%rip), %rax    # 0x39f140
movq %rcx, 0x10(%rax)
movq 0x1c2421(%rip), %rcx    # 0x1d00d0
movq 0x391492(%rip), %rax    # 0x39f148
movq %rcx, (%rax)
cmpb $0x0, 0x29045e(%rip)    # 0x29e11e
je 0xdcd6
movq 0x39147f(%rip), %rax    # 0x39f148
leaq 0x16207e(%rip), %rcx    # 0x16fd4e
movq %rcx, 0x8(%rax)
jmp 0xdce8
movq 0x39146b(%rip), %rax    # 0x39f148
leaq 0x161b63(%rip), %rcx    # 0x16f847
movq %rcx, 0x8(%rax)
leaq 0x162065(%rip), %rdi    # 0x16fd54
movb $0x0, %al
callq 0x9030
movq 0x1c23a3(%rip), %rdi    # 0x1d00a0
movq 0x1c23a4(%rip), %rsi    # 0x1d00a8
movq 0x39142d(%rip), %r11    # 0x39f138
movq 0x39142e(%rip), %r10    # 0x39f140
movq 0x39142f(%rip), %rax    # 0x39f148
leaq -0x90(%rbp), %rdx
leaq -0xb0(%rbp), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
callq 0x94f0
movq 0x1c2359(%rip), %rdi    # 0x1d00a0
leaq 0x16201a(%rip), %rsi    # 0x16fd68
xorl %edx, %edx
callq 0x9260
movq %rax, 0x39147c(%rip)    # 0x39f1d8
movq 0x1c233d(%rip), %rdi    # 0x1d00a0
movq 0x1c233e(%rip), %rsi    # 0x1d00a8
leaq 0x391467(%rip), %rdx    # 0x39f1d8
movl $0x1, %ecx
callq 0x91c0
cmpl $0x0, 0x269c82(%rip)    # 0x277a04
je 0xde19
movl $0x2, -0x40(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x30(%rbp)
movq 0x1c22ee(%rip), %rdi    # 0x1d00a0
leaq 0x161fc0(%rip), %rsi    # 0x16fd79
movl $0x1, %edx
callq 0x9260
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0xde17
leaq 0x161fb4(%rip), %rdi    # 0x16fd89
movb $0x0, %al
callq 0x9030
movb $0x1, 0x26c61b(%rip)    # 0x27a3fe
movq 0x1c22b6(%rip), %rdi    # 0x1d00a0
movq 0x1c22b7(%rip), %rsi    # 0x1d00a8
movq -0x48(%rbp), %rdx
movq -0x48(%rbp), %rcx
movl $0x20, %r8d
xorl %r9d, %r9d
leaq -0x40(%rbp), %rax
movq %rax, (%rsp)
movl $0x5, 0x8(%rsp)
callq 0x9300
jmp 0xde19
movq 0x1c2280(%rip), %rdi    # 0x1d00a0
movq 0x1c2281(%rip), %rsi    # 0x1d00a8
movl $0x2807d, %edx          # imm = 0x2807D
callq 0x9210
movq 0x1c2268(%rip), %rdi    # 0x1d00a0
movl $0x84, %esi
callq 0x91d0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xde64
movq 0x1c224c(%rip), %rdi    # 0x1d00a0
movq 0x1c224d(%rip), %rsi    # 0x1d00a8
movq -0x10(%rbp), %rdx
callq 0x9670
movq 0x1c2235(%rip), %rdi    # 0x1d00a0
movq 0x1c224e(%rip), %rsi    # 0x1d00c0
movq 0x1c2227(%rip), %rax    # 0x1d00a0
movq 0xe8(%rax), %rax
movslq 0x1c2241(%rip), %rcx    # 0x1d00c8
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rdx
callq 0x90d0
movq 0x1c2202(%rip), %rdi    # 0x1d00a0
movq 0x1c2203(%rip), %rsi    # 0x1d00a8
callq 0x9400
movl -0x54(%rbp), %esi
movl -0x58(%rbp), %edx
leaq 0x161eef(%rip), %rdi    # 0x16fda6
movb $0x0, %al
callq 0x9030
movq 0x1c21db(%rip), %rdi    # 0x1d00a0
movq 0x1c21dc(%rip), %rsi    # 0x1d00a8
movl -0x54(%rbp), %edx
movl -0x58(%rbp), %ecx
movl 0x39128b(%rip), %r8d    # 0x39f164
callq 0x90b0
movq %rax, 0x1c21cb(%rip)    # 0x1d00b0
cmpq $0x0, 0x1c21c3(%rip)    # 0x1d00b0
jne 0xdf00
movl $0x7530, %edi           # imm = 0x7530
leaq 0x161ecd(%rip), %rsi    # 0x16fdc8
callq 0xc050
leaq 0x161b4f(%rip), %rdi    # 0x16fa56
movb $0x0, %al
callq 0x9030
movl $0x64, %edi
callq 0xb8b0
movq 0x1c2181(%rip), %rdi    # 0x1d00a0
callq 0x95b0
movl 0x269ab6(%rip), %esi    # 0x2779e0
movl 0x269ab4(%rip), %edx    # 0x2779e4
leaq 0x161eaa(%rip), %rdi    # 0x16fde1
movb $0x0, %al
callq 0x9030
cmpl $0x0, 0x269ac3(%rip)    # 0x277a08
je 0xdf6b
movl 0x269a97(%rip), %eax    # 0x2779e4
movl %eax, 0x269ab9(%rip)    # 0x277a0c
movl 0x269a87(%rip), %eax    # 0x2779e0
movl %eax, 0x269a85(%rip)    # 0x2779e4
movl 0x269aa7(%rip), %eax    # 0x277a0c
movl %eax, 0x269a75(%rip)    # 0x2779e0
movl -0x4(%rbp), %edi
callq 0xeaf0
movq 0x1c2126(%rip), %rdi    # 0x1d00a0
callq 0x95b0
movl -0x4(%rbp), %esi
movl 0x269a58(%rip), %edx    # 0x2779e0
movl 0x269a56(%rip), %ecx    # 0x2779e4
leaq 0x161e62(%rip), %rdi    # 0x16fdf7
movb $0x0, %al
callq 0x9030
movl 0x269a3e(%rip), %edx    # 0x2779e0
movl 0x269a3c(%rip), %ecx    # 0x2779e4
xorl %esi, %esi
movl %esi, %edi
callq 0xf250
leaq 0x161e77(%rip), %rdi    # 0x16fe2f
movb $0x0, %al
callq 0x9030
movq 0x1a100a(%rip), %rax    # 0x1aefd0
movq (%rax), %rdi
callq 0x9430
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw (%rax,%rax)