// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movl %edi, %ebx
movl 0x20c947(%rip), %edx    # 0x218800
movl 0x20c945(%rip), %ecx    # 0x218804
leaq 0xfdcc1(%rip), %rdi     # 0x109b87
movl %ebx, %esi
xorl %eax, %eax
callq 0x9030
movl $0x3, %edi
callq 0xcf81
callq 0xc862
cmpl $0x0, 0x20c943(%rip)    # 0x218828
je 0xbf05
movl 0x20c917(%rip), %eax    # 0x218804
movl %eax, 0x20c939(%rip)    # 0x21882c
movl 0x20c907(%rip), %ecx    # 0x218800
movl %ecx, 0x20c905(%rip)    # 0x218804
movl %eax, 0x20c8fb(%rip)    # 0x218800
movl 0x20c8f5(%rip), %esi    # 0x218800
movl 0x20c8f3(%rip), %edx    # 0x218804
leaq 0xfdc9d(%rip), %rdi     # 0x109bb5
xorl %eax, %eax
callq 0x9030
movb 0x20c933(%rip), %al     # 0x218858
testb %al, %al
je 0xbf38
cmpb $0x9, %al
jae 0xbf6a
leaq 0x14449c(%rip), %rax    # 0x1503d0
movb $0x8, %cl
jmp 0xbfa5
cmpb $0x0, 0x20c8f1(%rip)    # 0x218830
setne %al
cmpl $0x0, 0x232fdb(%rip)    # 0x23ef24
sete %dl
andb %al, %dl
leal (%rdx,%rdx), %ecx
orb $0xc, %cl
leaq 0x149c95(%rip), %rsi    # 0x155bf0
leaq 0x14687e(%rip), %rax    # 0x1527e0
testb %dl, %dl
cmovneq %rsi, %rax
jmp 0xbfa5
cmpb $0xd, %al
jae 0xbf79
leaq 0x14686b(%rip), %rax    # 0x1527e0
movb $0xc, %cl
jmp 0xbfa5
cmpb $0xf, %al
jae 0xbf88
leaq 0x149c6c(%rip), %rax    # 0x155bf0
movb $0xe, %cl
jmp 0xbfa5
cmpb $0x11, %al
setb %cl
leaq 0x14d86c(%rip), %rdx    # 0x159800
leaq 0x146845(%rip), %rax    # 0x1527e0
cmovbq %rdx, %rax
shlb $0x2, %cl
addb $0xc, %cl
movb %cl, 0x20c8ad(%rip)     # 0x218858
movzbl %cl, %ecx
movl %ecx, 0x20c860(%rip)    # 0x218814
cmpb $0xd, %cl
setb %cl
addb %cl, %cl
cmpb $0x0, 0x232f7b(%rip)    # 0x23ef3e
leaq 0x151c46(%rip), %rdx    # 0x15dc10
leaq 0xfdc01(%rip), %rsi     # 0x109bd2
cmoveq %rdx, %rsi
leaq 0xfdc00(%rip), %rdx     # 0x109bdc
leaq 0x121cca(%rip), %rdi    # 0x12dcad
cmoveq %rdx, %rdi
movb %cl, 0x20c86c(%rip)     # 0x218859
movl $0x8, 0x20c819(%rip)    # 0x218810
movq %rax, 0x333eea(%rip)    # 0x33fee8
movq %rsi, -0x40(%rbp)
movq %rdi, -0x38(%rbp)
leaq 0xfdbdd(%rip), %rax     # 0x109bea
leaq 0xfdbd0(%rip), %rcx     # 0x109be4
cmoveq %rax, %rcx
movq %rcx, 0x164ed1(%rip)    # 0x170ef0
callq 0x9070
movq %rax, 0x333f2d(%rip)    # 0x33ff58
testq %rax, %rax
je 0xc052
callq 0x9280
movq %rax, 0x333f24(%rip)    # 0x33ff60
testq %rax, %rax
je 0xc052
callq 0x95a0
movq %rax, 0x333f1b(%rip)    # 0x33ff68
testq %rax, %rax
jne 0xc07e
movq 0x164e97(%rip), %rdx    # 0x170ef0
leaq 0x3301c0(%rip), %r14    # 0x33c220
leaq 0xfdb8b(%rip), %rsi     # 0x109bf2
movq %r14, %rdi
xorl %eax, %eax
callq 0x9060
movl $0x2715, %edi           # imm = 0x2715
movq %r14, %rsi
callq 0xb425
xorl %edi, %edi
callq 0x94e0
movq %rax, 0x164e34(%rip)    # 0x170ec0
testq %rax, %rax
jne 0xc0bf
movq 0x164e58(%rip), %rdx    # 0x170ef0
leaq 0x330181(%rip), %r14    # 0x33c220
leaq 0xfdb6b(%rip), %rsi     # 0x109c11
movq %r14, %rdi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x9060
movl $0x2716, %edi           # imm = 0x2716
movq %r14, %rsi
callq 0xb425
movq 0x164dfa(%rip), %rax    # 0x170ec0
movslq 0xe0(%rax), %rcx
movl %ecx, 0x164e15(%rip)    # 0x170ee8
movq 0xe8(%rax), %rax
shlq $0x7, %rcx
movl 0x18(%rax,%rcx), %esi
movl %esi, 0x20c710(%rip)    # 0x2187f8
movl 0x1c(%rax,%rcx), %edx
movl %edx, 0x20c70a(%rip)    # 0x2187fc
movl $0x1, 0x164db0(%rip)    # 0x170eac
movl 0x20c6fe(%rip), %ecx    # 0x218800
movl 0x20c6fb(%rip), %r8d    # 0x218804
movl 0x20c714(%rip), %r9d    # 0x218824
movl 0x20c6c9(%rip), %r10d   # 0x2187e0
subq $0x8, %rsp
leaq 0xfdb14(%rip), %rdi     # 0x109c36
xorl %eax, %eax
pushq %r10
callq 0x9030
addq $0x10, %rsp
cmpl $0x0, 0x20c6aa(%rip)    # 0x2187e0
setne %al
movl 0x20c6b9(%rip), %esi    # 0x2187f8
movl $0x140, %ecx            # imm = 0x140
cmpl %ecx, %esi
setae %dil
movl 0x20c6ac(%rip), %edx    # 0x2187fc
cmpl %ecx, %edx
setae %cl
andb %dil, %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0xc175
movl %esi, 0x20c69b(%rip)    # 0x218800
movl %edx, 0x20c699(%rip)    # 0x218804
movl $0x0, 0x20c66b(%rip)    # 0x2187e0
movl 0x20c6a8(%rip), %r9d    # 0x218824
testl %r9d, %r9d
je 0xc18b
movl $0x1, 0x20c655(%rip)    # 0x2187e0
movl 0x20c66f(%rip), %ecx    # 0x218800
movl 0x20c66c(%rip), %r8d    # 0x218804
movl 0x20c641(%rip), %r10d   # 0x2187e0
subq $0x8, %rsp
leaq 0xfdacf(%rip), %rdi     # 0x109c79
xorl %eax, %eax
pushq %r10
callq 0x9030
addq $0x10, %rsp
movl 0x20c643(%rip), %eax    # 0x218800
cmpl 0x20c635(%rip), %eax    # 0x2187f8
jae 0xc1d3
movl 0x20c639(%rip), %eax    # 0x218804
cmpl 0x20c62b(%rip), %eax    # 0x2187fc
jb 0xc248
cmpl $0x0, 0x164ce2(%rip)    # 0x170ebc
je 0xc232
movl 0x164cce(%rip), %esi    # 0x170eb0
testl %esi, %esi
je 0xc1fe
movl 0x164cc8(%rip), %eax    # 0x170eb4
movl %eax, 0x20c60e(%rip)    # 0x218800
movl 0x164cc0(%rip), %eax    # 0x170eb8
movl %eax, 0x20c606(%rip)    # 0x218804
movl $0x0, 0x164cb4(%rip)    # 0x170ebc
movl 0x164ca6(%rip), %edx    # 0x170eb4
movl 0x164ca4(%rip), %ecx    # 0x170eb8
movl 0x20c635(%rip), %r8d    # 0x218850
movl 0x20c632(%rip), %r9d    # 0x218854
leaq 0xfda94(%rip), %rdi     # 0x109cbd
xorl %eax, %eax
callq 0x9030
jmp 0xc248
movl $0x1, 0x164c80(%rip)    # 0x170ebc
leaq 0xff492(%rip), %rdi     # 0x10b6d5
callq 0x95d0
movl 0x164ca9(%rip), %r12d   # 0x170ef8
movl 0x164ca6(%rip), %r13d   # 0x170efc
movl 0x20c5a3(%rip), %r14d   # 0x218800
movl 0x20c5a0(%rip), %r15d   # 0x218804
leaq 0xfda7b(%rip), %rdi     # 0x109ce6
movl %r14d, %esi
movl %r15d, %edx
movl %r12d, %ecx
movl %r13d, %r8d
xorl %eax, %eax
callq 0x9030
movq 0x164c3b(%rip), %rdi    # 0x170ec0
movq 0xe8(%rdi), %rax
movslq 0x164c55(%rip), %rcx    # 0x170ee8
shlq $0x7, %rcx
movq 0x10(%rax,%rcx), %rsi
movdqu 0x58(%rax,%rcx), %xmm0
subq $0x20, %rsp
movdqu %xmm0, 0x8(%rsp)
movl $0x0, (%rsp)
movl %r12d, %edx
movl %r13d, %ecx
movl %r14d, %r8d
movl %r15d, %r9d
callq 0x90c0
addq $0x20, %rsp
movq %rax, 0x164bf9(%rip)    # 0x170ec8
testq %rax, %rax
jne 0xc2e5
leaq 0xfda32(%rip), %rsi     # 0x109d0d
movl $0x271a, %edi           # imm = 0x271A
callq 0xb425
leaq 0xff3f9(%rip), %rdi     # 0x10b6e5
callq 0x95d0
movq 0x164bc8(%rip), %rdi    # 0x170ec0
movq 0x164bc9(%rip), %rsi    # 0x170ec8
leaq 0x333c6a(%rip), %rdx    # 0x33ff70
callq 0x96d0
movl 0x333c5f(%rip), %ecx    # 0x33ff70
movl %ecx, 0x164be1(%rip)    # 0x170ef8
movl 0x333c57(%rip), %eax    # 0x33ff74
movl %eax, 0x164bd9(%rip)    # 0x170efc
testl %ecx, %ecx
jns 0xc331
movl $0x0, 0x164bc7(%rip)    # 0x170ef8
testl %eax, %eax
jns 0xc33f
movl $0x0, 0x164bbd(%rip)    # 0x170efc
movl 0x333c3f(%rip), %esi    # 0x33ff84
movl 0x164bad(%rip), %edx    # 0x170ef8
movl 0x164bab(%rip), %ecx    # 0x170efc
leaq 0xfd9d8(%rip), %rdi     # 0x109d30
xorl %eax, %eax
callq 0x9030
pcmpeqd %xmm0, %xmm0
movdqa %xmm0, 0x164c15(%rip)   # 0x170f80
movdqa %xmm0, 0x164c1d(%rip)   # 0x170f90
movdqa %xmm0, 0x164c25(%rip)   # 0x170fa0
movdqa %xmm0, 0x164c2d(%rip)   # 0x170fb0
callq 0xd3da
leaq 0xff36c(%rip), %rdi     # 0x10b6fb
callq 0x95d0
leaq -0x40(%rbp), %rdi
leaq -0x98(%rbp), %rdx
movl $0x1, %esi
callq 0x9380
testl %eax, %eax
jne 0xc3d9
movq 0x164b3c(%rip), %rdx    # 0x170ef0
leaq 0x32fe65(%rip), %r12    # 0x33c220
leaq 0xfd996(%rip), %rsi     # 0x109d58
movq %r12, %rdi
xorl %eax, %eax
callq 0x9060
movl $0x2717, %edi           # imm = 0x2717
movq %r12, %rsi
callq 0xb425
leaq 0xff329(%rip), %rdi     # 0x10b709
callq 0x95d0
leaq -0x38(%rbp), %rdi
leaq -0x78(%rbp), %rdx
movl $0x1, %esi
callq 0x9380
testl %eax, %eax
jne 0xc427
movq 0x164aee(%rip), %rdx    # 0x170ef0
leaq 0x32fe17(%rip), %r12    # 0x33c220
leaq 0xfd979(%rip), %rsi     # 0x109d89
movq %r12, %rdi
xorl %eax, %eax
callq 0x9060
movl $0x2718, %edi           # imm = 0x2718
movq %r12, %rsi
callq 0xb425
leaq 0xff2f0(%rip), %rdi     # 0x10b71e
callq 0x95d0
leaq 0xff2f2(%rip), %rdi     # 0x10b72c
callq 0x95d0
movq 0x143a2a(%rip), %r13    # 0x14fe70
movq (%r13), %rdi
callq 0x9420
movq 0x164a6a(%rip), %rdi    # 0x170ec0
movq 0x164a6b(%rip), %rsi    # 0x170ec8
leaq -0x118(%rbp), %rcx
xorl %edx, %edx
callq 0x9180
movq %rax, 0x164a6e(%rip)    # 0x170ee0
testq %rax, %rax
jne 0xc4af
movups 0xfd94a(%rip), %xmm0    # 0x109dc8
movaps %xmm0, 0x32fdab(%rip)   # 0x33c230
movdqu 0xfd92b(%rip), %xmm0    # 0x109db8
movdqa %xmm0, 0x32fd8b(%rip)   # 0x33c220
movw $0x74, 0x32fda2(%rip)   # 0x33c240
leaq 0x32fd7b(%rip), %rsi    # 0x33c220
movl $0x2722, %edi           # imm = 0x2722
callq 0xb425
callq 0xc99d
movl %eax, -0x2c(%rbp)
testl %eax, %eax
je 0xc4df
cmpb $0x0, 0x232a7c(%rip)    # 0x23ef3e
movq 0x1649f7(%rip), %rdi    # 0x170ec0
movq 0x1649f8(%rip), %rsi    # 0x170ec8
leaq -0x2c(%rbp), %r12
je 0xc4e8
leaq 0xfd8fd(%rip), %rdx     # 0x109dda
jmp 0xc4ef
movl $0x0, -0x2c(%rbp)
jmp 0xc50e
leaq 0xfd8f5(%rip), %rdx     # 0x109de4
leaq 0x1649e2(%rip), %r9     # 0x170ed8
leaq -0x30(%rbp), %rcx
movq %rcx, %r8
pushq %r12
pushq %r12
callq 0x9670
addq $0x10, %rsp
movl %eax, (%r12)
cmpl $0x0, -0x2c(%rbp)
je 0xc52b
leaq 0xff21d(%rip), %rdi     # 0x10b738
callq 0x95d0
movq $0x0, 0x1649ad(%rip) # 0x170ed8
movq 0x333a26(%rip), %rax    # 0x33ff58
movq $0x1c, (%rax)
movabsq $0x14000000140, %rcx    # imm = 0x14000000140
movq %rcx, 0x18(%rax)
xorl %eax, %eax
cmpq $0x0, 0x164987(%rip)    # 0x170ed8
setne %al
movq 0x333a05(%rip), %rcx    # 0x33ff60
leaq 0x3(,%rax,4), %rax
movq %rax, (%rcx)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x8(%rcx)
movq 0x16495d(%rip), %rax    # 0x170ed8
movq %rax, 0x10(%rcx)
movq 0x16496a(%rip), %rax    # 0x170ef0
movq 0x3339db(%rip), %rcx    # 0x33ff68
movq %rax, (%rcx)
cmpb $0x0, 0x2329a7(%rip)    # 0x23ef3e
leaq 0xfd4ac(%rip), %rax     # 0x109a4a
leaq 0xfd84b(%rip), %rcx     # 0x109df0
cmoveq %rax, %rcx
movq 0x3339b8(%rip), %rax    # 0x33ff68
movq %rcx, 0x8(%rax)
leaq 0xff192(%rip), %rdi     # 0x10b74d
callq 0x95d0
movq 0x1648f9(%rip), %rdi    # 0x170ec0
movq 0x1648fa(%rip), %rsi    # 0x170ec8
subq $0x8, %rsp
leaq -0x98(%rbp), %rdx
leaq -0x78(%rbp), %rcx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq 0x33397f(%rip)          # 0x33ff68
pushq 0x333971(%rip)          # 0x33ff60
pushq 0x333963(%rip)          # 0x33ff58
callq 0x94f0
addq $0x20, %rsp
movq 0x1648bb(%rip), %rdi    # 0x170ec0
leaq 0xfd7ea(%rip), %rsi     # 0x109df6
xorl %edx, %edx
callq 0x9250
movq %rax, 0x3339de(%rip)    # 0x33fff8
leaq 0x3339d7(%rip), %rdx    # 0x33fff8
movq 0x164898(%rip), %rdi    # 0x170ec0
movq 0x164899(%rip), %rsi    # 0x170ec8
movl $0x1, %ecx
callq 0x91c0
cmpl $0x0, 0x20c1e4(%rip)    # 0x218824
je 0xc6b2
movl $0x2, -0x54(%rbp)
pxor %xmm0, %xmm0
movdqu %xmm0, -0x50(%rbp)
movq 0x164867(%rip), %rdi    # 0x170ec0
leaq 0xfd7a7(%rip), %rsi     # 0x109e07
movl $0x1, %edx
callq 0x9250
testq %rax, %rax
je 0xc6b2
movq %rax, %r12
leaq 0xff0e7(%rip), %rdi     # 0x10b760
callq 0x95d0
movb $0x1, 0x20eb99(%rip)    # 0x21b21e
movq 0x164834(%rip), %rdi    # 0x170ec0
movq 0x164835(%rip), %rsi    # 0x170ec8
leaq -0x54(%rbp), %rax
movq %r12, %rdx
movq %r12, %rcx
movl $0x20, %r8d
xorl %r9d, %r9d
pushq $0x5
pushq %rax
callq 0x92f0
addq $0x10, %rsp
movq 0x164807(%rip), %rdi    # 0x170ec0
movq 0x164808(%rip), %rsi    # 0x170ec8
movl $0x2807d, %edx          # imm = 0x2807D
callq 0x9210
movq 0x1647ef(%rip), %rdi    # 0x170ec0
movl $0x84, %esi
callq 0x91d0
testq %rax, %rax
je 0xc6f6
movq 0x1647d9(%rip), %rdi    # 0x170ec0
movq 0x1647da(%rip), %rsi    # 0x170ec8
movq %rax, %rdx
callq 0x9690
movq 0x1647c3(%rip), %rdi    # 0x170ec0
movq 0x1647dc(%rip), %rsi    # 0x170ee0
movq 0xe8(%rdi), %rax
movslq 0x1647d6(%rip), %rcx    # 0x170ee8
shlq $0x7, %rcx
movq 0x58(%rax,%rcx), %rdx
callq 0x90d0
movq 0x164799(%rip), %rdi    # 0x170ec0
movq 0x16479a(%rip), %rsi    # 0x170ec8
callq 0x93f0
leaq 0xfd6dd(%rip), %rdi     # 0x109e17
movl %r14d, %esi
movl %r15d, %edx
xorl %eax, %eax
callq 0x9030
movq 0x164772(%rip), %rdi    # 0x170ec0
movq 0x164773(%rip), %rsi    # 0x170ec8
movl 0x333828(%rip), %r8d    # 0x33ff84
movl %r14d, %edx
movl %r15d, %ecx
callq 0x90b0
movq %rax, 0x164762(%rip)    # 0x170ed0
testq %rax, %rax
jne 0xc784
leaq 0xfd6bf(%rip), %rsi     # 0x109e39
movl $0x7530, %edi           # imm = 0x7530
callq 0xb425
leaq 0xff008(%rip), %rdi     # 0x10b793
callq 0x95d0
movl $0x186a0, %edi          # imm = 0x186A0
callq 0x9540
movq 0x16471f(%rip), %rdi    # 0x170ec0
callq 0x95c0
movl 0x20c054(%rip), %esi    # 0x218800
movl 0x20c052(%rip), %edx    # 0x218804
leaq 0xfd699(%rip), %rdi     # 0x109e52
xorl %eax, %eax
callq 0x9030
cmpl $0x0, 0x20c061(%rip)    # 0x218828
je 0xc7e7
movl 0x20c035(%rip), %eax    # 0x218804
movl %eax, 0x20c057(%rip)    # 0x21882c
movl 0x20c025(%rip), %ecx    # 0x218800
movl %ecx, 0x20c023(%rip)    # 0x218804
movl %eax, 0x20c019(%rip)    # 0x218800
movl %ebx, %edi
callq 0xcf81
movq 0x1646cb(%rip), %rdi    # 0x170ec0
callq 0x95c0
movl 0x20c000(%rip), %edx    # 0x218800
movl 0x20bffe(%rip), %ecx    # 0x218804
leaq 0xfd65b(%rip), %rdi     # 0x109e68
movl %ebx, %esi
xorl %eax, %eax
callq 0x9030
movl 0x20bfe4(%rip), %edx    # 0x218800
movl 0x20bfe2(%rip), %ecx    # 0x218804
xorl %edi, %edi
xorl %esi, %esi
xorl %r8d, %r8d
callq 0xf30c
leaq 0xfef47(%rip), %rdi     # 0x10b77c
callq 0x95d0
movq (%r13), %rdi
callq 0x9420
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq