// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathui.cpp
// Function: do_kbd(int)
int do_kbd(int c)
{
int fix_flag;
int old_lwa;
int old_rpn;

   // This routine processes a keystroke character.
   //
   // If variable "first_key" is set, this key stroke is the second keystroke
   // of the two character command that started with character "first_key".


   if(sound_alarm) {    // any keystroke turns off alarm clock
      if(sound_alarm & ALARM_DATE) {  // date specifed, so reset alarm
         alarm_time = alarm_date = 0;
         alarm_jd = 0.0;
         egg_timer = egg_val = 0;
         repeat_egg = 0;
      }

      reset_alarm();   // reset the alarm
      sound_alarm = 0;
      return 0;
   }

   if(disable_kbd > 1) return 0;  // nothing gets by

   fix_flag = 0;
   if(plot_lla || lla_showing) fix_flag = 1;

   if((zoom_screen == 'K') || last_null_key) {  // ZOOM_KBD touchscreen keyboard active
      // oh, the crap we have to do in order to make the zoomed calculator
      // touch screen keyboard work...

      if(((c == 0x0D) || (c == ESC_CHAR)) && last_zoom_calc) {  // exit touch keyboard to zoomed calc mode
         last_zoom_calc = 0;
         change_zoom_config(-666);
         cancel_zoom(666);
         config_screen(128);
         erase_screen();
         no_redraw = 0;

         if((c == 0x0D) && (edit_buffer[0] == ' ') && (edit_buffer[1] == 0)) {
            add_kbd(0x0D);
            start_calc_zoom(12);
            last_null_key = 0;
            return 0;
         }
         else if((c == 0x0D) && (edit_buffer[0] == ' ')) {
            add_kbd(0x0D);
            add_kbd(0x0D);
            start_calc_zoom(13);
            last_null_key = 0;
            return 0;
         }
         else if(1 && (c == ESC_CHAR) && (edit_buffer[0] == ' ') && (edit_buffer[1] == 0)) {
            add_kbd(0x0D);
            zoom_screen = '`';
            show_rpn_help = 0;
         }
         else if(0 && (c == ESC_CHAR) && edit_buffer[0]) {
            add_kbd(0x0D);
            zoom_screen = '`';
            show_rpn_help = 0;
         }
         add_kbd(0x0D);
         add_kbd(0x0D);
         start_calc_zoom(14);
         last_null_key = 0;
         return 0;
      }
      else if(last_null_key) {  // keyboard exit via touching a null key
         if(edit_buffer[0] == ' ') {
            add_kbd(0x0D);
            edit_buffer[0] = 0;
            edit_buffer[1] = 0;
            zoom_screen = '`';
            show_rpn_help = 0;
         }
         start_calc_zoom(15);
         last_null_key = 0;
         return 0;
      }
      else if((c == 0x0D) && edit_err_flag) {
         edit_err_flag = 0;
      }
      last_null_key = 0;
   }
   else if(zoom_screen == '`') {  //  touchscreen keyboard active for zoomed calculator
   }
   else if((zoom_screen || (un_zoom == ZOOM_ADEVS)) && (first_key == 0)) {  // any keystroke restores zoomed screen
      if((zoom_screen == 'P') && scroll_char(c)) ;
      else if(((zoom_screen == 'H') || (zoom_screen == 'O')) && (c == ' ')) {
         pause_monitor ^= 1;
         set_term_header(monitor_port);
         show_term_screen(monitor_port);
         return 0;
      }
      else if((zoom_screen == 'Q') && isdigit(c)) {  // set adjustment value
         cal_adjust = (cal_adjust*10) + (c-'0');
         if(cal_adjust >= 10000) cal_adjust = 0;
         return 0;
      }
      else if((zoom_screen == 'Q') && (c == '+')) {  // go forward a month
         if(cal_adjust) {
            cal_year += cal_adjust / 12;
            cal_month += (cal_adjust % 12);
         }
         else ++cal_month;
         if(cal_month > 12) {
            cal_month = 1;
            ++cal_year;
         }
         cal_adjust = 0;
         return 0;
      }
      else if((zoom_screen == 'Q') && (c == '-')) {  // go back a month
         if(cal_adjust) {
            cal_year -= cal_adjust / 12;
            cal_month -= (cal_adjust % 12);
         }
         else --cal_month;
         if(cal_month < 1) {
            cal_month = 12;
            --cal_year;
         }
         cal_adjust = 0;
         return 0;
      }
      else if((zoom_screen == 'Q') && (c == '>')) {  // go forward a year
         if(cal_adjust) cal_year += cal_adjust;
         else ++cal_year;
         cal_adjust = 0;
         return 0;
      }
      else if((zoom_screen == 'Q') && (c == '<')) {  // go back a year
         if(cal_adjust) cal_year -= cal_adjust;
         else --cal_year;
         cal_adjust = 0;
         return 0;
      }
      else if(c != '\\') {     // unless it is one of these keys
         if(zoom_screen == 'L') {
            fix_flag = zoom_fixes;
         }

         if(zoom_screen) {
            change_zoom_config(-108);
            cancel_zoom(18);     //zkzk
         }
         if(un_zoom == ZOOM_ADEVS) {
            if(rcvr_type == TICC_RCVR) all_adevs = ALL_CHANS;
            else                       all_adevs = SINGLE_ADEVS;
            plot_adev_data = old_plot_adevs;
            if(plot_adev_data == 0) adev_decades_shown = 0;
            un_zoom = UN_ZOOM;
         }

         show_fixes = 0;
         if(rcvr_type != NO_RCVR) show_fixes = zoom_fixes;  // zzzzzz
         if(fix_flag) {
            show_fixes = plot_lla = 1;
         }
         change_fix_config(show_fixes);
         plot_lla = 0;
         if(fix_flag) {
            plot_lla = 1;
         }

         no_redraw = 1;
         if((c == ' ') || (c == 0x0D) || (c == ESC_CHAR)) {
            no_redraw = 0;
         }
         config_screen(128);
         erase_screen();
         no_redraw = 0;

         if((c == ' ') || (c == 0x0D) || (c == ESC_CHAR)) { // don't bring up help screen
            return 0;
         }
      }
   }

   if(disable_kbd) {         // most of the keyboard is disabled
      last_was_mark = 0;
      if((first_key == 0) && (c != ESC_CHAR)) {
         BEEP(317);
         return 0;
      }
      else if((first_key == ESC_CHAR) && (c == '!')) {
         disable_kbd = 0;
         return sure_exit();
      }

      if((c >= 0x0100) || (c == '[') || (c == ']')) {  // cursor movement keys, etc
         c = 0;
         do_review(c, 2);       // stop review
         return sure_exit(); // prevents spurious scroll mode header
      }
   }

   if(rpn_mode < 0) {  // keep calculator mode active
      show_version_header();
      old_rpn = rpn_mode;
      rpn_mode = 0;
      if((c == 0x0D) || (c == ESC_CHAR) || (c == '`')) {
         if(zoom_screen) remove_zoom();
         show_version_header();
         return 0;
      }

      edit_buffer[0] = c;
      edit_buffer[1] = 0;
      start_calc(13);
   }

   if(c == 0) {
   }
   else if(getting_string) { // we are currently building a parameter value string
      last_was_mark = 0;
      return build_string(c);  // add the keystroke to the line
   }
   else if(getting_plot) {  // we are in the plot control sub-menu
      if(change_plot_param(c, 0)) return 0;
   }
   else if((c >= F1_CHAR) && (c <= F10_CHAR)) {  // F1..F10 - open script file
      if(first_key) return help_exit(c, 99); // xxxxxx
      sprintf(out, "f%d.scr", c-F1_CHAR+1);
      open_script(out);
   }
   else if((c >= 0x0100) || (c == '<') || (c == '>') || (c == '[') || (c == ']') || (c == '@')) {
      // cursor movement keys, etc
      // @ command - zoom to marked queue entry (invoked from mouse click or keyboard)
      last_was_mark = 0;
      if((first_key == 0) && (text_mode == 0)) {
         if(c == '@') {
            goto_mark(0);  // center plot on marked place
            hide_kbd(23);
         }
         else do_review(c, 3);  // scrolling around in the plot data
      }
      else if(first_key) {
         return help_exit(c, 99); // xxxxxx
      }
      else {
         if(c >= 0x0100) cmd_error(0);  //!!!!
         else            cmd_error(c);
      }
      if(c < 0x0100) last_plot_key = c;
      hide_kbd(8);  // no_unzoom
   }
   else if(c == ESC_CHAR) {  // ESC key exits program or aborts key sequence
      last_was_mark = 0;
      if(osc_params && (first_key != '&')) {  // ESC exits osc param display
         osc_params = 0;
         need_redraw = 8989;
      }
      else if(review_mode && (pause_data == 0)) {
         if(text_mode == 2) {  // displaying full screen help
            text_mode = 0;
            no_x_margin = no_y_margin = 0;
            need_redraw = 6677;
         }
         else {
            c = 0;
            old_lwa = last_was_adev;
            do_review(c, 4);  // stop review
            last_was_adev = old_lwa;
         }
      }
      else if(first_key == ESC_CHAR) {
         if(esc_esc_exit && (disable_kbd == 0)) {  // allow ESC ESC to end the program
            kbd_exit();
            return 1;
         }
      }
      else {
         if(are_you_sure(c) != c) return 0;
      }
   }
   else if((first_key == 0) && (c >= '0') && (c <= '9')) {  // plot markers
      kbd_marker(c);
      hide_kbd(20);
   }
   else {  // normal keystroke command
      if(c < 0x0100) c = tolower(c);
      if((c != '-') && (c != '+')) last_was_mark = 0;
      last_plot_key = 0;

      // break up the keyboard processing big 'if' statement
      // into two parts so the compiler heap does not overflow
      last_was_adev = 0;
      lwa = 13;
      if((c >= 'a') && (c <= 'o')) c = kbd_a_to_o(c);
      else                         c = kbd_other(c);
      return c;
   }

   return sure_exit();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x2c7557(%rip), %r14    # 0x30df48
movb (%r14), %al
testb %al, %al
je 0x46a46
testb $0x1, %al
je 0x46a38
leaq 0x2c7529(%rip), %rax    # 0x30df2c
xorl %ecx, %ecx
movl %ecx, (%rax)
leaq 0x2c750e(%rip), %rax    # 0x30df1c
movl %ecx, (%rax)
leaq 0x2c7529(%rip), %rax    # 0x30df40
movq %rcx, (%rax)
leaq 0x2c74ef(%rip), %rax    # 0x30df10
movq %rcx, (%rax)
leaq 0x2c74dd(%rip), %rax    # 0x30df08
movq %rcx, (%rax)
leaq 0x2c74e3(%rip), %rax    # 0x30df18
movb $0x0, (%rax)
callq 0xe3081
movb $0x0, (%r14)
jmp 0x47280
movl %edi, %ebx
leaq 0x1d47cd(%rip), %rdi    # 0x21b21c
movb (%rdi), %r14b
cmpb $0x1, %r14b
ja 0x47280
leaq 0x2f484d(%rip), %r8     # 0x33b2b0
cmpb $0x0, (%r8)
setne %r9b
leaq 0x2f484e(%rip), %rax    # 0x33b2c0
cmpl $0x0, (%rax)
setne %r13b
leaq 0x2c5d28(%rip), %rsi    # 0x30c7a8
movzbl (%rsi), %r15d
cmpl $0x4b, %r15d
sete %cl
leaq 0x1d4792(%rip), %r12    # 0x21b224
movl (%r12), %eax
testl %eax, %eax
setne %dl
orb %cl, %dl
cmpb $0x1, %dl
jne 0x46b67
cmpl $0xd, %ebx
setne %cl
cmpl $0x1b, %ebx
setne %dl
testb %dl, %cl
jne 0x46c26
leaq 0x2c5cf3(%rip), %rcx    # 0x30c7b4
cmpl $0x0, (%rcx)
je 0x46c26
cmpl $0xd, %ebx
sete %r13b
xorl %r14d, %r14d
movl %r14d, (%rcx)
movl $0xfffffd66, %edi       # imm = 0xFFFFFD66
movq %rsi, %r15
callq 0x27479
movb $0x0, (%r15)
leaq 0x2f4d3d(%rip), %r15    # 0x33b82c
movl %r14d, (%r15)
movl $0x69, %edi
callq 0xd8ba5
movl $0x80, %edi
callq 0xcf89
callq 0xeceb
leaq 0x1d1d36(%rip), %rax    # 0x218848
movl %r14d, (%rax)
leaq 0x2f87c4(%rip), %rcx    # 0x33f2e0
movb (%rcx), %al
movb 0x1(%rcx), %cl
cmpb $0x20, %al
sete %dl
andb %r13b, %dl
testb %cl, %cl
sete %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x46c5f
movl $0xd, %edi
callq 0xd4c8
movl $0x7a, %edi
callq 0xd4c8
movl $0x60, %edi
callq 0xd4c8
movl $0x0, (%r12)
jmp 0x47283
cmpl $0x60, %r15d
je 0x46cec
testl %r15d, %r15d
setne %al
leaq 0x2c5c32(%rip), %r12    # 0x30c7b0
movl (%r12), %r10d
cmpl $0x4, %r10d
sete %cl
orb %al, %cl
cmpb $0x1, %cl
jne 0x46cec
leaq 0x1f83bd(%rip), %rax    # 0x23ef58
cmpl $0x0, (%rax)
jne 0x46cec
cmpl $0x50, %r15d
jne 0x46be3
movl %ebx, %edi
movb %r9b, -0x29(%rbp)
movl %r10d, %r12d
callq 0x46998
movl %r12d, %r10d
movb -0x29(%rbp), %r9b
leaq 0x2c5bea(%rip), %r12    # 0x30c7b0
leaq 0x2f46e3(%rip), %r8     # 0x33b2b0
leaq 0x2c5bd4(%rip), %rsi    # 0x30c7a8
leaq 0x1d4641(%rip), %rdi    # 0x21b21c
testl %eax, %eax
jne 0x46cec
cmpl $0x48, %r15d
sete %al
cmpl $0x4f, %r15d
sete %cl
cmpl $0x20, %ebx
jne 0x46dde
orb %cl, %al
je 0x46dde
leaq 0x1f7833(%rip), %rax    # 0x23e43c
xorb $0x1, (%rax)
leaq 0x2c76bd(%rip), %rbx    # 0x30e2d0
movl (%rbx), %edi
callq 0x1efde
movl (%rbx), %edi
callq 0x1ecf5
jmp 0x47280
testl %eax, %eax
je 0x46ccc
leaq 0x2f86ab(%rip), %rbx    # 0x33f2e0
cmpb $0x20, (%rbx)
jne 0x46cab
movl $0xd, %edi
movq %rsi, %r14
callq 0xd4c8
movw $0x0, (%rbx)
movb $0x60, (%r14)
leaq 0x2f4bd5(%rip), %rax    # 0x33b82c
movl $0x0, (%rax)
jmp 0x46cab
testb %dl, %dl
jne 0x46c97
testb %cl, %cl
sete %cl
cmpb $0x20, %al
sete %al
cmpl $0x1b, %ebx
sete %dl
andb %al, %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x46c97
movl $0xd, %edi
callq 0xd4c8
leaq 0x2c5b1b(%rip), %rax    # 0x30c7a8
movb $0x60, (%rax)
movl $0x0, (%r15)
movl $0xd, %edi
callq 0xd4c8
movl $0xd, %edi
callq 0xd4c8
movl $0x7a, %edi
callq 0xd4c8
movl $0x60, %edi
callq 0xd4c8
movl $0x0, (%r12)
jmp 0x47280
cmpl $0xd, %ebx
jne 0x46ce4
cmpl $0x0, 0x2fbb60(%rip)    # 0x342838
je 0x46ce4
movl $0x0, 0x2fbb54(%rip)    # 0x342838
movl $0x0, (%r12)
testb %r14b, %r14b
je 0x46d64
leaq 0x1d4608(%rip), %rax    # 0x21b300
movl $0x0, (%rax)
leaq 0x1f8253(%rip), %rax    # 0x23ef58
movl (%rax), %eax
testl %eax, %eax
setne %cl
cmpl $0x1b, %ebx
sete %dl
orb %cl, %dl
jne 0x46d25
movl $0x13d, %edi            # imm = 0x13D
callq 0x9d78
jmp 0x47280
xorl $0x1b, %eax
movl %ebx, %ecx
xorl $0x21, %ecx
orl %eax, %ecx
jne 0x46d39
movb $0x0, (%rdi)
jmp 0x4727b
cmpl $0xff, %ebx
jg 0x46d4b
cmpl $0x5d, %ebx
je 0x46d4b
cmpl $0x5b, %ebx
jne 0x46d64
xorl %r14d, %r14d
xorl %edi, %edi
movl $0x2, %esi
callq 0x1c7ce
callq 0x27570
jmp 0x47283
leaq 0x2f4abd(%rip), %r14    # 0x33b828
cmpl $0x0, (%r14)
js 0x46da3
testl %ebx, %ebx
je 0x4727b
leaq 0x2f8888(%rip), %rax    # 0x33f608
cmpw $0x0, (%rax)
je 0x46e15
leaq 0x1d456f(%rip), %rax    # 0x21b300
movl $0x0, (%rax)
movl %ebx, %edi
callq 0x2c1dc
jmp 0x47280
movq %rsi, %r12
movq %rdi, %r15
callq 0x72683
movl $0x0, (%r14)
cmpl $0xd, %ebx
je 0x46dc8
cmpl $0x60, %ebx
je 0x46dc8
cmpl $0x1b, %ebx
jne 0x46e89
cmpb $0x0, (%r12)
je 0x46dd4
callq 0x238a8
callq 0x72683
jmp 0x47280
cmpl $0x51, %r15d
setne %cl
leal -0x30(%rbx), %eax
cmpl $0xa, %eax
setae %dl
orb %cl, %dl
jne 0x46e3b
movl 0x2fbb70(%rip), %ecx    # 0x342968
leal (%rcx,%rcx,4), %ecx
leal (%rax,%rcx,2), %eax
xorl %r14d, %r14d
cmpl $0x2710, %eax           # imm = 0x2710
cmovgel %r14d, %eax
movl %eax, 0x2fbb58(%rip)    # 0x342968
jmp 0x47283
cmpl $0x0, 0x2fbb20(%rip)    # 0x34293c
je 0x46ea3
xorl %r14d, %r14d
movl %ebx, %edi
xorl %esi, %esi
callq 0x3a097
testl %eax, %eax
jne 0x47283
jmp 0x4727b
movl %r15d, %eax
xorl $0x51, %eax
movl %ebx, %ecx
xorl $0x2b, %ecx
orl %eax, %ecx
jne 0x46eef
movl 0x2fbb14(%rip), %eax    # 0x342968
testl %eax, %eax
je 0x46fe1
leaq 0x2c66c9(%rip), %rcx    # 0x30d52c
movslq %eax, %rdx
imulq $0x2aaaaaab, %rdx, %rdx # imm = 0x2AAAAAAB
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x21, %rdx
addl %esi, %edx
addl %edx, (%rcx)
shll $0x2, %edx
leal (%rdx,%rdx,2), %ecx
subl %ecx, %eax
jmp 0x46fe6
leaq 0x2f8450(%rip), %rax    # 0x33f2e0
movb %bl, (%rax)
movb $0x0, 0x1(%rax)
callq 0x20ebb
movq %r15, %rdi
jmp 0x46d71
leal -0x13b(%rbx), %eax
cmpl $0x9, %eax
ja 0x46f54
leaq 0x1f809f(%rip), %rax    # 0x23ef58
cmpl $0x0, (%rax)
jne 0x47013
addl $0xfffffec6, %ebx       # imm = 0xFFFFFEC6
leaq 0x2f5351(%rip), %r14    # 0x33c220
leaq 0xd6e6b(%rip), %rsi     # 0x11dd41
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x9060
movq %r14, %rdi
callq 0x1cf62
jmp 0x4727b
movl %ebx, %ecx
xorl $0x2d, %ecx
orl %eax, %ecx
jne 0x46fbe
movl 0x2fba66(%rip), %eax    # 0x342968
testl %eax, %eax
je 0x4705d
movslq %eax, %rcx
imulq $-0x2aaaaaab, %rcx, %rdx # imm = 0xD5555555
movq %rdx, %rsi
shrq $0x3f, %rsi
sarq $0x21, %rdx
addl %esi, %edx
leaq 0x2c6604(%rip), %rsi    # 0x30d52c
addl %edx, (%rsi)
imulq $0x2aaaaaab, %rcx, %rcx # imm = 0x2AAAAAAB
movq %rcx, %rdx
shrq $0x3f, %rdx
shrq $0x21, %rcx
addl %edx, %ecx
shll $0x2, %ecx
leal (%rcx,%rcx,2), %ecx
leaq 0x2c65dd(%rip), %rdx    # 0x30d528
subl %eax, %ecx
addl (%rdx), %ecx
jmp 0x47068
cmpl $0xff, %ebx
jg 0x46f7c
leal -0x3c(%rbx), %eax
cmpl $0x21, %eax
ja 0x47213
movabsq $0x280000015, %rcx      # imm = 0x280000015
btq %rax, %rcx
jae 0x47213
leaq 0x1d437d(%rip), %rax    # 0x21b300
movl $0x0, (%rax)
leaq 0x1f7fc8(%rip), %rax    # 0x23ef58
movl (%rax), %eax
leaq 0x1d183f(%rip), %rcx    # 0x2187d8
movl (%rcx), %ecx
orl %eax, %ecx
jne 0x4700b
cmpl $0x40, %ebx
jne 0x47093
xorl %edi, %edi
callq 0x1b3c6
movl $0x17, %edi
callq 0xfd00
jmp 0x47268
movl %ebx, %ecx
xorl $0x3e, %ecx
orl %eax, %ecx
jne 0x4701f
movl 0x2fb99b(%rip), %eax    # 0x342968
cmpl $0x1, %eax
adcl $0x0, %eax
leaq 0x2c6552(%rip), %rcx    # 0x30d52c
addl %eax, (%rcx)
jmp 0x47084
movl $0x1, %eax
leaq 0x2c653b(%rip), %rcx    # 0x30d528
addl (%rcx), %eax
movl %eax, (%rcx)
cmpl $0xd, %eax
jl 0x47084
movl $0x1, (%rcx)
leaq 0x2c6525(%rip), %rax    # 0x30d52c
incl (%rax)
jmp 0x47084
testl %eax, %eax
je 0x47202
movl %ebx, %edi
callq 0x396ee
jmp 0x47280
movl %ebx, %ecx
xorl $0x3c, %ecx
orl %eax, %ecx
jne 0x470b0
movl 0x2fb936(%rip), %eax    # 0x342968
leaq 0x2c64f3(%rip), %rcx    # 0x30d52c
movl %eax, %edx
negl %edx
xorl %r14d, %r14d
cmpl $0x1, %eax
movl $0x0, %eax
sbbl %eax, %eax
orl %edx, %eax
addl %eax, (%rcx)
movl $0x0, 0x2fb910(%rip)    # 0x342968
jmp 0x47283
leaq 0x2c64c4(%rip), %rax    # 0x30d528
movl (%rax), %ecx
decl %ecx
leaq 0x2c64b9(%rip), %rax    # 0x30d528
movl %ecx, (%rax)
testl %ecx, %ecx
jg 0x47084
movl $0xc, (%rax)
leaq 0x2c64aa(%rip), %rax    # 0x30d52c
decl (%rax)
movl $0x0, 0x2fb8da(%rip)    # 0x342968
jmp 0x47280
movl %ebx, %edi
movl $0x3, %esi
callq 0x1c7ce
cmpl $0xff, %ebx
jbe 0x47268
jmp 0x47271
cmpl $0x5c, %ebx
je 0x46cec
orb %r13b, %r9b
movl %r9d, %r13d
movq %r8, %r14
testl %r15d, %r15d
je 0x4710a
cmpl $0x4c, %r15d
jne 0x470db
leaq 0x2c56d8(%rip), %rax    # 0x30c7ac
cmpl $0x0, (%rax)
setne %r13b
movl $0xffffff94, %edi       # imm = 0xFFFFFF94
callq 0x27479
leaq 0x2c56bc(%rip), %rax    # 0x30c7a8
movb $0x0, (%rax)
leaq 0x2f4736(%rip), %rax    # 0x33b82c
movl $0x0, (%rax)
movl $0x69, %edi
callq 0xd8ba5
movl (%r12), %r10d
leaq 0x1d17bf(%rip), %rax    # 0x2188d0
movq (%rax), %rax
cmpl $0x4, %r10d
movl %r13d, %esi
jne 0x4715f
xorl %ecx, %ecx
cmpq $0x10000, %rax          # imm = 0x10000
sete %cl
leal (%rcx,%rcx,4), %ecx
leaq 0x1f5c0c(%rip), %rdx    # 0x23cd3e
movb %cl, (%rdx)
leaq 0x1d429f(%rip), %rcx    # 0x21b3da
movb (%rcx), %cl
leaq 0x1d4295(%rip), %rdx    # 0x21b3d9
movb %cl, (%rdx)
testb %cl, %cl
jne 0x47157
leaq 0x1d1673(%rip), %rcx    # 0x2187c4
movl $0x0, (%rcx)
movl $0x0, (%r12)
leaq 0x2f416e(%rip), %rcx    # 0x33b2d4
movb $0x0, (%rcx)
xorl %edi, %edi
cmpq $0x400, %rax            # imm = 0x400
je 0x47182
leaq 0x2c5632(%rip), %rax    # 0x30c7ac
movl (%rax), %eax
movzbl %al, %edi
movb %dil, (%rcx)
testb %sil, %sil
je 0x47193
movb $0x1, %al
movb %al, (%r14)
movb %al, (%rcx)
movl $0x1, %edi
callq 0x3ab43
movb %r13b, (%r14)
movl $0x1, %eax
movl %ebx, %r15d
movabsq $0x108002000, %r12      # imm = 0x108002000
cmpl $0x20, %ebx
ja 0x471ba
btq %r15, %r12
jae 0x471ba
xorl %eax, %eax
leaq 0x1d1687(%rip), %r14    # 0x218848
movl %eax, (%r14)
movl $0x80, %edi
callq 0xcf89
callq 0xeceb
movl $0x0, (%r14)
cmpl $0x20, %ebx
leaq 0x1d4038(%rip), %rdi    # 0x21b21c
ja 0x471f3
xorl %r14d, %r14d
btq %r15, %r12
jb 0x47283
movb (%rdi), %r14b
leaq 0x2c55ab(%rip), %rsi    # 0x30c7a8
jmp 0x46cec
cmpl $0x100, %ebx            # imm = 0x100
jl 0x47261
xorl %edi, %edi
callq 0x27777
jmp 0x47271
cmpl $0x1b, %ebx
jne 0x47295
leaq 0x1d40e1(%rip), %rax    # 0x21b300
leaq 0x2c5ec6(%rip), %rcx    # 0x30d0ec
cmpb $0x0, (%rcx)
movl $0x0, (%rax)
setne %dl
leaq 0x1f7d1f(%rip), %rax    # 0x23ef58
movl (%rax), %eax
cmpl $0x26, %eax
setne %sil
andb %dl, %sil
cmpb $0x1, %sil
jne 0x47302
movb $0x0, (%rcx)
leaq 0x1d15eb(%rip), %rax    # 0x218844
movl $0x231d, (%rax)         # imm = 0x231D
jmp 0x4727b
movl %ebx, %edi
callq 0x27777
leaq 0x1d3fb1(%rip), %rax    # 0x21b220
movl %ebx, (%rax)
movl $0x8, %edi
callq 0xfd00
callq 0x27570
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leal -0x30(%rbx), %eax
cmpl $0x9, %eax
ja 0x472b7
leaq 0x1f7cb4(%rip), %rax    # 0x23ef58
cmpl $0x0, (%rax)
jne 0x472b7
movl %ebx, %edi
callq 0x3aa44
movl $0x14, %edi
jmp 0x47276
movl %ebx, %edi
callq 0x9580
cmpl $0x2d, %eax
je 0x472cc
cmpl $0x2b, %eax
jne 0x47384
leaq 0x1d3f4d(%rip), %rcx    # 0x21b220
xorl %edx, %edx
movl %edx, (%rcx)
leaq 0x1d4026(%rip), %rcx    # 0x21b304
movl %edx, (%rcx)
leaq 0x1d4021(%rip), %rcx    # 0x21b308
movl $0xd, (%rcx)
movl %eax, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x41589
leaq 0x1f5a37(%rip), %rcx    # 0x23cd40
cmpb $0x0, (%rcx)
je 0x47356
leaq 0x1d3f1f(%rip), %rcx    # 0x21b234
cmpb $0x0, (%rcx)
jne 0x47356
leaq 0x1d14b7(%rip), %rax    # 0x2187d8
cmpl $0x2, (%rax)
jne 0x473e9
movl $0x0, (%rax)
leaq 0x1d1524(%rip), %rax    # 0x21885b
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x1d1518(%rip), %rax    # 0x21885a
movb %cl, (%rax)
leaq 0x1d14f9(%rip), %rax    # 0x218844
movl $0x1a15, (%rax)         # imm = 0x1A15
jmp 0x4727b
cmpl $0x1b, %eax
jne 0x473d1
leaq 0x1d3ecf(%rip), %rax    # 0x21b231
cmpb $0x0, (%rax)
je 0x4727b
cmpb $0x0, (%rdi)
jne 0x4727b
callq 0x396ac
movl $0x1, %r14d
jmp 0x47283
leaq 0x1d3f75(%rip), %rcx    # 0x21b300
xorl %edx, %edx
movl %edx, (%rcx)
leaq 0x1d3e8a(%rip), %rcx    # 0x21b220
movl %edx, (%rcx)
leaq 0x1d3f65(%rip), %rcx    # 0x21b304
movl %edx, (%rcx)
leaq 0x1d3f60(%rip), %rcx    # 0x21b308
movl $0xd, (%rcx)
movl %eax, %ecx
addl $-0x61, %ecx
cmpl $0xe, %ecx
ja 0x472ed
movl %eax, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3b6cb
movl $0x1b, %edi
callq 0x27777
cmpl $0x1b, %eax
je 0x4727b
jmp 0x47280
leaq 0x1d3f14(%rip), %rbx    # 0x21b304
movl (%rbx), %r14d
xorl %edi, %edi
movl $0x4, %esi
callq 0x1c7ce
movl %r14d, (%rbx)
jmp 0x4727b