// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/liball/../lib/logging/logging.c
// Function: callback_timer
static int
callback_timer(void * cookie)
{
	struct stat sb_fd;
	struct stat sb_path;
	struct logging_file * F = cookie;

	/* Timer callback is no longer pending. */
	F->timer_cookie = NULL;

	/* Stat the file and the path. */
	if (fstat(F->fd, &sb_fd)) {
		warnp("fstat(%s)", F->path);
		goto err0;
	}
	if (stat(F->path, &sb_path)) {
		/* If the path doesn't exist, we need to reopen the file. */
		if (errno == ENOENT)
			goto reopen;

		/* Any other error is bad. */
		warnp("stat(%s)", F->path);
		goto err0;
	}

	/* If the path still points at the same file, do nothing. */
	if (S_ISREG(sb_fd.st_mode) && S_ISREG(sb_path.st_mode) &&
	    (sb_fd.st_dev == sb_path.st_dev) &&
	    (sb_fd.st_ino == sb_path.st_ino))
		goto done;

reopen:
	/* We need to close and re-open the log file. */
	if (close(F->fd))
		warnp("close");
	if ((F->fd = doopen(F->path)) == -1)
		goto err0;

done:
	/* Reset the callback. */
	if ((F->timer_cookie =
	    events_timer_register_double(callback_timer, F, 1.0)) == NULL)
		goto err0;

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x138(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x138(%rbp), %rax
movl (%rax), %edi
leaq -0xa0(%rbp), %rsi
callq 0x35b0
cmpl $0x0, %eax
je 0x9e15
jmp 0x9dc5
callq 0x3040
cmpl $0x0, (%rax)
je 0x9df5
movq -0x138(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x14dbe(%rip), %rdi     # 0x1eb9f
movb $0x0, %al
callq 0x66e0
callq 0x3040
movl $0x0, (%rax)
jmp 0x9e0e
movq -0x138(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x14d98(%rip), %rdi     # 0x1eb9f
movb $0x0, %al
callq 0x6930
jmp 0x9e10
jmp 0x9f7f
movq -0x138(%rbp), %rax
movq 0x8(%rax), %rdi
leaq -0x130(%rbp), %rsi
callq 0x3340
cmpl $0x0, %eax
je 0x9e92
callq 0x3040
cmpl $0x2, (%rax)
jne 0x9e40
jmp 0x9eda
jmp 0x9e42
callq 0x3040
cmpl $0x0, (%rax)
je 0x9e72
movq -0x138(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x14d42(%rip), %rdi     # 0x1eba0
movb $0x0, %al
callq 0x66e0
callq 0x3040
movl $0x0, (%rax)
jmp 0x9e8b
movq -0x138(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x14d1c(%rip), %rdi     # 0x1eba0
movb $0x0, %al
callq 0x6930
jmp 0x9e8d
jmp 0x9f7f
movl -0x88(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x9ed8
movl -0x118(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x9ed8
movq -0xa0(%rbp), %rax
cmpq -0x130(%rbp), %rax
jne 0x9ed8
movq -0x98(%rbp), %rax
cmpq -0x128(%rbp), %rax
jne 0x9ed8
jmp 0x9f48
jmp 0x9eda
movq -0x138(%rbp), %rax
movl (%rax), %edi
callq 0x3650
cmpl $0x0, %eax
je 0x9f26
jmp 0x9eef
callq 0x3040
cmpl $0x0, (%rax)
je 0x9f14
leaq 0x14311(%rip), %rdi     # 0x1e211
movb $0x0, %al
callq 0x66e0
callq 0x3040
movl $0x0, (%rax)
jmp 0x9f22
leaq 0x142f6(%rip), %rdi     # 0x1e211
movb $0x0, %al
callq 0x6930
jmp 0x9f24
jmp 0x9f26
movq -0x138(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x9ab0
movq -0x138(%rbp), %rcx
movl %eax, (%rcx)
cmpl $-0x1, %eax
jne 0x9f46
jmp 0x9f7f
jmp 0x9f48
movq -0x138(%rbp), %rsi
leaq -0x1d6(%rip), %rdi      # 0x9d80
movsd 0x14542(%rip), %xmm0    # 0x1e4a0
callq 0x5fc0
movq -0x138(%rbp), %rcx
movq %rax, 0x10(%rcx)
cmpq $0x0, %rax
jne 0x9f76
jmp 0x9f7f
movl $0x0, -0x4(%rbp)
jmp 0x9f86
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopw %cs:(%rax,%rax)