// File: /workspace/github_c_makefile_star2_O0/jarun[P]nnn/src/nnn.c
// Function: savecurctx
static void savecurctx(char *path, char *curname, int nextctx)
{
	settings tmpcfg = cfg;
	context *ctxr = &g_ctx[nextctx];

	/* Save current context */
	if (curname)
		xstrsncpy(g_ctx[tmpcfg.curctx].c_name, curname, NAME_MAX + 1);
	else
		g_ctx[tmpcfg.curctx].c_name[0] = '\0';

	g_ctx[tmpcfg.curctx].c_cfg = tmpcfg;

	if (ctxr->c_cfg.ctxactive) { /* Switch to saved context */
		tmpcfg = ctxr->c_cfg;
		/* Skip ordering an open context */
		if (order) {
			cfgsort[CTX_MAX] = cfgsort[nextctx];
			cfgsort[nextctx] = '0';
		}
	} else { /* Set up a new context from current context */
		ctxr->c_cfg.ctxactive = 1;
		xstrsncpy(ctxr->c_path, path, PATH_MAX);
		ctxr->c_last[0] = ctxr->c_name[0] = ctxr->c_fltr[0] = ctxr->c_fltr[1] = '\0';
		ctxr->c_cfg = tmpcfg;
		/* If already in an ordered dir, clear ordering for the new context and let it order */
		if (cfgsort[cfg.curctx] == 'z')
			cfgsort[nextctx] = 'z';
	}

	tmpcfg.curctx = nextctx;
	setcfg(tmpcfg);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl 0x10467(%rip), %eax     # 0x204d0
movl %eax, -0x18(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x11e19(%rip), %rax     # 0x21e90
imulq $0x2138, %rcx, %rcx     # imm = 0x2138
addq %rcx, %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x100bf
movl -0x18(%rbp), %eax
shrl $0xd, %eax
andl $0x7, %eax
movl %eax, %eax
leaq 0x11df2(%rip), %rdi     # 0x21e90
imulq $0x2138, %rax, %rax     # imm = 0x2138
addq %rax, %rdi
addq $0x2000, %rdi           # imm = 0x2000
movq -0x10(%rbp), %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x6250
jmp 0x100e4
movl -0x18(%rbp), %eax
shrl $0xd, %eax
andl $0x7, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x11dbd(%rip), %rax     # 0x21e90
imulq $0x2138, %rcx, %rcx     # imm = 0x2138
addq %rcx, %rax
movb $0x0, 0x2000(%rax)
movl -0x18(%rbp), %eax
shrl $0xd, %eax
andl $0x7, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x11d98(%rip), %rax     # 0x21e90
imulq $0x2138, %rcx, %rcx     # imm = 0x2138
addq %rcx, %rax
movl -0x18(%rbp), %ecx
movl %ecx, 0x2130(%rax)
movq -0x20(%rbp), %rax
movl 0x2130(%rax), %eax
shrl $0x9, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1015f
movq -0x20(%rbp), %rax
movl 0x2130(%rax), %eax
movl %eax, -0x18(%rbp)
cmpq $0x0, 0x10853(%rip)     # 0x20988
je 0x1015a
movslq -0x14(%rbp), %rcx
leaq 0x1a282(%rip), %rax     # 0x2a3c4
movb (%rax,%rcx), %al
movb %al, 0x1a27d(%rip)      # 0x2a3c8
movslq -0x14(%rbp), %rcx
leaq 0x1a26e(%rip), %rax     # 0x2a3c4
movb $0x30, (%rax,%rcx)
jmp 0x101f7
movq -0x20(%rbp), %rax
movl 0x2130(%rax), %ecx
andl $0xfffffdff, %ecx       # imm = 0xFFFFFDFF
orl $0x200, %ecx            # imm = 0x200
movl %ecx, 0x2130(%rax)
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x6250
movq -0x20(%rbp), %rax
movb $0x0, 0x2101(%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x2100(%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x2000(%rax)
movq -0x20(%rbp), %rax
movb $0x0, 0x1000(%rax)
movq -0x20(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, 0x2130(%rax)
movl 0x10304(%rip), %eax     # 0x204d0
shrl $0xd, %eax
andl $0x7, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x1a1e7(%rip), %rax     # 0x2a3c4
movzbl (%rax,%rcx), %eax
cmpl $0x7a, %eax
jne 0x101f5
movslq -0x14(%rbp), %rcx
leaq 0x1a1d3(%rip), %rax     # 0x2a3c4
movb $0x7a, (%rax,%rcx)
jmp 0x101f7
movl -0x14(%rbp), %ecx
movl -0x18(%rbp), %eax
andl $0x7, %ecx
shll $0xd, %ecx
andl $0xffff1fff, %eax       # imm = 0xFFFF1FFF
orl %ecx, %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %edi
callq 0x16190
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)