// File: /workspace/github_c_makefile_star2_O2/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 0x7055
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 0x3200
pushq $-0x1
popq %r15
testl %eax, %eax
js 0x71c3
movl %eax, %ebp
leal 0x15(%rbp), %r13d
movq %r13, %rdi
callq 0x34d0
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x71c3
leaq 0x18(%rsp), %rdi
callq 0x3330
cmpq $-0x1, %rax
je 0x7164
movq %rbx, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
callq 0x32c0
leaq 0x9766(%rip), %rdx      # 0x1083b
pushq $0x14
popq %rsi
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rcx
callq 0x3280
cmpq $0x13, %rax
jne 0x717a
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 0x3200
pushq $-0x1
popq %r15
testl %eax, %eax
js 0x71bb
cmpl %eax, %ebp
jne 0x720e
movl %ebp, %eax
movw $0xa, 0x13(%rbx,%rax)
movq 0x10(%rsp), %r14
movl (%r14), %edi
decq %r13
movq %rbx, %rsi
movq %r13, %rdx
callq 0xab28
cmpq %r13, %rax
jne 0x71d8
xorl %r15d, %r15d
jmp 0x71bb
callq 0x3040
cmpl $0x0, (%rax)
je 0x719b
movq %rax, %r14
leaq 0x96d9(%rip), %rdi      # 0x10851
jmp 0x718e
callq 0x3040
cmpl $0x0, (%rax)
je 0x71a4
movq %rax, %r14
leaq 0x96bf(%rip), %rdi      # 0x1084d
xorl %eax, %eax
callq 0x53ad
andl $0x0, (%r14)
jmp 0x71b2
leaq 0x96af(%rip), %rdi      # 0x10851
jmp 0x71ab
leaq 0x96a2(%rip), %rdi      # 0x1084d
xorl %eax, %eax
callq 0x553c
pushq $-0x1
popq %r15
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x3460
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 0x71fe
movq %rax, %r12
leaq 0x96dd(%rip), %rdi      # 0x108cd
xorl %eax, %eax
callq 0x53ad
andl $0x0, (%r12)
jmp 0x71bb
leaq 0x96c8(%rip), %rdi      # 0x108cd
xorl %eax, %eax
callq 0x553c
jmp 0x71bb
leaq 0x9641(%rip), %rdi      # 0x10856
leaq 0x9657(%rip), %rsi      # 0x10873
leaq 0x9669(%rip), %rcx      # 0x1088c
movl $0xf0, %edx
callq 0x3210