// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/liball/../lib/logging/logging.c
// Function: logging_printf
ssize_t
logging_printf(struct logging_file * F, const char * format, ...)
{
	va_list ap;
	int len;
	size_t buflen;
	char * str;
	time_t now;

	/* Figure out how long the line we're writing is. */
	va_start(ap, format);
	len = vsnprintf(NULL, 0, format, ap);
	va_end(ap);

	/* Did we fail? */
	if (len < 0)
		goto err0;
	buflen = (size_t)(len) + 21; /* "YYYY-MM-DD hh:mm:ss\n\0" */

	/* Allocate memory. */
	if ((str = malloc(buflen)) == NULL)
		goto err0;

	/* Write date and time to start of buffer. */
	if (time(&now) == (time_t)(-1)) {
		warnp("time");
		goto err1;
	}
	if (strftime(str, 20, "%Y-%m-%d %H:%M:%S", gmtime(&now)) != 19) {
		warnp("strftime");
		goto err1;
	}

	/* Append the log message. */
	va_start(ap, format);
	len = vsnprintf(&str[19], buflen - 19, format, ap);
	va_end(ap);

	/* Did we fail? */
	if (len < 0)
		goto err1;

	/* Make sure vsnprintf is deterministic. */
	assert(buflen == (size_t)(len) + 21);

	/* Add EOL and re-NUL-terminate. */
	str[19 + len] = '\n';
	str[20 + len] = '\0';

	/* Write the final string (sans terminating NUL) to the file. */
	if (noeintr_write(F->fd, str, buflen - 1) != (ssize_t)(buflen - 1)) {
		warnp("Cannot write to log file: %s", F->path);
		goto err1;
	}

	/* Free our string buffer. */
	free(str);

	/* Success! */
	return (0);

err1:
	free(str);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x40(%rsp), %r14
movq %rdx, 0x10(%r14)
movq %rcx, 0x18(%r14)
movq %r8, 0x20(%r14)
movq %r9, 0x28(%r14)
testb %al, %al
je 0x761c
movaps %xmm0, 0x70(%rsp)
movaps %xmm1, 0x80(%rsp)
movaps %xmm2, 0x90(%rsp)
movaps %xmm3, 0xa0(%rsp)
movaps %xmm4, 0xb0(%rsp)
movaps %xmm5, 0xc0(%rsp)
movaps %xmm6, 0xd0(%rsp)
movaps %xmm7, 0xe0(%rsp)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
leaq 0x20(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x130(%rsp), %rax
movq %rax, 0x8(%rcx)
movq %r14, 0x10(%rcx)
xorl %edi, %edi
xorl %esi, %esi
movq %r12, %rdx
callq 0x31f0
movq $-0x1, %r15
testl %eax, %eax
js 0x7798
movl %eax, %ebp
leal 0x15(%rbp), %r13d
movq %r13, %rdi
callq 0x34c0
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x7798
leaq 0x18(%rsp), %rdi
callq 0x3320
cmpq $-0x1, %rax
je 0x7733
movq %rbx, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
callq 0x32b0
leaq 0xa354(%rip), %rdx      # 0x119f3
movl $0x14, %esi
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rcx
callq 0x3270
cmpq $0x13, %rax
jne 0x7749
leaq 0x20(%rsp), %rcx
movq %r14, 0x10(%rcx)
leaq 0x130(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rcx)
movq %rbx, %rdi
addq $0x13, %rdi
leaq -0x13(%r13), %rsi
movq %r12, %rdx
callq 0x31f0
movq $-0x1, %r15
testl %eax, %eax
js 0x7790
cmpl %eax, %ebp
jne 0x77e6
movl %eax, %eax
movw $0xa, 0x13(%rbx,%rax)
movq 0x10(%rsp), %r14
movl (%r14), %edi
decq %r13
movq %rbx, %rsi
movq %r13, %rdx
callq 0xb90c
cmpq %r13, %rax
jne 0x77ad
xorl %r15d, %r15d
jmp 0x7790
callq 0x3040
cmpl $0x0, (%rax)
je 0x776d
movq %rax, %r14
leaq 0xa2c2(%rip), %rdi      # 0x11a09
jmp 0x775d
callq 0x3040
cmpl $0x0, (%rax)
je 0x7776
movq %rax, %r14
leaq 0xa2a8(%rip), %rdi      # 0x11a05
xorl %eax, %eax
callq 0x578c
movl $0x0, (%r14)
jmp 0x7784
leaq 0xa295(%rip), %rdi      # 0x11a09
jmp 0x777d
leaq 0xa288(%rip), %rdi      # 0x11a05
xorl %eax, %eax
callq 0x58ab
movq $-0x1, %r15
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x3450
movq %r15, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x3040
cmpl $0x0, (%rax)
movq 0x8(%r14), %rsi
je 0x77d6
movq %rax, %r12
leaq 0xa2c0(%rip), %rdi      # 0x11a85
xorl %eax, %eax
callq 0x578c
movl $0x0, (%r12)
jmp 0x7790
leaq 0xa2a8(%rip), %rdi      # 0x11a85
xorl %eax, %eax
callq 0x58ab
jmp 0x7790
leaq 0xa221(%rip), %rdi      # 0x11a0e
leaq 0xa237(%rip), %rsi      # 0x11a2b
leaq 0xa249(%rip), %rcx      # 0x11a44
movl $0xf0, %edx
callq 0x3200