// File: /workspace/github_c_makefile_star2_O3/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 0x74b0
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 0x762c
movl %eax, %ebp
leal 0x15(%rbp), %r13d
movq %r13, %rdi
callq 0x34c0
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x762c
leaq 0x18(%rsp), %rdi
callq 0x3320
cmpq $-0x1, %rax
je 0x75c7
movq %rbx, 0x10(%rsp)
leaq 0x18(%rsp), %rdi
callq 0x32b0
leaq 0xa338(%rip), %rdx      # 0x1186b
movl $0x14, %esi
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rcx
callq 0x3270
cmpq $0x13, %rax
jne 0x75dd
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 0x7624
cmpl %eax, %ebp
jne 0x767a
movl %ebp, %eax
movw $0xa, 0x13(%rbx,%rax)
movq 0x10(%rsp), %r14
movl (%r14), %edi
decq %r13
movq %rbx, %rsi
movq %r13, %rdx
callq 0xb7b8
cmpq %r13, %rax
jne 0x7641
xorl %r15d, %r15d
jmp 0x7624
callq 0x3040
cmpl $0x0, (%rax)
je 0x7601
movq %rax, %r14
leaq 0xa2a6(%rip), %rdi      # 0x11881
jmp 0x75f1
callq 0x3040
cmpl $0x0, (%rax)
je 0x760a
movq %rax, %r14
leaq 0xa28c(%rip), %rdi      # 0x1187d
xorl %eax, %eax
callq 0x57b8
movl $0x0, (%r14)
jmp 0x7618
leaq 0xa279(%rip), %rdi      # 0x11881
jmp 0x7611
leaq 0xa26c(%rip), %rdi      # 0x1187d
xorl %eax, %eax
callq 0x58d7
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 0x766a
movq %rax, %r12
leaq 0xa2a4(%rip), %rdi      # 0x118fd
xorl %eax, %eax
callq 0x57b8
movl $0x0, (%r12)
jmp 0x7624
leaq 0xa28c(%rip), %rdi      # 0x118fd
xorl %eax, %eax
callq 0x58d7
jmp 0x7624
leaq 0xa205(%rip), %rdi      # 0x11886
leaq 0xa21b(%rip), %rsi      # 0x118a3
leaq 0xa22d(%rip), %rcx      # 0x118bc
movl $0xf0, %edx
callq 0x3200