// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x80, %rsp
movq $0x0, -0x8(%rbp)
leaq 0xd712(%rip), %rax      # 0x197ac
movl (%rax), %eax
movl %eax, -0x50(%rbp)
leaq 0x8a56(%rip), %rax      # 0x14afc
movq %rax, -0x48(%rbp)
leaq 0xd6ff(%rip), %rax      # 0x197b0
movl (%rax), %eax
movl %eax, -0x40(%rbp)
leaq 0x8a4a(%rip), %rax      # 0x14b07
movq %rax, -0x38(%rbp)
leaq 0xd6ec(%rip), %rax      # 0x197b4
movl (%rax), %eax
movl %eax, -0x30(%rbp)
leaq 0x8a3e(%rip), %rax      # 0x14b12
movq %rax, -0x28(%rbp)
movl 0x13fda(%rip), %eax     # 0x200b8
andl $-0x15, %eax
movl %eax, 0x13fd1(%rip)     # 0x200b8
callq 0xc4c0
movl 0x160a6(%rip), %eax     # 0x22198
movl %eax, -0x18(%rbp)
cmpl $0x0, %eax
je 0xc10b
movq 0x16017(%rip), %rdi     # 0x22118
callq 0x65e0
movl %eax, -0x54(%rbp)
jmp 0xc112
xorl %eax, %eax
movl %eax, -0x54(%rbp)
jmp 0xc112
movl -0x54(%rbp), %eax
movl %eax, -0x1c(%rbp)
movsbl 0x15fd9(%rip), %eax     # 0x220f8
addl $-0x50, %eax
movl %eax, %ecx
movq %rcx, -0x60(%rbp)
subl $0x1b, %eax
ja 0xc402
movq -0x60(%rbp), %rax
leaq 0x83f8(%rip), %rcx      # 0x14534
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x1c(%rbp), %eax
movl %eax, -0x64(%rbp)
testl %eax, %eax
je 0xc19f
jmp 0xc151
movl -0x64(%rbp), %eax
subl $0x1, %eax
je 0xc1c2
jmp 0xc15b
movl -0x64(%rbp), %eax
subl $0x2, %eax
je 0xc1d9
jmp 0xc165
movl -0x64(%rbp), %eax
subl $0x4, %eax
je 0xc309
jmp 0xc173
movl -0x64(%rbp), %eax
addl $-0xa, %eax
subl $0x3, %eax
jb 0xc248
jmp 0xc184
movl -0x64(%rbp), %eax
subl $0x34, %eax
je 0xc1f0
jmp 0xc18e
movl -0x64(%rbp), %eax
subl $0x68, %eax
je 0xc31f
jmp 0xc3f0
cmpl $0x1, -0x18(%rbp)
jle 0xc1bd
movq 0x15f74(%rip), %rdi     # 0x22120
callq 0xea90
movq 0x15f68(%rip), %rdi     # 0x22120
callq 0xe9f0
jmp 0xc41f
cmpl $0x1, -0x18(%rbp)
jle 0xc1d4
movq 0x15f51(%rip), %rdi     # 0x22120
callq 0xe9f0
jmp 0xc41f
cmpl $0x1, -0x18(%rbp)
jle 0xc1eb
movq 0x15f3a(%rip), %rdi     # 0x22120
callq 0xea90
jmp 0xc41f
cmpl $0x2, -0x18(%rbp)
jle 0xc243
leaq 0x1624b(%rip), %rax     # 0x22448
cmpl $0x0, (%rax)
je 0xc243
movq 0x15f1f(%rip), %rdi     # 0x22128
callq 0xc580
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0xc229
movq -0x10(%rbp), %rdi
callq 0xdd00
callq 0xdc70
jmp 0xc241
movq 0xcdc0(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
leaq 0x88df(%rip), %rsi      # 0x14b19
movb $0x0, %al
callq 0x69d0
jmp 0xc243
jmp 0xc41f
cmpl $0x2, -0x18(%rbp)
jge 0xc253
jmp 0xc3f0
movq 0x15ec6(%rip), %rax     # 0x22120
movq %rax, -0x8(%rbp)
movl -0x1c(%rbp), %eax
subl $0xa, %eax
movl %eax, -0x14(%rbp)
cmpl $0x0, %eax
jl 0xc276
movslq -0x14(%rbp), %rax
cmpq $0x3, %rax
jb 0xc27b
jmp 0xc3f0
movq -0x8(%rbp), %rdi
leaq 0x88ab(%rip), %rsi      # 0x14b31
callq 0x6770
cmpl $0x0, %eax
jne 0xc2ad
movl -0x1c(%rbp), %edi
movslq -0x14(%rbp), %rcx
leaq -0x50(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %esi
xorl %edx, %edx
callq 0xc700
jmp 0xc304
movslq -0x14(%rbp), %rcx
leaq -0x50(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %edi
movq -0x8(%rbp), %rsi
callq 0xe0c0
cmpl $0x0, %eax
je 0xc2fd
movq 0xcd1d(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
movslq -0x14(%rbp), %rcx
leaq -0x50(%rbp), %rax
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdx
movq -0x8(%rbp), %rcx
leaq 0x883f(%rip), %rsi      # 0x14b33
movb $0x0, %al
callq 0x69d0
jmp 0xc302
callq 0x91d0
jmp 0xc304
jmp 0xc41f
cmpl $0x3, -0x18(%rbp)
jge 0xc314
jmp 0xc3f0
movq 0x15e0d(%rip), %rax     # 0x22128
movq %rax, -0x8(%rbp)
cmpl $0x1, -0x18(%rbp)
jle 0xc336
movq 0x15df4(%rip), %rdi     # 0x22120
callq 0x65e0
movl %eax, -0x68(%rbp)
jmp 0xc340
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, -0x68(%rbp)
jmp 0xc340
movl -0x68(%rbp), %eax
movl %eax, -0x14(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xc373
movq -0x8(%rbp), %rdi
leaq 0x87d9(%rip), %rsi      # 0x14b31
callq 0x6770
cmpl $0x0, %eax
jne 0xc373
movl -0x14(%rbp), %edi
xorl %esi, %esi
movl $0x1, %edx
callq 0xc700
jmp 0xc3ee
movl -0x14(%rbp), %edi
movq -0x8(%rbp), %rsi
callq 0xe0c0
cmpl $0x0, %eax
je 0xc3e7
cmpl $0x68, -0x1c(%rbp)
jne 0xc39a
cmpl $0x1, -0x18(%rbp)
jg 0xc39a
callq 0xdda0
jmp 0xc41f
movq 0xcc4f(%rip), %rax      # 0x18ff0
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x6c(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xc3bf
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
jmp 0xc3cc
leaq 0x87ad(%rip), %rax      # 0x14b73
movq %rax, -0x80(%rbp)
jmp 0xc3cc
movl -0x6c(%rbp), %edx
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rcx
leaq 0x8773(%rip), %rsi      # 0x14b51
movb $0x0, %al
callq 0x69d0
jmp 0xc3ec
callq 0x91d0
jmp 0xc3ee
jmp 0xc41f
jmp 0xc402
movq 0x15d1f(%rip), %rdi     # 0x22118
callq 0xea90
jmp 0xc41f
jmp 0xc41f
movq 0xcbe7(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
leaq 0x8767(%rip), %rsi      # 0x14b7a
movb $0x0, %al
callq 0x69d0
callq 0xc880
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)