// File: jkingan[P]ladyheather/heather.cpp
// Function: open_script(char*)
int open_script(char *fn)
{
   // open a keyboard script file (they can be nested)

   if(script_file) { // nested script files
      if(script_nest < SCRIPT_NEST) {
         strcpy(scripts[script_nest].name, script_name);
         scripts[script_nest].file  = script_file;
         scripts[script_nest].line  = script_line;
         scripts[script_nest].col   = script_col;
         scripts[script_nest].fault = script_fault;
         scripts[script_nest].err   = script_err;
         scripts[script_nest].pause = script_pause;
         ++script_nest;
      }
      else {
         edit_error("Script files nested too deep");
         close_script(1);
         return 2;
      }
   }

   strncpy(script_name, fn, SCRIPT_LEN);
   script_file  = topen(fn, "r");
   script_line  = 1;
   script_col   = 0;
   script_fault = 0;
   script_pause = 0;
   skip_comment = 0;
   if(script_file) return 0;
   else            return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, 0x274b14(%rip)    # 0x29e098
je 0x296c7
cmpl $0x4, 0x274b03(%rip)    # 0x29e094
jge 0x296a6
movslq 0x274af6(%rip), %rax    # 0x29e094
leaq 0x2747cb(%rip), %rdi    # 0x29dd70
imulq $0xa8, %rax, %rax
addq %rax, %rdi
leaq 0x274a5a(%rip), %rsi    # 0x29e010
callq 0x9350
movq 0x274ad6(%rip), %rcx    # 0x29e098
movslq 0x274acb(%rip), %rdx    # 0x29e094
leaq 0x2747a0(%rip), %rax    # 0x29dd70
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x88(%rax)
movl 0x274ab9(%rip), %ecx    # 0x29e0a0
movslq 0x274aa6(%rip), %rdx    # 0x29e094
leaq 0x27477b(%rip), %rax    # 0x29dd70
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x90(%rax)
movl 0x274a99(%rip), %ecx    # 0x29e0a4
movslq 0x274a82(%rip), %rdx    # 0x29e094
leaq 0x274757(%rip), %rax    # 0x29dd70
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x94(%rax)
movl 0x274a7d(%rip), %ecx    # 0x29e0ac
movslq 0x274a5e(%rip), %rdx    # 0x29e094
leaq 0x274733(%rip), %rax    # 0x29dd70
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x9c(%rax)
movl 0x274a55(%rip), %ecx    # 0x29e0a8
movslq 0x274a3a(%rip), %rdx    # 0x29e094
leaq 0x27470f(%rip), %rax    # 0x29dd70
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x98(%rax)
movb 0x274a39(%rip), %cl     # 0x29e0b0
movslq 0x274a16(%rip), %rdx    # 0x29e094
leaq 0x2746eb(%rip), %rax    # 0x29dd70
imulq $0xa8, %rdx, %rdx
addq %rdx, %rax
movb %cl, 0xa0(%rax)
movl 0x2749f9(%rip), %eax    # 0x29e094
addl $0x1, %eax
movl %eax, 0x2749f0(%rip)    # 0x29e094
jmp 0x296c5
leaq 0x14755c(%rip), %rdi    # 0x170c09
callq 0x30d60
movl $0x1, %edi
callq 0x293a0
movl $0x2, -0x4(%rbp)
jmp 0x29739
jmp 0x296c7
movq -0x10(%rbp), %rsi
leaq 0x27493e(%rip), %rdi    # 0x29e010
movl $0x80, %edx
callq 0x9170
movq -0x10(%rbp), %rdi
leaq 0x15a926(%rip), %rsi    # 0x18400d
callq 0x9b20
movq %rax, 0x2749a5(%rip)    # 0x29e098
movl $0x1, 0x2749a3(%rip)    # 0x29e0a0
movl $0x0, 0x27499d(%rip)    # 0x29e0a4
movl $0x0, 0x27499b(%rip)    # 0x29e0ac
movb $0x0, 0x274998(%rip)    # 0x29e0b0
movb $0x0, 0x274992(%rip)    # 0x29e0b1
cmpq $0x0, 0x274971(%rip)    # 0x29e098
je 0x29732
movl $0x0, -0x4(%rbp)
jmp 0x29739
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)