// File: jkingan[P]ladyheather/heathui.cpp
// Function: edit_string(int)
u08 edit_string(int c)
{
int row, col;
int attr;

   // perform an edit operation on the text string that we are building

   edit_ptr = strlen(edit_buffer);

   if(c == INS_CHAR) { // toggle insert mode
      insert_mode ^=1;
      first_edit = 0;
   }
   else if(c == LEFT_CHAR) {   // move cursor left
      if(edit_cursor) --edit_cursor;
      else BEEP(303);
      first_edit = 0;
   }
   else if(c == RIGHT_CHAR) {  // move cursor right
      if(++edit_cursor >= edit_ptr) {  // if past end of string, append blanks
         c = ' ';
         goto add_char;
      }
      first_edit = 0;
   }
   else if(c == END_CHAR) {  // move end-of-line
      edit_cursor = edit_ptr;
      first_edit = 0;
   }
   else if(c == HOME_CHAR) {  // move to start of line
      edit_cursor = 0;
      first_edit = 0;
   }
   else if(c == DOWN_CHAR) {  // delete to end-of-line
      edit_buffer[edit_cursor] = 0;
      first_edit = 0;
   }
   else if(c == UP_CHAR) {  // delete to start-of-line
      strcpy(out, &edit_buffer[edit_cursor+1]);
      strcpy(edit_buffer, out);
      edit_cursor = edit_ptr = 0;  // strlen(edit_buffer);
      first_edit = 0;
   }
   else if(c == PAGE_UP) {  // edit last line
      strcpy(edit_buffer, last_edit_buf);
      edit_cursor = edit_ptr = strlen(edit_buffer);
      first_edit = 1;
   }
   else if(c == DEL_CHAR) {  // delete char at cursor
      delete_char:
      if(edit_buffer[edit_cursor]) {
         strcpy(out, edit_buffer);
         strcpy(&edit_buffer[edit_cursor], &out[edit_cursor+1]);
         edit_ptr = strlen(edit_buffer);
      }
      else if(edit_cursor) {
         --edit_cursor;
         goto delete_char;
      }
      else BEEP(304);
      first_edit = 0;
   }
   else if(c == 0x08) { // back up and delete a char
      if(edit_cursor) {
         --edit_cursor;
         goto delete_char;
      }
      else BEEP(305);
   }
   else if(c >= 0x0100) {  // ignore unused cursor and function keys
   }
   else if(c == ESC_CHAR) {  // erase edit buffer
      if(edit_ptr) {  // if something is in the buffer,  erase the buffer
         edit_ptr = edit_cursor = c = 0;
         edit_buffer[edit_ptr] = 0;
      }
      else {  // ESC with nothing in the buffer,  abandon the edit
         first_edit = 0;
         no_auto_erase = 0;

         if(zoom_screen == '`') {  // cancel zoomed calculator
            rpn_mode = 0;
            remove_zoom();
         }
         else if(rpn_mode) {
            rpn_mode = (-1);
         }

         if(luxor && (prot_menu || show_prots)) {
            prot_menu = 0;
            redraw_screen();
         }
         return ESC_CHAR;
      }
   }
   else if(c == 0x0D) {  // end of edit
      script_pause = 0;
      first_edit = 0;
      strcpy(last_edit_buf, edit_buffer);
   }
   else if(c) {  // normal text char - insert it into the buffer
      if(first_edit && (no_auto_erase == 0)) {  // first char typed erases old buffer contents
         edit_ptr = 0;
         edit_buffer[edit_ptr++] = c;
         edit_buffer[edit_ptr] = 0;
         edit_cursor = edit_ptr;
      }
      else if(insert_mode) {
         if(edit_ptr >= (SLEN-1)) {  // gone too far
            edit_ptr = (SLEN-1);
            edit_buffer[edit_ptr] = 0;
            BEEP(306);
         }
         else if(edit_ptr >= (TEXT_COLS-3)) {  // gone too far
            edit_ptr = (TEXT_COLS-3);
            edit_buffer[edit_ptr] = 0;
            BEEP(307);
         }
         else {
            strcpy(out, &edit_buffer[edit_cursor]);
            edit_buffer[edit_cursor] = c;
            strcpy(&edit_buffer[edit_cursor+1], out);
            ++edit_cursor;
            edit_ptr = strlen(edit_buffer);
         }
      }
      else {  // overwrite mode
         add_char:
         if(edit_cursor >= edit_ptr) {  // append char to end of string
            if(edit_ptr >= (SLEN-1)) {  // gone too far
               edit_ptr = (SLEN-1);
               edit_buffer[edit_ptr] = 0;
               edit_cursor = edit_ptr;
               BEEP(308);
            }
            else if(edit_ptr >= (TEXT_COLS-3)) {  // gone too far
               edit_ptr = (TEXT_COLS-3);
               edit_buffer[edit_ptr] = 0;
               edit_cursor = edit_ptr;
               BEEP(309);
            }
            else {
               edit_buffer[edit_ptr] = c;
               edit_buffer[++edit_ptr] = 0;
               edit_cursor = edit_ptr;
               edit_ptr = strlen(edit_buffer);
            }
         }
         else {  // replace char in the string at the cursor
            edit_buffer[edit_cursor++] = c;
         }
      }

      c = 0;
      first_edit = 0;
   }

   if(first_edit == 0) no_auto_erase = 0;

   attr = WHITE;

   col = TEXT_COLS-SLEN-2;
   if(col < 0) col = 0;
   vidstr(e_row, EDIT_COL, WHITE, &blanks[col]);

   // kludgy,  but no-brainer way to erase old edit cursor
   col = (EDIT_COL+1+edit_cursor) * TEXT_WIDTH;
   row = e_row * TEXT_HEIGHT;
   if(zoom_screen == '`') {
      row += TEXT_HEIGHT;
      col += TEXT_WIDTH*2;
   }
   if(row < PLOT_TEXT_ROW) {  // undo Windows margin offsets
      if(no_x_margin == 0) col += TEXT_X_MARGIN; //*vc_font_scale / 100;
      if(no_y_margin == 0) row += TEXT_Y_MARGIN; //*vc_font_scale / 100;
   }
   line(0,row+TEXT_HEIGHT, SCREEN_WIDTH-1,row+TEXT_HEIGHT, BLACK);
   line(0,row+TEXT_HEIGHT+2, SCREEN_WIDTH-1,row+TEXT_HEIGHT+2, BLACK);

   sprintf(out, ">%s", edit_buffer);
   if((c == 0x0D) && (zoom_screen == '`')) {  // show empty edit line
      vidstr(e_row, EDIT_COL, WHITE, ">");
   }
   else vidstr(e_row, EDIT_COL, WHITE, out);  // show current edit line

   if(c != 0x0D) {  // draw the edit cursor under the char
      line(col,row+TEXT_HEIGHT, col+TEXT_WIDTH-1,row+TEXT_HEIGHT, PROMPT_COLOR);
      if(insert_mode) line(col,row+TEXT_HEIGHT+2, col+TEXT_WIDTH-1,row+TEXT_HEIGHT+2, PROMPT_COLOR);
   }

   if(fast_script && script_file && (script_pause == 0)) ;  // this makes script go faster,  but you can't see what is happening
   else refresh_page();

   return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
leaq 0x361bce(%rip), %rdi    # 0x39e4c0
callq 0x9120
movb %al, %cl
leaq 0x361eea(%rip), %rax    # 0x39e7ea
movb %cl, (%rax)
cmpl $0x152, -0x8(%rbp)      # imm = 0x152
jne 0x3c927
movzbl 0x365103(%rip), %eax    # 0x3a1a15
xorl $0x1, %eax
movb %al, 0x3650fa(%rip)     # 0x3a1a15
movb $0x0, 0x3650f2(%rip)    # 0x3a1a14
jmp 0x3cfcb
cmpl $0x14b, -0x8(%rbp)      # imm = 0x14B
jne 0x3c95f
cmpb $0x0, 0x3650df(%rip)    # 0x3a1a16
je 0x3c949
movb 0x3650d7(%rip), %al     # 0x3a1a16
addb $-0x1, %al
movb %al, 0x3650cf(%rip)     # 0x3a1a16
jmp 0x3c953
movl $0x12f, %edi            # imm = 0x12F
callq 0x9ec0
movb $0x0, 0x3650ba(%rip)    # 0x3a1a14
jmp 0x3cfc9
cmpl $0x14d, -0x8(%rbp)      # imm = 0x14D
jne 0x3c99f
movb 0x3650a8(%rip), %al     # 0x3a1a16
addb $0x1, %al
movb %al, 0x3650a0(%rip)     # 0x3a1a16
movzbl %al, %eax
leaq 0x361e6a(%rip), %rcx    # 0x39e7ea
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jl 0x3c993
movl $0x20, -0x8(%rbp)
jmp 0x3ce45
movb $0x0, 0x36507a(%rip)    # 0x3a1a14
jmp 0x3cfc7
cmpl $0x14f, -0x8(%rbp)      # imm = 0x14F
jne 0x3c9c3
leaq 0x361e3b(%rip), %rax    # 0x39e7ea
movb (%rax), %al
movb %al, 0x36505f(%rip)     # 0x3a1a16
movb $0x0, 0x365056(%rip)    # 0x3a1a14
jmp 0x3cfc5
cmpl $0x147, -0x8(%rbp)      # imm = 0x147
jne 0x3c9df
movb $0x0, 0x365043(%rip)    # 0x3a1a16
movb $0x0, 0x36503a(%rip)    # 0x3a1a14
jmp 0x3cfc3
cmpl $0x150, -0x8(%rbp)      # imm = 0x150
jne 0x3ca08
movzbl 0x365027(%rip), %eax    # 0x3a1a16
movl %eax, %ecx
leaq 0x361ac8(%rip), %rax    # 0x39e4c0
movb $0x0, (%rax,%rcx)
movb $0x0, 0x365011(%rip)    # 0x3a1a14
jmp 0x3cfc1
cmpl $0x148, -0x8(%rbp)      # imm = 0x148
jne 0x3ca63
movzbl 0x364ffe(%rip), %eax    # 0x3a1a16
addl $0x1, %eax
cltq
leaq 0x361a9c(%rip), %rsi    # 0x39e4c0
addq %rax, %rsi
leaq 0x35e9d2(%rip), %rdi    # 0x39b400
callq 0x9350
leaq 0x361a86(%rip), %rdi    # 0x39e4c0
leaq 0x35e9bf(%rip), %rsi    # 0x39b400
callq 0x9350
leaq 0x361d9d(%rip), %rax    # 0x39e7ea
movb $0x0, (%rax)
movb $0x0, 0x364fbf(%rip)    # 0x3a1a16
movb $0x0, 0x364fb6(%rip)    # 0x3a1a14
jmp 0x3cfbf
cmpl $0x149, -0x8(%rbp)      # imm = 0x149
jne 0x3caa6
leaq 0x361a4d(%rip), %rdi    # 0x39e4c0
leaq 0x361b46(%rip), %rsi    # 0x39e5c0
callq 0x9350
leaq 0x361a3a(%rip), %rdi    # 0x39e4c0
callq 0x9120
leaq 0x361d58(%rip), %rcx    # 0x39e7ea
movb %al, (%rcx)
movb %al, 0x364f7c(%rip)     # 0x3a1a16
movb $0x1, 0x364f73(%rip)    # 0x3a1a14
jmp 0x3cfbd
cmpl $0x153, -0x8(%rbp)      # imm = 0x153
jne 0x3cb57
jmp 0x3cab5
movzbl 0x364f5a(%rip), %eax    # 0x3a1a16
movl %eax, %ecx
leaq 0x3619fb(%rip), %rax    # 0x39e4c0
cmpb $0x0, (%rax,%rcx)
je 0x3cb23
leaq 0x35e92e(%rip), %rdi    # 0x39b400
leaq 0x3619e7(%rip), %rsi    # 0x39e4c0
callq 0x9350
movzbl 0x364f31(%rip), %eax    # 0x3a1a16
leaq 0x3619d4(%rip), %rdi    # 0x39e4c0
addq %rax, %rdi
movzbl 0x364f20(%rip), %eax    # 0x3a1a16
addl $0x1, %eax
cltq
leaq 0x35e8fe(%rip), %rsi    # 0x39b400
addq %rax, %rsi
callq 0x9350
leaq 0x3619af(%rip), %rdi    # 0x39e4c0
callq 0x9120
movb %al, %cl
leaq 0x361ccb(%rip), %rax    # 0x39e7ea
movb %cl, (%rax)
jmp 0x3cb4b
cmpb $0x0, 0x364eec(%rip)    # 0x3a1a16
je 0x3cb3f
movb 0x364ee4(%rip), %al     # 0x3a1a16
addb $-0x1, %al
movb %al, 0x364edc(%rip)     # 0x3a1a16
jmp 0x3cab5
movl $0x130, %edi            # imm = 0x130
callq 0x9ec0
jmp 0x3cb4b
movb $0x0, 0x364ec2(%rip)    # 0x3a1a14
jmp 0x3cfbb
cmpl $0x8, -0x8(%rbp)
jne 0x3cb88
cmpb $0x0, 0x364eb2(%rip)    # 0x3a1a16
je 0x3cb79
movb 0x364eaa(%rip), %al     # 0x3a1a16
addb $-0x1, %al
movb %al, 0x364ea2(%rip)     # 0x3a1a16
jmp 0x3cab5
movl $0x131, %edi            # imm = 0x131
callq 0x9ec0
jmp 0x3cfb9
cmpl $0x100, -0x8(%rbp)      # imm = 0x100
jl 0x3cb96
jmp 0x3cfb7
cmpl $0x1b, -0x8(%rbp)
jne 0x3cc6d
leaq 0x361c43(%rip), %rax    # 0x39e7ea
cmpb $0x0, (%rax)
je 0x3cbe0
movl $0x0, -0x8(%rbp)
movb $0x0, 0x364e5c(%rip)    # 0x3a1a16
leaq 0x361c29(%rip), %rax    # 0x39e7ea
movb $0x0, (%rax)
leaq 0x361c1f(%rip), %rax    # 0x39e7ea
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x3618e9(%rip), %rax    # 0x39e4c0
movb $0x0, (%rax,%rcx)
jmp 0x3cc68
movb $0x0, 0x364e2d(%rip)    # 0x3a1a14
movb $0x0, 0x364e29(%rip)    # 0x3a1a17
leaq 0x32ed93(%rip), %rax    # 0x36b988
movzbl (%rax), %eax
cmpl $0x60, %eax
jne 0x3cc11
leaq 0x35de04(%rip), %rax    # 0x39aa08
movl $0x0, (%rax)
callq 0x319b0
jmp 0x3cc2c
leaq 0x35ddf0(%rip), %rax    # 0x39aa08
cmpl $0x0, (%rax)
je 0x3cc2a
leaq 0x35dde4(%rip), %rax    # 0x39aa08
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
jmp 0x3cc2c
leaq 0x2614eb(%rip), %rax    # 0x29e11e
cmpb $0x0, (%rax)
je 0x3cc5f
leaq 0x23d6f9(%rip), %rax    # 0x27a338
cmpb $0x0, (%rax)
jne 0x3cc50
leaq 0x23d6ee(%rip), %rax    # 0x27a339
cmpb $0x0, (%rax)
je 0x3cc5f
leaq 0x23d6e1(%rip), %rax    # 0x27a338
movb $0x0, (%rax)
callq 0x12ae0
movb $0x1b, -0x1(%rbp)
jmp 0x3d26f
jmp 0x3cfb5
cmpl $0xd, -0x8(%rbp)
jne 0x3cc9c
leaq 0x261436(%rip), %rax    # 0x29e0b0
movb $0x0, (%rax)
movb $0x0, 0x364d90(%rip)    # 0x3a1a14
leaq 0x361935(%rip), %rdi    # 0x39e5c0
leaq 0x36182e(%rip), %rsi    # 0x39e4c0
callq 0x9350
jmp 0x3cfb3
cmpl $0x0, -0x8(%rbp)
je 0x3cfb1
cmpb $0x0, 0x364d67(%rip)    # 0x3a1a14
je 0x3cd1e
movzbl 0x364d61(%rip), %eax    # 0x3a1a17
cmpl $0x0, %eax
jne 0x3cd1e
leaq 0x361b28(%rip), %rax    # 0x39e7ea
movb $0x0, (%rax)
movl -0x8(%rbp), %eax
movb %al, %dl
leaq 0x361b19(%rip), %rax    # 0x39e7ea
movb (%rax), %al
movb %al, %sil
addb $0x1, %sil
leaq 0x361b09(%rip), %rcx    # 0x39e7ea
movb %sil, (%rcx)
movzbl %al, %eax
movl %eax, %ecx
leaq 0x3617d0(%rip), %rax    # 0x39e4c0
movb %dl, (%rax,%rcx)
leaq 0x361af0(%rip), %rax    # 0x39e7ea
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x3617ba(%rip), %rax    # 0x39e4c0
movb $0x0, (%rax,%rcx)
leaq 0x361ad9(%rip), %rax    # 0x39e7ea
movb (%rax), %al
movb %al, 0x364cfd(%rip)     # 0x3a1a16
jmp 0x3cfa3
cmpb $0x0, 0x364cf0(%rip)    # 0x3a1a15
je 0x3ce43
leaq 0x361ab8(%rip), %rax    # 0x39e7ea
movzbl (%rax), %eax
cmpl $0xf9, %eax
jl 0x3cd6c
leaq 0x361aa7(%rip), %rax    # 0x39e7ea
movb $-0x7, (%rax)
leaq 0x361a9d(%rip), %rax    # 0x39e7ea
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x361767(%rip), %rax    # 0x39e4c0
movb $0x0, (%rax,%rcx)
movl $0x132, %edi            # imm = 0x132
callq 0x9ec0
jmp 0x3ce3e
leaq 0x361a77(%rip), %rax    # 0x39e7ea
movzbl (%rax), %eax
leaq 0x23ac6b(%rip), %rcx    # 0x2779e8
movl (%rcx), %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
jl 0x3cdc0
leaq 0x23ac5b(%rip), %rax    # 0x2779e8
movl (%rax), %eax
subl $0x3, %eax
movb %al, %cl
leaq 0x361a4f(%rip), %rax    # 0x39e7ea
movb %cl, (%rax)
leaq 0x361a46(%rip), %rax    # 0x39e7ea
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x361710(%rip), %rax    # 0x39e4c0
movb $0x0, (%rax,%rcx)
movl $0x133, %edi            # imm = 0x133
callq 0x9ec0
jmp 0x3ce3c
movzbl 0x364c4f(%rip), %eax    # 0x3a1a16
leaq 0x3616f2(%rip), %rsi    # 0x39e4c0
addq %rax, %rsi
leaq 0x35e628(%rip), %rdi    # 0x39b400
callq 0x9350
movl -0x8(%rbp), %eax
movb %al, %dl
movzbl 0x364c2d(%rip), %eax    # 0x3a1a16
movl %eax, %ecx
leaq 0x3616ce(%rip), %rax    # 0x39e4c0
movb %dl, (%rax,%rcx)
movzbl 0x364c1a(%rip), %eax    # 0x3a1a16
addl $0x1, %eax
cltq
leaq 0x3616b8(%rip), %rdi    # 0x39e4c0
addq %rax, %rdi
leaq 0x35e5ee(%rip), %rsi    # 0x39b400
callq 0x9350
movb 0x364bf9(%rip), %al     # 0x3a1a16
addb $0x1, %al
movb %al, 0x364bf1(%rip)     # 0x3a1a16
leaq 0x361694(%rip), %rdi    # 0x39e4c0
callq 0x9120
movb %al, %cl
leaq 0x3619b0(%rip), %rax    # 0x39e7ea
movb %cl, (%rax)
jmp 0x3ce3e
jmp 0x3cfa1
jmp 0x3ce45
movzbl 0x364bca(%rip), %eax    # 0x3a1a16
leaq 0x361997(%rip), %rcx    # 0x39e7ea
movzbl (%rcx), %ecx
cmpl %ecx, %eax
jl 0x3cf7a
leaq 0x361985(%rip), %rax    # 0x39e7ea
movzbl (%rax), %eax
cmpl $0xf9, %eax
jl 0x3ceae
leaq 0x361974(%rip), %rax    # 0x39e7ea
movb $-0x7, (%rax)
leaq 0x36196a(%rip), %rax    # 0x39e7ea
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x361634(%rip), %rax    # 0x39e4c0
movb $0x0, (%rax,%rcx)
leaq 0x361953(%rip), %rax    # 0x39e7ea
movb (%rax), %al
movb %al, 0x364b77(%rip)     # 0x3a1a16
movl $0x134, %edi            # imm = 0x134
callq 0x9ec0
jmp 0x3cf78
leaq 0x361935(%rip), %rax    # 0x39e7ea
movzbl (%rax), %eax
leaq 0x23ab29(%rip), %rcx    # 0x2779e8
movl (%rcx), %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
jl 0x3cf11
leaq 0x23ab19(%rip), %rax    # 0x2779e8
movl (%rax), %eax
subl $0x3, %eax
movb %al, %cl
leaq 0x36190d(%rip), %rax    # 0x39e7ea
movb %cl, (%rax)
leaq 0x361904(%rip), %rax    # 0x39e7ea
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x3615ce(%rip), %rax    # 0x39e4c0
movb $0x0, (%rax,%rcx)
leaq 0x3618ed(%rip), %rax    # 0x39e7ea
movb (%rax), %al
movb %al, 0x364b11(%rip)     # 0x3a1a16
movl $0x135, %edi            # imm = 0x135
callq 0x9ec0
jmp 0x3cf76
movl -0x8(%rbp), %eax
movb %al, %dl
leaq 0x3618cd(%rip), %rax    # 0x39e7ea
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x361597(%rip), %rax    # 0x39e4c0
movb %dl, (%rax,%rcx)
leaq 0x3618b7(%rip), %rax    # 0x39e7ea
movb (%rax), %al
addb $0x1, %al
leaq 0x3618ac(%rip), %rcx    # 0x39e7ea
movb %al, (%rcx)
movzbl %al, %eax
movl %eax, %ecx
leaq 0x361574(%rip), %rax    # 0x39e4c0
movb $0x0, (%rax,%rcx)
leaq 0x361893(%rip), %rax    # 0x39e7ea
movb (%rax), %al
movb %al, 0x364ab7(%rip)     # 0x3a1a16
leaq 0x36155a(%rip), %rdi    # 0x39e4c0
callq 0x9120
movb %al, %cl
leaq 0x361876(%rip), %rax    # 0x39e7ea
movb %cl, (%rax)
jmp 0x3cf78
jmp 0x3cf9f
movl -0x8(%rbp), %eax
movb %al, %dl
movb 0x364a91(%rip), %al     # 0x3a1a16
movb %al, %cl
addb $0x1, %cl
movb %cl, 0x364a86(%rip)     # 0x3a1a16
movzbl %al, %eax
movl %eax, %ecx
leaq 0x361524(%rip), %rax    # 0x39e4c0
movb %dl, (%rax,%rcx)
jmp 0x3cfa1
jmp 0x3cfa3
movl $0x0, -0x8(%rbp)
movb $0x0, 0x364a63(%rip)    # 0x3a1a14
jmp 0x3cfb3
jmp 0x3cfb5
jmp 0x3cfb7
jmp 0x3cfb9
jmp 0x3cfbb
jmp 0x3cfbd
jmp 0x3cfbf
jmp 0x3cfc1
jmp 0x3cfc3
jmp 0x3cfc5
jmp 0x3cfc7
jmp 0x3cfc9
jmp 0x3cfcb
movzbl 0x364a42(%rip), %eax    # 0x3a1a14
cmpl $0x0, %eax
jne 0x3cfde
movb $0x0, 0x364a39(%rip)    # 0x3a1a17
movl $0xf, -0x14(%rbp)
leaq 0x23a9fc(%rip), %rax    # 0x2779e8
movl (%rax), %eax
subl $0xfa, %eax
subl $0x2, %eax
movl %eax, -0x10(%rbp)
cmpl $0x0, -0x10(%rbp)
jge 0x3d006
movl $0x0, -0x10(%rbp)
movl 0x364a10(%rip), %edi    # 0x3a1a1c
leaq 0x3617dd(%rip), %rax    # 0x39e7f0
movl (%rax), %esi
movslq -0x10(%rbp), %rax
leaq 0x35e1d0(%rip), %rcx    # 0x39b1f0
addq %rax, %rcx
movl $0xf, %edx
callq 0x10ee0
leaq 0x3617bc(%rip), %rax    # 0x39e7f0
movl (%rax), %eax
addl $0x1, %eax
movzbl 0x3649d6(%rip), %ecx    # 0x3a1a16
addl %ecx, %eax
leaq 0x23a9a7(%rip), %rcx    # 0x2779f0
imull (%rcx), %eax
movl %eax, -0x10(%rbp)
movl 0x3649c7(%rip), %eax    # 0x3a1a1c
leaq 0x23a998(%rip), %rcx    # 0x2779f4
imull (%rcx), %eax
movl %eax, -0xc(%rbp)
leaq 0x32e91f(%rip), %rax    # 0x36b988
movzbl (%rax), %eax
cmpl $0x60, %eax
jne 0x3d091
leaq 0x23a97c(%rip), %rax    # 0x2779f4
movl (%rax), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
leaq 0x23a969(%rip), %rax    # 0x2779f0
movl (%rax), %eax
shll %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0xc(%rbp), %eax
leaq 0x23a9d5(%rip), %rcx    # 0x277a70
cmpl (%rcx), %eax
jge 0x3d0e2
leaq 0x23a994(%rip), %rax    # 0x277a3a
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x3d0bf
leaq 0x23a93b(%rip), %rax    # 0x2779f0
movl (%rax), %eax
shll %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
leaq 0x23a975(%rip), %rax    # 0x277a3b
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x3d0e0
leaq 0x23a91f(%rip), %rax    # 0x2779f4
movl (%rax), %eax
shll $0x0, %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x3d0e2
movl -0xc(%rbp), %esi
leaq 0x23a908(%rip), %rax    # 0x2779f4
addl (%rax), %esi
leaq 0x23a8eb(%rip), %rax    # 0x2779e0
movl (%rax), %edx
subl $0x1, %edx
movl -0xc(%rbp), %ecx
leaq 0x23a8f0(%rip), %rax    # 0x2779f4
addl (%rax), %ecx
xorl %r8d, %r8d
movl %r8d, %edi
callq 0x109c0
movl -0xc(%rbp), %esi
leaq 0x23a8d9(%rip), %rax    # 0x2779f4
addl (%rax), %esi
addl $0x2, %esi
leaq 0x23a8b9(%rip), %rax    # 0x2779e0
movl (%rax), %edx
subl $0x1, %edx
movl -0xc(%rbp), %ecx
leaq 0x23a8be(%rip), %rax    # 0x2779f4
addl (%rax), %ecx
addl $0x2, %ecx
xorl %r8d, %r8d
movl %r8d, %edi
callq 0x109c0
leaq 0x35e2b3(%rip), %rdi    # 0x39b400
leaq 0x15726c(%rip), %rsi    # 0x1943c0
leaq 0x361365(%rip), %rdx    # 0x39e4c0
movb $0x0, %al
callq 0x9060
cmpl $0xd, -0x8(%rbp)
jne 0x3d199
leaq 0x32e819(%rip), %rax    # 0x36b988
movzbl (%rax), %eax
cmpl $0x60, %eax
jne 0x3d199
movl 0x36489f(%rip), %edi    # 0x3a1a1c
leaq 0x36166c(%rip), %rax    # 0x39e7f0
movl (%rax), %esi
movl $0xf, %edx
leaq 0x153118(%rip), %rcx    # 0x1902aa
callq 0x10ee0
jmp 0x3d1b9
movl 0x36487d(%rip), %edi    # 0x3a1a1c
leaq 0x36164a(%rip), %rax    # 0x39e7f0
movl (%rax), %esi
movl $0xf, %edx
leaq 0x35e24c(%rip), %rcx    # 0x39b400
callq 0x10ee0
cmpl $0xd, -0x8(%rbp)
je 0x3d23a
movl -0x10(%rbp), %edi
movl -0xc(%rbp), %esi
leaq 0x23a828(%rip), %rax    # 0x2779f4
addl (%rax), %esi
movl -0x10(%rbp), %edx
leaq 0x23a818(%rip), %rax    # 0x2779f0
addl (%rax), %edx
subl $0x1, %edx
movl -0xc(%rbp), %ecx
leaq 0x23a80d(%rip), %rax    # 0x2779f4
addl (%rax), %ecx
movl $0xb, %r8d
callq 0x109c0
cmpb $0x0, 0x36481a(%rip)    # 0x3a1a15
je 0x3d238
movl -0x10(%rbp), %edi
movl -0xc(%rbp), %esi
leaq 0x23a7ea(%rip), %rax    # 0x2779f4
addl (%rax), %esi
addl $0x2, %esi
movl -0x10(%rbp), %edx
leaq 0x23a7d7(%rip), %rax    # 0x2779f0
addl (%rax), %edx
subl $0x1, %edx
movl -0xc(%rbp), %ecx
leaq 0x23a7cc(%rip), %rax    # 0x2779f4
addl (%rax), %ecx
addl $0x2, %ecx
movl $0xb, %r8d
callq 0x109c0
jmp 0x3d23a
leaq 0x260e72(%rip), %rax    # 0x29e0b3
cmpb $0x0, (%rax)
je 0x3d264
leaq 0x260e4b(%rip), %rax    # 0x29e098
cmpq $0x0, (%rax)
je 0x3d264
leaq 0x260e56(%rip), %rax    # 0x29e0b0
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x3d264
jmp 0x3d269
callq 0xb0d0
movl -0x8(%rbp), %eax
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)