// File: /workspace/github_c_makefile_star2_O3/mrdotx[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
				tfulldirt();
			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
				tfulldirt();
			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
				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, "?"))
				osc4_color_response(j);
			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 */
		/* https://gitlab.com/gnachman/iterm2/-/wikis/synchronized-updates-spec */
		if (strstr(strescseq.buf, "=1s") == strescseq.buf)
			tsync_begin();  /* BSU */
		else if (strstr(strescseq.buf, "=2s") == strescseq.buf)
			tsync_end();  /* ESU */
		return;
	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, 0xf9f3(%rip)    # 0x1b500
movq 0x11b8c(%rip), %r14     # 0x1d6a0
movl $0x0, 0x11c1a(%rip)     # 0x1d738
movq 0x11b8b(%rip), %rax     # 0x1d6b0
movb $0x0, (%r14,%rax)
cmpb $0x0, (%r14)
je 0xbb7c
xorl %r15d, %r15d
leaq 0x11b5e(%rip), %rax     # 0x1d698
movq %r14, %rcx
movq %rcx, 0x20(%rax,%r15,8)
incq %r15
incq %rcx
movzbl -0x1(%rcx), %edx
testl %edx, %edx
je 0xbb65
cmpl $0x3b, %edx
jne 0xbb45
movb $0x0, -0x1(%rcx)
cmpq $0x10, %r15
jne 0xbb3d
movl $0x10, %r15d
movl %r15d, 0x11bcc(%rip)    # 0x1d738
movq 0x11b45(%rip), %rdi     # 0x1d6b8
callq 0x64d0
movl %eax, %ebx
jmp 0xbb81
xorl %r15d, %r15d
xorl %ebx, %ebx
movzbl 0x11b10(%rip), %eax     # 0x1d698
cmpl $0x5d, %eax
jle 0xbba0
leal -0x5e(%rax), %ecx
cmpl $0x2, %ecx
jae 0xbbe0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x50, %eax
je 0xbbff
cmpl $0x5d, %eax
jne 0xc157
cmpl $0xc, %ebx
ja 0xbc52
movl %ebx, %eax
leaq 0x6704(%rip), %rcx      # 0x122c4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x2, %r15d
jl 0xbb95
movq 0x11aea(%rip), %rdi     # 0x1d6c0
callq 0xd6af
jmp 0xc0c5
cmpl $0x6b, %eax
jne 0xc157
movq 0x11ac8(%rip), %rdi     # 0x1d6b8
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xd6af
cmpb $0x3d, (%r14)
jne 0xbb95
cmpb $0x31, 0x1(%r14)
jne 0xbc30
cmpb $0x73, 0x2(%r14)
jne 0xbc30
leaq 0xe8ae(%rip), %rsi      # 0x1a4c8
movl $0x1, %edi
callq 0x6130
movb $0x1, 0xe895(%rip)      # 0x1a4c0
jmp 0xbb95
cmpb $0x32, 0x1(%r14)
jne 0xbb95
cmpb $0x73, 0x2(%r14)
jne 0xbb95
movb $0x0, 0xe873(%rip)      # 0x1a4c0
jmp 0xbb95
cmpl $0x34, %ebx
je 0xc111
cmpl $0x68, %ebx
jne 0xc157
leaq 0x6d49(%rip), %r14      # 0x129b4
cmpl $0x2, %r15d
jl 0xc161
movq 0x11a44(%rip), %rdi     # 0x1d6c0
callq 0x64d0
movl %eax, %ebp
jmp 0xc16f
cmpl $0x2, %r15d
jl 0xc157
movq 0x11a27(%rip), %rbx     # 0x1d6c0
cmpb $0x3f, (%rbx)
jne 0xbca8
cmpb $0x0, 0x1(%rbx)
je 0xc2c4
leaq 0xd8e9(%rip), %rax      # 0x19598
movl (%rax), %edi
movq %rbx, %rsi
callq 0xd28a
testl %eax, %eax
jne 0xc339
movb $0x0, 0xe7f8(%rip)      # 0x1a4c0
movl 0xe83a(%rip), %eax      # 0x1a508
decl %eax
movl %eax, %ecx
sarl $0x1f, %ecx
andl %eax, %ecx
movq 0xf7ea(%rip), %rdx      # 0x1b4c8
movl %eax, %esi
negl %esi
cmovsl %eax, %esi
movslq %ecx, %rcx
leaq 0x4(%rsi), %rax
andq $-0x4, %rax
movq %rsi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
leaq (%rdx,%rcx,4), %rcx
addq $0xc, %rcx
xorl %edx, %edx
movdqa 0x6314(%rip), %xmm1     # 0x12020
movdqa 0x631c(%rip), %xmm2     # 0x12030
movdqa 0x6324(%rip), %xmm3     # 0x12040
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movq %rdx, %xmm5
pshufd $0x44, %xmm5, %xmm5     # xmm5 = xmm5[0,1,0,1]
movdqa %xmm5, %xmm6
por %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %esi
notl %esi
testb $0x1, %sil
je 0xbd6f
movl $0x1, -0xc(%rcx,%rdx,4)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %esi
testb $0x1, %sil
je 0xbd86
movl $0x1, -0x8(%rcx,%rdx,4)
por %xmm1, %xmm5
pxor %xmm3, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
pxor %xmm4, %xmm5
pextrw $0x0, %xmm5, %esi
testb $0x1, %sil
je 0xbdc3
movl $0x1, -0x4(%rcx,%rdx,4)
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0xbdd5
movl $0x1, (%rcx,%rdx,4)
addq $0x4, %rdx
cmpq %rdx, %rax
jne 0xbd24
jmp 0xbb95
cmpl $0x2, %r15d
jl 0xc157
movq 0x118c8(%rip), %rbx     # 0x1d6c0
cmpb $0x3f, (%rbx)
jne 0xbe07
cmpb $0x0, 0x1(%rbx)
je 0xc2d4
leaq 0xd782(%rip), %rax      # 0x19590
movl (%rax), %edi
movq %rbx, %rsi
callq 0xd28a
testl %eax, %eax
jne 0xc34c
movb $0x0, 0xe699(%rip)      # 0x1a4c0
movl 0xe6db(%rip), %eax      # 0x1a508
decl %eax
movl %eax, %ecx
sarl $0x1f, %ecx
andl %eax, %ecx
movq 0xf68b(%rip), %rdx      # 0x1b4c8
movl %eax, %esi
negl %esi
cmovsl %eax, %esi
movslq %ecx, %rcx
leaq 0x4(%rsi), %rax
andq $-0x4, %rax
movq %rsi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
leaq (%rdx,%rcx,4), %rcx
addq $0xc, %rcx
xorl %edx, %edx
movdqa 0x61b5(%rip), %xmm1     # 0x12020
movdqa 0x61bd(%rip), %xmm2     # 0x12030
movdqa 0x61c5(%rip), %xmm3     # 0x12040
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movq %rdx, %xmm5
pshufd $0x44, %xmm5, %xmm5     # xmm5 = xmm5[0,1,0,1]
movdqa %xmm5, %xmm6
por %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %esi
notl %esi
testb $0x1, %sil
je 0xbece
movl $0x1, -0xc(%rcx,%rdx,4)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %esi
testb $0x1, %sil
je 0xbee5
movl $0x1, -0x8(%rcx,%rdx,4)
por %xmm1, %xmm5
pxor %xmm3, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
pxor %xmm4, %xmm5
pextrw $0x0, %xmm5, %esi
testb $0x1, %sil
je 0xbf22
movl $0x1, -0x4(%rcx,%rdx,4)
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0xbf34
movl $0x1, (%rcx,%rdx,4)
addq $0x4, %rdx
cmpq %rdx, %rax
jne 0xbe83
jmp 0xbb95
cmpl $0x2, %r15d
jl 0xc157
movq 0x11769(%rip), %rbx     # 0x1d6c0
cmpb $0x3f, (%rbx)
jne 0xbf66
cmpb $0x0, 0x1(%rbx)
je 0xc2e4
leaq 0xd627(%rip), %rax      # 0x19594
movl (%rax), %edi
movq %rbx, %rsi
callq 0xd28a
testl %eax, %eax
jne 0xc35f
movb $0x0, 0xe53a(%rip)      # 0x1a4c0
movl 0xe57c(%rip), %eax      # 0x1a508
decl %eax
movl %eax, %ecx
sarl $0x1f, %ecx
andl %eax, %ecx
movq 0xf52c(%rip), %rdx      # 0x1b4c8
movl %eax, %esi
negl %esi
cmovsl %eax, %esi
movslq %ecx, %rcx
leaq 0x4(%rsi), %rax
andq $-0x4, %rax
movq %rsi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
leaq (%rdx,%rcx,4), %rcx
addq $0xc, %rcx
xorl %edx, %edx
movdqa 0x6056(%rip), %xmm1     # 0x12020
movdqa 0x605e(%rip), %xmm2     # 0x12030
movdqa 0x6066(%rip), %xmm3     # 0x12040
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movq %rdx, %xmm5
pshufd $0x44, %xmm5, %xmm5     # xmm5 = xmm5[0,1,0,1]
movdqa %xmm5, %xmm6
por %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %esi
notl %esi
testb $0x1, %sil
je 0xc02d
movl $0x1, -0xc(%rcx,%rdx,4)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %esi
testb $0x1, %sil
je 0xc044
movl $0x1, -0x8(%rcx,%rdx,4)
por %xmm1, %xmm5
pxor %xmm3, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
pxor %xmm4, %xmm5
pextrw $0x0, %xmm5, %esi
testb $0x1, %sil
je 0xc081
movl $0x1, -0x4(%rcx,%rdx,4)
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0xc093
movl $0x1, (%rcx,%rdx,4)
addq $0x4, %rdx
cmpq %rdx, %rax
jne 0xbfe2
jmp 0xbb95
cmpl $0x2, %r15d
jl 0xbb95
movq 0x1160a(%rip), %rdi     # 0x1d6c0
jmp 0xbbf0
cmpl $0x2, %r15d
jl 0xbb95
movq 0x115f4(%rip), %rdi     # 0x1d6c0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xd628
cmpl $0x3, %r15d
jl 0xc157
movq 0x115e0(%rip), %r14     # 0x1d6c8
movq 0x115d1(%rip), %rdi     # 0x1d6c0
callq 0x64d0
movl %eax, %ebp
testq %r14, %r14
je 0xc168
cmpb $0x3f, (%r14)
jne 0xc10c
cmpb $0x0, 0x1(%r14)
je 0xc301
movq %r14, %rsi
jmp 0xc171
cmpl $0x3, %r15d
jl 0xbb95
leaq 0x118c6(%rip), %rax     # 0x1d9e8
cmpl $0x0, (%rax)
je 0xbb95
movq 0x11596(%rip), %rdi     # 0x1d6c8
callq 0xc417
testq %rax, %rax
je 0xc384
movq %rax, %rdi
callq 0xcf5e
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xcefc
callq 0x6cc5
jmp 0xbb95
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xc16f
leaq 0x6845(%rip), %r14      # 0x129b4
xorl %esi, %esi
movl %ebp, %edi
callq 0xd28a
testl %eax, %eax
je 0xc19e
cmpl $0x1, %r15d
jg 0xc312
cmpl $0x68, %ebx
jne 0xc312
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xcfc6
movb $0x0, 0xe31b(%rip)      # 0x1a4c0
movl 0xe35d(%rip), %eax      # 0x1a508
decl %eax
movl %eax, %ecx
sarl $0x1f, %ecx
andl %eax, %ecx
movq 0xf30d(%rip), %rdx      # 0x1b4c8
movl %eax, %esi
negl %esi
cmovsl %eax, %esi
movslq %ecx, %rcx
leaq 0x4(%rsi), %rax
andq $-0x4, %rax
movq %rsi, %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
leaq (%rdx,%rcx,4), %rcx
addq $0xc, %rcx
xorl %edx, %edx
movdqa 0x5e37(%rip), %xmm1     # 0x12020
movdqa 0x5e3f(%rip), %xmm2     # 0x12030
movdqa 0x5e47(%rip), %xmm3     # 0x12040
pxor %xmm3, %xmm0
pcmpeqd %xmm4, %xmm4
movq %rdx, %xmm5
pshufd $0x44, %xmm5, %xmm5     # xmm5 = xmm5[0,1,0,1]
movdqa %xmm5, %xmm6
por %xmm2, %xmm6
pxor %xmm3, %xmm6
movdqa %xmm6, %xmm7
pcmpgtd %xmm0, %xmm7
pcmpeqd %xmm0, %xmm6
pshufd $0xf5, %xmm6, %xmm8     # xmm8 = xmm6[1,1,3,3]
pand %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm6     # xmm6 = xmm7[1,1,3,3]
por %xmm8, %xmm6
movd %xmm6, %esi
notl %esi
testb $0x1, %sil
je 0xc24c
movl $0x1, -0xc(%rcx,%rdx,4)
pxor %xmm4, %xmm6
pextrw $0x4, %xmm6, %esi
testb $0x1, %sil
je 0xc263
movl $0x1, -0x8(%rcx,%rdx,4)
por %xmm1, %xmm5
pxor %xmm3, %xmm5
movdqa %xmm5, %xmm6
pcmpgtd %xmm0, %xmm6
pcmpeqd %xmm0, %xmm5
pshufd $0xf5, %xmm5, %xmm7     # xmm7 = xmm5[1,1,3,3]
pand %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm5     # xmm5 = xmm6[1,1,3,3]
por %xmm7, %xmm5
pxor %xmm4, %xmm5
pextrw $0x0, %xmm5, %esi
testb $0x1, %sil
je 0xc2a0
movl $0x1, -0x4(%rcx,%rdx,4)
pextrw $0x4, %xmm5, %esi
testb $0x1, %sil
je 0xc2b2
movl $0x1, (%rcx,%rdx,4)
addq $0x4, %rdx
cmpq %rdx, %rax
jne 0xc201
jmp 0xbb95
leaq 0xd2cd(%rip), %rax      # 0x19598
movl (%rax), %edi
movl $0xc, %esi
jmp 0xc2f2
leaq 0xd2b5(%rip), %rax      # 0x19590
movl (%rax), %edi
movl $0xa, %esi
jmp 0xc2f2
leaq 0xd2a9(%rip), %rax      # 0x19594
movl (%rax), %edi
movl $0xb, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x8e22
movl %ebp, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x8d8f
movq 0xccd7(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
leaq 0x666f(%rip), %rsi      # 0x12992
movl %ebp, %edx
movq %r14, %rcx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x68d0
movq 0xccb0(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
leaq 0x6626(%rip), %rsi      # 0x12970
jmp 0xc370
movq 0xcc9d(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
leaq 0x65c7(%rip), %rsi      # 0x12924
jmp 0xc370
movq 0xcc8a(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
leaq 0x65da(%rip), %rsi      # 0x1294a
movq %rbx, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x68d0
callq 0x6ca9
jmp 0xbb95