// File: /workspace/github_cpp_makefile_star2_O3/jkingan[P]ladyheather/heathui.cpp
// Function: edit_write_cmd()
int edit_write_cmd()
{
int valid;
   // process a file write/delete command
   if(edit_buffer[0]) {
      if(dump_type == 's') {
         reset_first_key(21);
         prot_menu = 0;
         draw_plot(REFRESH_SCREEN);
         draw_maps();
         refresh_page();

         valid = 0;
         if     (strstr(edit_buffer, ".gif")) valid = 1;
         else if(strstr(edit_buffer, ".GIF")) valid = 1;
         else if(strstr(edit_buffer, ".bmp")) valid = 1;
         else if(strstr(edit_buffer, ".BMP")) valid = 1;
         if(valid == 0) {
            first_key = ' ';
            edit_error("Screen dump file type must be .gif or .bmp");
         }
         else if(dump_screen(invert_dump, top_line, edit_buffer) == 0) {
            first_key = ' ';
            edit_error("Could not write screen image file");
         }
      }
      else if(dump_type == 'c') {  // luxor cal .SCR file
         dump_cal_file();
      }
      else if(dump_type == 'd') {   //delete file
         if(path_unlink(edit_buffer)) {
            sprintf(out, "Could not delete file: %s", edit_buffer);
         }
         else {
            sprintf(out, "File %s deleted", edit_buffer);
         }
         edit_error(out);
      }
      else if(dump_type == 'm') {  // MTIE data
         dump_mtie_data();
      }
      else {
         dump_log(edit_buffer, dump_type);
      }
   }
   else {
      edit_error("Missing file name");
   }

   top_line = 0;
   return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x30be58(%rip), %rax    # 0x33f2e0
cmpb $0x0, (%rax)
je 0x334ea
leaq 0x20af79(%rip), %rax    # 0x23e40d
movzbl (%rax), %esi
cmpl $0x6c, %esi
jg 0x3350a
cmpl $0x63, %esi
je 0x335ef
cmpl $0x64, %esi
jne 0x335de
leaq 0x30be2b(%rip), %rbx    # 0x33f2e0
movq %rbx, %rdi
callq 0xa1e1
testl %eax, %eax
leaq 0xe20d4(%rip), %rax     # 0x11559a
leaq 0xe20b3(%rip), %rsi     # 0x115580
cmoveq %rax, %rsi
leaq 0x308d48(%rip), %r14    # 0x33c220
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9060
movq %r14, %rdi
jmp 0x334f1
leaq 0xe20b9(%rip), %rdi     # 0x1155aa
callq 0x23027
leaq 0x1e5343(%rip), %rax    # 0x218840
movl $0x0, (%rax)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
cmpl $0x6d, %esi
je 0x335f9
cmpl $0x73, %esi
jne 0x335de
callq 0x275c7
leaq 0x1e7c30(%rip), %rax    # 0x21b158
movb $0x0, (%rax)
movl $0x1, %edi
callq 0x197ae
callq 0xf7b6a
callq 0xab54
leaq 0x30bd9a(%rip), %rdi    # 0x33f2e0
leaq 0xd76a3(%rip), %rsi     # 0x10abf0
callq 0x9090
testq %rax, %rax
jne 0x3359f
leaq 0x30bd82(%rip), %rdi    # 0x33f2e0
leaq 0xd6a0c(%rip), %rsi     # 0x109f71
callq 0x9090
testq %rax, %rax
jne 0x3359f
leaq 0x30bd6a(%rip), %rdi    # 0x33f2e0
leaq 0xe1fdc(%rip), %rsi     # 0x115559
callq 0x9090
testq %rax, %rax
jne 0x3359f
leaq 0x30bd52(%rip), %rdi    # 0x33f2e0
leaq 0xe1f99(%rip), %rsi     # 0x11552e
callq 0x9090
testq %rax, %rax
je 0x33603
leaq 0x1e528e(%rip), %rax    # 0x218834
movl (%rax), %edi
leaq 0x1e5291(%rip), %rax    # 0x218840
movl (%rax), %esi
leaq 0x30bd28(%rip), %rdx    # 0x33f2e0
callq 0xf7a8
testl %eax, %eax
jne 0x334f6
leaq 0x20b98c(%rip), %rax    # 0x23ef58
movl $0x20, (%rax)
leaq 0xe1f85(%rip), %rdi     # 0x11555e
jmp 0x334f1
leaq 0x30bcfb(%rip), %rdi    # 0x33f2e0
callq 0xd191e
jmp 0x334f6
callq 0x330dd
jmp 0x334f6
callq 0x3336d
jmp 0x334f6
leaq 0x20b94e(%rip), %rax    # 0x23ef58
movl $0x20, (%rax)
leaq 0xe1f1c(%rip), %rdi     # 0x115533
jmp 0x334f1