// File: /workspace/github_c_makefile_star2_O0/containers[P]conmon/src/ctr_logging.c
// Function: configure_log_drivers
void configure_log_drivers(gchar **log_drivers, int64_t log_size_max_, int64_t log_global_size_max_, char *cuuid_, char *name_, char *tag,
			   gchar **log_labels)
{
	log_size_max = log_size_max_;
	log_global_size_max = log_global_size_max_;
	if (log_drivers == NULL)
		nexit("Log driver not provided. Use --log-path");
	for (int driver = 0; log_drivers[driver]; ++driver) {
		parse_log_path(log_drivers[driver]);
	}
	if (use_k8s_logging) {
		/* Open the log path file. */
		k8s_log_fd = open(k8s_log_path, O_WRONLY | O_APPEND | O_CREAT | O_CLOEXEC, 0640);
		if (k8s_log_fd < 0)
			pexit("Failed to open log file");

		struct stat statbuf;
		if (fstat(k8s_log_fd, &statbuf) == 0) {
			k8s_bytes_written = statbuf.st_size;
		} else {
			nwarnf("Could not stat log file %s, assuming 0 size", k8s_log_path);
			k8s_bytes_written = 0;
		}
		k8s_total_bytes_written = k8s_bytes_written;

		if (!use_journald_logging) {
			if (tag) {
				nexit("k8s-file doesn't support --log-tag");
			}
			if (log_labels) {
				nexit("k8s-file doesn't support --log-label");
			}
		}
	}

	if (use_journald_logging) {
#ifndef USE_JOURNALD
		nexit("Include journald in compilation path to log to systemd journal");
#endif
		/* save the length so we don't have to compute every sd_journal_* call */
		if (cuuid_ == NULL)
			nexit("Container ID must be provided and of the correct length");
		cuuid_len = strlen(cuuid_);
		if (cuuid_len <= TRUNC_ID_LEN)
			nexit("Container ID must be longer than 12 characters");

		cuuid = cuuid_;
		strncpy(short_cuuid, cuuid, TRUNC_ID_LEN);
		short_cuuid[TRUNC_ID_LEN] = '\0';
		name = name_;

		/* Setup some sd_journal_sendv arguments that won't change */
		container_id_full = g_strdup_printf("CONTAINER_ID_FULL=%s", cuuid);
		container_id = g_strdup_printf("CONTAINER_ID=%s", short_cuuid);

		/* Priority order of syslog_identifier (in order of precedence) is tag, name, `conmon`. */
		syslog_identifier = g_strdup_printf("SYSLOG_IDENTIFIER=%s", short_cuuid);
		syslog_identifier_len = TRUNC_ID_LEN + SYSLOG_IDENTIFIER_EQ_LEN;
		if (name) {
			name_len = strlen(name);
			container_name = g_strdup_printf("CONTAINER_NAME=%s", name);

			g_free(syslog_identifier);
			syslog_identifier = g_strdup_printf("SYSLOG_IDENTIFIER=%s", name);
			syslog_identifier_len = name_len + SYSLOG_IDENTIFIER_EQ_LEN;
		}
		if (tag) {
			container_tag = g_strdup_printf("CONTAINER_TAG=%s", tag);
			container_tag_len = strlen(container_tag);

			g_free(syslog_identifier);
			syslog_identifier = g_strdup_printf("SYSLOG_IDENTIFIER=%s", tag);
			syslog_identifier_len = strlen(syslog_identifier);
		}
		if (log_labels) {
			container_labels = log_labels;

			/* Ensure that valid LABEL=VALUE pairs have been passed */
			for (char **ptr = log_labels; *ptr; ptr++) {
				if (**ptr == '=') {
					nexitf("Container labels must be in format LABEL=VALUE (no LABEL present in '%s')", *ptr);
				}
				if (count_chars_in_string(*ptr, '=') != 1) {
					nexitf("Container labels must be in format LABEL=VALUE (none or more than one '=' present in '%s')",
					       *ptr);
				}
				if (!is_valid_label_name(*ptr)) {
					nexitf("Container label names must contain only uppercase letters, numbers and underscore (in '%s')",
					       *ptr);
				}
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, 0xf3ce(%rip)      # 0x16490
movq -0x18(%rbp), %rax
movq %rax, 0xf3cb(%rip)      # 0x16498
cmpq $0x0, -0x8(%rbp)
jne 0x712f
jmp 0x70d6
movq 0xef13(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x853a(%rip), %rsi      # 0xf621
leaq 0x886c(%rip), %rdx      # 0xf95a
movb $0x0, %al
callq 0x4830
leaq 0x23e4c(%rip), %rax     # 0x2af48
cmpl $0x0, (%rax)
je 0x7125
leaq 0x23e38(%rip), %rax     # 0x2af40
movq (%rax), %rdx
movl $0x3, %edi
leaq 0x8539(%rip), %rsi      # 0xf650
leaq 0x883c(%rip), %rcx      # 0xf95a
movb $0x0, %al
callq 0x4120
movl $0x1, %edi
callq 0x41e0
movl $0x0, -0x34(%rbp)
movq -0x8(%rbp), %rax
movslq -0x34(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x7161
movq -0x8(%rbp), %rax
movslq -0x34(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x73e0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x7136
cmpl $0x0, 0x1fd1c(%rip)     # 0x26e84
je 0x7366
movq 0x1fd13(%rip), %rdi     # 0x26e88
movl $0x80441, %esi          # imm = 0x80441
movl $0x1a0, %edx            # imm = 0x1A0
movb $0x0, %al
callq 0x48d0
movl %eax, 0xf314(%rip)      # 0x164a0
cmpl $0x0, 0xf30d(%rip)      # 0x164a0
jge 0x71f0
jmp 0x7197
movq 0xee52(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x7e6b(%rip), %rsi      # 0xf013
leaq 0x87d3(%rip), %rdx      # 0xf982
movb $0x0, %al
callq 0x4830
leaq 0x23d8b(%rip), %rax     # 0x2af48
cmpl $0x0, (%rax)
je 0x71e6
leaq 0x23d77(%rip), %rax     # 0x2af40
movq (%rax), %rdx
movl $0x3, %edi
leaq 0x7e65(%rip), %rsi      # 0xf03d
leaq 0x87a3(%rip), %rcx      # 0xf982
movb $0x0, %al
callq 0x4120
movl $0x1, %edi
callq 0x41e0
movl 0xf2aa(%rip), %edi      # 0x164a0
leaq -0xc8(%rbp), %rsi
callq 0x41f0
cmpl $0x0, %eax
jne 0x7217
movq -0x98(%rbp), %rax
movq %rax, 0x1fc7b(%rip)     # 0x26e90
jmp 0x7283
leaq 0xf286(%rip), %rax      # 0x164a4
cmpl $0x1, (%rax)
jb 0x7278
jmp 0x7225
movq 0xedc4(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
movq 0x1fc52(%rip), %rdx     # 0x26e88
leaq 0x875d(%rip), %rsi      # 0xf99a
movb $0x0, %al
callq 0x4830
leaq 0x23cfd(%rip), %rax     # 0x2af48
cmpl $0x0, (%rax)
je 0x7274
leaq 0x23ce9(%rip), %rax     # 0x2af40
movq (%rax), %rdx
movq 0x1fc27(%rip), %rcx     # 0x26e88
movl $0x6, %edi
leaq 0x8766(%rip), %rsi      # 0xf9d3
movb $0x0, %al
callq 0x4120
jmp 0x7276
jmp 0x7278
movq $0x0, 0x1fc0d(%rip) # 0x26e90
movq 0x1fc06(%rip), %rax     # 0x26e90
movq %rax, 0x1fc07(%rip)     # 0x26e98
cmpl $0x0, 0x1fc08(%rip)     # 0x26ea0
jne 0x7364
cmpq $0x0, -0x30(%rbp)
je 0x7300
jmp 0x72a7
movq 0xed42(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x8369(%rip), %rsi      # 0xf621
leaq 0x8758(%rip), %rdx      # 0xfa17
movb $0x0, %al
callq 0x4830
leaq 0x23c7b(%rip), %rax     # 0x2af48
cmpl $0x0, (%rax)
je 0x72f6
leaq 0x23c67(%rip), %rax     # 0x2af40
movq (%rax), %rdx
movl $0x3, %edi
leaq 0x8368(%rip), %rsi      # 0xf650
leaq 0x8728(%rip), %rcx      # 0xfa17
movb $0x0, %al
callq 0x4120
movl $0x1, %edi
callq 0x41e0
cmpq $0x0, 0x10(%rbp)
je 0x7362
jmp 0x7309
movq 0xece0(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x8307(%rip), %rsi      # 0xf621
leaq 0x8719(%rip), %rdx      # 0xfa3a
movb $0x0, %al
callq 0x4830
leaq 0x23c19(%rip), %rax     # 0x2af48
cmpl $0x0, (%rax)
je 0x7358
leaq 0x23c05(%rip), %rax     # 0x2af40
movq (%rax), %rdx
movl $0x3, %edi
leaq 0x8306(%rip), %rsi      # 0xf650
leaq 0x86e9(%rip), %rcx      # 0xfa3a
movb $0x0, %al
callq 0x4120
movl $0x1, %edi
callq 0x41e0
jmp 0x7364
jmp 0x7366
cmpl $0x0, 0x1fb33(%rip)     # 0x26ea0
je 0x73ca
jmp 0x7371
movq 0xec78(%rip), %rax      # 0x15ff0
movq (%rax), %rdi
leaq 0x829f(%rip), %rsi      # 0xf621
leaq 0x86d6(%rip), %rdx      # 0xfa5f
movb $0x0, %al
callq 0x4830
leaq 0x23bb1(%rip), %rax     # 0x2af48
cmpl $0x0, (%rax)
je 0x73c0
leaq 0x23b9d(%rip), %rax     # 0x2af40
movq (%rax), %rdx
movl $0x3, %edi
leaq 0x829e(%rip), %rsi      # 0xf650
leaq 0x86a6(%rip), %rcx      # 0xfa5f
movb $0x0, %al
callq 0x4120
movl $0x1, %edi
callq 0x41e0
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)