LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/locking.c
// Function: wait_queue_notify_all
void wait_queue_notify_all(struct wait_queue *queue)
{
	LIST_HEAD(threads);
	const unsigned long flags = spin_lock_irqsave(&queue->lock);

	list_splice(&queue->threads, &threads);
	spin_unlock_irqrestore(&queue->lock, flags);

	struct list_head *head = &threads;
	struct list_head *ptr = head->next;

	for (; ptr != head; ptr = ptr->next) {
		struct wait_head *wh = LIST_ENTRY(ptr, struct wait_head, link);

		activate_thread(wh->thread);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
leaq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq -0x18(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
callq 0xffffffff8010deb0
andb $0x1, %al
movzbl %al, %eax
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0xffffffff801012b0
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
cmpq $0x0, -0x20(%rbp)
setne %al
movzbl %al, %esi
andl $0x1, %esi
callq 0xffffffff8010df20
leaq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x28(%rbp), %rax
je 0xffffffff8010dfe9
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xffffffff801084b0
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0xffffffff8010dfbd
addq $0x40, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/locking.c
// Function: _mutex_try_lock
static bool __mutex_try_lock(struct mutex *mutex)
{
	if (mutex->state == MUTEX_STATE_UNLOCKED) {
		mutex->state = MUTEX_STATE_LOCKED;
		return true;
	}
	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x18(%rax)
jne 0xffffffff8010e113
movq -0x10(%rbp), %rax
movl $0x1, 0x18(%rax)
movb $0x1, -0x1(%rbp)
jmp 0xffffffff8010e117
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/locking.c
// Function: mutex_unlock
void mutex_unlock(struct mutex *mutex)
{
	const bool enabled = spin_lock_irqsave(&mutex->wq.lock);

	mutex->state = MUTEX_STATE_UNLOCKED;
	__wait_queue_notify(&mutex->wq);
	spin_unlock_irqrestore(&mutex->wq.lock, enabled);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
callq 0xffffffff8010deb0
andb $0x1, %al
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x8(%rbp), %rdi
callq 0xffffffff8010ded0
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
movb -0x9(%rbp), %al
andb $0x1, %al
movzbl %al, %esi
callq 0xffffffff8010df20
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/locking.c
// Function: condition_wait
void condition_wait(struct mutex *mutex, struct condition *condition)
{
	struct thread *self = current();
	struct wait_head wh;

	wh.thread = self;

	spin_lock(&condition->wq.lock);
	self->state = THREAD_BLOCKED;
	list_add_tail(&wh.link, &condition->wq.threads);
	mutex_unlock(mutex);
	spin_unlock(&condition->wq.lock);

	schedule();

	mutex_lock(mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
callq 0xffffffff80108940
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
callq 0xffffffff8010e0d0
movq -0x18(%rbp), %rax
movl $0x2, 0x30(%rax)
leaq -0x30(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xffffffff80101220
movq -0x8(%rbp), %rdi
callq 0xffffffff8010e140
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
callq 0xffffffff8010e120
callq 0xffffffff80107ea0
movq -0x8(%rbp), %rdi
callq 0xffffffff8010dff0
addq $0x30, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/ide.c
// Function: bio_alloc
struct bio *bio_alloc(void)
{
	struct bio *bio = kmem_cache_alloc(ide_bio_cache);

	if (!bio)
		return 0;

	memset(bio, 0, sizeof(*bio));
	condition_init(&bio->cond);
	mutex_init(&bio->mutex);
	list_init(&bio->link);
	bio->status = BIO_NONE;
	return bio;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq 0x335f19(%rip), %rdi    # 0xffffffff80444238
callq 0xffffffff80106fd0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xffffffff8010e339
movq $0x0, -0x8(%rbp)
jmp 0xffffffff8010e37f
movq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x68, %edx
callq 0xffffffff801017e0
movq -0x10(%rbp), %rdi
addq $0x10, %rdi
callq 0xffffffff8010e390
movq -0x10(%rbp), %rdi
addq $0x28, %rdi
callq 0xffffffff8010e3b0
movq -0x10(%rbp), %rdi
callq 0xffffffff80101190
movq -0x10(%rbp), %rax
movl $0x0, 0x64(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/ide.c
// Function: bio_submit
void bio_submit(struct bio *bio)
{
	mutex_lock(&ide_bio_queue_mutex);
	list_add_tail(&bio->link, &ide_bio_queue);
	condition_notify(&ide_bio_queue_condition);
	mutex_unlock(&ide_bio_queue_mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
leaq 0x9a95(%rip), %rdi      # 0xffffffff80117eb8
callq 0xffffffff8010dff0
movq -0x8(%rbp), %rdi
leaq 0x9aa5(%rip), %rsi      # 0xffffffff80117ed8
callq 0xffffffff80101220
leaq 0x9aa9(%rip), %rdi      # 0xffffffff80117ee8
callq 0xffffffff8010e200
leaq 0x9a6d(%rip), %rdi      # 0xffffffff80117eb8
callq 0xffffffff8010e140
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/ide.c
// Function: bio_wait
void bio_wait(struct bio *bio)
{
	mutex_lock(&bio->mutex);
	while (bio->status == BIO_NONE)
		condition_wait(&bio->mutex, &bio->cond);
	mutex_unlock(&bio->mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0xffffffff8010dff0
movq -0x8(%rbp), %rax
cmpl $0x0, 0x64(%rax)
jne 0xffffffff8010e49a
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
movq -0x8(%rbp), %rsi
addq $0x10, %rsi
callq 0xffffffff8010e190
jmp 0xffffffff8010e479
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0xffffffff8010e140
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/ide.c
// Function: process_bio_queue
static int process_bio_queue(void *data)
{
	(void) data;

	while (!done) {
		struct bio *bio = dequeue_bio();

		if (!bio)
			continue;

		handle_bio(bio);
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl 0x335cce(%rip), %eax    # 0xffffffff80444240
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xffffffff8010e580
jmp 0xffffffff8010e59d
callq 0xffffffff8010e600
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xffffffff8010e592
jmp 0xffffffff8010e56c
movq -0x10(%rbp), %rdi
callq 0xffffffff8010e6a0
jmp 0xffffffff8010e56c
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/ide.c
// Function: dequeue_bio
static struct bio *dequeue_bio(void)
{
	struct bio *bio = 0;

	mutex_lock(&ide_bio_queue_mutex);
	while (!done && list_empty(&ide_bio_queue))
		condition_wait(&ide_bio_queue_mutex, &ide_bio_queue_condition);

	if (!list_empty(&ide_bio_queue)) {
		struct list_head *head = list_first(&ide_bio_queue);

		list_del(head);
		bio = LIST_ENTRY(head, struct bio, link);
	}
	mutex_unlock(&ide_bio_queue_mutex);

	return bio;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq $0x0, -0x8(%rbp)
leaq 0x98a1(%rip), %rdi      # 0xffffffff80117eb8
callq 0xffffffff8010dff0
movl 0x335c1e(%rip), %ecx    # 0xffffffff80444240
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x11(%rbp)
jne 0xffffffff8010e63b
leaq 0x98a5(%rip), %rdi      # 0xffffffff80117ed8
callq 0xffffffff801012f0
movb %al, -0x11(%rbp)
movb -0x11(%rbp), %al
testb $0x1, %al
jne 0xffffffff8010e644
jmp 0xffffffff8010e659
leaq 0x986d(%rip), %rdi      # 0xffffffff80117eb8
leaq 0x9896(%rip), %rsi      # 0xffffffff80117ee8
callq 0xffffffff8010e190
jmp 0xffffffff8010e61c
leaq 0x9878(%rip), %rdi      # 0xffffffff80117ed8
callq 0xffffffff801012f0
testb $0x1, %al
jne 0xffffffff8010e68a
leaq 0x9868(%rip), %rdi      # 0xffffffff80117ed8
callq 0xffffffff80101370
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0xffffffff80101250
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq 0x9827(%rip), %rdi      # 0xffffffff80117eb8
callq 0xffffffff8010e140
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/ide.c
// Function: handle_bio
static void handle_bio(struct bio *bio)
{
	if (bio->map.length % IDE_SECTOR_SIZE) {
		finish_bio(bio, BIO_FAILED);
		return;
	}

	char *page = page_addr(bio->map.page);
	const unsigned long long lba = bio->map.sector;
	const size_t count = bio->map.length / IDE_SECTOR_SIZE;
	void *data = page + bio->map.offset;
	const int rc = bio->dir == BIO_READ
				? read_sectors(data, lba, count)
				: write_sectors(data, lba, count);

	finish_bio(bio, rc == 0 ? BIO_FINISHED : BIO_FAILED);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl 0x5c(%rax), %eax
movl $0x200, %ecx            # imm = 0x200
cltd
idivl %ecx
cmpl $0x0, %edx
je 0xffffffff8010e6d3
movq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0xffffffff8010e780
jmp 0xffffffff8010e76e
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rdi
callq 0xffffffff8010e7d0
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movl 0x5c(%rax), %eax
movl $0x200, %ecx            # imm = 0x200
cltd
idivl %ecx
cltq
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movslq 0x58(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x60(%rax)
jne 0xffffffff8010e738
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xffffffff8010e800
movl %eax, -0x30(%rbp)
jmp 0xffffffff8010e74c
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xffffffff8010e840
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %ecx
movl $0x2, %esi
movl $0x1, %eax
cmpl $0x0, %ecx
cmovel %eax, %esi
callq 0xffffffff8010e780
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/ide.c
// Function: finish_bio
static void finish_bio(struct bio *bio, enum bio_status status)
{
	mutex_lock(&bio->mutex);
	bio->status = status;
	condition_notify_all(&bio->cond);
	mutex_unlock(&bio->mutex);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0xffffffff8010dff0
movl -0xc(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x64(%rax)
movq -0x8(%rbp), %rdi
addq $0x10, %rdi
callq 0xffffffff8010e220
movq -0x8(%rbp), %rdi
addq $0x28, %rdi
callq 0xffffffff8010e140
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/ide.c
// Function: read_sectors
static int read_sectors(char *data, unsigned long long sector, size_t count)
{
	local_preempt_disable();
	const int rc = __read_sectors_lba48(data, sector, count);
	local_preempt_enable();

	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
callq 0xffffffff8010e8c0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xffffffff8010e8d0
movl %eax, -0x1c(%rbp)
callq 0xffffffff8010eab0
movl -0x1c(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/ide_smoke_test.c
// Function: ide_test
void ide_test(void)
{
	const unsigned long rsecs[] = { 0, 13, 42, 56, 1024 };
	static char src[PAGE_SIZE], dst[PAGE_SIZE];

	for (size_t i = 0; i != sizeof(rsecs)/sizeof(rsecs[0]); ++i) {
		const unsigned long sector = rsecs[i];
		int rc;

		generate_random_page(src);

		rc = write_page(src, sector);
		if (rc)
			DBG_ERR("write_page failed with error %s", errstr(rc));

		read_page(dst, sector);
		if (rc)
			DBG_ERR("read_page failed with error %s", errstr(rc));

		if (!match_pages(src, dst))
			DBG_ERR("Read page doesn't match written (sector: %lu)",
						sector);
		else
			DBG_INFO("Read page matches written page (sector: %lu)",
						sector);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0xffffffff801017e0
movq $0xd, -0x28(%rbp)
movq $0x2a, -0x20(%rbp)
movq $0x38, -0x18(%rbp)
movq $0x400, -0x10(%rbp) # imm = 0x400
movq $0x0, -0x38(%rbp)
cmpq $0x5, -0x38(%rbp)
je 0xffffffff8010eee2
movq -0x38(%rbp), %rax
movq -0x30(%rbp,%rax,8), %rax
movq %rax, -0x40(%rbp)
leaq 0x335471(%rip), %rdi    # 0xffffffff80444250
callq 0xffffffff8010eef0
movq -0x40(%rbp), %rsi
leaq 0x335461(%rip), %rdi    # 0xffffffff80444250
callq 0xffffffff8010ef50
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
je 0xffffffff8010ee29
movl -0x44(%rbp), %edi
callq 0xffffffff8010d240
movq %rax, %r8
leaq 0x336a(%rip), %rdi      # 0xffffffff80112179
leaq 0x3f75(%rip), %rsi      # 0xffffffff80112d8b
movl $0x70, %edx
leaq 0x3f7a(%rip), %rcx      # 0xffffffff80112d9c
movb $0x0, %al
callq 0xffffffff80101e60
movq -0x40(%rbp), %rsi
leaq 0x33641c(%rip), %rdi    # 0xffffffff80445250
callq 0xffffffff8010f060
cmpl $0x0, -0x44(%rbp)
je 0xffffffff8010ee6b
movl -0x44(%rbp), %edi
callq 0xffffffff8010d240
movq %rax, %r8
leaq 0x3328(%rip), %rdi      # 0xffffffff80112179
leaq 0x3f33(%rip), %rsi      # 0xffffffff80112d8b
movl $0x74, %edx
leaq 0x3f58(%rip), %rcx      # 0xffffffff80112dbc
movb $0x0, %al
callq 0xffffffff80101e60
leaq 0x3353de(%rip), %rdi    # 0xffffffff80444250
leaq 0x3363d7(%rip), %rsi    # 0xffffffff80445250
callq 0xffffffff8010f180
cmpl $0x0, %eax
jne 0xffffffff8010eeaa
movq -0x40(%rbp), %r8
leaq 0x32eb(%rip), %rdi      # 0xffffffff80112179
leaq 0x3ef6(%rip), %rsi      # 0xffffffff80112d8b
movl $0x78, %edx
leaq 0x3f3a(%rip), %rcx      # 0xffffffff80112ddb
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010eecf
movq -0x40(%rbp), %r8
leaq 0x328f(%rip), %rdi      # 0xffffffff80112144
leaq 0x3ecf(%rip), %rsi      # 0xffffffff80112d8b
movl $0x7b, %edx
leaq 0x3f41(%rip), %rcx      # 0xffffffff80112e09
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010eed1
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0xffffffff8010edc0
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/ide_smoke_test.c
// Function: write_page
static int write_page(const void *data, unsigned long sector)
{
	struct page *page = alloc_pages(0);

	if (!page)
		return -ENOMEM;

	struct bio *bio = bio_alloc();

	if (!bio) {
		free_pages(page, 0);
		return -ENOMEM;
	}

	const pfn_t pfn = page2pfn(page);
	void *buf = va(pfn << PAGE_BITS);

	memcpy(buf, data, PAGE_SIZE);
	bio->dir = BIO_WRITE;
	bio->map.page = page;
	bio->map.sector = sector;
	bio->map.offset = 0;
	bio->map.length = PAGE_SIZE;

	bio_submit(bio);
	bio_wait(bio);

	const int rc = (bio->status == BIO_FINISHED ? 0 : -EIO);

	bio_free(bio);
	free_pages(page, 0);

	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
xorl %edi, %edi
callq 0xffffffff801043b0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xffffffff8010ef7e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xffffffff8010f051
callq 0xffffffff8010e310
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xffffffff8010efa5
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0xffffffff801043d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xffffffff8010f051
movq -0x20(%rbp), %rdi
callq 0xffffffff80103dd0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
shlq $0xc, %rdi
callq 0xffffffff8010f200
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0xffffffff801016a0
movq -0x28(%rbp), %rax
movl $0x1, 0x60(%rax)
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x58(%rax)
movq -0x28(%rbp), %rax
movl $0x1000, 0x5c(%rax)     # imm = 0x1000
movq -0x28(%rbp), %rdi
callq 0xffffffff8010e410
movq -0x28(%rbp), %rdi
callq 0xffffffff8010e460
movq -0x28(%rbp), %rax
movl 0x64(%rax), %edx
movl $0xfffffff9, %eax       # imm = 0xFFFFFFF9
xorl %ecx, %ecx
cmpl $0x1, %edx
cmovel %ecx, %eax
movl %eax, -0x3c(%rbp)
movq -0x28(%rbp), %rdi
callq 0xffffffff8010e3e0
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0xffffffff801043d0
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/ide_smoke_test.c
// Function: read_page
static int read_page(void *data, unsigned long sector)
{
	struct page *page = alloc_pages(0);

	if (!page)
		return -ENOMEM;

	struct bio *bio = bio_alloc();

	if (!bio) {
		free_pages(page, 0);
		return -ENOMEM;
	}

	bio->dir = BIO_READ;
	bio->map.page = page;
	bio->map.sector = sector;
	bio->map.offset = 0;
	bio->map.length = PAGE_SIZE;

	bio_submit(bio);
	bio_wait(bio);

	if (bio->status == BIO_FINISHED) {
		const pfn_t pfn = page2pfn(page);
		void *buf = va(pfn << PAGE_BITS);

		memcpy(data, buf, PAGE_SIZE);
	}

	const int rc = (bio->status == BIO_FINISHED ? 0 : -EIO);

	bio_free(bio);
	free_pages(page, 0);

	return rc;	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
xorl %edi, %edi
callq 0xffffffff801043b0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xffffffff8010f08e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xffffffff8010f16b
callq 0xffffffff8010e310
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xffffffff8010f0b5
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0xffffffff801043d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xffffffff8010f16b
movq -0x28(%rbp), %rax
movl $0x0, 0x60(%rax)
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x50(%rax)
movq -0x28(%rbp), %rax
movl $0x0, 0x58(%rax)
movq -0x28(%rbp), %rax
movl $0x1000, 0x5c(%rax)     # imm = 0x1000
movq -0x28(%rbp), %rdi
callq 0xffffffff8010e410
movq -0x28(%rbp), %rdi
callq 0xffffffff8010e460
movq -0x28(%rbp), %rax
cmpl $0x1, 0x64(%rax)
jne 0xffffffff8010f13a
movq -0x20(%rbp), %rdi
callq 0xffffffff80103dd0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
shlq $0xc, %rdi
callq 0xffffffff8010f200
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0xffffffff801016a0
movq -0x28(%rbp), %rax
movl 0x64(%rax), %edx
movl $0xfffffff9, %eax       # imm = 0xFFFFFFF9
xorl %ecx, %ecx
cmpl $0x1, %edx
cmovel %ecx, %eax
movl %eax, -0x3c(%rbp)
movq -0x28(%rbp), %rdi
callq 0xffffffff8010e3e0
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0xffffffff801043d0
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/ide_smoke_test.c
// Function: match_pages
static int match_pages(const void *page0, const void *page1)
{
	const char *p0 = page0;
	const char *p1 = page1;

	for (size_t i = 0; i != PAGE_SIZE; ++i)
		if (*p0++ != *p1++)
			return 0;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
cmpq $0x1000, -0x30(%rbp) # imm = 0x1000
je 0xffffffff8010f1ef
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movsbl (%rax), %eax
movq -0x28(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
movsbl (%rcx), %ecx
cmpl %ecx, %eax
je 0xffffffff8010f1df
movl $0x0, -0x4(%rbp)
jmp 0xffffffff8010f1f6
jmp 0xffffffff8010f1e1
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0xffffffff8010f1a4
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/misc.c
// Function: setup_misc
void setup_misc(void)
{
	extern const uint32_t mboot_info;

	struct multiboot_info *pmboot_info = (void *)((uintptr_t)mboot_info);

	setup_memory_map(pmboot_info);
	setup_cmdline(pmboot_info);
	setup_initrd(pmboot_info);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq $0x1001ec, %rax         # imm = 0x1001EC
movl (%rax), %eax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xffffffff8010f260
movq -0x8(%rbp), %rdi
callq 0xffffffff8010f370
movq -0x8(%rbp), %rdi
callq 0xffffffff8010f3c0
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/misc.c
// Function: setup_memory_map
static void setup_memory_map(struct multiboot_info *info)
{
	if ((info->flags & (1ul << 6)) == 0) {
		DBG_ERR("memory map info isn't available");
		while (1);
	}

	const char *begin = (const char *)((uintptr_t)info->mmap_addr);
	const char *end = begin + info->mmap_length;

	while (begin < end) {
		const struct mboot_mmap_entry *entry =
					(const struct mboot_mmap_entry *)begin;

		memory_map[memory_map_size].addr = entry->addr;
		memory_map[memory_map_size].length = entry->length;
		memory_map[memory_map_size].type = entry->type;

		begin += entry->size + sizeof(entry->size);
		++memory_map_size;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
andq $0x40, %rax
cmpq $0x0, %rax
jne 0xffffffff8010f29f
leaq 0x2ef6(%rip), %rdi      # 0xffffffff80112179
leaq 0x3bac(%rip), %rsi      # 0xffffffff80112e36
movl $0x1d, %edx
leaq 0x3ba7(%rip), %rcx      # 0xffffffff80112e3d
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010f29d
movq -0x8(%rbp), %rax
movl 0x30(%rax), %eax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rcx
movl 0x2c(%rcx), %ecx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0xffffffff8010f35b
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x4(%rax), %rcx
movslq 0x33715f(%rip), %rdx    # 0xffffffff80446440
leaq 0x336f78(%rip), %rax    # 0xffffffff80446260
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movq 0xc(%rax), %rcx
movslq 0x33713f(%rip), %rdx    # 0xffffffff80446440
leaq 0x336f58(%rip), %rax    # 0xffffffff80446260
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movl 0x14(%rax), %eax
movl %eax, %ecx
movslq 0x33711d(%rip), %rdx    # 0xffffffff80446440
leaq 0x336f36(%rip), %rax    # 0xffffffff80446260
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movl (%rax), %eax
addq $0x4, %rax
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movl 0x3370f3(%rip), %eax    # 0xffffffff80446440
addl $0x1, %eax
movl %eax, 0x3370ea(%rip)    # 0xffffffff80446440
jmp 0xffffffff8010f2bc
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/misc.c
// Function: setup_initrd
static void setup_initrd(const struct multiboot_info *info)
{
	if ((info->flags & (1ul << 3)) == 0 || info->mods_count == 0) {
		DBG_ERR("No initrd provided!\n");
		while (1);
	}

	const struct mboot_mod *mods =
			(const struct mboot_mod *)((uintptr_t)info->mods_addr);

	for (int i = 0; i != (int)info->mods_count; ++i) {
		const struct mboot_mod *mod = mods + i;

		if (mod->mod_end - mod->mod_start < 6)
			continue;

		const void *ptr = (const void *)((uintptr_t)mod->mod_start);

		if (memcmp(ptr, "070701", 6))
			continue;

		initrd_begin = mod->mod_start;
		initrd_end = mod->mod_end;
		return;
	}

	DBG_ERR("No initrd found!\n");
	while (1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
andq $0x8, %rax
cmpq $0x0, %rax
je 0xffffffff8010f3e6
movq -0x8(%rbp), %rax
cmpl $0x0, 0x14(%rax)
jne 0xffffffff8010f409
leaq 0x2d8c(%rip), %rdi      # 0xffffffff80112179
leaq 0x3a42(%rip), %rsi      # 0xffffffff80112e36
movl $0x45, %edx
leaq 0x3a5d(%rip), %rcx      # 0xffffffff80112e5d
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010f407
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x14(%rcx), %eax
je 0xffffffff8010f4a3
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x20(%rbp), %rcx
subl (%rcx), %eax
cmpl $0x6, %eax
jae 0xffffffff8010f44e
jmp 0xffffffff8010f495
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x3a0f(%rip), %rsi      # 0xffffffff80112e72
movl $0x6, %edx
callq 0xffffffff80101830
cmpl $0x0, %eax
je 0xffffffff8010f474
jmp 0xffffffff8010f495
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq %rax, 0x336fc7(%rip)    # 0xffffffff80446448
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
movq %rax, 0x336fc1(%rip)    # 0xffffffff80446450
addq $0x30, %rsp
popq %rbp
retq
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xffffffff8010f41b
leaq 0x2ccf(%rip), %rdi      # 0xffffffff80112179
leaq 0x3985(%rip), %rsi      # 0xffffffff80112e36
movl $0x5c, %edx
leaq 0x39bc(%rip), %rcx      # 0xffffffff80112e79
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010f4c4
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/initramfs.c
// Function: setup_initramfs
void setup_initramfs(void)
{
	const int rc = vfs_mount("ramfs", "initramfs", 0, 0);

	if (rc) {
		DBG_ERR("initramfs mount failed with error %s", errstr(rc));
		while (1);
	}

	parse_cpio(va((phys_t)initrd_begin), initrd_end - initrd_begin);
	memory_free_region(initrd_begin, initrd_end - initrd_begin);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x39b0(%rip), %rdi      # 0xffffffff80112e8f
leaq 0x39a5(%rip), %rsi      # 0xffffffff80112e8b
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0xffffffff8010a8f0
movl %eax, -0x4(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0xffffffff8010f529
movl -0x4(%rbp), %edi
callq 0xffffffff8010d240
movq %rax, %r8
leaq 0x2c6c(%rip), %rdi      # 0xffffffff80112179
leaq 0x3981(%rip), %rsi      # 0xffffffff80112e95
movl $0x83, %edx
leaq 0x3981(%rip), %rcx      # 0xffffffff80112ea1
movb $0x0, %al
callq 0xffffffff80101e60
jmp 0xffffffff8010f527
movq $-0x7fbb9bb8, %rax      # imm = 0x80446448
movq (%rax), %rdi
callq 0xffffffff8010f6f0
movq %rax, %rdi
movq $-0x7fbb9bb0, %rax      # imm = 0x80446450
movq (%rax), %rsi
movq $-0x7fbb9bb8, %rax      # imm = 0x80446448
subq (%rax), %rsi
callq 0xffffffff8010f580
movq $-0x7fbb9bb8, %rax      # imm = 0x80446448
movq (%rax), %rdi
movq $-0x7fbb9bb0, %rax      # imm = 0x80446450
movq (%rax), %rsi
movq $-0x7fbb9bb8, %rax      # imm = 0x80446448
subq (%rax), %rsi
callq 0xffffffff80103720
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/initramfs.c
// Function: parse_cpio
static void parse_cpio(const char *data, unsigned long size)
{
	unsigned long pos = 0;
	bool root = true;

	while (pos < size && size - pos >= sizeof(struct cpio_header)) {
		const struct cpio_header *hdr = (const void *)(data + pos);
		const unsigned long mode = parse_hex(hdr->mode);
		const unsigned long namesize = parse_hex(hdr->namesize);
		const unsigned long filesize = parse_hex(hdr->filesize);

		pos += sizeof(struct cpio_header);
		const char *filename = data + pos;
		pos = ALIGN(pos + namesize, 4);

		if (pos > size)
			break;

		if (strcmp(filename, "TRAILER!!!") == 0)
			break;

		const char *filedata = data + pos;
		pos += filesize;

		if (S_ISDIR(mode)) {
			if (!root)
				create_dir(filename);
			else
				root = false;
		} else if (S_ISREG(mode)) {
			if (pos <= size)
				create_file(filename, filedata, filesize);
		}
		pos = ALIGN(pos, 4);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movb $0x1, -0x19(%rbp)
movq -0x18(%rbp), %rcx
xorl %eax, %eax
cmpq -0x10(%rbp), %rcx
movb %al, -0x51(%rbp)
jae 0xffffffff8010f5bd
movq -0x10(%rbp), %rax
subq -0x18(%rbp), %rax
cmpq $0x6e, %rax
setae %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0xffffffff8010f5c9
jmp 0xffffffff8010f6e8
movq -0x8(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
addq $0xe, %rdi
callq 0xffffffff8010f710
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
addq $0x5e, %rdi
callq 0xffffffff8010f710
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rdi
addq $0x36, %rdi
callq 0xffffffff8010f710
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
addq $0x6e, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rdi
addq -0x38(%rbp), %rdi
movl $0x4, %esi
callq 0xffffffff8010f760
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x10(%rbp), %rax
jbe 0xffffffff8010f645
jmp 0xffffffff8010f6e8
movq -0x48(%rbp), %rdi
leaq 0x3876(%rip), %rsi      # 0xffffffff80112ec6
callq 0xffffffff80101980
cmpl $0x0, %eax
jne 0xffffffff8010f65f
jmp 0xffffffff8010f6e8
movq -0x8(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x40(%rbp), %rax
addq -0x18(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x30(%rbp), %rax
andq $0xf000, %rax           # imm = 0xF000
cmpq $0x4000, %rax           # imm = 0x4000
jne 0xffffffff8010f6a0
testb $0x1, -0x19(%rbp)
jne 0xffffffff8010f69a
movq -0x48(%rbp), %rdi
callq 0xffffffff8010f790
jmp 0xffffffff8010f69e
movb $0x0, -0x19(%rbp)
jmp 0xffffffff8010f6d1
movq -0x30(%rbp), %rax
andq $0xf000, %rax           # imm = 0xF000
cmpq $0x8000, %rax           # imm = 0x8000
jne 0xffffffff8010f6cf
movq -0x18(%rbp), %rax
cmpq -0x10(%rbp), %rax
ja 0xffffffff8010f6cd
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0xffffffff8010f7f0
jmp 0xffffffff8010f6cf
jmp 0xffffffff8010f6d1
movq -0x18(%rbp), %rdi
movl $0x4, %esi
callq 0xffffffff8010f760
movq %rax, -0x18(%rbp)
jmp 0xffffffff8010f59c
addq $0x60, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/initramfs.c
// Function: create_file
static void create_file(const char *name, const void *data, size_t size)
{
	struct fs_file file;
	int rc = vfs_create(name, &file);

	if (!rc) {
		rc = write_file(&file, data, size);
		if (rc)
			DBG_ERR("Failed to write file %s with error %s",
						name, errstr(rc));
		vfs_release(&file);
	} else {
		DBG_ERR("Failed to create file %s with error %s",
					name, errstr(rc));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xffffffff80109870
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jne 0xffffffff8010f877
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x38(%rbp), %rdi
callq 0xffffffff8010f8c0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0xffffffff8010f86c
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x3c(%rbp), %edi
callq 0xffffffff8010d240
movq -0x48(%rbp), %r8
movq %rax, %r9
leaq 0x2927(%rip), %rdi      # 0xffffffff80112179
leaq 0x363c(%rip), %rsi      # 0xffffffff80112e95
movl $0x51, %edx
leaq 0x368e(%rip), %rcx      # 0xffffffff80112ef3
movb $0x0, %al
callq 0xffffffff80101e60
leaq -0x38(%rbp), %rdi
callq 0xffffffff80109ae0
jmp 0xffffffff8010f8af
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movl -0x3c(%rbp), %edi
callq 0xffffffff8010d240
movq -0x50(%rbp), %r8
movq %rax, %r9
leaq 0x28e4(%rip), %rdi      # 0xffffffff80112179
leaq 0x35f9(%rip), %rsi      # 0xffffffff80112e95
movl $0x55, %edx
leaq 0x3671(%rip), %rcx      # 0xffffffff80112f19
movb $0x0, %al
callq 0xffffffff80101e60
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/initramfs.c
// Function: write_file
static int write_file(struct fs_file *file, const void *data, size_t size)
{
	const char *buf = data;
	size_t wr = 0;

	while (wr != size) {
		const int rc = vfs_write(file, buf + wr, size - wr);

		if (rc < 0)
			return rc;
		wr += rc;
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x20(%rbp), %rax
je 0xffffffff8010f926
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
addq -0x30(%rbp), %rsi
movq -0x20(%rbp), %rdx
subq -0x30(%rbp), %rdx
callq 0xffffffff80109c10
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0xffffffff8010f918
movl -0x34(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xffffffff8010f92d
movslq -0x34(%rbp), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0xffffffff8010f8e4
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/serial.c
// Function: setup_serial
void setup_serial(void)
{
	out8(REG_IER, 0);
	out8(REG_LCR, LCR_DLAB);
	out8(REG_DLL, 0x0C);
	out8(REG_DLH, 0x00);
	out8(REG_LCR, LCR_8BIT);

	static struct console serial_console = {
		.write = &serial_write
	};

	register_console(&serial_console);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x3f9, %edi            # imm = 0x3F9
xorl %esi, %esi
callq 0xffffffff8010f9a0
movl $0x3fb, %edi            # imm = 0x3FB
movl $0x80, %esi
callq 0xffffffff8010f9a0
movl $0x3f8, %edi            # imm = 0x3F8
movl $0xc, %esi
callq 0xffffffff8010f9a0
movl $0x3f9, %edi            # imm = 0x3F9
xorl %esi, %esi
callq 0xffffffff8010f9a0
movl $0x3fb, %edi            # imm = 0x3FB
movl $0x3, %esi
callq 0xffffffff8010f9a0
leaq 0x8578(%rip), %rdi      # 0xffffffff80117f08
callq 0xffffffff801013e0
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/mm.c
// Function: _lookup_vma
static int __lookup_vma(struct mm *mm, virt_t begin, virt_t end,
			struct vma_iter *iter)
{
	struct rb_node **plink = &mm->vma.root;
	struct rb_node *parent = 0;

	while (*plink) {
		struct vma *vma = TREE_ENTRY(*plink, struct vma, link);

		if (begin >= vma->end) {
			parent = *plink;
			plink = &parent->right;
		} else if (end <= vma->begin) {
			parent = *plink;
			plink = &parent->left;
		} else {
			iter->plink = plink;
			iter->parent = parent;
			iter->vma = vma;
			return 1;
		}
	}

	iter->plink = plink;
	iter->parent = parent;
	iter->vma = 0;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x30(%rbp), %rax
cmpq $0x0, (%rax)
je 0xffffffff8010fb8a
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jb 0xffffffff8010fb34
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x30(%rbp)
jmp 0xffffffff8010fb85
movq -0x20(%rbp), %rax
movq -0x40(%rbp), %rcx
cmpq 0x18(%rcx), %rax
ja 0xffffffff8010fb57
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0xffffffff8010fb83
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x1, -0x4(%rbp)
jmp 0xffffffff8010fbb4
jmp 0xffffffff8010fb85
jmp 0xffffffff8010faf4
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x28(%rbp), %rax
movq $0x0, 0x10(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/mm.c
// Function: mm_page_fault
int mm_page_fault(struct thread *thread, virt_t vaddr, int access)
{
	struct mm *mm = thread->mm;

	if (!mm)
		return -EINVAL;

	vaddr &= ~((virt_t)PAGE_MASK);

	struct vma_iter iter;

	/*
	 * __lookup_vma won't work with empty regions, so +1.
	 * Seems like a dirty hack.
	 */
	if (!__lookup_vma(mm, vaddr, vaddr + 1, &iter))
		return -EINVAL;

	return iter.vma->fault(mm, iter.vma, vaddr, access);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xffffffff8010fbef
movl $0xfffffffa, -0x4(%rbp) # imm = 0xFFFFFFFA
jmp 0xffffffff8010fc40
movq -0x18(%rbp), %rax
andq $-0x1000, %rax          # imm = 0xF000
movq %rax, -0x18(%rbp)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rdx
addq $0x1, %rdx
leaq -0x40(%rbp), %rcx
callq 0xffffffff8010fad0
cmpl $0x0, %eax
jne 0xffffffff8010fc24
movl $0xfffffffa, -0x4(%rbp) # imm = 0xFFFFFFFA
jmp 0xffffffff8010fc40
movq -0x30(%rbp), %rax
movq 0x38(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
callq *%rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/mm.c
// Function: _mmap
int __mmap(struct mm *mm, virt_t begin, virt_t end, int perm)
{
	struct vma_iter iter;

	begin = ALIGN_DOWN_CONST(begin, PAGE_SIZE);
	end = ALIGN_CONST(end, PAGE_SIZE);

	if (__lookup_vma(mm, begin, end, &iter))
		return -EBUSY;

	int rc = pt_populate_range(page_addr(mm->pt), begin, end);

	if (rc)
		return rc;

	struct vma *vma = alloc_vma();

	if (!vma) {
		pt_release_range(page_addr(mm->pt), begin, end);
		return -ENOMEM;
	}

	vma->begin = begin;
	vma->end = end;
	vma->perm = perm;
	vma->mm = mm;
	vma->fault = &anon_page_fault;

	rb_link(&vma->link, iter.parent, iter.plink);
	rb_insert(&vma->link, &mm->vma);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movq -0x18(%rbp), %rax
andq $-0x1000, %rax          # imm = 0xF000
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rax
addq $0x1000, %rax           # imm = 0x1000
subq $0x1, %rax
andq $-0x1000, %rax          # imm = 0xF000
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x40(%rbp), %rcx
callq 0xffffffff8010fad0
cmpl $0x0, %eax
je 0xffffffff8010fcb3
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0xffffffff8010fd7c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xffffffff8010fdc0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xffffffff8010fd90
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
je 0xffffffff8010fce4
movl -0x44(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xffffffff8010fd7c
callq 0xffffffff8010fdf0
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0xffffffff8010fd1a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xffffffff8010fdc0
movq %rax, %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0xffffffff8010fe30
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xffffffff8010fd7c
movq -0x18(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x20(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x20(%rax)
movl -0x24(%rbp), %ecx
movq -0x50(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x10(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x30(%rax)
movq -0x50(%rbp), %rax
leaq 0x10d(%rip), %rcx       # 0xffffffff8010fe60
movq %rcx, 0x38(%rax)
movq -0x50(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0xffffffff8010ffc0
movq -0x50(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xffffffff8010b5d0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/mm.c
// Function: alloc_vma
static struct vma *alloc_vma(void)
{
	struct vma *vma = kmem_cache_alloc(vma_cachep);

	if (vma)
		memset(vma, 0, sizeof(*vma));
	return vma;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq 0x336779(%rip), %rdi    # 0xffffffff80446578
callq 0xffffffff80106fd0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xffffffff8010fe1f
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x40, %edx
callq 0xffffffff801017e0
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/mm.c
// Function: anon_page_fault
static int anon_page_fault(struct mm *mm, struct vma *vma,
				virt_t vaddr, int access)
{
	if (access == VMA_ACCESS_WRITE && (vma->perm & VMA_PERM_WRITE) == 0)
		return -EINVAL;

	if (access == VMA_ACCESS_READ) {
		__mmap_pages(mm, vaddr, &zero_page, 1, PTE_USER);
		flush_tlb_addr(vaddr);

		return 0;
	}

	struct page *old = mapped_page(mm, vaddr);

	if (old) {
		struct page *new = copy_page(old);

		if (!new)
			return -ENOMEM;

		__mmap_pages(mm, vaddr, &new, 1, PTE_USER | PTE_WRITE);
		flush_tlb_addr(vaddr);
		put_page(old);

		return 0;
	}

	struct page *page = alloc_pages(0);

	if (!page)
		return -ENOMEM;

	memset(page_addr(page), 0, PAGE_SIZE);
	page->u.refcount = 0;
	__mmap_pages(mm, vaddr, &page, 1, PTE_USER | PTE_WRITE);
	flush_tlb_addr(vaddr);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
cmpl $0x1, -0x24(%rbp)
jne 0xffffffff8010fe98
movq -0x18(%rbp), %rax
movl 0x28(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xffffffff8010fe98
movl $0xfffffffa, -0x4(%rbp) # imm = 0xFFFFFFFA
jmp 0xffffffff8010ffac
cmpl $0x0, -0x24(%rbp)
jne 0xffffffff8010fed2
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq 0x3366d3(%rip), %rdx    # 0xffffffff80446580
movl $0x1, %ecx
movl $0x4, %r8d
callq 0xffffffff80110870
movq -0x20(%rbp), %rdi
callq 0xffffffff80110d10
movl $0x0, -0x4(%rbp)
jmp 0xffffffff8010ffac
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xffffffff80110d30
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0xffffffff8010ff41
movq -0x30(%rbp), %rdi
callq 0xffffffff80110ee0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xffffffff8010ff0a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xffffffff8010ffac
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0x38(%rbp), %rdx
movl $0x1, %ecx
movl $0x6, %r8d
callq 0xffffffff80110870
movq -0x20(%rbp), %rdi
callq 0xffffffff80110d10
movq -0x30(%rbp), %rdi
callq 0xffffffff80110af0
movl $0x0, -0x4(%rbp)
jmp 0xffffffff8010ffac
xorl %edi, %edi
callq 0xffffffff801043b0
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xffffffff8010ff5c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xffffffff8010ffac
movq -0x40(%rbp), %rdi
callq 0xffffffff8010fdc0
movq %rax, %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0xffffffff801017e0
movq -0x40(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0x40(%rbp), %rdx
movl $0x1, %ecx
movl $0x6, %r8d
callq 0xffffffff80110870
movq -0x20(%rbp), %rdi
callq 0xffffffff80110d10
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/mm.c
// Function: _munmap
void __munmap(struct mm *mm, virt_t begin, virt_t end)
{
	struct vma_iter iter;

	__munmap_pages(mm, begin, (end - begin) >> PAGE_BITS);
	pt_release_range(page_addr(mm->pt), begin, end);

	while (__lookup_vma(mm, begin, end, &iter)) {
		struct vma *vma = iter.vma;

		if (vma->begin >= begin) {
			if (vma->end <= end) {
				rb_erase(&vma->link, &mm->vma);
				free_vma(vma);
			} else {
				vma->begin = end;
			}
		} else {
			if (vma->end <= end) {
				vma->end = begin;
			} else {
				struct vma *high = 0;

				/* we must not fail */
				while (!high)
					high = alloc_vma();

				*high = *vma;
				high->begin = end;
				vma->end = begin;
				insert_vma(mm, high);
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
subq -0x10(%rbp), %rdx
shrq $0xc, %rdx
callq 0xffffffff80110180
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xffffffff8010fdc0
movq %rax, %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0xffffffff8010fe30
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x30(%rbp), %rcx
callq 0xffffffff8010fad0
cmpl $0x0, %eax
je 0xffffffff8011016f
movq -0x20(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
cmpq -0x10(%rbp), %rax
jb 0xffffffff801100f2
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
cmpq -0x18(%rbp), %rax
ja 0xffffffff801100e4
movq -0x38(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0xffffffff8010b960
movq -0x38(%rbp), %rdi
callq 0xffffffff80110370
jmp 0xffffffff801100f0
movq -0x18(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0xffffffff8011016a
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rax
cmpq -0x18(%rbp), %rax
ja 0xffffffff8011010e
movq -0x10(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0xffffffff80110168
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xffffffff80110126
jmp 0xffffffff80110131
callq 0xffffffff8010fdf0
movq %rax, -0x40(%rbp)
jmp 0xffffffff80110116
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
movl $0x40, %edx
callq 0xffffffff801016a0
movq -0x18(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xffffffff801103a0
jmp 0xffffffff8011016a
jmp 0xffffffff8011008a
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/mm.c
// Function: create_mm
struct mm *create_mm(void)
{
	struct mm *mm = alloc_mm();

	if (!mm)
		return 0;

	struct page *pt = alloc_page_table();

	if (!pt) {
		free_mm(mm);
		return 0;
	}

	/*
	 * kernel part is shared between the all threads, so we need to
	 * copy at least kernel part of page table, to make it usable.
	 */
	const size_t offset = pml4_i(HIGH_BASE) * sizeof(pte_t);

	memcpy((char *)page_addr(pt) + offset,
		(char *)va(load_pml4()) + offset, PAGE_SIZE - offset);
	mm->pt = pt;

	return mm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
callq 0xffffffff801104f0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xffffffff80110455
movq $0x0, -0x8(%rbp)
jmp 0xffffffff801104dc
callq 0xffffffff80110530
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xffffffff80110478
movq -0x10(%rbp), %rdi
callq 0xffffffff80110570
movq $0x0, -0x8(%rbp)
jmp 0xffffffff801104dc
movabsq $-0x800000000000, %rdi # imm = 0xFFFF800000000000
callq 0xffffffff801105a0
cltq
shlq $0x3, %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0xffffffff8010fdc0
addq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
callq 0xffffffff801105e0
movq %rax, %rdi
callq 0xffffffff801105c0
movq -0x28(%rbp), %rdi
movq %rax, %rsi
addq -0x20(%rbp), %rsi
movl $0x1000, %edx           # imm = 0x1000
subq -0x20(%rbp), %rdx
callq 0xffffffff801016a0
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/mm.c
// Function: alloc_mm
static struct mm *alloc_mm(void)
{
	struct mm *mm = kmem_cache_alloc(mm_cachep);

	if (mm)
		memset(mm, 0, sizeof(*mm));
	return mm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq 0x336071(%rip), %rdi    # 0xffffffff80446570
callq 0xffffffff80106fd0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xffffffff8011051f
movq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0x30, %edx
callq 0xffffffff801017e0
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/krinkinmu[P]64bit/mm.c
// Function: alloc_page_table
static struct page *alloc_page_table(void)
{
	struct page *page = alloc_pages(0);

	if (page)
		memset(page_addr(page), 0, PAGE_SIZE);
	return page;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
xorl %edi, %edi
callq 0xffffffff801043b0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0xffffffff80110562
movq -0x8(%rbp), %rdi
callq 0xffffffff8010fdc0
movq %rax, %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0xffffffff801017e0
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopl (%rax)