// File: /workspace/github_c_makefile_star2_O1/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, %r14
movq %rsi, %r15
movq %rdi, %rbp
movl $0xfffffffc, %esi       # imm = 0xFFFFFFFC
callq 0x18ce0
testl %eax, %eax
je 0x227d5
movq 0x58(%rbp), %rax
testq %r14, %r14
je 0x226d2
movl $0x1, 0x911c(%rax)
shlq $0xd, %r15
leaq (%rax,%r15), %rbx
addq $0x111c, %rbx           # imm = 0x111C
movq %rbx, %rdi
callq 0x18680
cmpq $0x17ff, %rax           # imm = 0x17FF
ja 0x227d5
movl $0x7d0, %edx            # imm = 0x7D0
movq %rbx, %rdi
movq %r14, %rsi
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x188f0
movl $0x0, 0x911c(%rax)
movl $0x111d, %r15d          # imm = 0x111D
movq $-0x111b, %r14          # imm = 0xEEE5
xorl %r12d, %r12d
movq %rbp, (%rsp)
movq 0x58(%rbp), %rbx
leaq (%rbx,%r15), %r13
decq %r13
movq %r13, %rdi
callq 0x18680
testq %rax, %rax
je 0x227ba
cmpq $0x31, %rax
ja 0x2273b
movq %rbp, %rdi
movl %r12d, %esi
leaq 0x3128e(%rip), %rdx     # 0x539ad
movq %r13, %rcx
xorl %eax, %eax
movq 0x46ed5(%rip), %r8      # 0x69600
callq *0x10(%r8)
movq 0x58(%rbp), %rax
movb $0x0, -0x1(%rax,%r15)
jmp 0x227ac
leaq (%rbx,%r15), %rdi
movl $0xa, %esi
callq 0x18730
movq %rax, %rbp
incq %rax
movq %rax, 0x8(%rsp)
movl $0xfa, %edx
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x18880
subq %rbx, %rbp
addq %r14, %rbp
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
movq (%rsp), %rbp
callq 0x181c0
movq %r13, %rdi
movq 0x8(%rsp), %rsi
callq 0x182a0
movq %rbp, %rdi
movl %r12d, %esi
leaq 0x31211(%rip), %rdx     # 0x539ad
movq %rbx, %rcx
xorl %eax, %eax
movq 0x46e58(%rip), %r8      # 0x69600
callq *0x10(%r8)
movq 0x58(%rbp), %rax
movl $0x1, 0x911c(%rax)
incq %r12
addq $0x2000, %r15           # imm = 0x2000
addq $-0x2000, %r14          # imm = 0xE000
cmpq $0x4, %r12
jne 0x226f0
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq