// File: /workspace/github_c_makefile_star2_O0/jarun[P]nnn/src/nnn.c
// Function: set_sort_flags
static int set_sort_flags(int r)
{
	bool session = (r == '\0');
	bool reverse = FALSE;

	if (ISUPPER_(r) && (r != 'R') && (r != 'C')) {
		reverse = TRUE;
		r = TOLOWER(r);
	}

	/* Set the correct input in case of a session load */
	if (session) {
		if (cfg.apparentsz) {
			cfg.apparentsz = 0;
			r = 'a';
		} else if (cfg.blkorder) {
			cfg.blkorder = 0;
			r = 'd';
		}

		/* Ensure function pointers are in sync with cfg. */
		entrycmpfn = cfg.reverse ? &reventrycmp : &entrycmp;
		namecmpfn = cfg.version ? &xstrverscasecmp : &xstricmp;
	} else if (r == CONTROL('T')) {
		/* Cycling order: clear -> size -> time -> clear */
		if (cfg.timeorder)
			r = 's';
		else if (cfg.sizeorder)
			r = 'c';
		else
			r = 't';
	}

	switch (r) {
	case 'a': /* Apparent du */
		cfg.apparentsz ^= 1;
		if (cfg.apparentsz) {
			cfg.blkorder = 1;
			blk_shift = 0;
		} else
			cfg.blkorder = 0;
		// fallthrough
	case 'd': /* Disk usage */
		if (r == 'd') {
			if (!cfg.apparentsz)
				cfg.blkorder ^= 1;
			cfg.apparentsz = 0;
			blk_shift = ffs(S_BLKSIZE) - 1;
		}

		if (cfg.blkorder)
			cfg.showdetail = 1;
		cfg.timeorder = 0;
		cfg.sizeorder = 0;
		cfg.extnorder = 0;
		if (!session) {
			cfg.reverse = 0;
			entrycmpfn = &entrycmp;
		}
		endselection(TRUE); /* We are going to reload dir */
		break;
	case 'c':
		cfg.timeorder = 0;
		cfg.sizeorder = 0;
		cfg.apparentsz = 0;
		cfg.blkorder = 0;
		cfg.extnorder = 0;
		cfg.reverse = 0;
		cfg.version = 0;
		entrycmpfn = &entrycmp;
		namecmpfn = &xstricmp;
		break;
	case 'e': /* File extension */
		cfg.extnorder ^= 1;
		cfg.sizeorder = 0;
		cfg.timeorder = 0;
		cfg.apparentsz = 0;
		cfg.blkorder = 0;
		cfg.reverse = 0;
		entrycmpfn = &entrycmp;
		break;
	case 'r': /* Reverse sort */
		cfg.reverse ^= 1;
		entrycmpfn = cfg.reverse ? &reventrycmp : &entrycmp;
		break;
	case 's': /* File size */
		cfg.sizeorder ^= 1;
		cfg.timeorder = 0;
		cfg.apparentsz = 0;
		cfg.blkorder = 0;
		cfg.extnorder = 0;
		cfg.reverse = 0;
		entrycmpfn = &entrycmp;
		break;
	case 't': /* Time */
		cfg.timeorder ^= 1;
		cfg.sizeorder = 0;
		cfg.apparentsz = 0;
		cfg.blkorder = 0;
		cfg.extnorder = 0;
		cfg.reverse = 0;
		entrycmpfn = &entrycmp;
		break;
	case 'v': /* Version */
		cfg.version ^= 1;
		namecmpfn = cfg.version ? &xstrverscasecmp : &xstricmp;
		cfg.timeorder = 0;
		cfg.sizeorder = 0;
		cfg.apparentsz = 0;
		cfg.blkorder = 0;
		cfg.extnorder = 0;
		break;
	default:
		return 0;
	}

	if (reverse) {
		cfg.reverse = 1;
		entrycmpfn = &reventrycmp;
	}

	cfgsort[cfg.curctx] = (uchar_t)r;

	return r;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
sete %al
andb $0x1, %al
movb %al, -0x9(%rbp)
movb $0x0, -0xa(%rbp)
cmpl $0x41, -0x8(%rbp)
jl 0x79bd
cmpl $0x5a, -0x8(%rbp)
jg 0x79bd
cmpl $0x52, -0x8(%rbp)
je 0x79bd
cmpl $0x43, -0x8(%rbp)
je 0x79bd
movb $0x1, -0xa(%rbp)
cmpl $0x41, -0x8(%rbp)
jl 0x79b1
cmpl $0x5a, -0x8(%rbp)
jg 0x79b1
movl -0x8(%rbp), %eax
subl $0x41, %eax
addl $0x61, %eax
movl %eax, -0x10(%rbp)
jmp 0x79b7
movl -0x8(%rbp), %eax
movl %eax, -0x10(%rbp)
movl -0x10(%rbp), %eax
movl %eax, -0x8(%rbp)
testb $0x1, -0x9(%rbp)
je 0x7a71
movl 0x18b03(%rip), %eax     # 0x204d0
shrl $0x3, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x79f3
movl 0x18af2(%rip), %eax     # 0x204d0
andl $-0x9, %eax
orl $0x0, %eax
movl %eax, 0x18ae6(%rip)     # 0x204d0
movl $0x61, -0x8(%rbp)
jmp 0x7a1f
movl 0x18ad7(%rip), %eax     # 0x204d0
shrl $0x4, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x7a1d
movl 0x18ac6(%rip), %eax     # 0x204d0
andl $-0x11, %eax
orl $0x0, %eax
movl %eax, 0x18aba(%rip)     # 0x204d0
movl $0x64, -0x8(%rbp)
jmp 0x7a1f
movl 0x18aab(%rip), %edx     # 0x204d0
shrl $0xa, %edx
andl $0x1, %edx
leaq 0x5a8e(%rip), %rax      # 0xd4c0
leaq 0x5a07(%rip), %rcx      # 0xd440
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, 0x18d89(%rip)     # 0x207d0
movl 0x18a83(%rip), %edx     # 0x204d0
shrl $0xb, %edx
andl $0x1, %edx
leaq 0x5fe6(%rip), %rax      # 0xda40
leaq 0x5d1f(%rip), %rcx      # 0xd780
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, 0x18d69(%rip)     # 0x207d8
jmp 0x7ab7
cmpl $0x14, -0x8(%rbp)
jne 0x7ab5
movl 0x18a53(%rip), %eax     # 0x204d0
shrl %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x7a90
movl $0x73, -0x8(%rbp)
jmp 0x7ab3
movl 0x18a3a(%rip), %eax     # 0x204d0
shrl $0x2, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x7aaa
movl $0x63, -0x8(%rbp)
jmp 0x7ab1
movl $0x74, -0x8(%rbp)
jmp 0x7ab3
jmp 0x7ab5
jmp 0x7ab7
movl -0x8(%rbp), %eax
addl $-0x61, %eax
movl %eax, %ecx
movq %rcx, -0x18(%rbp)
subl $0x15, %eax
ja 0x7f9d
movq -0x18(%rbp), %rax
leaq 0x1365d(%rip), %rcx     # 0x1b134
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x189ea(%rip), %ecx     # 0x204d0
shrl $0x3, %ecx
andl $0x1, %ecx
xorl $0x1, %ecx
movl 0x189db(%rip), %eax     # 0x204d0
andl $0x1, %ecx
shll $0x3, %ecx
andl $-0x9, %eax
orl %ecx, %eax
movl %eax, 0x189ca(%rip)     # 0x204d0
movl 0x189c4(%rip), %eax     # 0x204d0
shrl $0x3, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x7b32
movl 0x189b3(%rip), %eax     # 0x204d0
andl $-0x11, %eax
orl $0x10, %eax
movl %eax, 0x189a7(%rip)     # 0x204d0
movb $0x0, 0x18cb0(%rip)     # 0x207e0
jmp 0x7b44
movl 0x18998(%rip), %eax     # 0x204d0
andl $-0x11, %eax
orl $0x0, %eax
movl %eax, 0x1898c(%rip)     # 0x204d0
jmp 0x7b46
cmpl $0x64, -0x8(%rbp)
jne 0x7ba8
movl 0x1897e(%rip), %eax     # 0x204d0
shrl $0x3, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x7b83
movl 0x1896d(%rip), %ecx     # 0x204d0
shrl $0x4, %ecx
andl $0x1, %ecx
xorl $0x1, %ecx
movl 0x1895e(%rip), %eax     # 0x204d0
andl $0x1, %ecx
shll $0x4, %ecx
andl $-0x11, %eax
orl %ecx, %eax
movl %eax, 0x1894d(%rip)     # 0x204d0
movl 0x18947(%rip), %eax     # 0x204d0
andl $-0x9, %eax
orl $0x0, %eax
movl %eax, 0x1893b(%rip)     # 0x204d0
movl $0x200, %edi            # imm = 0x200
callq 0x4570
subl $0x1, %eax
movb %al, 0x18c38(%rip)      # 0x207e0
movl 0x18922(%rip), %eax     # 0x204d0
shrl $0x4, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x7bcf
movl 0x18911(%rip), %eax     # 0x204d0
andl $0xfffffeff, %eax       # imm = 0xFFFFFEFF
orl $0x100, %eax            # imm = 0x100
movl %eax, 0x18901(%rip)     # 0x204d0
movl 0x188fb(%rip), %eax     # 0x204d0
andl $-0x3, %eax
orl $0x0, %eax
movl %eax, 0x188ef(%rip)     # 0x204d0
movl 0x188e9(%rip), %eax     # 0x204d0
andl $-0x5, %eax
orl $0x0, %eax
movl %eax, 0x188dd(%rip)     # 0x204d0
movl 0x188d7(%rip), %eax     # 0x204d0
andl $-0x21, %eax
orl $0x0, %eax
movl %eax, 0x188cb(%rip)     # 0x204d0
testb $0x1, -0x9(%rbp)
jne 0x7c2d
movl 0x188bf(%rip), %eax     # 0x204d0
andl $0xfffffbff, %eax       # imm = 0xFFFFFBFF
orl $0x0, %eax
movl %eax, 0x188b1(%rip)     # 0x204d0
leaq 0x589a(%rip), %rax      # 0xd4c0
movq %rax, 0x18ba3(%rip)     # 0x207d0
movl $0x1, %edi
callq 0xdb10
jmp 0x7fa6
movl 0x1888e(%rip), %eax     # 0x204d0
andl $-0x3, %eax
orl $0x0, %eax
movl %eax, 0x18882(%rip)     # 0x204d0
movl 0x1887c(%rip), %eax     # 0x204d0
andl $-0x5, %eax
orl $0x0, %eax
movl %eax, 0x18870(%rip)     # 0x204d0
movl 0x1886a(%rip), %eax     # 0x204d0
andl $-0x9, %eax
orl $0x0, %eax
movl %eax, 0x1885e(%rip)     # 0x204d0
movl 0x18858(%rip), %eax     # 0x204d0
andl $-0x11, %eax
orl $0x0, %eax
movl %eax, 0x1884c(%rip)     # 0x204d0
movl 0x18846(%rip), %eax     # 0x204d0
andl $-0x21, %eax
orl $0x0, %eax
movl %eax, 0x1883a(%rip)     # 0x204d0
movl 0x18834(%rip), %eax     # 0x204d0
andl $0xfffffbff, %eax       # imm = 0xFFFFFBFF
orl $0x0, %eax
movl %eax, 0x18826(%rip)     # 0x204d0
movl 0x18820(%rip), %eax     # 0x204d0
andl $0xfffff7ff, %eax       # imm = 0xFFFFF7FF
orl $0x0, %eax
movl %eax, 0x18812(%rip)     # 0x204d0
leaq 0x57fb(%rip), %rax      # 0xd4c0
movq %rax, 0x18b04(%rip)     # 0x207d0
leaq 0x5d6d(%rip), %rax      # 0xda40
movq %rax, 0x18afe(%rip)     # 0x207d8
jmp 0x7fa6
movl 0x187eb(%rip), %ecx     # 0x204d0
shrl $0x5, %ecx
andl $0x1, %ecx
xorl $0x1, %ecx
movl 0x187dc(%rip), %eax     # 0x204d0
andl $0x1, %ecx
shll $0x5, %ecx
andl $-0x21, %eax
orl %ecx, %eax
movl %eax, 0x187cb(%rip)     # 0x204d0
movl 0x187c5(%rip), %eax     # 0x204d0
andl $-0x5, %eax
orl $0x0, %eax
movl %eax, 0x187b9(%rip)     # 0x204d0
movl 0x187b3(%rip), %eax     # 0x204d0
andl $-0x3, %eax
orl $0x0, %eax
movl %eax, 0x187a7(%rip)     # 0x204d0
movl 0x187a1(%rip), %eax     # 0x204d0
andl $-0x9, %eax
orl $0x0, %eax
movl %eax, 0x18795(%rip)     # 0x204d0
movl 0x1878f(%rip), %eax     # 0x204d0
andl $-0x11, %eax
orl $0x0, %eax
movl %eax, 0x18783(%rip)     # 0x204d0
movl 0x1877d(%rip), %eax     # 0x204d0
andl $0xfffffbff, %eax       # imm = 0xFFFFFBFF
orl $0x0, %eax
movl %eax, 0x1876f(%rip)     # 0x204d0
leaq 0x5758(%rip), %rax      # 0xd4c0
movq %rax, 0x18a61(%rip)     # 0x207d0
jmp 0x7fa6
movl 0x18756(%rip), %ecx     # 0x204d0
shrl $0xa, %ecx
andl $0x1, %ecx
xorl $0x1, %ecx
movl 0x18747(%rip), %eax     # 0x204d0
andl $0x1, %ecx
shll $0xa, %ecx
andl $0xfffffbff, %eax       # imm = 0xFFFFFBFF
orl %ecx, %eax
movl %eax, 0x18734(%rip)     # 0x204d0
movl 0x1872e(%rip), %edx     # 0x204d0
shrl $0xa, %edx
andl $0x1, %edx
leaq 0x5711(%rip), %rax      # 0xd4c0
leaq 0x568a(%rip), %rcx      # 0xd440
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, 0x18a0c(%rip)     # 0x207d0
jmp 0x7fa6
movl 0x18701(%rip), %ecx     # 0x204d0
shrl $0x2, %ecx
andl $0x1, %ecx
xorl $0x1, %ecx
movl 0x186f2(%rip), %eax     # 0x204d0
andl $0x1, %ecx
shll $0x2, %ecx
andl $-0x5, %eax
orl %ecx, %eax
movl %eax, 0x186e1(%rip)     # 0x204d0
movl 0x186db(%rip), %eax     # 0x204d0
andl $-0x3, %eax
orl $0x0, %eax
movl %eax, 0x186cf(%rip)     # 0x204d0
movl 0x186c9(%rip), %eax     # 0x204d0
andl $-0x9, %eax
orl $0x0, %eax
movl %eax, 0x186bd(%rip)     # 0x204d0
movl 0x186b7(%rip), %eax     # 0x204d0
andl $-0x11, %eax
orl $0x0, %eax
movl %eax, 0x186ab(%rip)     # 0x204d0
movl 0x186a5(%rip), %eax     # 0x204d0
andl $-0x21, %eax
orl $0x0, %eax
movl %eax, 0x18699(%rip)     # 0x204d0
movl 0x18693(%rip), %eax     # 0x204d0
andl $0xfffffbff, %eax       # imm = 0xFFFFFBFF
orl $0x0, %eax
movl %eax, 0x18685(%rip)     # 0x204d0
leaq 0x566e(%rip), %rax      # 0xd4c0
movq %rax, 0x18977(%rip)     # 0x207d0
jmp 0x7fa6
movl 0x1866c(%rip), %ecx     # 0x204d0
shrl %ecx
andl $0x1, %ecx
xorl $0x1, %ecx
movl 0x1865e(%rip), %eax     # 0x204d0
andl $0x1, %ecx
shll %ecx
andl $-0x3, %eax
orl %ecx, %eax
movl %eax, 0x1864e(%rip)     # 0x204d0
movl 0x18648(%rip), %eax     # 0x204d0
andl $-0x5, %eax
orl $0x0, %eax
movl %eax, 0x1863c(%rip)     # 0x204d0
movl 0x18636(%rip), %eax     # 0x204d0
andl $-0x9, %eax
orl $0x0, %eax
movl %eax, 0x1862a(%rip)     # 0x204d0
movl 0x18624(%rip), %eax     # 0x204d0
andl $-0x11, %eax
orl $0x0, %eax
movl %eax, 0x18618(%rip)     # 0x204d0
movl 0x18612(%rip), %eax     # 0x204d0
andl $-0x21, %eax
orl $0x0, %eax
movl %eax, 0x18606(%rip)     # 0x204d0
movl 0x18600(%rip), %eax     # 0x204d0
andl $0xfffffbff, %eax       # imm = 0xFFFFFBFF
orl $0x0, %eax
movl %eax, 0x185f2(%rip)     # 0x204d0
leaq 0x55db(%rip), %rax      # 0xd4c0
movq %rax, 0x188e4(%rip)     # 0x207d0
jmp 0x7fa6
movl 0x185d9(%rip), %ecx     # 0x204d0
shrl $0xb, %ecx
andl $0x1, %ecx
xorl $0x1, %ecx
movl 0x185ca(%rip), %eax     # 0x204d0
andl $0x1, %ecx
shll $0xb, %ecx
andl $0xfffff7ff, %eax       # imm = 0xFFFFF7FF
orl %ecx, %eax
movl %eax, 0x185b7(%rip)     # 0x204d0
movl 0x185b1(%rip), %edx     # 0x204d0
shrl $0xb, %edx
andl $0x1, %edx
leaq 0x5b14(%rip), %rax      # 0xda40
leaq 0x584d(%rip), %rcx      # 0xd780
cmpl $0x0, %edx
cmovneq %rcx, %rax
movq %rax, 0x18897(%rip)     # 0x207d8
movl 0x18589(%rip), %eax     # 0x204d0
andl $-0x3, %eax
orl $0x0, %eax
movl %eax, 0x1857d(%rip)     # 0x204d0
movl 0x18577(%rip), %eax     # 0x204d0
andl $-0x5, %eax
orl $0x0, %eax
movl %eax, 0x1856b(%rip)     # 0x204d0
movl 0x18565(%rip), %eax     # 0x204d0
andl $-0x9, %eax
orl $0x0, %eax
movl %eax, 0x18559(%rip)     # 0x204d0
movl 0x18553(%rip), %eax     # 0x204d0
andl $-0x11, %eax
orl $0x0, %eax
movl %eax, 0x18547(%rip)     # 0x204d0
movl 0x18541(%rip), %eax     # 0x204d0
andl $-0x21, %eax
orl $0x0, %eax
movl %eax, 0x18535(%rip)     # 0x204d0
jmp 0x7fa6
movl $0x0, -0x4(%rbp)
jmp 0x7ff5
testb $0x1, -0xa(%rbp)
je 0x7fd0
movl 0x1851e(%rip), %eax     # 0x204d0
andl $0xfffffbff, %eax       # imm = 0xFFFFFBFF
orl $0x400, %eax            # imm = 0x400
movl %eax, 0x1850e(%rip)     # 0x204d0
leaq 0x5477(%rip), %rax      # 0xd440
movq %rax, 0x18800(%rip)     # 0x207d0
movl -0x8(%rbp), %eax
movb %al, %dl
movl 0x184f5(%rip), %eax     # 0x204d0
shrl $0xd, %eax
andl $0x7, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x223d8(%rip), %rax     # 0x2a3c4
movb %dl, (%rax,%rcx)
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nop