// File: /workspace/github_c_makefile_star2_O2/odknt[P]st/st.c
// Function: strhandle
void
strhandle(void)
{
	char *p = NULL, *dec;
	int j, narg, par;
	const struct { int idx; char *str; } osc_table[] = {
		{ defaultfg, "foreground" },
		{ defaultbg, "background" },
		{ defaultcs, "cursor" }
	};

	term.esc &= ~(ESC_STR_END|ESC_STR);
	strparse();
	par = (narg = strescseq.narg) ? atoi(strescseq.args[0]) : 0;

	switch (strescseq.type) {
	case ']': /* OSC -- Operating System Command */
		switch (par) {
		case 0:
			if (narg > 1) {
				xsettitle(strescseq.args[1]);
				xseticontitle(strescseq.args[1]);
			}
			return;
		case 1:
			if (narg > 1)
				xseticontitle(strescseq.args[1]);
			return;
		case 2:
			if (narg > 1)
				xsettitle(strescseq.args[1]);
			return;
		case 52:
			if (narg > 2 && allowwindowops) {
				dec = base64dec(strescseq.args[2]);
				if (dec) {
					xsetsel(dec);
					xclipcopy();
				} else {
					fprintf(stderr, "erresc: invalid base64\n");
				}
			}
			return;
		case 10:
		case 11:
		case 12:
			if (narg < 2)
				break;
			p = strescseq.args[1];
			if ((j = par - 10) < 0 || j >= LEN(osc_table))
				break; /* shouldn't be possible */

			if (!strcmp(p, "?")) {
				osc_color_response(par, osc_table[j].idx, 0);
			} else if (xsetcolorname(osc_table[j].idx, p)) {
				fprintf(stderr, "erresc: invalid %s color: %s\n",
				        osc_table[j].str, p);
			} else {
				tfulldirt();
			}
			return;
		case 4: /* color set */
			if (narg < 3)
				break;
			p = strescseq.args[2];
			/* FALLTHROUGH */
		case 104: /* color reset */
			j = (narg > 1) ? atoi(strescseq.args[1]) : -1;

			if (p && !strcmp(p, "?")) {
				osc_color_response(j, 0, 1);
			} else if (xsetcolorname(j, p)) {
				if (par == 104 && narg <= 1) {
					xloadcols();
					return; /* color reset without parameter */
				}
				fprintf(stderr, "erresc: invalid color j=%d, p=%s\n",
				        j, p ? p : "(null)");
			} else {
				/*
				 * TODO if defaultbg color is changed, borders
				 * are dirty
				 */
				tfulldirt();
			}
			return;
		}
		break;
	case 'k': /* old title set compatibility */
		xsettitle(strescseq.args[0]);
		return;
	case 'P': /* DCS -- Device Control String */
	case '_': /* APC -- Application Program Command */
	case '^': /* PM -- Privacy Message */
		return;
	}

	fprintf(stderr, "erresc: unknown str ");
	strdump();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
leaq 0xd133(%rip), %rax      # 0x175bc
movl (%rax), %eax
movl %eax, 0x10(%rsp)
leaq 0x63b4(%rip), %rax      # 0x1084a
movq %rax, 0x18(%rsp)
leaq 0xd11e(%rip), %rax      # 0x175c0
movl (%rax), %eax
movl %eax, 0x20(%rsp)
leaq 0x63a6(%rip), %rax      # 0x10855
movq %rax, 0x28(%rsp)
leaq 0xd109(%rip), %rax      # 0x175c4
movl (%rax), %eax
movl %eax, 0x30(%rsp)
leaq 0x6398(%rip), %rax      # 0x10860
movq %rax, 0x38(%rsp)
andb $-0x15, 0x11e54(%rip)   # 0x1c328
movq 0x13e95(%rip), %rax     # 0x1e370
andl $0x0, 0x13f26(%rip)     # 0x1e408
movq 0x13e97(%rip), %rcx     # 0x1e380
movb $0x0, (%rax,%rcx)
cmpb $0x0, (%rax)
je 0xa545
xorl %r12d, %r12d
leaq 0x13e6c(%rip), %rcx     # 0x1e368
cmpq $0x10, %r12
je 0xa539
movq %rax, 0x20(%rcx,%r12,8)
incq %r12
incq %rax
movzbl -0x1(%rax), %edx
cmpl $0x3b, %edx
je 0xa51c
testl %edx, %edx
jne 0xa50a
jmp 0xa522
movb $0x0, -0x1(%rax)
jmp 0xa4fc
movl %r12d, 0x13edf(%rip)    # 0x1e408
movq 0x13e58(%rip), %rdi     # 0x1e388
callq 0x65e0
movl %eax, %ebx
jmp 0xa54a
movl %r12d, 0x13ec8(%rip)    # 0x1e408
testl %r12d, %r12d
jne 0xa529
xorl %r12d, %r12d
xorl %ebx, %ebx
movzbl 0x13e17(%rip), %eax     # 0x1e368
leal -0x5e(%rax), %ecx
cmpl $0x2, %ecx
jb 0xa7e2
cmpl $0x50, %eax
je 0xa7e2
cmpl $0x6b, %eax
je 0xa607
cmpl $0x5d, %eax
jne 0xa7f1
cmpl $0xc, %ebx
ja 0xa621
movl %ebx, %eax
leaq 0x5dc2(%rip), %rcx      # 0x1034c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x2, %r12d
jl 0xa7f1
movq 0x13dec(%rip), %r14     # 0x1e390
leal -0xa(%rbx), %r15d
cmpb $0x3f, (%r14)
jne 0xa5b9
cmpb $0x0, 0x1(%r14)
je 0xa92f
shlq $0x4, %r15
movl 0x10(%rsp,%r15), %edi
movq %r14, %rsi
callq 0xb552
testl %eax, %eax
je 0xa91c
leaq (%rsp,%r15), %rax
addq $0x10, %rax
movq 0xca0f(%rip), %rcx      # 0x16ff0
movq (%rcx), %rdi
movq 0x8(%rax), %rdx
leaq 0x6290(%rip), %rsi      # 0x1087f
movq %r14, %rcx
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x69d0
movq 0x13d7a(%rip), %rdi     # 0x1e388
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xbc82
cmpl $0x34, %ebx
je 0xa6db
cmpl $0x68, %ebx
jne 0xa7f1
xorl %r14d, %r14d
cmpl $0x2, %r12d
jge 0xa6ab
pushq $-0x1
popq %rbp
leaq 0x6279(%rip), %r15      # 0x108bf
jmp 0xa8e8
cmpl $0x2, %r12d
jl 0xa7e2
movq 0x13d34(%rip), %rdi     # 0x1e390
callq 0xbc82
jmp 0xa680
cmpl $0x2, %r12d
jl 0xa7e2
movq 0x13d1c(%rip), %rdi     # 0x1e390
jmp 0xa60e
cmpl $0x2, %r12d
jl 0xa7e2
movq 0x13d09(%rip), %rdi     # 0x1e390
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xbc08
cmpl $0x3, %r12d
jl 0xa7f1
movq 0x13ced(%rip), %r14     # 0x1e398
movq 0x13cde(%rip), %rdi     # 0x1e390
callq 0x65e0
movl %eax, %ebp
testq %r14, %r14
je 0xa8de
cmpb $0x3f, (%r14)
jne 0xa6d3
cmpb $0x0, 0x1(%r14)
je 0xa93e
movq %r14, %r15
jmp 0xa8e8
cmpl $0x3, %r12d
jl 0xa7e2
leaq 0x13fcc(%rip), %rax     # 0x1e6b8
cmpl $0x0, (%rax)
je 0xa7e2
movq 0x13c9c(%rip), %r15     # 0x1e398
movq %rsp, %rax
movq %r15, (%rax)
movq %r15, %rdi
callq 0x6410
addq $0x3, %rax
shrq $0x2, %rax
leaq (%rax,%rax,2), %rdi
incq %rdi
callq 0x6bcc
movq %rax, %r13
leaq 0x2(%rax), %rbp
movq %rax, 0x8(%rsp)
cmpb $0x0, (%r15)
je 0xa958
movq %rsp, %r12
movq %r12, %rdi
callq 0xab7f
movzbl %al, %eax
leaq 0x5d57(%rip), %rbx      # 0x104a0
movb (%rax,%rbx), %r14b
movq %r12, %rdi
callq 0xab7f
movzbl %al, %eax
movb (%rax,%rbx), %r15b
movq %r12, %rdi
callq 0xab7f
movzbl %al, %eax
movb (%rax,%rbx), %bl
movq %r12, %rdi
callq 0xab7f
cmpb $-0x1, %r14b
je 0xa95e
cmpb $-0x1, %r15b
je 0xa95e
movzbl %al, %eax
leaq 0x5d10(%rip), %rcx      # 0x104a0
movb (%rax,%rcx), %al
shlb $0x2, %r14b
movl %r15d, %ecx
shrb $0x4, %cl
andb $0x3, %cl
orb %r14b, %cl
movb %cl, -0x2(%rbp)
cmpb $-0x1, %bl
je 0xa963
shlb $0x4, %r15b
movl %ebx, %ecx
shrb $0x2, %cl
andb $0xf, %cl
orb %r15b, %cl
movb %cl, -0x1(%rbp)
cmpb $-0x1, %al
je 0xa966
shlb $0x6, %bl
orb %bl, %al
addq $0x3, %r13
movb %al, (%rbp)
movq (%rsp), %r15
addq $0x3, %rbp
jmp 0xa72a
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xc7f8(%rip), %r12      # 0x16ff0
movq (%r12), %rcx
leaq 0x60c3(%rip), %rdi      # 0x108c6
pushq $0x14
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x6950
movq (%r12), %rdi
movsbl 0x13b4c(%rip), %edx     # 0x1e368
leaq 0x615a(%rip), %rsi      # 0x1097d
xorl %eax, %eax
callq 0x69d0
pushq $0x4
popq %r15
leaq 0x615d(%rip), %rbp      # 0x10992
xorl %r13d, %r13d
cmpq 0x13b41(%rip), %r13     # 0x1e380
jae 0xa9b7
movq 0x13b24(%rip), %rax     # 0x1e370
movzbl (%rax,%r13), %r14d
testl %r14d, %r14d
je 0xa8c4
callq 0x6460
movq (%rax), %rax
testb $0x40, 0x1(%rax,%r14,2)
movq (%r12), %rcx
je 0xa87a
movl %r14d, %edi
movq %rcx, %rsi
callq 0x6620
incq %r13
jmp 0xa838
cmpl $0x1b, %r14d
je 0xa89e
cmpl $0xd, %r14d
je 0xa895
cmpl $0xa, %r14d
jne 0xa8b2
leaq 0x60f0(%rip), %rdi      # 0x10983
jmp 0xa8a5
leaq 0x60ec(%rip), %rdi      # 0x10988
jmp 0xa8a5
leaq 0x60e8(%rip), %rdi      # 0x1098d
movq %r15, %rsi
movq %rbx, %rdx
callq 0x6950
jmp 0xa875
movq %rcx, %rdi
movq %rbp, %rsi
movl %r14d, %edx
xorl %eax, %eax
callq 0x69d0
jmp 0xa875
movq (%r12), %rsi
pushq $0xa
popq %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6620
leaq 0x5fda(%rip), %r15      # 0x108bf
xorl %r14d, %r14d
movl %ebp, %edi
movq %r14, %rsi
callq 0xb552
testl %eax, %eax
je 0xa91c
cmpl $0x1, %r12d
jg 0xa98c
cmpl $0x68, %ebx
jne 0xa98c
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb343
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x849c
shlq $0x4, %r15
movl 0x10(%rsp,%r15), %esi
movl %ebx, %edi
xorl %edx, %edx
jmp 0xa945
pushq $0x1
popq %rdx
movl %ebp, %edi
xorl %esi, %esi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaa6e
addq $-0x2, %rbp
jmp 0xa966
movq %r13, %rbp
jmp 0xa966
decq %rbp
movb $0x0, (%rbp)
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0xa9c6
callq 0xb2db
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb27c
movq 0xc65d(%rip), %rax      # 0x16ff0
movq (%rax), %rdi
leaq 0x5f00(%rip), %rsi      # 0x1089d
movl %ebp, %edx
movq %r15, %rcx
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x69d0
movq (%r12), %rcx
leaq 0x5fd7(%rip), %rdi      # 0x10999
pushq $0x5
jmp 0xa9d9
movq 0xc623(%rip), %rax      # 0x16ff0
movq (%rax), %rcx
leaq 0x5e90(%rip), %rdi      # 0x10867
pushq $0x17
popq %rsi
pushq $0x1
popq %rdx
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6950