// File: /workspace/github_cpp_makefile_star2_O2/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 0x2f8b70(%rip), %rax    # 0x3292e0
cmpb $0x0, (%rax)
je 0x30864
leaq 0x1f7c8d(%rip), %rax    # 0x22840d
movzbl (%rax), %eax
cmpl $0x63, %eax
je 0x308c4
cmpl $0x64, %eax
je 0x3086d
cmpl $0x6d, %eax
je 0x308bd
cmpl $0x73, %eax
jne 0x308cb
callq 0x2591f
leaq 0x1d49a5(%rip), %rax    # 0x205158
movb $0x0, (%rax)
pushq $0x1
popq %rdi
callq 0x18cb0
callq 0xe23b2
callq 0xaa05
leaq 0x2f8b11(%rip), %rdi    # 0x3292e0
leaq 0xc4495(%rip), %rsi     # 0xf4c6b
callq 0x9090
testq %rax, %rax
jne 0x3082c
leaq 0x2f8af9(%rip), %rdi    # 0x3292e0
leaq 0xc37d3(%rip), %rsi     # 0xf3fc1
callq 0x9090
testq %rax, %rax
jne 0x3082c
leaq 0x2f8ae1(%rip), %rdi    # 0x3292e0
leaq 0xcedd3(%rip), %rsi     # 0xff5d9
callq 0x9090
testq %rax, %rax
jne 0x3082c
leaq 0x2f8ac9(%rip), %rdi    # 0x3292e0
leaq 0xced90(%rip), %rsi     # 0xff5ae
callq 0x9090
testq %rax, %rax
je 0x308dc
leaq 0x1d2001(%rip), %rax    # 0x202834
movl (%rax), %edi
leaq 0x1d2004(%rip), %rax    # 0x202840
movl (%rax), %esi
leaq 0x2f8a9b(%rip), %rdx    # 0x3292e0
callq 0xf1b3
testl %eax, %eax
jne 0x308ac
leaq 0x1f8703(%rip), %rax    # 0x228f58
movl $0x20, (%rax)
leaq 0xced7c(%rip), %rdi     # 0xff5de
jmp 0x308a7
leaq 0xcedbf(%rip), %rdi     # 0xff62a
jmp 0x308a7
leaq 0x2f8a6c(%rip), %rbx    # 0x3292e0
movq %rbx, %rdi
callq 0xa15d
testl %eax, %eax
leaq 0xced95(%rip), %rax     # 0xff61a
leaq 0xced74(%rip), %rsi     # 0xff600
cmoveq %rax, %rsi
leaq 0x2f5989(%rip), %r14    # 0x326220
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x9060
movq %r14, %rdi
callq 0x214df
leaq 0x1d1f8d(%rip), %rax    # 0x202840
andl $0x0, (%rax)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
callq 0x30660
jmp 0x308ac
callq 0x303d6
jmp 0x308ac
movzbl %al, %esi
leaq 0x2f8a0b(%rip), %rdi    # 0x3292e0
callq 0xc00e0
jmp 0x308ac
leaq 0x1f8675(%rip), %rax    # 0x228f58
movl $0x20, (%rax)
leaq 0xcecc3(%rip), %rdi     # 0xff5b3
jmp 0x308a7