// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathui.cpp
// Function: edit_error(char*)
int edit_error(char *s)
{
int x;
char out[256+1];
int row,col,width;

   rpn_break = 1;
   edit_err_flag = 1;

   if(reading_lla && (zoom_screen == 'L')) {
      row = TEXT_ROWS-4;
      col = TEXT_COLS/2;
      width = TEXT_COLS/2;
   }
   else {
      row = EDIT_ROW+3;
      col = EDIT_COL;
      width = 80;
   }

   // show an error message and wait for a key press
   vidstr(row+0, col, PROMPT_COLOR, &blanks[TEXT_COLS-width]);
   vidstr(row+1, col, PROMPT_COLOR, &blanks[TEXT_COLS-width]);
   vidstr(row+2, col, PROMPT_COLOR, &blanks[TEXT_COLS-width]);
   vidstr(row+3, col, PROMPT_COLOR, &blanks[TEXT_COLS-width]);
   vidstr(row+4, col, PROMPT_COLOR, &blanks[TEXT_COLS-width]);
   vidstr(row+5, col, PROMPT_COLOR, &blanks[TEXT_COLS-width]);

   if(script_file) {
      sprintf(out, "Error in script file %s: line %d, col %d: %s",
         script_name, script_line, script_col, s);
      vidstr(row+1, col, PROMPT_COLOR, out);
      vidstr(row+2, col, PROMPT_COLOR, "Press any key to stop script....");
   }
   else {
      vidstr(row+1, col, PROMPT_COLOR, s);
      vidstr(row+2, col, PROMPT_COLOR, "Press any key to continue....");
   }

   if(rpn_mode) {
      BEEP(6566);
   }

   refresh_page();

   //!!! just waiting for a key here would be bad news because
   //    gps data would not be processed and the queue can overflow
   wait_for_key(1);

   vidstr(row+1, col, PROMPT_COLOR, "                                ");
   refresh_page();

   if(KBHIT()) x = GETCH();
   else        x = 0;
   script_fault = 1;

   if(rpn_mode) {
      edit_buffer[0] = 0;
      edit_buffer[1] = 0;
      msg_field[0] = 0;
      nmea_msg[0] = 0;
      msg_col = 0;
      start_calc(123);
      rpn_mode = (-1);
      rpn_err_flag = 1;
   }
   return x;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, -0x38(%rbp)
movl $0x1, %eax
movl %eax, 0x31fd06(%rip)    # 0x342d50
movl %eax, 0x31f7e8(%rip)    # 0x342838
leaq 0x318280(%rip), %rax    # 0x33b2d7
cmpb $0x0, (%rax)
je 0x2308d
leaq 0x2e9745(%rip), %rax    # 0x30c7a8
cmpb $0x4c, (%rax)
jne 0x2308d
leaq 0x1f579d(%rip), %rax    # 0x21880c
movl (%rax), %r12d
addl $-0x4, %r12d
leaq 0x1f578b(%rip), %rax    # 0x218808
movl (%rax), %eax
movl %eax, %ebx
shrl $0x1f, %ebx
addl %eax, %ebx
sarl %ebx
movl %ebx, %r13d
jmp 0x230b3
leaq 0x31c578(%rip), %rax    # 0x33f60c
movl (%rax), %r12d
addl $0x3, %r12d
leaq 0x31c56e(%rip), %rax    # 0x33f610
movl (%rax), %ebx
leaq 0x1f575d(%rip), %rax    # 0x218808
movl (%rax), %eax
movl $0x50, %r13d
subl %r13d, %eax
movslq %eax, %rcx
leaq 0x318f50(%rip), %r14    # 0x33c010
addq %r14, %rcx
movl %r12d, %edi
movl %ebx, %esi
movl $0xb, %edx
callq 0xe787
leal 0x1(%r12), %edi
leaq 0x1f572a(%rip), %r15    # 0x218808
movslq (%r15), %rcx
movslq %r13d, %r13
subq %r13, %rcx
addq %r14, %rcx
movl %edi, -0x30(%rbp)
movl %ebx, %esi
movl $0xb, %edx
callq 0xe787
leal 0x2(%r12), %edi
movslq (%r15), %rcx
subq %r13, %rcx
addq %r14, %rcx
movl %edi, -0x2c(%rbp)
movl %ebx, %esi
movl $0xb, %edx
callq 0xe787
leal 0x3(%r12), %edi
movslq (%r15), %rcx
subq %r13, %rcx
addq %r14, %rcx
movl %ebx, %esi
movl $0xb, %edx
callq 0xe787
leal 0x4(%r12), %edi
movslq (%r15), %rcx
subq %r13, %rcx
addq %r14, %rcx
movl %ebx, %esi
movl $0xb, %edx
callq 0xe787
addl $0x5, %r12d
movslq (%r15), %rcx
subq %r13, %rcx
addq %r14, %rcx
movl %r12d, %edi
movl %ebx, %esi
movl $0xb, %edx
callq 0xe787
leaq 0x21bd4b(%rip), %rax    # 0x23eeb8
cmpq $0x0, (%rax)
je 0x231c8
leaq 0x21bd46(%rip), %rax    # 0x23eec0
movl (%rax), %ecx
leaq 0x21bd41(%rip), %rax    # 0x23eec4
movl (%rax), %r8d
leaq 0xf1890(%rip), %rsi     # 0x114a1d
leaq 0x21bc9c(%rip), %rdx    # 0x23ee30
leaq -0x140(%rbp), %r12
movq %r12, %rdi
movq -0x38(%rbp), %r9
xorl %eax, %eax
callq 0x9060
movl -0x30(%rbp), %r15d
movl %r15d, %edi
movl %ebx, %esi
movl $0xb, %edx
movq %r12, %rcx
callq 0xe787
leaq 0xf1884(%rip), %rcx     # 0x114a4a
jmp 0x231e6
movl -0x30(%rbp), %r15d
movl %r15d, %edi
movl %ebx, %esi
movl $0xb, %edx
movq -0x38(%rbp), %rcx
callq 0xe787
leaq 0xf1885(%rip), %rcx     # 0x114a6b
movl -0x2c(%rbp), %edi
movl %ebx, %esi
movl $0xb, %edx
callq 0xe787
leaq 0x31862c(%rip), %r14    # 0x33b828
cmpl $0x0, (%r14)
je 0x2320c
movl $0x19a6, %edi           # imm = 0x19A6
callq 0x9d78
callq 0xab54
movl $0x1, %edi
callq 0x1cc09
leaq 0x110923(%rip), %rcx    # 0x133b45
movl %r15d, %edi
movl %ebx, %esi
movl $0xb, %edx
callq 0xe787
callq 0xab54
callq 0xd542
testl %eax, %eax
je 0x23248
callq 0xd576
movl %eax, %ebx
jmp 0x2324a
xorl %ebx, %ebx
leaq 0x21bc7b(%rip), %rax    # 0x23eecc
movl $0x1, (%rax)
cmpl $0x0, (%r14)
je 0x232a0
leaq 0x31c07c(%rip), %rax    # 0x33f2e0
movw $0x0, (%rax)
leaq 0x3187d0(%rip), %rax    # 0x33ba40
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x3185b5(%rip), %rax    # 0x33b830
movb %cl, (%rax)
leaq 0x3189c0(%rip), %rax    # 0x33bc44
movl $0x0, (%rax)
callq 0x20ebb
movl $0xffffffff, (%r14)     # imm = 0xFFFFFFFF
movl $0x1, 0x321478(%rip)    # 0x344718
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq