LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/afi-lambda[P]a_little_smalltalk/src/unixio.c
// Function: imageRead
void imageRead(FILE *fp)
{
    short i, size;
    //object *mBlockAlloc();

    fr(fp, (char *) &symbols, sizeof(object));
    i = 0;

    while (fr(fp, (char *) &dummyObject, sizeof(dummyObject)))
    {
        i = dummyObject.di;

        if ((i < 0) || (i > ObjectTableMax))
            sysError("reading index out of range", "");
        objectTable[i].STclass = dummyObject.cl;
        if ((objectTable[i].STclass < 0) || ((objectTable[i].STclass >> 1)
                                             > ObjectTableMax))
        {
            fprintf(stderr, "index %d\n", dummyObject.cl);
            sysError("class out of range", "imageRead");
        }
        objectTable[i].size = size = dummyObject.ds;
        if (size < 0)
            size = ((-size) + 1) / 2;
        if (size != 0)
        {
            objectTable[i].memory = mBlockAlloc((int) size);
            fr(fp, (char *) objectTable[i].memory, sizeof(object)
               * (int) size);
        }
        else
            objectTable[i].memory = (object *) 0;
    }

    /* now restore ref counts, getting rid of unneeded junk */
    visit(symbols);
    /* toss out the old free lists, build new ones */
    setFreeLists();

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1edcb(%rip), %rsi     # 0x27894
movl $0x2, %edx
callq 0x8bda
leaq 0x215e6(%rip), %rsi     # 0x2a0c0
movq %rbx, %rdi
movl $0x8, %edx
callq 0x8bda
testl %eax, %eax
je 0x8bb6
leaq 0xbbf(%rip), %r12       # 0x96b5
leaq 0x5743(%rip), %rbp      # 0xe240
leaq 0x215bc(%rip), %r13     # 0x2a0c0
movl 0x215b5(%rip), %r14d    # 0x2a0c0
movzwl %r14w, %eax
cmpl $0x1965, %eax           # imm = 0x1965
jb 0x8b25
leaq 0x112b(%rip), %rdi      # 0x9c48
movq %r12, %rsi
callq 0x4dfc
movzwl 0x21598(%rip), %edi     # 0x2a0c4
movswq %r14w, %r14
shlq $0x4, %r14
movw %di, (%rbp,%r14)
cmpl $0x32ca, %edi           # imm = 0x32CA
jae 0x8baf
addq %rbp, %r14
movzwl 0x2157a(%rip), %eax     # 0x2a0c6
movw %ax, 0x4(%r14)
movl $0x1, %ecx
subl %eax, %ecx
movzwl %cx, %r15d
shrl %r15d
testw %ax, %ax
cmovnsl %eax, %r15d
testw %r15w, %r15w
je 0x8b8d
movzwl %r15w, %edi
callq 0x2cb0
movq %rax, 0x8(%r14)
leal (%r15,%r15), %ecx
movzwl %cx, %edx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x8bda
jmp 0x8b95
movq $0x0, 0x8(%r14)
movq %rbx, %rdi
movq %r13, %rsi
movl $0x8, %edx
callq 0x8bda
testl %eax, %eax
jne 0x8b04
jmp 0x8bb6
callq 0x287f
jmp 0x8b42
leaq 0x1ecd7(%rip), %rax     # 0x27894
movswl (%rax), %edi
callq 0x30a9
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2c3f
// File: /workspace/github_c_makefile_star2_O1/afi-lambda[P]a_little_smalltalk/src/unixio.c
// Function: fr
static int fr(FILE *fp, char *p, int s)
{
    int r;

    r = fread(p, s, 1, fp);
    if (r && (r != 1))
        sysError("imageRead count error", "");
    return r;
}

// Assembly:
pushq %rbx
movq %rsi, %rax
movq %rdi, %rcx
movslq %edx, %rsi
movl $0x1, %edx
movq %rax, %rdi
callq 0x2070
movq %rax, %rbx
cmpl $0x2, %ebx
jb 0x8c0c
leaq 0x10cf(%rip), %rdi      # 0x9ccf
leaq 0xaae(%rip), %rsi       # 0x96b5
callq 0x4dfc
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/afi-lambda[P]a_little_smalltalk/src/unixio.c
// Function: imageWrite
void imageWrite(FILE *fp)
{
    short i, size;

    fw(fp, (char *) &symbols, sizeof(object));

    for (i = 0; i < ObjectTableMax; i++)
    {
        if (objectTable[i].referenceCount > 0)
        {
            dummyObject.di = i;
            dummyObject.cl = objectTable[i].STclass;
            dummyObject.ds = size = objectTable[i].size;
            fw(fp, (char *) &dummyObject, sizeof(dummyObject));
            if (size < 0)
                size = ((-size) + 1) / 2;
            if (size != 0)
                fw(fp, (char *) objectTable[i].memory, sizeof(object) * size);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
leaq 0x1ec72(%rip), %rsi     # 0x27894
movl $0x2, %edx
callq 0x8cb7
leaq 0x560d(%rip), %r15      # 0xe240
addq $0x8, %r15
xorl %r12d, %r12d
leaq 0x2147f(%rip), %r14     # 0x2a0c0
cmpw $0x0, -0x6(%r15)
jle 0x8c9e
movl %r12d, 0x21470(%rip)    # 0x2a0c0
movzwl -0x8(%r15), %eax
movw %ax, 0x21468(%rip)      # 0x2a0c4
movl -0x4(%r15), %ebp
movw %bp, 0x2145f(%rip)      # 0x2a0c6
movq %rbx, %rdi
movq %r14, %rsi
movl $0x8, %edx
callq 0x8cb7
movl $0x1, %eax
subl %ebp, %eax
movzwl %ax, %eax
shrl %eax
testw %bp, %bp
cmovnsl %ebp, %eax
testw %ax, %ax
je 0x8c9e
movq (%r15), %rsi
addl %eax, %eax
movzwl %ax, %edx
movq %rbx, %rdi
callq 0x8cb7
incq %r12
addq $0x10, %r15
cmpq $0x1964, %r12           # imm = 0x1964
jne 0x8c41
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/mkdb.c
// Function: main
int main(int argc, char **argv)
{
	int index = -1;
	int opt;
	struct arg_table argtbl;

	while ((opt = getopt(argc, argv, "n:f:")) != -1) {
		switch (opt) {
		case 'n':
			argtbl.size = atoll(optarg);
			break;
		case 'f':
			/* FIXME: Beware of overflowing!!!. */
			strcpy(argtbl.path, optarg);
			break;
		default:
			usage(argc, argv);
			exit(EXIT_FAILURE);
		}
		index++;
	}
	if (index < 0) {
		usage(argc, argv);
		exit(EXIT_FAILURE);
	}
	if (mkdb(&argtbl))
		exit(EXIT_FAILURE);

	exit(EXIT_SUCCESS);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movq %rsi, %rbx
movl %edi, %r14d
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
leaq 0x4947(%rip), %r15      # 0x708a
movq 0x888e(%rip), %r12      # 0xafd8
movl %r14d, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2240
cmpl $0x66, %eax
je 0x2771
cmpl $0x6e, %eax
jne 0x2786
movq (%r12), %rdi
callq 0x2150
movq %rax, -0x30(%rbp)
jmp 0x2781
movq (%r12), %rsi
leaq -0x1030(%rbp), %rdi
callq 0x2050
incl %r13d
jmp 0x274a
cmpl $-0x1, %eax
jne 0x2790
testl %r13d, %r13d
jns 0x27a2
movq %rbx, %rsi
callq 0x252c
movl $0x1, %edi
callq 0x2260
leaq -0x1030(%rbp), %rdi
callq 0x2542
testl %eax, %eax
jne 0x2798
xorl %edi, %edi
callq 0x2260
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/extents_bh.c
// Function: fs_bread
struct buffer_head *fs_bread(struct super_block *sb, ext4_fsblk_t block, int *ret)
{
	int err = 0;
	struct buffer_head *bh;
	bh = sb_getblk(sb, block);
	if (!bh)
		return NULL;

	err = bh_submit_read(bh);
	wait_on_buffer(bh);
	if (ret)
		*ret = err;

	fs_bh_alloc++;

	return bh;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq 0x10(%rdi), %rax
movl (%rdi), %edx
movq %rax, %rdi
callq 0x30b0
testq %rax, %rax
je 0x280e
movq %rax, %r14
movq %rax, %rdi
callq 0x2fee
movl %eax, %r15d
movq %r14, %rdi
callq 0x2bbc
testq %rbx, %rbx
je 0x2806
movl %r15d, (%rbx)
incl 0x8988(%rip)            # 0xb194
jmp 0x2811
xorl %r14d, %r14d
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/extents_bh.c
// Function: fs_bwrite
struct buffer_head *fs_bwrite(struct super_block *sb, ext4_fsblk_t block, int *ret)
{
	int err = 0;
	struct buffer_head *bh;
	bh = sb_getblk(sb, block);
	if (ret)
		*ret = err;

	if (bh)
		fs_bh_alloc++;

	return bh;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq 0x10(%rdi), %rax
movl (%rdi), %edx
movq %rax, %rdi
callq 0x30b0
testq %rbx, %rbx
je 0x2841
movl $0x0, (%rbx)
testq %rax, %rax
je 0x284c
incl 0x8948(%rip)            # 0xb194
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: bdev_alloc
struct block_device *bdev_alloc(int fd, int blocksize_bits)
{
	struct block_device *bdev;
	struct super_block *super;

	bdev = xmalloc(sizeof(struct block_device) + sizeof(struct super_block));
	memset(bdev, 0,
	       sizeof(struct block_device) + sizeof(struct super_block));
	super = (struct super_block *)(bdev + 1);

	bdev->bd_fd = fd;
	bdev->bd_flags = 0;
	bdev->bd_super = super;

	INIT_LIST_HEAD(&bdev->bd_bh_free);
	INIT_LIST_HEAD(&bdev->bd_bh_dirty);
#ifndef USE_AIO
	INIT_LIST_HEAD(&bdev->bd_bh_ioqueue);
#endif
	pthread_mutex_init(&bdev->bd_bh_free_lock, NULL);
	pthread_mutex_init(&bdev->bd_bh_dirty_lock, NULL);
#ifndef USE_AIO
	pthread_mutex_init(&bdev->bd_bh_ioqueue_lock, NULL);
#endif
	pthread_mutex_init(&bdev->bd_bh_root_lock, NULL);

	super->s_blocksize_bits = blocksize_bits;
	super->s_blocksize = 1 << super->s_blocksize_bits;
	super->s_bdev = bdev;

	pipe(bdev->bd_bh_writeback_wakeup_fd);
	pthread_create(&bdev->bd_bh_writeback_thread, NULL,
			buffer_writeback_thread, bdev);

#ifndef USE_AIO
	pipe(bdev->bd_bh_io_wakeup_fd);
	pthread_create(&bdev->bd_bh_io_thread, NULL,
			buffer_io_thread, bdev);
#endif

	return bdev;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movl %edi, %r15d
movl $0x148, %edi            # imm = 0x148
callq 0x21c0
movq %rax, %rbx
movl $0x148, %edx            # imm = 0x148
movq %rax, %rdi
xorl %esi, %esi
callq 0x20d0
leaq 0x128(%rbx), %rax
movl %r15d, (%rbx)
movq $0x0, 0x8(%rbx)
movq %rax, 0x10(%rbx)
leaq 0x48(%rbx), %rax
movq %rax, 0x50(%rbx)
movq %rax, 0x48(%rbx)
leaq 0x80(%rbx), %rax
movq %rax, 0x88(%rbx)
movq %rax, 0x80(%rbx)
leaq 0x20(%rbx), %rdi
xorl %esi, %esi
callq 0x22a0
leaq 0x58(%rbx), %rdi
xorl %esi, %esi
callq 0x22a0
leaq 0xc8(%rbx), %rdi
xorl %esi, %esi
callq 0x22a0
movl %r14d, 0x130(%rbx)
movl $0x1, %eax
movl %r14d, %ecx
shll %cl, %eax
cltq
movq %rax, 0x128(%rbx)
movq %rbx, 0x138(%rbx)
leaq 0x120(%rbx), %rdi
callq 0x20f0
leaq 0x110(%rbx), %rdi
leaq 0x18(%rip), %rdx        # 0x29b1
xorl %esi, %esi
movq %rbx, %rcx
callq 0x21f0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: buffer_writeback_thread
static void *buffer_writeback_thread(void *arg)
{
	struct epoll_event epev = {0};
	struct block_device *bdev = arg;
	int epfd = epoll_create(1);
	if (epfd < 0)
		return NULL;

	epev.events = EPOLLIN;
	epoll_ctl(epfd, EPOLL_CTL_ADD, bdev->bd_bh_writeback_wakeup_fd[0], &epev);

	while (1) {
		int ret;
		ret = epoll_wait(epfd, &epev, 1, buffer_writeback_ms);
		if (ret > 0) {
			/* We got an nofication. */
			signed char command;
			command = bdev_writeback_thread_read_notify(bdev);
			try_to_sync_buffers(bdev);
			if (bdev_is_notify_exiting(command))
				break;
			
			continue;
		}
		if (ret == 0) {
			/* just flush out the dirty data. */
			try_to_sync_buffers(bdev);
		}
		if (ret < 0 && errno != EINTR)
			break;

	}
	close(epfd);
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x1, %edi
callq 0x2250
testl %eax, %eax
js 0x2a74
movl %eax, %r14d
leaq -0x38(%rbp), %r15
movl $0x1, (%r15)
movl 0x120(%rbx), %edx
movl %eax, %edi
movl $0x1, %esi
movq %r15, %rcx
callq 0x2110
leaq -0x29(%rbp), %r12
movl %r14d, %edi
movq %r15, %rsi
movl $0x1, %edx
movl $0x2710, %ecx           # imm = 0x2710
callq 0x21e0
testl %eax, %eax
jle 0x2a50
movb $0x0, -0x29(%rbp)
movl 0x120(%rbx), %edi
movl $0x1, %edx
movq %r12, %rsi
callq 0x2130
movb -0x29(%rbp), %r13b
movq %rbx, %rdi
callq 0x342a
testb %r13b, %r13b
jns 0x2a0d
jmp 0x2a6c
movl %eax, %r13d
jne 0x2a5d
movq %rbx, %rdi
callq 0x342a
testl %r13d, %r13d
jns 0x2a0d
callq 0x2040
cmpl $0x4, (%rax)
je 0x2a0d
movl %r14d, %edi
callq 0x20e0
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: bdev_free
void bdev_free(struct block_device *bdev)
{
	struct rb_node *node;

	bdev_writeback_thread_notify_exit(bdev);
	pthread_join(bdev->bd_bh_writeback_thread, NULL);

#ifndef USE_AIO
	bdev_io_thread_notify_exit(bdev);
	pthread_join(bdev->bd_bh_io_thread, NULL);
#endif
	
	pthread_mutex_lock(&bdev->bd_bh_root_lock);
	while ((node = rb_first(&bdev->bd_bh_root))) {
		struct buffer_head *bh = rb_entry(
		    node, struct buffer_head, b_rb_node);
		wait_on_buffer(bh);
		detach_bh_from_freelist(bh);
		__buffer_remove(bdev, bh);
		buffer_free(bh);
	}
	pthread_mutex_unlock(&bdev->bd_bh_root_lock);

	if (bdev->bd_nr_free != 0)
		fprintf(stderr, "bdev->bd_nr_free == %d", bdev->bd_nr_free);

#ifndef USE_AIO
	close(bdev->bd_bh_io_wakeup_fd[0]);
	close(bdev->bd_bh_io_wakeup_fd[1]);
#endif

	close(bdev->bd_bh_writeback_wakeup_fd[0]);
	close(bdev->bd_bh_writeback_wakeup_fd[1]);

	pthread_mutex_destroy(&bdev->bd_bh_free_lock);
	pthread_mutex_destroy(&bdev->bd_bh_dirty_lock);
#ifndef USE_AIO
	pthread_mutex_destroy(&bdev->bd_bh_ioqueue_lock);
#endif
	pthread_mutex_destroy(&bdev->bd_bh_root_lock);

	xfree(bdev);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq -0x29(%rbp), %rsi
movb $-0x1, (%rsi)
movl 0x124(%rdi), %edi
movl $0x1, %edx
callq 0x2080
movq 0x110(%rbx), %rdi
xorl %esi, %esi
callq 0x2290
leaq 0xc8(%rbx), %rdi
movq %rdi, -0x38(%rbp)
callq 0x22c0
leaq 0xf0(%rbx), %r15
movq %r15, %rdi
callq 0x3a44
testq %rax, %rax
je 0x2b30
movq %rax, %r12
leaq -0x168(%r12), %r13
leaq -0x98(%r12), %r14
movq %r14, %rdi
callq 0x2060
movq %r14, %rdi
callq 0x2100
movq %r13, %rdi
callq 0x2be2
movq %r12, %rdi
movq %r15, %rsi
callq 0x3b16
movq %r13, %rdi
callq 0x2c5c
movq %r15, %rdi
callq 0x3a44
movq %rax, %r12
testq %rax, %rax
jne 0x2ae5
movq -0x38(%rbp), %r14
movq %r14, %rdi
callq 0x21b0
movl 0x18(%rbx), %edx
testl %edx, %edx
jne 0x2b8e
movl 0x120(%rbx), %edi
callq 0x20e0
movl 0x124(%rbx), %edi
callq 0x20e0
leaq 0x20(%rbx), %rdi
callq 0x20b0
leaq 0x58(%rbx), %rdi
callq 0x20b0
movq %r14, %rdi
callq 0x20b0
testq %rbx, %rbx
je 0x2ba8
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2030
movq 0x8463(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x4544(%rip), %rsi      # 0x70e3
xorl %eax, %eax
callq 0x2170
jmp 0x2b43
callq 0x2306
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: detach_bh_from_freelist
static void
detach_bh_from_freelist(struct buffer_head *bh)
{
	struct block_device *bdev = bh->b_bdev;
	if (!list_empty(&bh->b_freelist)) {
		pthread_mutex_lock(&bdev->bd_bh_free_lock);
		list_del_init(&bh->b_freelist);
		bh->b_bdev->bd_nr_free--;
		pthread_mutex_unlock(&bdev->bd_bh_free_lock);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x158(%rdi), %r15
cmpq %r15, 0x160(%rdi)
je 0x2c51
movq %rdi, %rbx
movq 0xf0(%rdi), %r14
addq $0x20, %r14
movq %r14, %rdi
callq 0x22c0
movq 0x158(%rbx), %rax
movq 0x160(%rbx), %rcx
movq %rax, (%rcx)
movq %rcx, 0x8(%rax)
movq %r15, 0x160(%rbx)
movq %r15, 0x158(%rbx)
movq 0xf0(%rbx), %rax
decl 0x18(%rax)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x21b0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: buffer_free
static void buffer_free(struct buffer_head *bh)
{
	sem_destroy(&bh->b_event);
	pthread_mutex_destroy(&bh->b_lock);

	if (bh->b_count != 0)
		fprintf(stderr, "bh: %p b_count != 0, my pid: %d", bh, getpid());

	xfree(bh);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0xd0, %rdi
callq 0x22b0
leaq 0x110(%rbx), %rdi
callq 0x20b0
cmpl $0x0, 0x108(%rbx)
jne 0x2c99
testq %rbx, %rbx
je 0x2ca3
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2030
movq %rbx, %rdi
callq 0x2328
jmp 0x2c86
callq 0x235b
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: buffer_alloc
struct buffer_head *buffer_alloc(struct block_device *bdev, uint64_t block,
				 int page_size)
{
	struct buffer_head *bh;
	bh = xmalloc(sizeof(struct buffer_head) + page_size);
	if (!bh)
		return NULL;

	memset(bh, 0, sizeof(struct buffer_head));
	bh->b_bdev = bdev;
	bh->b_data = bh + 1;
	bh->b_size = page_size;
	bh->b_blocknr = block;
	bh->b_count = 0;
	bh->b_page = NULL;

	sem_init(&bh->b_event, 0, 1);

	pthread_mutex_init(&bh->b_lock, NULL);
	INIT_LIST_HEAD(&bh->b_freelist);
	INIT_LIST_HEAD(&bh->b_dirty_list);

#ifndef USE_AIO
	INIT_LIST_HEAD(&bh->b_io_list);
#endif

	sync_writeback_buffers(bdev);

	return bh;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
movq %rdi, %r14
movslq %edx, %r12
leaq 0x180(%r12), %rdi
callq 0x21c0
testq %rax, %rax
je 0x2d8b
movq %rax, %rbx
movl $0x180, %edx            # imm = 0x180
movq %rax, %rdi
xorl %esi, %esi
callq 0x20d0
movq %r14, 0xf0(%rbx)
leaq 0x180(%rbx), %rax
movq %rax, 0x18(%rbx)
movq %r12, 0x10(%rbx)
movq %r15, 0x8(%rbx)
movl $0x0, 0x108(%rbx)
movq $0x0, 0x20(%rbx)
leaq 0xd0(%rbx), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x21d0
leaq 0x110(%rbx), %rdi
xorl %esi, %esi
callq 0x22a0
leaq 0x158(%rbx), %rax
movq %rax, 0x160(%rbx)
movq %rax, 0x158(%rbx)
movq %rbx, %rax
addq $0x148, %rax            # imm = 0x148
movq %rax, 0x150(%rbx)
movq %rax, 0x148(%rbx)
cmpl $0xa, 0x842d(%rip)      # 0xb19c
jl 0x2d8d
leaq -0x21(%rbp), %rsi
movb $0x1, (%rsi)
movl 0x124(%r14), %edi
movl $0x1, %edx
callq 0x2080
jmp 0x2d8d
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: after_buffer_sync
void after_buffer_sync(struct buffer_head *bh, int uptodate)
{
	if (uptodate)
		set_buffer_uptodate(bh);

	put_bh(bh);
	remove_buffer_from_writeback(bh);
	clear_buffer_dirty(bh);
	attach_bh_to_freelist(bh);
	unlock_buffer(bh);
	sem_post(&bh->b_event);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x2e65
orb $0x1, (%rbx)
lock
decl 0x108(%rbx)
movq %rbx, %rdi
callq 0x2ea0
andb $-0x3, (%rbx)
movq %rbx, %rdi
callq 0x2efe
leaq 0x110(%rbx), %rdi
callq 0x21b0
addq $0xd0, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2100
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: remove_buffer_from_writeback
static void remove_buffer_from_writeback(struct buffer_head *bh)
{
	struct block_device *bdev = bh->b_bdev;
	pthread_mutex_lock(&bdev->bd_bh_dirty_lock);
	if (!list_empty(&bh->b_dirty_list)) {
		list_del_init(&bh->b_dirty_list);
		buffer_dirty_count--;
	}
	pthread_mutex_unlock(&bdev->bd_bh_dirty_lock);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movq 0xf0(%rdi), %rbx
addq $0x58, %rbx
movq %rbx, %rdi
callq 0x22c0
leaq 0x148(%r14), %rax
movq 0x150(%r14), %rcx
cmpq %rax, %rcx
je 0x2ef2
movq 0x148(%r14), %rdx
movq %rdx, (%rcx)
movq %rcx, 0x8(%rdx)
movq %rax, 0x150(%r14)
movq %rax, 0x148(%r14)
decl 0x82aa(%rip)            # 0xb19c
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x21b0
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: attach_bh_to_freelist
static void
attach_bh_to_freelist(struct buffer_head *bh)
{
	struct block_device *bdev = bh->b_bdev;
	if (list_empty(&bh->b_freelist)) {
		pthread_mutex_lock(&bdev->bd_bh_free_lock);
		list_add_tail(&bh->b_freelist, &bh->b_bdev->bd_bh_free);
		bh->b_bdev->bd_nr_free++;
		pthread_mutex_unlock(&bdev->bd_bh_free_lock);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x158(%rdi), %r15
cmpq %r15, 0x160(%rdi)
je 0x2f23
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rbx
movq 0xf0(%rdi), %r14
addq $0x20, %r14
movq %r14, %rdi
callq 0x22c0
movq 0xf0(%rbx), %rax
leaq 0x48(%rax), %rcx
movq 0x48(%rax), %rdx
movq %r15, 0x48(%rax)
movq %rcx, 0x160(%rbx)
movq %rdx, 0x158(%rbx)
movq %r15, 0x8(%rdx)
incl 0x18(%rax)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x21b0
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: after_buffer_write
void after_buffer_write(struct buffer_head *bh, int uptodate)
{
	if (uptodate)
		set_buffer_uptodate(bh);

	put_bh(bh);
	remove_buffer_from_writeback(bh);
	clear_buffer_dirty(bh);
	unlock_buffer(bh);
	sem_post(&bh->b_event);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x2f83
orb $0x1, (%rbx)
lock
decl 0x108(%rbx)
movq %rbx, %rdi
callq 0x2ea0
andb $-0x3, (%rbx)
leaq 0x110(%rbx), %rdi
callq 0x21b0
addq $0xd0, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2100
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: after_submit_read
void after_submit_read(struct buffer_head *bh, int uptodate)
{
	if (uptodate)
		set_buffer_uptodate(bh);

	put_bh(bh);
	unlock_buffer(bh);
	sem_post(&bh->b_event);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x2fc6
orb $0x1, (%rbx)
lock
decl 0x108(%rbx)
leaq 0x110(%rbx), %rdi
callq 0x21b0
addq $0xd0, %rbx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2100
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: bh_submit_read
int bh_submit_read(struct buffer_head *bh)
{
	int ret;

	lock_buffer(bh);
	if (buffer_uptodate(bh)) {
		unlock_buffer(bh);
		return 0;
	}

	get_bh(bh);
	clear_buffer_dirty(bh);
	remove_buffer_from_writeback(bh);
	bh->b_end_io = after_submit_read;
	ret = submit_bh(READ, bh);
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x110(%rdi), %r14
movq %r14, %rdi
callq 0x2120
testl %eax, %eax
je 0x3013
movq %r14, %rdi
callq 0x22c0
testq $0x1, (%rbx)
jne 0x3048
lock
incl 0x108(%rbx)
andb $-0x3, (%rbx)
movq %rbx, %rdi
callq 0x2ea0
leaq -0x7f(%rip), %rax       # 0x2fb6
movq %rax, 0xf8(%rbx)
xorl %edi, %edi
movq %rbx, %rsi
callq 0x2dce
jmp 0x3050
movq %r14, %rdi
callq 0x21b0
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: write_dirty_buffer
int write_dirty_buffer(struct buffer_head *bh)
{
	int ret = 0;

	if (!trylock_buffer(bh))
		return ret;

	if (buffer_dirty(bh)) {
		get_bh(bh);
		bh->b_end_io = after_buffer_write;
		ret = submit_bh(WRITE, bh);
	} else {
		unlock_buffer(bh);
	}
	return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x110(%rdi), %r14
movq %r14, %rdi
callq 0x2120
testl %eax, %eax
jne 0x30a9
testq $0x2, (%rbx)
jne 0x3087
movq %r14, %rdi
callq 0x21b0
jmp 0x30a9
lock
incl 0x108(%rbx)
leaq -0x122(%rip), %rax      # 0x2f73
movq %rax, 0xf8(%rbx)
movl $0x1, %edi
movq %rbx, %rsi
callq 0x2dce
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: _getblk
struct buffer_head *__getblk(struct block_device *bdev, uint64_t block,
			     int bsize)
{
	struct buffer_head *bh;

	bh = buffer_search(bdev, block);
	if (bh) {
		detach_bh_from_freelist(bh);
		remove_buffer_from_writeback(bh);
		get_bh(bh);
		return bh;
	}
	bh = buffer_alloc(bdev, block, bsize);
	if (bh == NULL)
		return NULL;

	buffer_insert(bdev, bh);

	get_bh(bh);
	return bh;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r12d
movq %rsi, %r13
movq %rdi, %r15
leaq 0xf0(%rdi), %rax
movq %rax, -0x30(%rbp)
leaq 0xc8(%rdi), %r14
movq %r14, %rdi
callq 0x22c0
movq 0xf0(%r15), %rax
testq %rax, %rax
je 0x311c
movq -0x160(%rax), %rcx
cmpq %rcx, %r13
js 0x310b
movl $0x8, %ecx
jne 0x3110
leaq -0x168(%rax), %rbx
xorl %ecx, %ecx
jmp 0x3116
movl $0x10, %ecx
movq (%rax,%rcx), %rax
movb $0x1, %cl
testb %cl, %cl
jne 0x30e8
jmp 0x311e
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x21b0
testq %rbx, %rbx
je 0x313d
movq %rbx, %rdi
callq 0x2be2
movq %rbx, %rdi
callq 0x2ea0
jmp 0x317d
movq %r15, %rdi
movq %r13, %rsi
movl %r12d, %edx
callq 0x2caf
testq %rax, %rax
je 0x3196
movq %rax, %rbx
movq %r14, %rdi
callq 0x22c0
movq %rbx, %rsi
addq $0x168, %rsi            # imm = 0x168
leaq 0x29d(%rip), %rdx       # 0x3409
movq -0x30(%rbp), %rdi
callq 0x3b56
movq %r14, %rdi
callq 0x21b0
lock
incl 0x108(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x3184
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: brelse
void brelse(struct buffer_head *bh)
{
	int refcount;
	if (bh == NULL)
		return;
	refcount = put_bh_and_read(bh);
	if (refcount >= 1)
		goto out;
	assert(refcount == 0);

	if (!buffer_dirty(bh))
		reclaim_buffer(bh);
	else
		move_buffer_to_writeback(bh);
out:
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
je 0x31c6
movq %rdi, %rbx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
lock
xaddl %eax, 0x108(%rdi)
decl %eax
testl %eax, %eax
jle 0x31d5
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jne 0x3315
testq $0x2, (%rbx)
movq 0xf0(%rbx), %r14
jne 0x32af
movq %rbx, -0x30(%rbp)
cmpl $0x15f91, 0x18(%r14)    # imm = 0x15F91
jl 0x3298
leaq 0x20(%r14), %r15
leaq 0x48(%r14), %rax
movq %rax, -0x40(%rbp)
leaq 0xc8(%r14), %r12
leaq 0xf0(%r14), %rax
movq %rax, -0x38(%rbp)
movq %r15, %rdi
callq 0x22c0
movq 0x50(%r14), %rbx
cmpq -0x40(%rbp), %rbx
je 0x3286
leaq -0x158(%rbx), %r13
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movq %rax, (%rcx)
movq %rcx, 0x8(%rax)
movq %rbx, 0x8(%rbx)
movq %rbx, (%rbx)
movq -0x68(%rbx), %rax
decl 0x18(%rax)
movq %r15, %rdi
callq 0x21b0
movq %r12, %rdi
callq 0x22c0
addq $0x10, %rbx
movq %rbx, %rdi
movq -0x38(%rbp), %rsi
callq 0x3b16
movq %r12, %rdi
callq 0x21b0
movq %r13, %rdi
callq 0x2c5c
jmp 0x328e
movq %r15, %rdi
callq 0x21b0
cmpl $0x15f90, 0x18(%r14)    # imm = 0x15F90
jg 0x321f
movq -0x30(%rbp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2efe
addq $0x58, %r14
movq %r14, %rdi
callq 0x22c0
leaq 0x148(%rbx), %rax
cmpq %rax, 0x150(%rbx)
jne 0x32ff
movq 0xf0(%rbx), %rcx
leaq 0x80(%rcx), %rdx
movq 0x80(%rcx), %rsi
movq %rax, 0x80(%rcx)
movq %rdx, 0x150(%rbx)
movq %rsi, 0x148(%rbx)
movq %rax, 0x8(%rsi)
incl 0x7e9d(%rip)            # 0xb19c
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x21b0
leaq 0x3dfe(%rip), %rdi      # 0x711a
leaq 0x3e05(%rip), %rsi      # 0x7128
leaq 0x3e07(%rip), %rcx      # 0x7131
movl $0x323, %edx            # imm = 0x323
callq 0x20c0
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: simple_balloc
uint64_t simple_balloc(struct super_block *device, unsigned long blockcnt)
{
	struct stat64 buf;
	if(fstat64(device->s_bdev->bd_fd, &buf)) {
		perror("fstat64");
		printf("file size: %" PRIu64 "\n", buf.st_size);
		return 0;
	}
	if (posix_fallocate(device->s_bdev->bd_fd, buf.st_size, (uint64_t)blockcnt * device->s_blocksize)) {
		perror("fallocate64");
		printf("file size: %" PRIu64 ", request blockcnt: %lu\n", buf.st_size, blockcnt);
		return 0;
	}

	return buf.st_size / device->s_blocksize;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x98, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq 0x10(%rdi), %rax
movl (%rax), %edi
leaq -0xa8(%rbp), %rsi
callq 0x2280
testl %eax, %eax
jne 0x3399
movq 0x10(%r14), %rax
movl (%rax), %edi
movq -0x78(%rbp), %r15
movq (%r14), %rdx
imulq %rbx, %rdx
movq %r15, %rsi
callq 0x2190
testl %eax, %eax
jne 0x33aa
movq %r15, %rax
xorl %edx, %edx
divq (%r14)
movq %rax, %r14
movq %r14, %rax
addq $0x98, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq -0xa8(%rbp), %rdi
callq 0x237d
xorl %r14d, %r14d
jmp 0x3388
leaq 0x3dba(%rip), %rdi      # 0x716b
callq 0x2230
leaq 0x3dba(%rip), %rdi      # 0x7177
xorl %r14d, %r14d
movq %r15, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x20a0
jmp 0x3388
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: device_size
uint64_t device_size(struct block_device *bdev)
{
	struct stat64 buf;
	if(fstat64(bdev->bd_fd, &buf)) {
		perror("fstat64");
		printf("file size: %" PRIu64 "\n", buf.st_size);
		return 0;
	}

	return buf.st_size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movl (%rdi), %edi
leaq -0x90(%rbp), %rsi
callq 0x2280
testl %eax, %eax
jne 0x33f9
movq -0x60(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
leaq -0x90(%rbp), %rdi
callq 0x23aa
xorl %eax, %eax
jmp 0x33f0
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/buffer.c
// Function: try_to_sync_buffers
static void try_to_sync_buffers(struct block_device *bdev)
{
	while (1) {
		struct buffer_head *cur;
		cur = remove_first_buffer_from_writeback(bdev);
		if (cur) {
			sync_dirty_buffer(cur);
			wait_on_buffer(cur);
		} else
			break;

	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x58(%rdi), %r14
leaq 0x80(%rdi), %r13
movq %r14, %rdi
callq 0x22c0
movq 0x88(%rbx), %rax
cmpq %r13, %rax
je 0x347e
leaq -0x148(%rax), %r15
movq (%rax), %rcx
movq 0x8(%rax), %rdx
movq %rcx, (%rdx)
movq %rdx, 0x8(%rcx)
movq %rax, 0x8(%rax)
movq %rax, (%rax)
decl 0x7d20(%rip)            # 0xb19c
jmp 0x3481
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x21b0
testq %r15, %r15
je 0x3503
leaq 0x110(%r15), %r12
movq %r12, %rdi
callq 0x2120
testl %eax, %eax
jne 0x34bc
cmpl $0x0, 0x108(%r15)
jg 0x34b4
testq $0x2, (%r15)
jne 0x34de
movq %r12, %rdi
callq 0x21b0
leaq 0xd0(%r15), %r12
movq %r12, %rdi
callq 0x2060
movq %r12, %rdi
callq 0x2100
testq %r15, %r15
jne 0x3446
jmp 0x3503
lock
incl 0x108(%r15)
leaq -0x698(%rip), %rax      # 0x2e55
movq %rax, 0xf8(%r15)
movl $0x1, %edi
movq %r15, %rsi
callq 0x2dce
jmp 0x34bc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/rbtree.c
// Function: rb_insert_color
void rb_insert_color(struct rb_node *node, struct rb_root *root)
{
	struct rb_node *parent, *gparent;

	while ((parent = rb_parent(node)) && rb_is_red(parent)) {
		gparent = rb_parent(parent);

		if (parent == gparent->rb_left) {
			{
				register struct rb_node *uncle =
				    gparent->rb_right;
				if (uncle && rb_is_red(uncle)) {
					rb_set_black(uncle);
					rb_set_black(parent);
					rb_set_red(gparent);
					node = gparent;
					continue;
				}
			}

			if (parent->rb_right == node) {
				register struct rb_node *tmp;
				__rb_rotate_left(parent, root);
				tmp = parent;
				parent = node;
				node = tmp;
			}

			rb_set_black(parent);
			rb_set_red(gparent);
			__rb_rotate_right(gparent, root);
		} else {
			{
				register struct rb_node *uncle =
				    gparent->rb_left;
				if (uncle && rb_is_red(uncle)) {
					rb_set_black(uncle);
					rb_set_black(parent);
					rb_set_red(gparent);
					node = gparent;
					continue;
				}
			}

			if (parent->rb_left == node) {
				register struct rb_node *tmp;
				__rb_rotate_right(parent, root);
				tmp = parent;
				parent = node;
				node = tmp;
			}

			rb_set_black(parent);
			rb_set_red(gparent);
			__rb_rotate_left(gparent, root);
		}
	}

	rb_set_black(root->rb_node);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
andq $-0x4, %rdi
je 0x35f8
movq (%rdi), %r15
testb $0x1, %r15b
jne 0x35f8
andq $-0x4, %r15
movq 0x10(%r15), %rcx
cmpq %rdi, %rcx
je 0x359d
movb $0x1, %al
testq %rcx, %rcx
je 0x356e
movq (%rcx), %rdx
testb $0x1, %dl
jne 0x356e
orq $0x1, %rdx
movq %rdx, (%rcx)
orb $0x1, (%rdi)
andb $-0x2, (%r15)
xorl %eax, %eax
movq %r15, %r14
testb %al, %al
je 0x35f0
cmpq %r14, 0x10(%rdi)
jne 0x3589
movq %rdi, %r12
movq %rbx, %rsi
callq 0x3667
movq %r14, %rdi
movq %r12, %r14
orb $0x1, (%rdi)
andb $-0x2, (%r15)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3608
jmp 0x35f0
movq 0x8(%r15), %rcx
movb $0x1, %al
testq %rcx, %rcx
je 0x35c3
movq (%rcx), %rdx
testb $0x1, %dl
jne 0x35c3
orq $0x1, %rdx
movq %rdx, (%rcx)
orb $0x1, (%rdi)
andb $-0x2, (%r15)
xorl %eax, %eax
movq %r15, %r14
testb %al, %al
je 0x35f0
cmpq %r14, 0x8(%rdi)
jne 0x35de
movq %rdi, %r12
movq %rbx, %rsi
callq 0x3608
movq %r14, %rdi
movq %r12, %r14
orb $0x1, (%rdi)
andb $-0x2, (%r15)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3667
movq (%r14), %rdi
jmp 0x3528
movq (%rbx), %rax
orq $0x1, (%rax)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/rbtree.c
// Function: _rb_rotate_left
static void __rb_rotate_left(struct rb_node *node, struct rb_root *root)
{
	struct rb_node *right = node->rb_right;
	struct rb_node *parent = rb_parent(node);

	if ((node->rb_right = right->rb_left))
		rb_set_parent(right->rb_left, node);
	right->rb_left = node;

	rb_set_parent(right, parent);

	if (parent) {
		if (node == parent->rb_left)
			parent->rb_left = right;
		else
			parent->rb_right = right;
	} else
		root->rb_node = right;
	rb_set_parent(node, right);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rcx
movq 0x8(%rdi), %rax
andq $-0x4, %rcx
movq 0x10(%rax), %rdx
movq %rdx, 0x8(%rdi)
testq %rdx, %rdx
je 0x3631
movq (%rdx), %r8
andl $0x3, %r8d
orq %rdi, %r8
movq %r8, (%rdx)
movq %rdi, 0x10(%rax)
movq (%rax), %rdx
andl $0x3, %edx
orq %rcx, %rdx
movq %rdx, (%rax)
testq %rcx, %rcx
je 0x3656
leaq 0x10(%rcx), %rdx
leaq 0x8(%rcx), %rsi
cmpq %rdi, 0x10(%rcx)
cmoveq %rdx, %rsi
movq %rax, (%rsi)
movq (%rdi), %rcx
andl $0x3, %ecx
orq %rax, %rcx
movq %rcx, (%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/rbtree.c
// Function: _rb_rotate_right
static void __rb_rotate_right(struct rb_node *node, struct rb_root *root)
{
	struct rb_node *left = node->rb_left;
	struct rb_node *parent = rb_parent(node);

	if ((node->rb_left = left->rb_right))
		rb_set_parent(left->rb_right, node);
	left->rb_right = node;

	rb_set_parent(left, parent);

	if (parent) {
		if (node == parent->rb_right)
			parent->rb_right = left;
		else
			parent->rb_left = left;
	} else
		root->rb_node = left;
	rb_set_parent(node, left);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rcx
movq 0x10(%rdi), %rax
andq $-0x4, %rcx
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rdi)
testq %rdx, %rdx
je 0x3690
movq (%rdx), %r8
andl $0x3, %r8d
orq %rdi, %r8
movq %r8, (%rdx)
movq %rdi, 0x8(%rax)
movq (%rax), %rdx
andl $0x3, %edx
orq %rcx, %rdx
movq %rdx, (%rax)
testq %rcx, %rcx
je 0x36b5
leaq 0x8(%rcx), %rdx
leaq 0x10(%rcx), %rsi
cmpq %rdi, 0x8(%rcx)
cmoveq %rdx, %rsi
movq %rax, (%rsi)
movq (%rdi), %rcx
andl $0x3, %ecx
orq %rax, %rcx
movq %rcx, (%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/rbtree.c
// Function: rb_augment_path
static void rb_augment_path(struct rb_node *node, rb_augment_f func,
			      void *data)
{
	struct rb_node *parent;

up:
	func(node, data);
	parent = rb_parent(node);
	if (!parent)
		return;

	if (node == parent->rb_left && parent->rb_right)
		func(parent->rb_right, data);
	else if (parent->rb_left)
		func(parent->rb_left, data);

	node = parent;
	goto up;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
movq %rdx, %rsi
callq *%r14
movq (%r12), %r15
andq $-0x4, %r15
je 0x398f
movq 0x10(%r15), %rax
cmpq %rax, %r12
je 0x396f
movq %rax, %rdi
testq %rax, %rax
jne 0x3978
jmp 0x397e
movq 0x8(%r15), %rdi
testq %rdi, %rdi
je 0x3965
movq %rbx, %rsi
callq *%r14
movq %r15, %r12
movq %r15, %rdi
movq %rbx, %rsi
callq *%r14
movq (%r15), %r15
jmp 0x3956
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/rbtree.c
// Function: rb_augment_erase_begin
struct rb_node *rb_augment_erase_begin(struct rb_node *node)
{
	struct rb_node *deepest;

	if (!node->rb_right && !node->rb_left)
		deepest = rb_parent(node);
	else if (!node->rb_right)
		deepest = node->rb_left;
	else if (!node->rb_left)
		deepest = node->rb_right;
	else {
		deepest = rb_next(node);
		if (deepest->rb_right)
			deepest = deepest->rb_right;
		else if (rb_parent(deepest) != node)
			deepest = rb_parent(deepest);
	}

	return deepest;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x39d5
cmpq $0x0, 0x10(%rbx)
je 0x39ee
movq %rbx, %rdi
callq 0x39f5
movq %rax, %rcx
movq 0x8(%rax), %rax
testq %rax, %rax
jne 0x39ee
movq (%rcx), %rax
andq $-0x4, %rax
cmpq %rbx, %rax
cmoveq %rcx, %rax
jmp 0x39ee
cmpq $0x0, 0x10(%rbx)
je 0x39e7
testq %rax, %rax
jne 0x39aa
movq 0x10(%rbx), %rax
jmp 0x39ee
movq (%rbx), %rax
andq $-0x4, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/rbtree.c
// Function: rb_prev
struct rb_node *rb_prev(const struct rb_node *node)
{
	struct rb_node *parent;

	if (rb_parent(node) == node)
		return NULL;

	/* If we have a left-hand child, go down and then right as far
	   as we can. */
	if (node->rb_left) {
		node = node->rb_left;
		while (node->rb_right)
			node = node->rb_right;
		return (struct rb_node *)node;
	}

	/* No left-hand children. Go up till we find an ancestor which
	   is a right-hand child of its parent */
	while ((parent = rb_parent(node)) && node == parent->rb_left)
		node = parent;

	return parent;
}

// Assembly:
movq (%rdi), %rax
andq $-0x4, %rax
cmpq %rdi, %rax
je 0x3ab9
pushq %rbp
movq %rsp, %rbp
movq 0x10(%rdi), %rcx
testq %rcx, %rcx
je 0x3aae
movq %rcx, %rax
movq 0x8(%rcx), %rcx
testq %rcx, %rcx
jne 0x3a97
jmp 0x3ab7
cmpq 0x10(%rax), %rdi
movq %rax, %rdi
jne 0x3ab7
movq (%rdi), %rax
andq $-0x4, %rax
jne 0x3aa5
popq %rbp
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/rbtree.c
// Function: rb_replace_node
void rb_replace_node(struct rb_node *victim, struct rb_node *new,
		       struct rb_root *root)
{
	struct rb_node *parent = rb_parent(victim);

	/* Set the surrounding nodes to point to the replacement */
	if (parent) {
		if (victim == parent->rb_left)
			parent->rb_left = new;
		else
			parent->rb_right = new;
	} else {
		root->rb_node = new;
	}
	if (victim->rb_left)
		rb_set_parent(victim->rb_left, new);
	if (victim->rb_right)
		rb_set_parent(victim->rb_right, new);

	/* Copy the pointers/colour from the victim to the replacement */
	*new = *victim;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rax
andq $-0x4, %rax
je 0x3ad9
leaq 0x10(%rax), %rcx
leaq 0x8(%rax), %rdx
cmpq %rdi, 0x10(%rax)
cmoveq %rcx, %rdx
movq %rsi, (%rdx)
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x3af1
movq (%rax), %rcx
andl $0x3, %ecx
orq %rsi, %rcx
movq %rcx, (%rax)
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x3b06
movq (%rax), %rcx
andl $0x3, %ecx
orq %rsi, %rcx
movq %rcx, (%rax)
movq 0x10(%rdi), %rax
movq %rax, 0x10(%rsi)
movups (%rdi), %xmm0
movups %xmm0, (%rsi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/rbtree.c
// Function: rb_erase
void rb_erase(struct rb_node *node, struct rb_root *root)
{
	if (node == root->rb_leftmost)
		root->rb_leftmost = rb_next(node);
	if (node == root->rb_rightmost)
		root->rb_rightmost = rb_prev(node);

	__rb_erase(node, root);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
cmpq %rdi, 0x8(%rsi)
jne 0x3b35
movq %r14, %rdi
callq 0x39f5
movq %rax, 0x8(%rbx)
cmpq %r14, 0x10(%rbx)
jne 0x3b47
movq %r14, %rdi
callq 0x3a7e
movq %rax, 0x10(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %rbp
jmp 0x36c6
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/rbtree.c
// Function: rb_insert
void rb_insert(struct rb_root *root, struct rb_node *node,
		 int (*cmp)(struct rb_node *, struct rb_node *))
{
	struct rb_node **new = &(root->rb_node), *parent = NULL;
	int leftmost = 1, rightmost = 1;

	/* Figure out where to put new node */
	while (*new) {
		int result = cmp(node, *new);

		parent = *new;
		if (result < 0) {
			rightmost = 0;
			new = &((*new)->rb_left);
		} else if (result > 0) {
			leftmost = 0;
			new = &((*new)->rb_right);
		} else
			return;
	}

	/* Add new node and rebalance tree. */
	if (rightmost)
		root->rb_rightmost = node;
	if (leftmost)
		root->rb_leftmost = node;
	rb_link_node(node, parent, new);
	rb_insert_color(node, root);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r8
movq (%rdi), %rsi
testq %rsi, %rsi
je 0x3bcc
movq %rdx, %r15
movl $0x1, %r13d
movq %r8, -0x30(%rbp)
movq %r8, %r12
movl $0x1, %ebx
movq %r14, %rdi
callq *%r15
movq (%r12), %rcx
testl %eax, %eax
js 0x3ba5
xorl %edx, %edx
testl %eax, %eax
je 0x3bae
leaq 0x8(%rcx), %r12
movb $0x1, %dl
xorl %ebx, %ebx
jmp 0x3bae
leaq 0x10(%rcx), %r12
movb $0x1, %dl
xorl %r13d, %r13d
testb %dl, %dl
je 0x3c0d
movq (%r12), %rsi
testq %rsi, %rsi
jne 0x3b87
testl %r13d, %r13d
sete %dl
testl %ebx, %ebx
sete %al
movq -0x30(%rbp), %r8
jmp 0x3bd5
xorl %ecx, %ecx
xorl %eax, %eax
xorl %edx, %edx
movq %r8, %r12
testb %dl, %dl
jne 0x3bdd
movq %r14, 0x10(%r8)
testb %al, %al
jne 0x3be5
movq %r14, 0x8(%r8)
movq %rcx, (%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r14)
movq %r14, (%r12)
movq %r14, %rdi
movq %r8, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3514
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/ext4_crc32.c
// Function: ext4_crc32c
uint32_t
ext4_crc32c(uint32_t crc, const void *buf, size_t size)
{
	const uint8_t *p = buf;


	while (size--)
		crc = crc32Table[(crc ^ *p++) & 0xff] ^ (crc >> 8);

	return crc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, %eax
testq %rdx, %rdx
je 0x3c4a
xorl %ecx, %ecx
leaq 0x3990(%rip), %rdi      # 0x75c0
movb (%rsi,%rcx), %r8b
xorb %al, %r8b
movzbl %r8b, %r8d
shrl $0x8, %eax
xorl (%rdi,%r8,4), %eax
incq %rcx
cmpq %rcx, %rdx
jne 0x3c30
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/db_bitmap.c
// Function: load_all_bitmap
struct db_bitmap *load_all_bitmap(struct super_block *sb, ext4_fsblk_t nrblocks, ext4_fsblk_t bitmap_block)
{
	int i, err = 0;
	int bitmap_nrblocks = blocks_of_bitmap(sb, nrblocks);
	uint8_t *bitmap = NULL;
	struct db_bitmap_desc *desc = NULL;
	struct db_bitmap *db_bitmap = xzalloc(sizeof(struct db_bitmap));
	if (!db_bitmap)
		return NULL;

	bitmap = xzalloc(bitmap_nrblocks << sb->s_blocksize_bits);
	if (!bitmap) {
		xfree(db_bitmap);
		return NULL;
	}

	desc = xzalloc(sizeof(struct db_bitmap_desc) * bitmap_nrblocks);

	for (i = 0;i < bitmap_nrblocks;i++) {
		struct buffer_head *bh;
		bh = fs_bread(sb, bitmap_block + i, &err);
		if (err)
			goto out;

		memcpy(bitmap + (i << sb->s_blocksize_bits), bh->b_data,
			sb->s_blocksize);
		fs_brelse(bh);
	}
out:
	if (err) {
		if (db_bitmap)
			xfree(db_bitmap);
		if (bitmap)
			xfree(bitmap);
		if (desc)
			xfree(desc);

		db_bitmap = NULL;
	} else {
		db_bitmap->sb = sb;
		db_bitmap->bitmap_count = bitmap_nrblocks;
		db_bitmap->bitmap = bitmap;
		db_bitmap->bitmap_desc = desc;
		db_bitmap->bitmap_block = bitmap_block;
	}
	return db_bitmap;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, -0x50(%rbp)
movq %rdi, %r14
movq %rsi, %rax
shrq $0x3, %rax
andl $0x7, %esi
cmpq $0x1, %rsi
sbbq $-0x1, %rax
movl $0x0, -0x2c(%rbp)
movl 0x8(%rdi), %r13d
movq %rax, %r15
movl %r13d, %ecx
shrq %cl, %r15
xorl %r12d, %r12d
xorl %edx, %edx
divq (%rdi)
cmpq $0x1, %rdx
sbbq $-0x1, %r15
movl $0x1, %edi
movl $0x28, %esi
callq 0x2140
testq %rax, %rax
je 0x3df8
movq %rax, %rbx
movl %r15d, %eax
movl %r13d, %ecx
shll %cl, %eax
movslq %eax, %rsi
movl $0x1, %edi
callq 0x2140
movq %rax, -0x38(%rbp)
testq %rax, %rax
je 0x3d99
movq %rbx, -0x48(%rbp)
movslq %r15d, %rsi
shlq $0x2, %rsi
movl $0x1, %edi
callq 0x2140
movq %rax, -0x40(%rbp)
testl %r15d, %r15d
jle 0x3da3
movl %r15d, %r12d
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %ebx, %ebx
movq -0x50(%rbp), %rax
leaq (%rax,%rbx), %rsi
movq %r14, %rdi
leaq -0x2c(%rbp), %rdx
callq 0x27c8
movq %rax, %r13
movl $0x5, %eax
cmpl $0x0, -0x2c(%rbp)
jne 0x3d8b
movb 0x8(%r14), %cl
movl %ebx, %eax
shll %cl, %eax
movslq %eax, %rdi
addq -0x38(%rbp), %rdi
movq 0x18(%r13), %rsi
movq (%r14), %rdx
callq 0x2180
movq %r13, %rdi
callq 0x2853
xorl %eax, %eax
testl %eax, %eax
jne 0x3d9e
incq %rbx
cmpq %rbx, %r12
jne 0x3d44
jmp 0x3da3
movq %rbx, %rdi
jmp 0x3dc4
cmpl $0x5, %eax
jne 0x3df8
cmpl $0x0, -0x2c(%rbp)
je 0x3dce
movq -0x48(%rbp), %rdi
callq 0x2030
movq -0x38(%rbp), %rdi
callq 0x2030
movq -0x40(%rbp), %rdi
testq %rdi, %rdi
je 0x3dc9
callq 0x2030
xorl %r12d, %r12d
jmp 0x3df8
movq -0x48(%rbp), %r12
movq %r14, (%r12)
movl %r15d, 0x18(%r12)
movq -0x38(%rbp), %rax
movq %rax, 0x8(%r12)
movq -0x40(%rbp), %rax
movq %rax, 0x10(%r12)
movq -0x50(%rbp), %rax
movq %rax, 0x20(%r12)
jmp 0x3df8
movq %r12, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/db_bitmap.c
// Function: save_all_bitmap
void save_all_bitmap(struct super_block *sb, struct db_bitmap *db_bitmap)
{
	int i, err = 0;
	int bitmap_nrblocks = db_bitmap->bitmap_count;
	uint8_t *bitmap = db_bitmap->bitmap;
	ext4_fsblk_t bitmap_block = db_bitmap->bitmap_block;

	for (i = 0;i < bitmap_nrblocks;i++) {
		struct buffer_head *bh;
		if (db_bitmap->bitmap_desc[i].dirty) {
			bh = fs_bwrite(sb, bitmap_block + i, &err);
			if (err)
				goto out;

			memcpy(bh->b_data, bitmap + (i << sb->s_blocksize_bits),
				sb->s_blocksize);
			fs_mark_buffer_dirty(bh);
			fs_brelse(bh);
			db_bitmap->bitmap_desc[i].dirty = 0;
		}
	}
out:
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl $0x0, -0x2c(%rbp)
movslq 0x18(%rsi), %r13
testq %r13, %r13
jle 0x3f0a
movq %rsi, %rbx
movq %rdi, %r14
movq 0x8(%rsi), %rax
movq %rax, -0x38(%rbp)
movq 0x20(%rsi), %rax
movq %rax, -0x40(%rbp)
xorl %r15d, %r15d
movq 0x10(%rbx), %rax
testb $0x1, (%rax,%r15,4)
je 0x3f02
movq -0x40(%rbp), %rax
leaq (%rax,%r15), %rsi
movq %r14, %rdi
leaq -0x2c(%rbp), %rdx
callq 0x281f
cmpl $0x0, -0x2c(%rbp)
jne 0x3f0a
movq %rax, %r12
movb 0x8(%r14), %cl
movl %r15d, %eax
shll %cl, %eax
movq 0x18(%r12), %rdi
movslq %eax, %rsi
addq -0x38(%rbp), %rsi
movq (%r14), %rdx
callq 0x2180
movq %r12, %rdi
callq 0x2863
movq %r12, %rdi
callq 0x2853
movq 0x10(%rbx), %rax
andb $-0x2, (%rax,%r15,4)
incq %r15
cmpq %r15, %r13
jne 0x3ea4
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/ngkaho1234[P]ext4-extents-tree/db_bitmap.c
// Function: bitmap_bits_set
void bitmap_bits_set(struct db_bitmap *db_bitmap, ext4_fsblk_t bit)
{
	uint8_t *bitmap = db_bitmap->bitmap;
	int bitmap_block = bit >> (db_bitmap->sb->s_blocksize_bits << 3);
	*(bitmap + (bit >> 3)) |= (1 << (bit & 7));
	db_bitmap->bitmap_desc[bitmap_block].dirty = 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rax
movq 0x8(%rdi), %rdx
movb 0x8(%rax), %cl
shlb $0x3, %cl
movq %rsi, %rax
shrq %cl, %rax
movl %esi, %ecx
andb $0x7, %cl
movb $0x1, %r8b
shlb %cl, %r8b
shrq $0x3, %rsi
orb %r8b, (%rdx,%rsi)
movq 0x10(%rdi), %rcx
cltq
orb $0x1, (%rcx,%rax,4)
popq %rbp
retq