// File: /workspace/github_c_makefile_star2_O1/jebaum[P]st/st.c
// Function: strhandle
void
strhandle(void)
{
	char *p = NULL, *dec;
	int j, narg, par;

	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:
			if (narg < 2)
				break;

			p = strescseq.args[1];

			if (!strcmp(p, "?"))
				osc_color_response(defaultfg, 10);
			else if (xsetcolorname(defaultfg, p))
				fprintf(stderr, "erresc: invalid foreground color: %s\n", p);
			else
				redraw();
			return;
		case 11:
			if (narg < 2)
				break;

			p = strescseq.args[1];

			if (!strcmp(p, "?"))
				osc_color_response(defaultbg, 11);
			else if (xsetcolorname(defaultbg, p))
				fprintf(stderr, "erresc: invalid background color: %s\n", p);
			else
				redraw();
			return;
		case 12:
			if (narg < 2)
				break;

			p = strescseq.args[1];

			if (!strcmp(p, "?"))
				osc_color_response(defaultcs, 12);
			else if (xsetcolorname(defaultcs, p))
				fprintf(stderr, "erresc: invalid cursor color: %s\n", p);
			else
				redraw();
			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, "?"))
				osc4_color_response(j);
			else if (xsetcolorname(j, p)) {
				if (par == 104 && narg <= 1)
					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
				 */
				redraw();
			}
			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 %rbx
pushq %rax
andb $-0x15, 0x10dd0(%rip)   # 0x1a788
movq 0x12e01(%rip), %rcx     # 0x1c7c0
movl $0x0, 0x12e8f(%rip)     # 0x1c858
movq 0x12e00(%rip), %rax     # 0x1c7d0
movb $0x0, (%rcx,%rax)
cmpb $0x0, (%rcx)
je 0x9a0f
xorl %eax, %eax
leaq 0x12dd6(%rip), %rdx     # 0x1c7b8
movq %rcx, 0x20(%rdx,%rax,8)
incq %rax
incq %rcx
movzbl -0x1(%rcx), %esi
testl %esi, %esi
je 0x9a09
cmpl $0x3b, %esi
jne 0x99ea
movb $0x0, -0x1(%rcx)
cmpq $0x10, %rax
jne 0x99e2
movl $0x10, %eax
movl %eax, 0x12e49(%rip)     # 0x1c858
movl 0x12e42(%rip), %r15d    # 0x1c858
testl %r15d, %r15d
je 0x9a2b
movq 0x12db6(%rip), %rdi     # 0x1c7d8
callq 0x54b0
movl %eax, %ebx
jmp 0x9a2d
xorl %ebx, %ebx
movzbl 0x12d84(%rip), %eax     # 0x1c7b8
cmpl $0x5d, %eax
jle 0x9a64
leal -0x5e(%rax), %ecx
cmpl $0x2, %ecx
jb 0x9cec
cmpl $0x6b, %eax
jne 0x9ce7
movq 0x12d83(%rip), %rdi     # 0x1c7d8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xafff
cmpl $0x50, %eax
je 0x9cec
cmpl $0x5d, %eax
jne 0x9ce7
cmpl $0xc, %ebx
ja 0x9aa8
movl %ebx, %eax
leaq 0x5800(%rip), %rcx      # 0xf284
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x2, %r15d
jl 0x9cec
movq 0x12d42(%rip), %rdi     # 0x1c7e0
callq 0xafff
jmp 0x9bf3
cmpl $0x34, %ebx
je 0x9cad
cmpl $0x68, %ebx
jne 0x9ce7
xorl %r14d, %r14d
jmp 0x9c1a
cmpl $0x2, %r15d
jl 0x9ce7
movq 0x12d0d(%rip), %rbx     # 0x1c7e0
leaq 0x5de8(%rip), %rsi      # 0xf8c2
movq %rbx, %rdi
callq 0x5660
leaq 0xca0b(%rip), %rcx      # 0x164f4
movl (%rcx), %edi
testl %eax, %eax
je 0x9d08
movq %rbx, %rsi
callq 0xac04
testl %eax, %eax
je 0x9c9e
movq 0xc4e6(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x5dfc(%rip), %rsi      # 0xf910
jmp 0x9bbf
cmpl $0x2, %r15d
jl 0x9ce7
movq 0x12cb6(%rip), %rbx     # 0x1c7e0
leaq 0x5d91(%rip), %rsi      # 0xf8c2
movq %rbx, %rdi
callq 0x5660
leaq 0xc9ac(%rip), %rcx      # 0x164ec
movl (%rcx), %edi
testl %eax, %eax
je 0x9d0f
movq %rbx, %rsi
callq 0xac04
testl %eax, %eax
je 0x9c9e
movq 0xc48f(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x5d59(%rip), %rsi      # 0xf8c4
jmp 0x9bbf
cmpl $0x2, %r15d
jl 0x9ce7
movq 0x12c62(%rip), %rbx     # 0x1c7e0
leaq 0x5d3d(%rip), %rsi      # 0xf8c2
movq %rbx, %rdi
callq 0x5660
leaq 0xc95c(%rip), %rcx      # 0x164f0
movl (%rcx), %edi
testl %eax, %eax
je 0x9d16
movq %rbx, %rsi
callq 0xac04
testl %eax, %eax
je 0x9c9e
movq 0xc43b(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x5d2b(%rip), %rsi      # 0xf8ea
movq %rbx, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5870
cmpl $0x2, %r15d
jl 0x9cec
movq 0x12bfc(%rip), %rdi     # 0x1c7e0
jmp 0x9a55
cmpl $0x2, %r15d
jl 0x9cec
movq 0x12be6(%rip), %rdi     # 0x1c7e0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xaf7c
cmpl $0x3, %r15d
jl 0x9ce7
movq 0x12bce(%rip), %r14     # 0x1c7e8
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $0x2, %r15d
jl 0x9c33
movq 0x12bb4(%rip), %rdi     # 0x1c7e0
callq 0x54b0
movl %eax, %ebp
testq %r14, %r14
je 0x9c4f
leaq 0x5c83(%rip), %rsi      # 0xf8c2
movq %r14, %rdi
callq 0x5660
testl %eax, %eax
je 0x9cf7
movl %ebp, %edi
movq %r14, %rsi
callq 0xac04
testl %eax, %eax
je 0x9c9e
cmpl $0x1, %r15d
jg 0x9c6c
cmpl $0x68, %ebx
je 0x9cec
testq %r14, %r14
movq 0xc37a(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x5cd4(%rip), %rcx      # 0xf954
cmovneq %r14, %rcx
leaq 0x5ca7(%rip), %rsi      # 0xf932
movl %ebp, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5870
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x81f6
cmpl $0x3, %r15d
jl 0x9cec
leaq 0x12e4e(%rip), %rax     # 0x1cb08
cmpl $0x0, (%rax)
je 0x9cec
movq 0x12b22(%rip), %rdi     # 0x1c7e8
callq 0x9dba
testq %rax, %rax
je 0x9d2a
movq %rax, %rdi
callq 0xa93a
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xa8d8
callq 0x5ca3
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %ebp, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x7991
movl $0xc, %esi
jmp 0x9d1b
movl $0xa, %esi
jmp 0x9d1b
movl $0xb, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x7a24
callq 0x5c87
jmp 0x9cec