// File: /workspace/github_c_makefile_star2_O1/qpfiffer[P]38-Moths/src/logging.c
// Function: m38_log_msg
void m38_log_msg(log_level level, const char *fmsg, ...) {
	char buffer[100];
	char msg[800];
	va_list ap;
	FILE *fd;

	const char inf[] = "[%c[%dm-%c[%dm]"; /* Blue   [-] */
	const char dbg[] = "[%c[%dm^%c[%dm]"; /* Orange [^] */
	const char wrn[] = "[%c[%dm!%c[%dm]"; /* Yellow [!] */
	const char err[] = "[%c[%dmx%c[%dm]"; /* Red    [x] */
	const char fun[] = "[%c[%dm~%c[%dm]"; /* Teal   [~] */
	const char dbc[] = "[%c[%dm~%c[%dm]"; /* Purple [&] */
	char sym_buf[15] = {0};


	if (level == LOG_ERR) {
		fd = stderr;
	} else {
		fd = stdout;
	}

	/* Time stuff */
	struct timeval timest;
	gettimeofday(&timest, NULL);
	strftime(buffer, sizeof(buffer), "%b %d %H:%M:%S",
			localtime(&timest.tv_sec));

	switch (level) {
		case LOG_INFO:
			snprintf(sym_buf, strlen(inf), inf, 0x1B, 34, 0x1B, 0);
			break;
		case LOG_DEBUG:
			snprintf(sym_buf, strlen(dbg), dbg, 0x1B, 91, 0x1B, 0);
			break;
		case LOG_WARN:
			snprintf(sym_buf, strlen(wrn), wrn, 0x1B, 33, 0x1B, 0);
			break;
		case LOG_ERR:
			snprintf(sym_buf, strlen(err), err, 0x1B, 31, 0x1B, 0);
			break;
		case LOG_FUN:
			snprintf(sym_buf, strlen(fun), fun, 0x1B, 36, 0x1B, 0);
			break;
		case LOG_DB:
			snprintf(sym_buf, strlen(dbc), dbc, 0x1B, 35, 0x1B, 0);
			break;
	}

	/* Format msg */
	va_start(ap, fmsg);
	vsnprintf(msg, sizeof(msg), fmsg, ap);
	va_end(ap);

	fprintf(fd, "%s %s %s\n", buffer, sym_buf, msg);

	fflush(fd);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x490, %rsp            # imm = 0x490
movq %rsi, %r14
movl %edi, %ebp
movq %rdx, 0x60(%rsp)
movq %rcx, 0x68(%rsp)
movq %r8, 0x70(%rsp)
movq %r9, 0x78(%rsp)
testb %al, %al
je 0x4884
movaps %xmm0, 0x80(%rsp)
movaps %xmm1, 0x90(%rsp)
movaps %xmm2, 0xa0(%rsp)
movaps %xmm3, 0xb0(%rsp)
movaps %xmm4, 0xc0(%rsp)
movaps %xmm5, 0xd0(%rsp)
movaps %xmm6, 0xe0(%rsp)
movaps %xmm7, 0xf0(%rsp)
xorl %eax, %eax
movq %rax, 0x17(%rsp)
movq %rax, 0x10(%rsp)
movq 0x4761(%rip), %rax      # 0x8ff8
movq (%rax), %r12
movq 0x4737(%rip), %rax      # 0x8fd8
movq (%rax), %rbx
leaq 0x20(%rsp), %r15
movq %r15, %rdi
xorl %esi, %esi
callq 0x1100
movq %r15, %rdi
callq 0x1040
leaq 0x264e(%rip), %rdx      # 0x6f10
leaq 0x100(%rsp), %rdi
movl $0x64, %esi
movq %rax, %rcx
callq 0x11e0
cmpl $0x5, %ebp
ja 0x49e1
movl %ebp, %eax
leaq 0x25b3(%rip), %rcx      # 0x6e9c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, (%rsp)
leaq 0x25c0(%rip), %rdx      # 0x6ec0
leaq 0x10(%rsp), %rdi
movl $0xf, %esi
movl $0x1b, %ecx
movl $0x22, %r8d
jmp 0x49d4
movl $0x0, (%rsp)
leaq 0x25d8(%rip), %rdx      # 0x6f00
leaq 0x10(%rsp), %rdi
movl $0xf, %esi
movl $0x1b, %ecx
movl $0x24, %r8d
jmp 0x49d4
movl $0x0, (%rsp)
leaq 0x2590(%rip), %rdx      # 0x6ee0
leaq 0x10(%rsp), %rdi
movl $0xf, %esi
movl $0x1b, %ecx
movl $0x21, %r8d
jmp 0x49d4
movl $0x0, (%rsp)
leaq 0x257b(%rip), %rdx      # 0x6ef0
leaq 0x10(%rsp), %rdi
movl $0xf, %esi
movl $0x1b, %ecx
movl $0x1f, %r8d
jmp 0x49d4
movl $0x0, (%rsp)
leaq 0x2536(%rip), %rdx      # 0x6ed0
leaq 0x10(%rsp), %rdi
movl $0xf, %esi
movl $0x1b, %ecx
movl $0x5b, %r8d
jmp 0x49d4
movl $0x0, (%rsp)
leaq 0x2541(%rip), %rdx      # 0x6f00
leaq 0x10(%rsp), %rdi
movl $0xf, %esi
movl $0x1b, %ecx
movl $0x23, %r8d
movl $0x1b, %r9d
xorl %eax, %eax
callq 0x10f0
cmpl $0x3, %ebp
cmoveq %r12, %rbx
leaq 0x50(%rsp), %rax
leaq 0x30(%rsp), %rcx
movq %rax, 0x10(%rcx)
leaq 0x4c0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rcx)
leaq 0x170(%rsp), %r15
movl $0x320, %esi            # imm = 0x320
movq %r15, %rdi
movq %r14, %rdx
callq 0x1090
leaq 0x24f1(%rip), %rsi      # 0x6f1f
leaq 0x100(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %rbx, %rdi
movq %r15, %r8
xorl %eax, %eax
callq 0x1180
movq %rbx, %rdi
callq 0x11b0
addq $0x490, %rsp            # imm = 0x490
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq