LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/buffer.c
// Function: buffer_initialize
void
buffer_initialize(struct buffer *buffer,
                  const struct wld_buffer_impl *impl,
                  uint32_t width, uint32_t height,
                  uint32_t format, uint32_t pitch)
{
	*((const struct wld_buffer_impl **)&buffer->base.impl) = impl;
	buffer->base.width = width;
	buffer->base.height = height;
	buffer->base.format = format;
	buffer->base.pitch = pitch;
	buffer->base.map = NULL;
	buffer->ref = 1;
	buffer->map_ref = 0;
	buffer->exporters = NULL;
	buffer->destructors = NULL;
	pixman_region32_init_rect(&buffer->base.damage, 0, 0, width, height);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl %r8d, -0x1c(%rbp)
movl %r9d, -0x20(%rbp)
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movl -0x14(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x8(%rax)
movl -0x18(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0xc(%rax)
movl -0x1c(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x14(%rax)
movl -0x20(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x30(%rax)
movq -0x8(%rbp), %rax
movl $0x1, 0x38(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x3c(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x40(%rax)
movq -0x8(%rbp), %rax
movq $0x0, 0x48(%rax)
movq -0x8(%rbp), %rdi
addq $0x18, %rdi
movl -0x14(%rbp), %ecx
movl -0x18(%rbp), %r8d
xorl %edx, %edx
movl %edx, %esi
callq 0x96a0
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/buffer.c
// Function: wld_map
EXPORT
bool
wld_map(struct wld_buffer *base)
{
	struct buffer *buffer = (void *)base;

	if (buffer->map_ref == 0 && !buffer->base.impl->map(buffer))
		return false;

	++buffer->map_ref;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x3c(%rax)
jne 0x9a98
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rdi
callq *%rax
testb $0x1, %al
jne 0x9a98
movb $0x0, -0x1(%rbp)
jmp 0x9aa9
movq -0x18(%rbp), %rax
movl 0x3c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x3c(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/buffer.c
// Function: wld_unmap
EXPORT
bool
wld_unmap(struct wld_buffer *base)
{
	struct buffer *buffer = (void *)base;

	if (buffer->map_ref == 0 || (buffer->map_ref == 1 && !buffer->base.impl->unmap(buffer)))
		return false;

	--buffer->map_ref;
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x3c(%rax)
je 0x9afd
movq -0x18(%rbp), %rax
cmpl $0x1, 0x3c(%rax)
jne 0x9b03
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rdi
callq *%rax
testb $0x1, %al
jne 0x9b03
movb $0x0, -0x1(%rbp)
jmp 0x9b14
movq -0x18(%rbp), %rax
movl 0x3c(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0x3c(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/buffer.c
// Function: wld_export
EXPORT
bool
wld_export(struct wld_buffer *base, uint32_t type, union wld_object *object)
{
	struct buffer *buffer = (void *)base;
	struct wld_exporter *exporter;

	for (exporter = buffer->exporters; exporter; exporter = exporter->next) {
		if (exporter->export(exporter, &buffer->base, type, object))
			return true;
	}

	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x9b82
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
movl -0x14(%rbp), %edx
movq -0x20(%rbp), %rcx
callq *%rax
testb $0x1, %al
jne 0x9b6c
jmp 0x9b72
movb $0x1, -0x1(%rbp)
jmp 0x9b86
jmp 0x9b74
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
jmp 0x9b47
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/buffer.c
// Function: wld_buffer_unreference
EXPORT
void
wld_buffer_unreference(struct wld_buffer *base)
{
	struct buffer *buffer = (void *)base;
	struct wld_destructor *destructor, *next;

	if (--buffer->ref > 0)
		return;

	pixman_region32_fini(&buffer->base.damage);

	for (destructor = buffer->destructors; destructor; destructor = next) {
		next = destructor->next;
		destructor->destroy(destructor);
	}

	if (buffer->map_ref > 0)
		buffer->base.impl->unmap(buffer);

	buffer->base.impl->destroy(buffer);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rcx
movl 0x38(%rcx), %eax
addl $-0x1, %eax
movl %eax, 0x38(%rcx)
cmpl $0x0, %eax
jbe 0x9c68
jmp 0x9cd7
movq -0x10(%rbp), %rdi
addq $0x18, %rdi
callq 0x9140
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x9cab
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rdi
callq *%rax
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x9c81
movq -0x10(%rbp), %rax
cmpl $0x0, 0x3c(%rax)
jbe 0x9cc6
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/buffered_surface.c
// Function: buffered_surface_create
struct wld_surface *
buffered_surface_create(struct wld_context *context, uint32_t width, uint32_t height,
                        uint32_t format, uint32_t flags, struct buffer_socket *buffer_socket)
{
	struct buffered_surface *surface;

	if (!(surface = malloc(sizeof *surface)))
		return NULL;

	surface_initialize(&surface->base, &wld_surface_impl);
	surface->context = context;
	surface->entries = NULL;
	surface->back = NULL;
	surface->entries_size = 0;
	surface->entries_capacity = 0;
	surface->buffer_socket = buffer_socket;
	surface->width = width;
	surface->height = height;
	surface->format = format;
	surface->flags = flags;

	return &surface->base;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movl $0x40, %edi
callq 0x9590
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0x9d1e
movq $0x0, -0x8(%rbp)
jmp 0x9da4
movq -0x30(%rbp), %rdi
leaq 0xed17(%rip), %rsi      # 0x18a40
callq 0xb040
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x30(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x20(%rax)
movq -0x30(%rbp), %rax
movl $0x0, 0x24(%rax)
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x28(%rax)
movl -0x14(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x30(%rax)
movl -0x18(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x34(%rax)
movl -0x1c(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x38(%rax)
movl -0x20(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x3c(%rax)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/buffered_surface.c
// Function: surface_damage
pixman_region32_t *
surface_damage(struct wld_surface *base, pixman_region32_t *new_damage)
{
	struct buffered_surface *surface = buffered_surface(base);
	struct buffer *back_buffer;
	unsigned index;

	if (pixman_region32_not_empty(new_damage)) {
		for (index = 0; index < surface->entries_size; ++index) {
			pixman_region32_union(&surface->entries[index].buffer->base.damage,
			                      &surface->entries[index].buffer->base.damage,
			                      new_damage);
		}
	}

	if (!(back_buffer = surface_back(base)))
		return NULL;

	return &back_buffer->base.damage;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa290
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x9200
cmpl $0x0, %eax
je 0x9e36
movl $0x0, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jae 0x9e34
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
addq $0x18, %rdi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x2c(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rsi
addq $0x18, %rsi
movq -0x18(%rbp), %rdx
callq 0x9780
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x9de2
jmp 0x9e36
movq -0x10(%rbp), %rdi
callq 0x9e70
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x9e53
movq $0x0, -0x8(%rbp)
jmp 0x9e5f
movq -0x28(%rbp), %rax
addq $0x18, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/buffered_surface.c
// Function: surface_take
struct buffer *
surface_take(struct wld_surface *base)
{
	struct buffered_surface *surface = buffered_surface(base);
	struct buffer *buffer;

	if (!(buffer = surface_back(base)))
		return NULL;

	surface->back->busy = true;
	surface->back = NULL;
	pixman_region32_clear(&buffer->base.damage);

	return buffer;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa290
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x9e70
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0xa086
movq $0x0, -0x8(%rbp)
jmp 0xa0b3
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movb $0x1, 0x8(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
callq 0x94d0
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/buffered_surface.c
// Function: surface_release
bool
surface_release(struct wld_surface *base, struct buffer *buffer)
{
	struct buffered_surface *surface = buffered_surface(base);
	unsigned index;

	for (index = 0; index < surface->entries_size; ++index) {
		if (surface->entries[index].buffer == buffer) {
			surface->entries[index].busy = false;
			return true;
		}
	}

	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa290
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x24(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jae 0xa134
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x24(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rax
cmpq -0x18(%rbp), %rax
jne 0xa127
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x24(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movb $0x0, 0x8(%rax)
movb $0x1, -0x1(%rbp)
jmp 0xa138
jmp 0xa129
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xa0e4
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/buffered_surface.c
// Function: surface_swap
bool
surface_swap(struct wld_surface *base)
{
	struct buffered_surface *surface = buffered_surface(base);
	struct buffer *buffer;

	if (!surface->buffer_socket)
		return false;

	if (!(buffer = surface_back(base)))
		return false;

	if (!surface->buffer_socket->impl->attach(surface->buffer_socket, buffer))
		return false;

	surface->back->busy = true;
	surface->back = NULL;
	pixman_region32_clear(&buffer->base.damage);

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0xa290
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x28(%rax)
jne 0xa17a
movb $0x0, -0x1(%rbp)
jmp 0xa1e2
movq -0x10(%rbp), %rdi
callq 0x9e70
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0xa193
movb $0x0, -0x1(%rbp)
jmp 0xa1e2
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rdi
movq -0x20(%rbp), %rsi
callq *%rax
testb $0x1, %al
jne 0xa1b9
movb $0x0, -0x1(%rbp)
jmp 0xa1e2
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movb $0x1, 0x8(%rax)
movq -0x18(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x20(%rbp), %rdi
addq $0x18, %rdi
callq 0x94d0
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/buffered_surface.c
// Function: surface_destroy
void
surface_destroy(struct wld_surface *base)
{
	struct buffered_surface *surface = buffered_surface(base);
	unsigned index;

	if (surface->buffer_socket)
		surface->buffer_socket->impl->destroy(surface->buffer_socket);

	for (index = 0; index < surface->entries_size; ++index)
		wld_buffer_unreference(&surface->entries[index].buffer->base);

	free(surface->entries);
	free(surface);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xa290
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0xa22d
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x28(%rcx), %rdi
callq *%rax
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jae 0xa265
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x14(%rbp), %ecx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x9270
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xa234
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x9060
movq -0x10(%rbp), %rdi
callq 0x9060
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/color.c
// Function: wld_lookup_named_color
EXPORT
bool
wld_lookup_named_color(const char *name, uint32_t *color)
{
	char *end;
	int low = 0, mid, high = ARRAY_LENGTH(named_colors);
	int r;

	if (name[0] == '#' && name[1] != '\0') {
		*color = strtoul(name + 1, &end, 16);

		/* Set alpha channel to opaque. */
		*color |= 0xff << 24;

		if (*end == '\0')
			return true;
	}

	while (low <= high) {
		mid = (low + high) / 2;
		r = strcasecmp(named_colors[mid].name, name);

		if (r == 0) {
			*color = named_colors[mid].color;
			return true;
		}
		if (r < 0)
			low = mid + 1;
		else
			high = mid - 1;
	}

	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x2f0, -0x2c(%rbp)     # imm = 0x2F0
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0xa35a
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0xa35a
movq -0x10(%rbp), %rdi
addq $0x1, %rdi
leaq -0x20(%rbp), %rsi
movl $0x10, %edx
callq 0x97a0
movl %eax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movq -0x18(%rbp), %rax
movl (%rax), %ecx
orl $0xff000000, %ecx       # imm = 0xFF000000
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0xa358
movb $0x1, -0x1(%rbp)
jmp 0xa3dd
jmp 0xa35a
jmp 0xa35c
movl -0x24(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jg 0xa3d9
movl -0x24(%rbp), %eax
addl -0x2c(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, -0x28(%rbp)
movslq -0x28(%rbp), %rcx
leaq 0xe6f0(%rip), %rax      # 0x18a70
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
callq 0x9070
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0xa3bd
movslq -0x28(%rbp), %rcx
leaq 0xe6c9(%rip), %rax      # 0x18a70
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0xa3dd
cmpl $0x0, -0x30(%rbp)
jge 0xa3ce
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0xa3d7
movl -0x28(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0xa35c
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/font.c
// Function: wld_font_create_context
wld_font_context *
wld_font_create_context()
{
	struct wld_font_context *context;

	context = malloc(sizeof *context);

	if (!context)
		goto error0;

	if (FT_Init_FreeType(&context->library) != 0) {
		DEBUG("Failed to initialize FreeType library\n");

		goto error1;
	}

	return context;

error1:
	free(context);
error0:
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl $0x8, %edi
callq 0x9590
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xa56f
jmp 0xa5b1
movq -0x10(%rbp), %rdi
callq 0x9350
cmpl $0x0, %eax
je 0xa59e
movq 0x11a6c(%rip), %rax     # 0x1bff0
movq (%rax), %rdi
leaq 0xa5a2(%rip), %rsi      # 0x14b30
leaq 0xa5c8(%rip), %rdx      # 0x14b5d
movb $0x0, %al
callq 0x94a0
jmp 0xa5a8
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xa5b9
movq -0x10(%rbp), %rdi
callq 0x9060
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/font.c
// Function: wld_font_open_name
wld_font *
wld_font_open_name(struct wld_font_context *context, const char *name)
{
	FcPattern *pattern, *match;
	FcResult result;

	DEBUG("Opening font with name: %s\n", name);

	pattern = FcNameParse((const FcChar8 *)name);
	FcConfigSubstitute(NULL, pattern, FcMatchPattern);
	FcDefaultSubstitute(pattern);

	match = FcFontMatch(NULL, pattern, &result);

	if (!match)
		return NULL;

	return wld_font_open_pattern(context, match);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq 0x119d9(%rip), %rax     # 0x1bff0
movq (%rax), %rdi
movq -0x18(%rbp), %rcx
leaq 0xa550(%rip), %rsi      # 0x14b75
leaq 0xa56b(%rip), %rdx      # 0x14b97
movb $0x0, %al
callq 0x94a0
movq -0x18(%rbp), %rdi
callq 0x90e0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
xorl %edx, %edx
callq 0x93b0
movq -0x20(%rbp), %rdi
callq 0x9630
movq -0x20(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edi
leaq -0x2c(%rbp), %rdx
callq 0x9540
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xa67e
movq $0x0, -0x8(%rbp)
jmp 0xa68f
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x9500
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/font.c
// Function: font_ensure_glyph
bool
font_ensure_glyph(struct font *font, FT_UInt glyph_index)
{
	if (glyph_index) {
		if (!font->glyphs[glyph_index]) {
			struct glyph *glyph;

			glyph = malloc(sizeof *glyph);

			if (!glyph)
				return false;

			FT_Load_Glyph(font->face, glyph_index, FT_LOAD_RENDER | FT_LOAD_MONOCHROME | FT_LOAD_TARGET_MONO);

			FT_Bitmap_New(&glyph->bitmap);

			FT_Bitmap_Copy(font->context->library,
			               &font->face->glyph->bitmap, &glyph->bitmap);

			glyph->advance = font->face->glyph->metrics.horiAdvance >> 6;
			glyph->x = font->face->glyph->bitmap_left;
			glyph->y = -font->face->glyph->bitmap_top;

			font->glyphs[glyph_index] = glyph;
		}

		return true;
	}

	return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0xaa52
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x14(%rbp), %ecx
cmpq $0x0, (%rax,%rcx,8)
jne 0xaa4c
movl $0x30, %edi
callq 0x9590
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xa98d
movb $0x0, -0x1(%rbp)
jmp 0xaa56
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movl -0x14(%rbp), %esi
movl $0x21004, %edx          # imm = 0x21004
callq 0x90d0
movq -0x20(%rbp), %rdi
callq 0x9370
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x98(%rax), %rsi
addq $0x98, %rsi
movq -0x20(%rbp), %rdx
callq 0x9280
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x98(%rax), %rax
movq 0x50(%rax), %rax
sarq $0x6, %rax
movw %ax, %cx
movq -0x20(%rbp), %rax
movw %cx, 0x2c(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x98(%rax), %rax
movl 0xc0(%rax), %eax
movw %ax, %cx
movq -0x20(%rbp), %rax
movw %cx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x98(%rax), %rcx
xorl %eax, %eax
subl 0xc4(%rcx), %eax
movw %ax, %cx
movq -0x20(%rbp), %rax
movw %cx, 0x2a(%rax)
movq -0x20(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x14(%rbp), %ecx
movq %rdx, (%rax,%rcx,8)
movb $0x1, -0x1(%rbp)
jmp 0xaa56
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/font.c
// Function: wld_font_text_extents_n
EXPORT
void
wld_font_text_extents_n(struct wld_font *font_base,
                        const char *text, int32_t length,
                        struct wld_extents *extents)
{
	struct font *font = (void *)font_base;
	int ret;
	uint32_t c;
	FT_UInt glyph_index;

	extents->advance = 0;

	while ((ret = FcUtf8ToUcs4((FcChar8 *)text, &c, length) > 0) && c != '\0') {
		length -= ret;
		text += ret;
		glyph_index = FT_Get_Char_Index(font->face, c);

		if (!font_ensure_glyph(font, glyph_index))
			continue;

		extents->advance += font->glyphs[glyph_index]->advance;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
leaq -0x30(%rbp), %rsi
callq 0x92b0
cmpl $0x0, %eax
setg %cl
movb %cl, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x2c(%rbp)
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x35(%rbp)
jne 0xab05
jmp 0xab0f
cmpl $0x0, -0x30(%rbp)
setne %al
movb %al, -0x35(%rbp)
movb -0x35(%rbp), %al
testb $0x1, %al
jne 0xab18
jmp 0xab7e
movl -0x2c(%rbp), %ecx
movl -0x14(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x14(%rbp)
movl -0x2c(%rbp), %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rdi
movl -0x30(%rbp), %eax
movl %eax, %esi
callq 0x9660
movl %eax, -0x34(%rbp)
movq -0x28(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0xa940
testb $0x1, %al
jne 0xab5e
jmp 0xaad9
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x34(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movzwl 0x2c(%rax), %ecx
movq -0x20(%rbp), %rax
addl (%rax), %ecx
movl %ecx, (%rax)
jmp 0xaad9
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/renderer.c
// Function: default_fill_region
void
default_fill_region(struct wld_renderer *renderer, uint32_t color, pixman_region32_t *region)
{
	pixman_box32_t *box;
	int num_boxes;

	box = pixman_region32_rectangles(region, &num_boxes);

	while (num_boxes--) {
		renderer->impl->fill_rectangle(renderer, color, box->x1, box->y1,
		                               box->x2 - box->x1, box->y2 - box->y1);
		++box;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x24(%rbp), %rsi
callq 0x93d0
movq %rax, -0x20(%rbp)
movl -0x24(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x24(%rbp)
cmpl $0x0, %eax
je 0xac12
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
movq -0x20(%rbp), %rcx
movl (%rcx), %edx
movq -0x20(%rbp), %rcx
movl 0x4(%rcx), %ecx
movq -0x20(%rbp), %r8
movl 0x8(%r8), %r8d
movq -0x20(%rbp), %r9
subl (%r9), %r8d
movq -0x20(%rbp), %r9
movl 0xc(%r9), %r9d
movq -0x20(%rbp), %r10
subl 0x4(%r10), %r9d
callq *%rax
movq -0x20(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x20(%rbp)
jmp 0xabb4
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/renderer.c
// Function: default_copy_region
void
default_copy_region(struct wld_renderer *renderer, struct buffer *buffer,
                    int32_t dst_x, int32_t dst_y,
                    pixman_region32_t *region)
{
	pixman_box32_t *box;
	int num_boxes;

	box = pixman_region32_rectangles(region, &num_boxes);

	while (num_boxes--) {
		renderer->impl->copy_rectangle(renderer, buffer,
		                               dst_x + box->x1, dst_y + box->y1,
		                               box->x1, box->y1,
		                               box->x2 - box->x1, box->y2 - box->y1);
		++box;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x48, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq -0x34(%rbp), %rsi
callq 0x93d0
movq %rax, -0x30(%rbp)
movl -0x34(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x34(%rbp)
cmpl $0x0, %eax
je 0xacca
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x20(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movq -0x30(%rbp), %rcx
addl (%rcx), %edx
movl -0x20(%rbp), %ecx
movq -0x30(%rbp), %r8
addl 0x4(%r8), %ecx
movq -0x30(%rbp), %r8
movl (%r8), %r8d
movq -0x30(%rbp), %r9
movl 0x4(%r9), %r9d
movq -0x30(%rbp), %r10
movl 0x8(%r10), %r11d
movq -0x30(%rbp), %r10
subl (%r10), %r11d
movq -0x30(%rbp), %r10
movl 0xc(%r10), %r10d
movq -0x30(%rbp), %rbx
subl 0x4(%rbx), %r10d
movl %r11d, (%rsp)
movl %r10d, 0x8(%rsp)
callq *%rax
movq -0x30(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x30(%rbp)
jmp 0xac4c
addq $0x48, %rsp
popq %rbx
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/renderer.c
// Function: wld_set_target_buffer
EXPORT
bool
wld_set_target_buffer(struct wld_renderer *renderer, struct wld_buffer *buffer)
{
	if (!renderer->impl->set_target(renderer, (struct buffer *)buffer))
		return false;

	renderer->target = buffer;

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq *%rax
testb $0x1, %al
jne 0xad9f
movb $0x0, -0x1(%rbp)
jmp 0xadaf
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/drm.c
// Function: wld_drm_create_context
wld_context *
wld_drm_create_context(int fd)
{
	const struct drm_driver *driver;
	struct wld_context *context;

	if (!getenv("WLD_DRM_DUMB")) {
		driver = find_driver(fd);
		if (driver) {
			context = driver->create_context(fd);
			if (context)
				return context;
		}
	}

	DEBUG("Falling back to dumb DRM driver\n");
	return dumb_drm_driver.create_context(fd);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0xc(%rbp)
leaq 0x9ad1(%rip), %rdi      # 0x14c33
callq 0x9030
cmpq $0x0, %rax
jne 0xb1a6
movl -0xc(%rbp), %edi
callq 0xb1f0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xb1a4
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl -0xc(%rbp), %edi
callq *%rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0xb1a2
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xb1d9
jmp 0xb1a4
jmp 0xb1a6
movq 0x10e43(%rip), %rax     # 0x1bff0
movq (%rax), %rdi
leaq 0x9a89(%rip), %rsi      # 0x14c40
leaq 0x9aa9(%rip), %rdx      # 0x14c67
movb $0x0, %al
callq 0x94a0
leaq 0x107a4(%rip), %rax     # 0x1b970
movq 0x10(%rax), %rax
movl -0xc(%rbp), %edi
callq *%rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/dumb.c
// Function: driver_create_context
struct wld_context *
driver_create_context(int drm_fd)
{
	struct dumb_context *context;

	if (!(context = malloc(sizeof *context)))
		return NULL;

	context_initialize(&context->base, &wld_context_impl);
	context->fd = drm_fd;

	return &context->base;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0xc(%rbp)
movl $0x10, %edi
callq 0x9590
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0xb499
movq $0x0, -0x8(%rbp)
jmp 0xb4bb
movq -0x18(%rbp), %rdi
leaq 0x104e4(%rip), %rsi     # 0x1b988
callq 0xa3f0
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/dumb.c
// Function: context_create_buffer
struct buffer *
context_create_buffer(struct wld_context *base,
                      uint32_t width, uint32_t height,
                      uint32_t format, uint32_t flags)
{
	struct dumb_context *context = dumb_context(base);
	struct buffer *buffer;
	struct drm_mode_create_dumb create_dumb = {
		.height = height,
		.width = width,
		.bpp = format_bytes_per_pixel(format) * 8,
	};

	if (drmIoctl(context->fd, DRM_IOCTL_MODE_CREATE_DUMB, &create_dumb) != 0)
		goto error0;

	buffer = new_buffer(context, width, height, format,
	                    create_dumb.handle, create_dumb.pitch);

	if (!buffer)
		goto error1;

	return buffer;

error1 : {
	struct drm_mode_destroy_dumb destroy_dumb = {
		.handle = create_dumb.handle
	};

	drmIoctl(context->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
}
error0:
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0xb6c0
movq %rax, -0x28(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x50(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x1c(%rbp), %edi
callq 0xb710
movzbl %al, %eax
shll $0x3, %eax
movl %eax, -0x48(%rbp)
movl $0x0, -0x44(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x3c(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x28(%rbp), %rax
movl 0x8(%rax), %edi
movl $0xc02064b2, %esi       # imm = 0xC02064B2
leaq -0x50(%rbp), %rdx
callq 0x98c0
cmpl $0x0, %eax
je 0xb57c
jmp 0xb5ca
movq -0x28(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
movl -0x40(%rbp), %r8d
movl -0x3c(%rbp), %eax
movl %eax, %r9d
callq 0xb750
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xb5a5
jmp 0xb5af
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xb5d2
movl -0x40(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x28(%rbp), %rax
movl 0x8(%rax), %edi
movl $0xc00464b4, %esi       # imm = 0xC00464B4
leaq -0x54(%rbp), %rdx
callq 0x98c0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/dumb.c
// Function: context_import_buffer
struct buffer *
context_import_buffer(struct wld_context *base,
                      uint32_t type, union wld_object object,
                      uint32_t width, uint32_t height,
                      uint32_t format, uint32_t pitch)
{
	struct dumb_context *context = dumb_context(base);
	uint32_t handle;

	switch (type) {
	case WLD_DRM_OBJECT_PRIME_FD:
		if (drmPrimeFDToHandle(context->fd, object.i, &handle) != 0)
			return NULL;
		break;
	default:
		return NULL;
	}

	return new_buffer(context, width, height, format, handle, pitch);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl 0x10(%rbp), %eax
movq %rdx, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0xb6c0
movq %rax, -0x30(%rbp)
movl -0x1c(%rbp), %eax
subl $0x2000001, %eax        # imm = 0x2000001
jne 0xb63e
jmp 0xb61a
movq -0x30(%rbp), %rax
movl 0x8(%rax), %edi
movl -0x10(%rbp), %esi
leaq -0x34(%rbp), %rdx
callq 0x9800
cmpl $0x0, %eax
je 0xb63c
movq $0x0, -0x8(%rbp)
jmp 0xb668
jmp 0xb648
movq $0x0, -0x8(%rbp)
jmp 0xb668
movq -0x30(%rbp), %rdi
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
movl -0x28(%rbp), %ecx
movl -0x34(%rbp), %r8d
movl 0x10(%rbp), %eax
movl %eax, %r9d
callq 0xb750
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/./wld-private.h
// Function: format_bytes_per_pixel
static inline uint8_t
format_bytes_per_pixel(enum wld_format format)
{
	switch (format) {
	case WLD_FORMAT_ARGB8888:
	case WLD_FORMAT_XRGB8888:
		return 4;
	default:
		return 0;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edi, -0x8(%rbp)
movl -0x8(%rbp), %eax
movl %eax, -0xc(%rbp)
subl $0x34325241, %eax       # imm = 0x34325241
je 0xb732
jmp 0xb726
movl -0xc(%rbp), %eax
subl $0x34325258, %eax       # imm = 0x34325258
jne 0xb738
jmp 0xb732
movb $0x4, -0x1(%rbp)
jmp 0xb73c
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/dumb.c
// Function: new_buffer
static struct buffer *
new_buffer(struct dumb_context *context,
           uint32_t width, uint32_t height,
           uint32_t format, uint32_t handle,
           unsigned long pitch)
{
	struct dumb_buffer *buffer;

	if (!(buffer = malloc(sizeof *buffer)))
		return NULL;

	buffer_initialize(&buffer->base, &wld_buffer_impl,
	                  width, height, format, pitch);
	buffer->context = context;
	buffer->handle = handle;
	buffer->exporter.export = &export;
	wld_buffer_add_exporter(&buffer->base.base, &buffer->exporter);

	return &buffer->base;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movq %r9, -0x28(%rbp)
movl $0x70, %edi
callq 0x9590
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0xb78b
movq $0x0, -0x8(%rbp)
jmp 0xb7ea
movq -0x30(%rbp), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
movl -0x1c(%rbp), %r8d
movq -0x28(%rbp), %rax
movl %eax, %r9d
leaq 0x10209(%rip), %rsi     # 0x1b9b0
callq 0x99b0
movq -0x10(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x60(%rax)
movl -0x20(%rbp), %ecx
movq -0x30(%rbp), %rax
movl %ecx, 0x68(%rax)
movq -0x30(%rbp), %rax
leaq 0x33(%rip), %rcx        # 0xb800
movq %rcx, 0x50(%rax)
movq -0x30(%rbp), %rdi
movq -0x30(%rbp), %rsi
addq $0x50, %rsi
callq 0x9810
movq -0x30(%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/michaelforney[P]wld/dumb.c
// Function: export
static bool export(struct wld_exporter *exporter, struct wld_buffer *base,
                   uint32_t type, union wld_object *object)
{
	struct dumb_buffer *buffer = dumb_buffer(base);

	switch (type) {
	case WLD_DRM_OBJECT_HANDLE:
		object->u32 = buffer->handle;
		return true;
	case WLD_DRM_OBJECT_PRIME_FD:
		if (drmPrimeHandleToFD(buffer->context->fd, buffer->handle,
		                       DRM_CLOEXEC, &object->i)
		    != 0) {
			return false;
		}

		return true;
	default:
		return false;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0xba10
movq %rax, -0x30(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x34(%rbp)
subl $0x2000000, %eax        # imm = 0x2000000
je 0xb83f
jmp 0xb833
movl -0x34(%rbp), %eax
subl $0x2000001, %eax        # imm = 0x2000001
je 0xb852
jmp 0xb883
movq -0x30(%rbp), %rax
movl 0x68(%rax), %ecx
movq -0x28(%rbp), %rax
movl %ecx, (%rax)
movb $0x1, -0x1(%rbp)
jmp 0xb887
movq -0x30(%rbp), %rax
movq 0x60(%rax), %rax
movl 0x8(%rax), %edi
movq -0x30(%rbp), %rax
movl 0x68(%rax), %esi
movq -0x28(%rbp), %rcx
movl $0x80000, %edx          # imm = 0x80000
callq 0x9100
cmpl $0x0, %eax
je 0xb87d
movb $0x0, -0x1(%rbp)
jmp 0xb887
movb $0x1, -0x1(%rbp)
jmp 0xb887
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/dumb.c
// Function: buffer_map
bool
buffer_map(struct buffer *base)
{
	struct dumb_buffer *buffer = dumb_buffer(&base->base);
	struct drm_mode_map_dumb map_dumb = { .handle = buffer->handle };
	void *data;

	if (drmIoctl(buffer->context->fd, DRM_IOCTL_MODE_MAP_DUMB,
	             &map_dumb)
	    != 0) {
		return false;
	}

	data = mmap(NULL, buffer->base.base.pitch * buffer->base.base.height,
	            PROT_READ | PROT_WRITE, MAP_SHARED,
	            buffer->context->fd, map_dumb.offset);

	if (data == MAP_FAILED)
		return false;

	buffer->base.base.map = data;

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0xba10
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl 0x68(%rax), %eax
movl %eax, -0x28(%rbp)
movl $0x0, -0x24(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movl 0x8(%rax), %edi
movl $0xc01064b3, %esi       # imm = 0xC01064B3
leaq -0x28(%rbp), %rdx
callq 0x98c0
cmpl $0x0, %eax
je 0xb8f6
movb $0x0, -0x1(%rbp)
jmp 0xb953
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x18(%rbp), %rcx
imull 0xc(%rcx), %eax
movl %eax, %eax
movl %eax, %esi
movq -0x18(%rbp), %rax
movq 0x60(%rax), %rax
movl 0x8(%rax), %r8d
movq -0x20(%rbp), %r9
xorl %eax, %eax
movl %eax, %edi
movl $0x3, %edx
movl $0x1, %ecx
callq 0x92a0
movq %rax, -0x30(%rbp)
movq $-0x1, %rax
cmpq %rax, -0x30(%rbp)
jne 0xb943
movb $0x0, -0x1(%rbp)
jmp 0xb953
movq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x30(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/dumb.c
// Function: buffer_unmap
bool
buffer_unmap(struct buffer *buffer)
{
	if (munmap(buffer->base.map,
	           buffer->base.pitch * buffer->base.height)
	    == -1) {
		return false;
	}

	buffer->base.map = NULL;

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rdi
movq -0x10(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x10(%rbp), %rcx
imull 0xc(%rcx), %eax
movl %eax, %eax
movl %eax, %esi
callq 0x9650
cmpl $-0x1, %eax
jne 0xb997
movb $0x0, -0x1(%rbp)
jmp 0xb9a7
movq -0x10(%rbp), %rax
movq $0x0, 0x30(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/dumb.c
// Function: buffer_destroy
void
buffer_destroy(struct buffer *base)
{
	struct dumb_buffer *buffer = dumb_buffer(&base->base);
	struct drm_mode_destroy_dumb destroy_dumb = {
		.handle = buffer->handle
	};

	drmIoctl(buffer->context->fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroy_dumb);
	free(buffer);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xba10
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl 0x68(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movl 0x8(%rax), %edi
movl $0xc00464b4, %esi       # imm = 0xC00464B4
leaq -0x14(%rbp), %rdx
callq 0x98c0
movq -0x10(%rbp), %rdi
callq 0x9060
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/intel.c
// Function: driver_create_context
struct wld_context *
driver_create_context(int drm_fd)
{
	struct intel_context *context;

	context = malloc(sizeof *context);

	if (!context)
		goto error0;

	context_initialize(&context->base, &wld_context_impl);
	context->bufmgr = drm_intel_bufmgr_gem_init(drm_fd, INTEL_BATCH_SIZE);

	if (!context->bufmgr)
		goto error1;

	return &context->base;

error1:
	free(context);
error0:
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0xc(%rbp)
movl $0x10, %edi
callq 0x9590
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xbaa2
jmp 0xbaea
movq -0x18(%rbp), %rdi
leaq 0xff33(%rip), %rsi      # 0x1b9e0
callq 0xa3f0
movl -0xc(%rbp), %edi
movl $0x8000, %esi           # imm = 0x8000
callq 0x98d0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0xbad7
jmp 0xbae1
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xbaf2
movq -0x18(%rbp), %rdi
callq 0x9060
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/intel.c
// Function: context_create_renderer
struct wld_renderer *
context_create_renderer(struct wld_context *base)
{
	struct intel_context *context = intel_context(base);
	struct intel_renderer *renderer;

	if (!(renderer = malloc(sizeof *renderer)))
		goto error0;

	if (!(intel_batch_initialize(&renderer->batch, context->bufmgr)))
		goto error1;

	renderer_initialize(&renderer->base, &wld_renderer_impl);

	return &renderer->base;

error1:
	free(renderer);
error0:
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0xbd80
movq %rax, -0x18(%rbp)
movl $0x8030, %edi           # imm = 0x8030
callq 0x9590
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0xbb2f
jmp 0xbb6d
movq -0x20(%rbp), %rdi
addq $0x10, %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xcfe0
testb $0x1, %al
jne 0xbb4a
jmp 0xbb64
movq -0x20(%rbp), %rdi
leaq 0xfeb3(%rip), %rsi      # 0x1ba08
callq 0xace0
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xbb75
movq -0x20(%rbp), %rdi
callq 0x9060
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/intel.c
// Function: context_create_buffer
struct buffer *
context_create_buffer(struct wld_context *base,
                      uint32_t width, uint32_t height,
                      uint32_t format, uint32_t flags)
{
	struct intel_context *context = intel_context(base);
	struct buffer *buffer;
	drm_intel_bo *bo;
	uint32_t tiling_mode = width >= 128 && !(flags & WLD_FLAG_CURSOR) ? I915_TILING_X : I915_TILING_NONE;
	unsigned long pitch;

	bo = drm_intel_bo_alloc_tiled(context->bufmgr, "buffer", width, height, 4,
	                              &tiling_mode, &pitch, 0);

	if (!bo)
		goto error0;

	if (!(buffer = new_buffer(width, height, format, pitch, bo)))
		goto error1;

	return buffer;

error1:
	drm_intel_bo_unreference(bo);
error0:
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0xbd80
movq %rax, -0x28(%rbp)
xorl %eax, %eax
cmpl $0x80, -0x14(%rbp)
movb %al, -0x49(%rbp)
jb 0xbbc7
movl -0x20(%rbp), %eax
andl $0x20000, %eax          # imm = 0x20000
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
movl %eax, -0x3c(%rbp)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x14(%rbp), %edx
movl -0x18(%rbp), %ecx
leaq 0x97d3(%rip), %rsi      # 0x153c2
movl $0x4, %r8d
leaq -0x3c(%rbp), %r9
leaq -0x48(%rbp), %rax
xorl %r10d, %r10d
movq %rax, (%rsp)
movq $0x0, 0x8(%rsp)
callq 0x93a0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0xbc1f
jmp 0xbc56
movl -0x14(%rbp), %edi
movl -0x18(%rbp), %esi
movl -0x1c(%rbp), %edx
movq -0x48(%rbp), %rax
movl %eax, %ecx
movq -0x38(%rbp), %r8
callq 0xce70
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0xbc43
jmp 0xbc4d
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xbc5e
movq -0x38(%rbp), %rdi
callq 0x94f0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/intel.c
// Function: context_import_buffer
struct buffer *
context_import_buffer(struct wld_context *base,
                      uint32_t type, union wld_object object,
                      uint32_t width, uint32_t height,
                      uint32_t format, uint32_t pitch)
{
	struct intel_context *context = intel_context(base);
	struct buffer *buffer;
	drm_intel_bo *bo;

	switch (type) {
	case WLD_DRM_OBJECT_PRIME_FD: {
		uint32_t size = width * height * format_bytes_per_pixel(format);
		bo = drm_intel_bo_gem_create_from_prime(context->bufmgr,
		                                        object.i, size);
		break;
	}
	default:
		bo = NULL;
	};

	if (!bo)
		goto error0;

	if (!(buffer = new_buffer(width, height, format, pitch, bo)))
		goto error1;

	return buffer;

error1:
	drm_intel_bo_unreference(bo);
error0:
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl 0x10(%rbp), %eax
movq %rdx, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0xbd80
movq %rax, -0x30(%rbp)
movl -0x1c(%rbp), %eax
subl $0x2000001, %eax        # imm = 0x2000001
jne 0xbce3
jmp 0xbcaa
movl -0x20(%rbp), %eax
imull -0x24(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x28(%rbp), %edi
callq 0xcfa0
movb %al, %cl
movl -0x48(%rbp), %eax
movzbl %cl, %ecx
imull %ecx, %eax
movl %eax, -0x44(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
movl -0x10(%rbp), %esi
movl -0x44(%rbp), %edx
callq 0x96d0
movq %rax, -0x40(%rbp)
jmp 0xbceb
movq $0x0, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xbcf4
jmp 0xbd28
movl -0x20(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
movl 0x10(%rbp), %ecx
movq -0x40(%rbp), %r8
callq 0xce70
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0xbd15
jmp 0xbd1f
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0xbd30
movq -0x40(%rbp), %rdi
callq 0x94f0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/intel.c
// Function: renderer_set_target
bool
renderer_set_target(struct wld_renderer *base, struct buffer *buffer)
{
	struct intel_renderer *renderer = intel_renderer(base);

	if (buffer && buffer->base.impl != &wld_buffer_impl)
		return false;

	renderer->target = buffer ? intel_buffer(&buffer->base) : NULL;

	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0xc4f0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xbe4a
movq -0x18(%rbp), %rax
leaq 0xfc11(%rip), %rcx      # 0x1ba50
cmpq %rcx, (%rax)
je 0xbe4a
movb $0x0, -0x1(%rbp)
jmp 0xbe7b
cmpq $0x0, -0x18(%rbp)
je 0xbe60
movq -0x18(%rbp), %rdi
callq 0xc4a0
movq %rax, -0x28(%rbp)
jmp 0xbe68
xorl %eax, %eax
movq %rax, -0x28(%rbp)
jmp 0xbe68
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8028(%rax)
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]wld/intel.c
// Function: renderer_fill_rectangle
void
renderer_fill_rectangle(struct wld_renderer *base, uint32_t color,
                        int32_t x, int32_t y,
                        uint32_t width, uint32_t height)
{
	struct intel_renderer *renderer = intel_renderer(base);
	struct intel_buffer *dst = renderer->target;

	xy_color_blt(&renderer->batch, dst->bo, dst->base.base.pitch,
	             x, y, x + width, y + height, color);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl %ecx, -0x14(%rbp)
movl %r8d, -0x18(%rbp)
movl %r9d, -0x1c(%rbp)
movq -0x8(%rbp), %rdi
callq 0xc4f0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x8028(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
addq $0x10, %rdi
movq -0x30(%rbp), %rax
movq 0x60(%rax), %rsi
movq -0x30(%rbp), %rax
movl 0x10(%rax), %eax
movw %ax, %dx
movl -0x10(%rbp), %eax
movw %ax, %cx
movl -0x14(%rbp), %eax
movw %ax, %r8w
movl -0x10(%rbp), %eax
addl -0x18(%rbp), %eax
movw %ax, %r9w
movl -0x14(%rbp), %eax
addl -0x1c(%rbp), %eax
movw %ax, %r10w
movl -0xc(%rbp), %eax
movzwl %dx, %edx
movzwl %cx, %ecx
movzwl %r8w, %r8d
movzwl %r9w, %r9d
movzwl %r10w, %r10d
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0xc540
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)