// File: /workspace/github_c_makefile_star2_O0/open-mesh-mirror[P]batmand/posix/unix_socket.c
// Function: debug_output
void debug_output(int8_t debug_prio, const char *format, ...) {

	struct list_head *debug_pos;
	struct debug_level_info *debug_level_info;
	int8_t debug_prio_intern;
	va_list args;


	if (!log_facility_active) {
		va_start(args, format);
		vprintf(format, args);
		va_end(args);
		return;
	}

	if (debug_prio == 0) {

		if (debug_level == 0) {

			va_start(args, format);
			vsyslog(LOG_ERR, format, args);
			va_end(args);

		} else if ((debug_level == 3) || (debug_level == 4)) {

			if (debug_level == 4)
				printf("[%10u] ", get_time_msec());

			va_start(args, format);
			vprintf(format, args);
			va_end(args);

		}

		debug_prio_intern = 3;

	} else {

		debug_prio_intern = debug_prio - 1;

	}

	if (debug_clients.clients_num[debug_prio_intern] < 1)
		return;

	if (pthread_mutex_trylock((pthread_mutex_t *)debug_clients.mutex[debug_prio_intern] ) != 0) {
		debug_output(0, "Warning - could not trylock mutex (debug_output): %s \n", strerror(EBUSY));
		return;
	}

	va_start(args, format);

	list_for_each(debug_pos, (struct list_head *)debug_clients.fd_list[debug_prio_intern]) {

		debug_level_info = list_entry(debug_pos, struct debug_level_info, list);

		/* batman debug gets milliseconds prepended for better debugging */
		if (debug_prio_intern == 3)
			dprintf(debug_level_info->fd, "[%10u] ", get_time_msec());

		if (((debug_level == 1) || (debug_level == 2)) && (debug_level_info->fd == 1) && (strncmp(format, "BOD", 3) == 0))
			/* clear screen, set cursor back to 0,0 */
			printf("\033[2J\033[0;0f");

		if (((debug_level != 1) && (debug_level != 2)) || (debug_level_info->fd != 1) || (strncmp(format, "EOD", 3) != 0))
			vdprintf(debug_level_info->fd, format, args);

	}

	va_end(args);

	if (pthread_mutex_unlock((pthread_mutex_t *)debug_clients.mutex[debug_prio_intern]) < 0)
		debug_output(0, "Error - could not unlock mutex (debug_output): %s \n", strerror(errno));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
testb %al, %al
je 0x1242b
movaps %xmm0, -0xc0(%rbp)
movaps %xmm1, -0xb0(%rbp)
movaps %xmm2, -0xa0(%rbp)
movaps %xmm3, -0x90(%rbp)
movaps %xmm4, -0x80(%rbp)
movaps %xmm5, -0x70(%rbp)
movaps %xmm6, -0x60(%rbp)
movaps %xmm7, -0x50(%rbp)
movq %r9, -0xc8(%rbp)
movq %r8, -0xd0(%rbp)
movq %rcx, -0xd8(%rbp)
movq %rdx, -0xe0(%rbp)
movb %dil, %al
movb %al, -0x1(%rbp)
movq %rsi, -0x10(%rbp)
leaq 0x8f35(%rip), %rax      # 0x1b38d
cmpb $0x0, (%rax)
jne 0x12497
leaq -0x40(%rbp), %rax
leaq -0xf0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x10, (%rax)
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2360
leaq -0x40(%rbp), %rax
jmp 0x12763
movsbl -0x1(%rbp), %eax
cmpl $0x0, %eax
jne 0x1256e
leaq 0x8ead(%rip), %rax      # 0x1b358
movzbl (%rax), %eax
cmpl $0x0, %eax
jne 0x124ef
leaq -0x40(%rbp), %rax
leaq -0xf0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x10, (%rax)
movq -0x10(%rbp), %rsi
leaq -0x40(%rbp), %rdx
movl $0x3, %edi
callq 0x2440
leaq -0x40(%rbp), %rax
jmp 0x12568
leaq 0x8e62(%rip), %rax      # 0x1b358
movzbl (%rax), %eax
cmpl $0x3, %eax
je 0x1250d
leaq 0x8e53(%rip), %rax      # 0x1b358
movzbl (%rax), %eax
cmpl $0x4, %eax
jne 0x12566
leaq 0x8e44(%rip), %rax      # 0x1b358
movzbl (%rax), %eax
cmpl $0x4, %eax
jne 0x12531
callq 0xf260
movl %eax, %esi
leaq 0x57a0(%rip), %rdi      # 0x17cca
movb $0x0, %al
callq 0x21a0
leaq -0x40(%rbp), %rax
leaq -0xf0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x10, (%rax)
movq -0x10(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x2360
leaq -0x40(%rbp), %rax
jmp 0x12568
movb $0x3, -0x21(%rbp)
jmp 0x12578
movsbl -0x1(%rbp), %eax
subl $0x1, %eax
movb %al, -0x21(%rbp)
leaq 0x8e69(%rip), %rax      # 0x1b3e8
movq 0x8(%rax), %rax
movsbq -0x21(%rbp), %rcx
movswl (%rax,%rcx,2), %eax
cmpl $0x1, %eax
jge 0x12596
jmp 0x12763
leaq 0x8e4b(%rip), %rax      # 0x1b3e8
movq 0x10(%rax), %rax
movsbq -0x21(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2240
cmpl $0x0, %eax
je 0x125d6
movl $0x10, %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0x5708(%rip), %rsi      # 0x17cd2
movb $0x0, %al
callq 0x123f0
jmp 0x12763
leaq -0x40(%rbp), %rax
leaq -0xf0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x10, (%rax)
leaq 0x8de7(%rip), %rax      # 0x1b3e8
movq (%rax), %rax
movsbq -0x21(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
leaq 0x8dc9(%rip), %rcx      # 0x1b3e8
movq (%rcx), %rcx
movsbq -0x21(%rbp), %rdx
cmpq (%rcx,%rdx,8), %rax
je 0x12722
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movsbl -0x21(%rbp), %eax
cmpl $0x3, %eax
jne 0x1266a
movq -0x20(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0xf4(%rbp)
callq 0xf260
movl -0xf4(%rbp), %edi
movl %eax, %edx
leaq 0x5667(%rip), %rsi      # 0x17cca
movb $0x0, %al
callq 0x2220
leaq 0x8ce7(%rip), %rax      # 0x1b358
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x12688
leaq 0x8cd8(%rip), %rax      # 0x1b358
movzbl (%rax), %eax
cmpl $0x2, %eax
jne 0x126ba
movq -0x20(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x126ba
movq -0x10(%rbp), %rdi
leaq 0x492c(%rip), %rsi      # 0x16fc9
movl $0x3, %edx
callq 0x20a0
cmpl $0x0, %eax
jne 0x126ba
leaq 0x491a(%rip), %rdi      # 0x16fcd
movb $0x0, %al
callq 0x21a0
leaq 0x8c97(%rip), %rax      # 0x1b358
movzbl (%rax), %eax
cmpl $0x1, %eax
je 0x126d8
leaq 0x8c88(%rip), %rax      # 0x1b358
movzbl (%rax), %eax
cmpl $0x2, %eax
jne 0x126fc
movq -0x20(%rbp), %rax
cmpl $0x1, 0x8(%rax)
jne 0x126fc
movq -0x10(%rbp), %rdi
leaq 0x48d8(%rip), %rsi      # 0x16fc5
movl $0x3, %edx
callq 0x20a0
cmpl $0x0, %eax
je 0x12710
movq -0x20(%rbp), %rax
movl 0x8(%rax), %edi
movq -0x10(%rbp), %rsi
leaq -0x40(%rbp), %rdx
callq 0x23f0
jmp 0x12712
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0x12614
leaq -0x40(%rbp), %rax
leaq 0x8cbb(%rip), %rax      # 0x1b3e8
movq 0x10(%rax), %rax
movsbq -0x21(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2300
cmpl $0x0, %eax
jge 0x12763
callq 0x2070
movl (%rax), %edi
callq 0x24a0
movq %rax, %rdx
xorl %edi, %edi
leaq 0x55ad(%rip), %rsi      # 0x17d09
movb $0x0, %al
callq 0x123f0
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopl (%rax)