// File: /workspace/github_c_makefile_star2_O2/lucvoo[P]sparse-dev/semind.c
// Function: update_stream
static void update_stream(void)
{
	if (semind_streams_nr >= input_stream_nr)
		return;

	semind_streams = realloc(semind_streams, input_stream_nr * sizeof(struct semind_streams));
	if (!semind_streams)
		semind_error(1, errno, "realloc");

	sqlite_run(lock_stmt);

	for (int i = semind_streams_nr; i < input_stream_nr; i++) {
		struct stat st;
		const char *filename;
		char fullname[PATH_MAX];
		sqlite3_int64 cur_mtime = 0;

		if (input_streams[i].fd != -1) {
			/*
			 * FIXME: Files in the input_streams may be duplicated.
			 */
			if (stat(input_streams[i].name, &st) < 0)
				semind_error(1, errno, "stat: %s", input_streams[i].name);

			cur_mtime = st.st_mtime;

			if (!realpath(input_streams[i].name, fullname))
				semind_error(1, errno, "realpath: %s", input_streams[i].name);

			if (!strncmp(fullname, cwd, n_cwd) && fullname[n_cwd] == '/') {
				filename = fullname + n_cwd + 1;
				semind_streams[i].id = 0;
			} else {
				semind_streams[i].id = -1;
				continue;
			}
		} else {
			semind_streams[i].id = -1;
			continue;
		}

		if (semind_verbose > 1)
			message("filename: %s", filename);

		sqlite_bind_text(select_file_stmt, "@name", filename, -1);

		if (sqlite_run(select_file_stmt) == SQLITE_ROW) {
			sqlite3_int64 old_mtime;

			semind_streams[i].id = sqlite3_column_int64(select_file_stmt, 0);
			old_mtime = sqlite3_column_int64(select_file_stmt, 1);

			sqlite_reset_stmt(select_file_stmt);

			if (cur_mtime == old_mtime)
				continue;

			sqlite_bind_text(delete_file_stmt, "@name", filename, -1);
			sqlite_run(delete_file_stmt);
			sqlite_reset_stmt(delete_file_stmt);
		}

		sqlite_reset_stmt(select_file_stmt);

		sqlite_bind_text(insert_file_stmt,  "@name",  filename, -1);
		sqlite_bind_int64(insert_file_stmt, "@mtime", cur_mtime);
		sqlite_run(insert_file_stmt);
		sqlite_reset_stmt(insert_file_stmt);

		semind_streams[i].id = sqlite3_last_insert_rowid(semind_db);
	}

	sqlite_run(unlock_stmt);

	semind_streams_nr = input_stream_nr;
}

