// File: /workspace/github_c_makefile_star2_O2/QwazyWabbitWOS[P]lmctf60/g_ctffunc.c
// Function: ctf_SafePrint
void ctf_SafePrint(edict_t * ent, long print_priority, char * buf)
{
	long i;
	size_t printsize;
	char *cptr = NULL;
	char tempbuf[MAX_INFO_STRING];

	if (!ctf_validateplayer(ent, CTF_TEAM_IGNORETEAM))
		return;

	if (buf != NULL) //this is a queue request
	{
		ent->client->ctf.printready = true;
		printsize = strlen(ent->client->ctf.printdata[print_priority]);
		if ( printsize < (MAX_PRINT_BUF - 2048) )
			strncat(ent->client->ctf.printdata[print_priority], buf, 2000);
	}
	else
	{
		ent->client->ctf.printready = false;
		for (i=PRINT_LOW; i<=PRINT_CHAT; i++)
		{
			printsize = strlen(ent->client->ctf.printdata[i]);
			if (printsize <= 0)
				continue;
			else if (printsize < 50) //print it all
			{
				gi.cprintf(ent, i, "%s", ent->client->ctf.printdata[i]);
				strcpy(ent->client->ctf.printdata[i], "");
				ent->client->ctf.printready = true;
			}
			else
			{
				//just print up to the nearest return
				cptr = strchr(&ent->client->ctf.printdata[i][1], '\n');
				cptr++; //include the return
				memset(tempbuf, 0, 250);
				strncpy(tempbuf, ent->client->ctf.printdata[i], (long) (cptr - ent->client->ctf.printdata[i]) );
				strcpy(ent->client->ctf.printdata[i], cptr);
				gi.cprintf(ent, i, "%s", tempbuf);
				ent->client->ctf.printready = true;
			}
		}
	}
	return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbp
pushq $-0x4
popq %rsi
callq 0x18de0
testl %eax, %eax
je 0x20c24
movq 0x58(%rbp), %r14
testq %r12, %r12
je 0x20b22
movl $0x1, 0x911c(%r14)
shlq $0xd, %r15
leaq (%r14,%r15), %rbx
addq $0x111c, %rbx           # imm = 0x111C
movq %rbx, %rdi
callq 0x186c0
cmpq $0x17ff, %rax           # imm = 0x17FF
ja 0x20c24
movl $0x7d0, %edx            # imm = 0x7D0
movq %rbx, %rdi
movq %r12, %rsi
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x18950
andl $0x0, 0x911c(%r14)
movq $-0x111b, %r15          # imm = 0xEEE5
movl $0x111d, %ebx           # imm = 0x111D
xorl %r12d, %r12d
movq %rbp, (%rsp)
cmpq $-0x911b, %r15          # imm = 0xFFFF6EE5
je 0x20c24
leaq (%r14,%rbx), %r13
decq %r13
movq %r13, %rdi
callq 0x186c0
testq %rax, %rax
je 0x20c0e
cmpq $0x31, %rax
ja 0x20b90
movq %rbp, %rdi
movl %r12d, %esi
leaq 0x2de38(%rip), %rdx     # 0x4e9ad
movq %r13, %rcx
xorl %eax, %eax
movq 0x45a7f(%rip), %r8      # 0x66600
callq *0x10(%r8)
movq 0x58(%rbp), %rax
movb $0x0, -0x1(%rax,%rbx)
jmp 0x20bff
leaq (%r14,%rbx), %rdi
pushq $0xa
popq %rsi
callq 0x18780
movq %rax, %rbp
incq %rax
movq %rax, 0x8(%rsp)
movl $0xfa, %edx
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x188e0
subq %r14, %rbp
addq %r15, %rbp
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq (%rsp), %rbp
callq 0x181e0
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0x182c0
movq %rbp, %rdi
movl %r12d, %esi
leaq 0x2ddbe(%rip), %rdx     # 0x4e9ad
movq %r14, %rcx
xorl %eax, %eax
movq 0x45a05(%rip), %r8      # 0x66600
callq *0x10(%r8)
movq 0x58(%rbp), %r14
movl $0x1, 0x911c(%r14)
addq $-0x2000, %r15          # imm = 0xE000
addq $0x2000, %rbx           # imm = 0x2000
incl %r12d
jmp 0x20b3d
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq