// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/src/setproctitle.c
// Function: setproctitle
void setproctitle(const char *fmt, ...) {
	char buf[SPT_MAXTITLE + 1]; /* use buffer in case argv[0] is passed */
	va_list ap;
	char *nul;
	int len, error;

	if (!SPT.base)
		return;

	if (fmt) {
		va_start(ap, fmt);
		len = vsnprintf(buf, sizeof buf, fmt, ap);
		va_end(ap);
	} else {
		len = snprintf(buf, sizeof buf, "%s", SPT.arg0);
	}

	if (len <= 0)
		{ error = errno; goto error; }

	if (!SPT.reset) {
		memset(SPT.base, 0, SPT.end - SPT.base);
		SPT.reset = 1;
	} else {
		memset(SPT.base, 0, spt_min(sizeof buf, SPT.end - SPT.base));
	}

	len = spt_min(len, spt_min(sizeof buf, SPT.end - SPT.base) - 1);
	memcpy(SPT.base, buf, len);
	nul = &SPT.base[len];

	if (nul < SPT.nul) {
		*SPT.nul = '.';
	} else if (nul == SPT.nul && &nul[1] < SPT.end) {
		*SPT.nul = ' ';
		*++nul = '\0';
	}

	return;
error:
	SPT.error = error;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
testb %al, %al
je 0x9d457
movaps %xmm0, -0x1c0(%rbp)
movaps %xmm1, -0x1b0(%rbp)
movaps %xmm2, -0x1a0(%rbp)
movaps %xmm3, -0x190(%rbp)
movaps %xmm4, -0x180(%rbp)
movaps %xmm5, -0x170(%rbp)
movaps %xmm6, -0x160(%rbp)
movaps %xmm7, -0x150(%rbp)
movq %r9, -0x1c8(%rbp)
movq %r8, -0x1d0(%rbp)
movq %rcx, -0x1d8(%rbp)
movq %rdx, -0x1e0(%rbp)
movq %rsi, -0x1e8(%rbp)
movq %rdi, -0x8(%rbp)
cmpq $0x0, 0xefc02(%rip)     # 0x18d088
jne 0x9d48d
jmp 0x9d67a
cmpq $0x0, -0x8(%rbp)
je 0x9d4e6
leaq -0x130(%rbp), %rax
leaq -0x1f0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x8, (%rax)
leaq -0x110(%rbp), %rdi
movq -0x8(%rbp), %rdx
leaq -0x130(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
callq 0x26810
movl %eax, -0x13c(%rbp)
leaq -0x130(%rbp), %rax
jmp 0x9d50d
leaq -0x110(%rbp), %rdi
movq 0xefb8c(%rip), %rcx     # 0x18d080
movl $0x100, %esi            # imm = 0x100
leaq 0xa9186(%rip), %rdx     # 0x146686
movb $0x0, %al
callq 0x26120
movl %eax, -0x13c(%rbp)
cmpl $0x0, -0x13c(%rbp)
jg 0x9d528
callq 0x26880
movl (%rax), %eax
movl %eax, -0x140(%rbp)
jmp 0x9d66e
testb $0x1, 0xefb71(%rip)     # 0x18d0a0
jne 0x9d559
movq 0xefb50(%rip), %rdi     # 0x18d088
movq 0xefb51(%rip), %rdx     # 0x18d090
movq 0xefb42(%rip), %rax     # 0x18d088
subq %rax, %rdx
xorl %esi, %esi
callq 0x26110
movb $0x1, 0xefb49(%rip)     # 0x18d0a0
jmp 0x9d593
movq 0xefb28(%rip), %rax     # 0x18d088
movq %rax, -0x1f8(%rbp)
movq 0xefb22(%rip), %rsi     # 0x18d090
movq 0xefb13(%rip), %rax     # 0x18d088
subq %rax, %rsi
movl $0x100, %edi            # imm = 0x100
callq 0x9d690
movq -0x1f8(%rbp), %rdi
movq %rax, %rdx
xorl %esi, %esi
callq 0x26110
movslq -0x13c(%rbp), %rax
movq %rax, -0x200(%rbp)
movq 0xefae8(%rip), %rsi     # 0x18d090
movq 0xefad9(%rip), %rax     # 0x18d088
subq %rax, %rsi
movl $0x100, %edi            # imm = 0x100
callq 0x9d690
movq -0x200(%rbp), %rdi
movq %rax, %rsi
subq $0x1, %rsi
callq 0x9d690
movl %eax, -0x13c(%rbp)
movq 0xefaac(%rip), %rdi     # 0x18d088
leaq -0x110(%rbp), %rsi
movslq -0x13c(%rbp), %rdx
callq 0x26c60
movq 0xefa92(%rip), %rax     # 0x18d088
movslq -0x13c(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rax
cmpq 0xefa83(%rip), %rax     # 0x18d098
jae 0x9d623
movq 0xefa7a(%rip), %rax     # 0x18d098
movb $0x2e, (%rax)
jmp 0x9d66c
movq -0x138(%rbp), %rax
cmpq 0xefa67(%rip), %rax     # 0x18d098
jne 0x9d66a
movq -0x138(%rbp), %rax
addq $0x1, %rax
cmpq 0xefa4b(%rip), %rax     # 0x18d090
jae 0x9d66a
movq 0xefa4a(%rip), %rax     # 0x18d098
movb $0x20, (%rax)
movq -0x138(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x138(%rbp)
movb $0x0, 0x1(%rax)
jmp 0x9d66c
jmp 0x9d67a
movl -0x140(%rbp), %eax
movl %eax, 0xefa2a(%rip)     # 0x18d0a4
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
nopw %cs:(%rax,%rax)