// Assembly:
leaq 0x5daba(%rip), %rax     # 0x6e300
movslq (%rax), %rsi
cmpl %esi, 0x55f09(%rip)     # 0x66758
jge 0x10b36
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1098, %rsp           # imm = 0x1098
movq 0x55ecb(%rip), %rdi     # 0x66738
shlq $0x3, %rsi
callq 0xf4a0
movq %rax, 0x55ebb(%rip)     # 0x66738
testq %rax, %rax
jne 0x1089a
callq 0xf390
movl (%rax), %esi
leaq 0x3496a(%rip), %rdx     # 0x451fa
pushq $0x1
popq %rdi
xorl %eax, %eax
callq 0x10384
movq 0x55e67(%rip), %rdi     # 0x66708
callq 0x107c8
movslq 0x55eab(%rip), %r13     # 0x66758
imulq $0x50, %r13, %rbx
pushq $-0x1
popq %rdx
pushq $-0x1
popq %rcx
leaq 0x5da42(%rip), %rax     # 0x6e300
movslq (%rax), %rax
cmpq %rax, %r13
jge 0x10b0a
leaq 0x5da37(%rip), %rax     # 0x6e308
movq (%rax), %rsi
cmpl $-0x1, (%rsi,%rbx)
movq %rdx, %rax
je 0x10af3
movl %ecx, %r14d
movq 0x8(%rsi,%rbx), %rdi
movq %rsp, %rsi
callq 0xf4f0
testl %eax, %eax
jns 0x1091c
callq 0xf390
movl (%rax), %esi
leaq 0x5da05(%rip), %rax     # 0x6e308
movq (%rax), %rax
movq 0x8(%rax,%rbx), %rcx
pushq $0x1
popq %rdi
leaq 0x2cb34(%rip), %rdx     # 0x3d449
xorl %eax, %eax
callq 0x10384
movq 0x58(%rsp), %r15
leaq 0x5d9e0(%rip), %rax     # 0x6e308
movq (%rax), %rax
movq 0x8(%rax,%rbx), %rdi
leaq 0x90(%rsp), %rbp
movq %rbp, %rsi
callq 0xf270
testq %rax, %rax
jne 0x1096c
callq 0xf390
movl (%rax), %esi
leaq 0x5d9b5(%rip), %rax     # 0x6e308
movq (%rax), %rax
movq 0x8(%rax,%rbx), %rcx
pushq $0x1
popq %rdi
leaq 0x2caed(%rip), %rdx     # 0x3d452
xorl %eax, %eax
callq 0x10384
movq 0x55d6d(%rip), %r12     # 0x666e0
movq %rbp, %rdi
leaq 0x54d63(%rip), %rsi     # 0x656e0
movq %r12, %rdx
callq 0xf190
movl %eax, %ecx
pushq $-0x1
popq %rdx
movq %rdx, %rax
testl %ecx, %ecx
movl %r14d, %ecx
jne 0x10af3
cmpb $0x2f, 0x90(%rsp,%r12)
movq %rdx, %rax
jne 0x10af3
movq 0x55d87(%rip), %rax     # 0x66738
andq $0x0, (%rax,%r13,8)
leaq 0x91(%rsp), %rax
addq %rax, %r12
cmpl $0x2, 0x55d34(%rip)     # 0x666fc
jl 0x109e2
xorl %edi, %edi
xorl %esi, %esi
leaq 0x2ca8a(%rip), %rdx     # 0x3d45f
movq %r12, %rcx
xorl %eax, %eax
callq 0x10384
movl %r14d, %ecx
movq 0x55d37(%rip), %rdi     # 0x66720
leaq 0x2ca0e(%rip), %rbp     # 0x3d3fe
movq %rbp, %rsi
movq %r12, %rdx
movl %ecx, %r14d
callq 0x10bf6
movq 0x55d1b(%rip), %rdi     # 0x66720
callq 0x107c8
cmpl $0x64, %eax
movq %r15, %rax
movl %r14d, %r15d
movq %rax, %r14
jne 0x10a92
movq 0x55d01(%rip), %rdi     # 0x66720
xorl %esi, %esi
callq 0xf240
movq 0x55d0b(%rip), %rcx     # 0x66738
movq %rax, (%rcx,%r13,8)
movq 0x55ce8(%rip), %rdi     # 0x66720
pushq $0x1
popq %rsi
callq 0xf240
movq %rax, %rbp
movq 0x55cd6(%rip), %rdi     # 0x66720
callq 0x10c5d
cmpq %rbp, %r14
pushq $-0x1
popq %rdx
movl %r15d, %ecx
je 0x10afe
movq 0x55ccb(%rip), %rdi     # 0x66730
leaq 0x2c992(%rip), %rbp     # 0x3d3fe
movq %rbp, %rsi
movq %r12, %rdx
movl %ecx, %r15d
callq 0x10bf6
movq 0x55caf(%rip), %rdi     # 0x66730
callq 0x107c8
movq 0x55ca3(%rip), %rdi     # 0x66730
callq 0x10c5d
movq 0x55c87(%rip), %rdi     # 0x66720
callq 0x10c5d
movq 0x55c83(%rip), %rdi     # 0x66728
movq %rbp, %rsi
movq %r12, %rdx
movl %r15d, %ecx
callq 0x10bf6
movq 0x55c6e(%rip), %rdi     # 0x66728
leaq 0x2c9ab(%rip), %rsi     # 0x3d46c
movq %r14, %rdx
callq 0x10c6f
movq 0x55c58(%rip), %rdi     # 0x66728
callq 0x107c8
movq 0x55c4c(%rip), %rdi     # 0x66728
callq 0x10c5d
movq 0x55c08(%rip), %rdi     # 0x666f0
callq 0xf560
pushq $-0x1
popq %rdx
movl %r15d, %ecx
movq 0x55c3e(%rip), %rsi     # 0x66738
movq %rax, (%rsi,%r13,8)
incq %r13
addq $0x50, %rbx
jmp 0x108b7
movq 0x55bff(%rip), %rdi     # 0x66710
callq 0x107c8
leaq 0x5d7e3(%rip), %rax     # 0x6e300
movl (%rax), %eax
movl %eax, 0x55c33(%rip)     # 0x66758
addq $0x1098, %rsp           # imm = 0x1098
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq