LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x9dcd
movq %rbx, %rdi
callq 0x9bb8
movq %rax, %r14
testq %rax, %rax
je 0x9cce
movq 0x18(%rbx), %rax
movb $0x1, 0x8(%rax)
andq $0x0, 0x18(%rbx)
movq %r14, %rdi
addq $0x18, %rdi
callq 0x94b0
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x9dcd
movl 0x20(%r14), %eax
xorl %ecx, %ecx
xorl %edi, %edi
movq %rdi, %rdx
cmpq %rdi, %rax
je 0x9d13
movq 0x10(%r14), %rsi
leaq 0x1(%rdx), %rdi
leaq 0x10(%rcx), %r8
cmpq %rbx, (%rsi,%rcx)
movq %r8, %rcx
jne 0x9cf0
movb $0x0, -0x8(%rsi,%r8)
cmpq %rax, %rdx
setb %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x9dcd
cmpq $0x0, 0x28(%rbx)
je 0x9d71
movq %rbx, %rdi
callq 0x9bb8
testq %rax, %rax
je 0x9d71
movq %rax, %r14
movq 0x28(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *(%rax)
testb %al, %al
je 0x9d71
movq 0x18(%rbx), %rax
movb $0x1, 0x8(%rax)
andq $0x0, 0x18(%rbx)
addq $0x18, %r14
movq %r14, %rdi
callq 0x94b0
movb $0x1, %al
jmp 0x9d73
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x9dcd
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x9d97
movq (%rdi), %rax
callq *0x10(%rax)
xorl %r14d, %r14d
xorl %r15d, %r15d
movl 0x20(%rbx), %eax
movq 0x10(%rbx), %rdi
cmpq %rax, %r15
jae 0x9dbb
movq (%rdi,%r14), %rdi
callq 0x9260
incq %r15
addq $0x10, %r14
jmp 0x9d9d
callq 0x9060
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x9060
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
cmpb $0x23, (%rdi)
jne 0x9e3f
cmpb $0x0, 0x1(%r14)
je 0x9e3f
leaq 0x1(%r14), %rdi
leaq 0x10(%rsp), %r15
pushq $0x10
popq %rdx
movq %r15, %rsi
callq 0x9780
orl $0xff000000, %eax       # imm = 0xFF000000
movl %eax, (%rbx)
movq (%r15), %rax
cmpb $0x0, (%rax)
je 0x9ea6
movq %rbx, 0x8(%rsp)
movl $0x2f0, %ebx            # imm = 0x2F0
xorl %r13d, %r13d
leaq 0xbbed(%rip), %r12      # 0x15a40
cmpl %ebx, %r13d
jg 0x9e93
leal (%rbx,%r13), %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
movl %eax, %r15d
movslq %eax, %rbp
shlq $0x4, %rbp
movq (%rbp,%r12), %rdi
movq %r14, %rsi
callq 0x9070
testl %eax, %eax
je 0x9e97
leal 0x1(%r15), %ecx
decl %r15d
testl %eax, %eax
cmovsl %ecx, %r13d
cmovsl %ebx, %r15d
movl %r15d, %ebx
jmp 0x9e53
xorl %eax, %eax
jmp 0x9ea8
addq %rbp, %r12
movl 0x8(%r12), %eax
movq 0x8(%rsp), %rcx
movl %eax, (%rcx)
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
pushq $0x8
popq %rdi
callq 0x9570
testq %rax, %rax
je 0x9f28
movq %rax, %rbx
movq %rax, %rdi
callq 0x9340
testl %eax, %eax
je 0x9f2a
movq 0xf0e8(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
leaq 0x6c11(%rip), %rsi      # 0x10b23
leaq 0x6c37(%rip), %rdx      # 0x10b50
xorl %eax, %eax
callq 0x9480
movq %rbx, %rdi
callq 0x9060
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq 0xf096(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
leaq 0x6c04(%rip), %rsi      # 0x10b68
leaq 0x6c1f(%rip), %rdx      # 0x10b8a
xorl %r14d, %r14d
movq %r15, %rcx
xorl %eax, %eax
callq 0x9480
movq %r15, %rdi
callq 0x90e0
movq %rax, %r15
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
callq 0x93a0
movq %r15, %rdi
callq 0x9610
leaq 0xc(%rsp), %rdx
xorl %edi, %edi
movq %r15, %rsi
callq 0x9520
testq %rax, %rax
je 0x9fb9
movq %rbx, %rdi
movq %rax, %rsi
callq 0x94e0
movq %rax, %r14
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testl %esi, %esi
je 0xa22b
movl %esi, %ebp
movq %rdi, %r14
movq 0x20(%rdi), %rax
movl %esi, %r12d
movb $0x1, %bl
cmpq $0x0, (%rax,%r12,8)
jne 0xa22d
pushq $0x30
popq %rdi
callq 0x9570
testq %rax, %rax
je 0xa22b
movq %rax, %r15
movq 0x18(%r14), %rdi
movl %ebp, %esi
movl $0x21004, %edx          # imm = 0x21004
callq 0x90d0
movq %r15, %rdi
callq 0x9360
movq 0x10(%r14), %rax
movq 0x18(%r14), %rcx
movq (%rax), %rdi
movl $0x98, %esi
addq 0x98(%rcx), %rsi
movq %r15, %rdx
callq 0x9270
movq 0x18(%r14), %rax
movq 0x98(%rax), %rax
movl 0x50(%rax), %ecx
shrl $0x6, %ecx
movw %cx, 0x2c(%r15)
movzwl 0xc0(%rax), %ecx
movw %cx, 0x28(%r15)
xorl %ecx, %ecx
subw 0xc4(%rax), %cx
movw %cx, 0x2a(%r15)
movq 0x20(%r14), %rax
movq %r15, (%rax,%r12,8)
jmp 0xa22d
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
andl $0x0, (%rcx)
leaq 0x4(%rsp), %r12
movq %r14, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x92a0
testl %eax, %eax
jle 0xa2bb
movl 0x4(%rsp), %esi
testl %esi, %esi
je 0xa2bb
movq 0x18(%r15), %rdi
callq 0x9640
movl %eax, %r13d
movq %r15, %rdi
movl %eax, %esi
callq 0xa181
testb %al, %al
je 0xa2b4
movq 0x20(%r15), %rax
movl %r13d, %ecx
movq (%rax,%rcx,8), %rax
movzwl 0x2c(%rax), %eax
addl %eax, (%rbx)
incq %r14
decl %ebp
jmp 0xa270
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
movq %rdi, %r14
leaq 0xc(%rsp), %rsi
movq %rdx, %rdi
callq 0x93b0
movq %rax, %r15
subl $0x1, 0xc(%rsp)
jb 0xa317
movq (%r14), %rax
movl (%r15), %edx
movl 0x4(%r15), %ecx
movl 0x8(%r15), %r8d
subl %edx, %r8d
movl 0xc(%r15), %r9d
subl %ecx, %r9d
movq %r14, %rdi
movl %ebx, %esi
callq *0x10(%rax)
addq $0x10, %r15
jmp 0xa2ea
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %ecx, %ebx
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r12
leaq 0xc(%rsp), %rsi
movq %r8, %rdi
callq 0x93b0
movq %rax, %r13
subl $0x1, 0xc(%rsp)
jb 0xa389
movq (%r12), %rax
movl (%r13), %r8d
movl 0x4(%r13), %r9d
leal (%r8,%r14), %edx
leal (%r9,%rbx), %ecx
movl 0x8(%r13), %r10d
subl %r8d, %r10d
movl 0xc(%r13), %r11d
subl %r9d, %r11d
movq %r12, %rdi
movq %r15, %rsi
pushq %r11
pushq %r10
callq *0x20(%rax)
addq $0x10, %rsp
addq $0x10, %r13
jmp 0xa349
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movl %edi, %ebp
leaq 0x67a0(%rip), %rdi      # 0x10c26
callq 0x9030
testq %rax, %rax
jne 0xa604
leaq 0x78(%rsp), %rsi
movl %ebp, 0xc(%rsp)
movl %ebp, %edi
callq 0x9880
cmpl $-0x1, %eax
je 0xa600
movq 0xa0(%rsp), %r14
movq %r14, %rdi
callq 0x95f0
movl %eax, %ebp
movq %r14, %rdi
callq 0x9770
leaq 0x67a3(%rip), %rdx      # 0x10c71
leaq 0x10(%rsp), %rdi
pushq $0x40
popq %rsi
movl %ebp, %ecx
movl %eax, %r8d
xorl %eax, %eax
callq 0x9300
leal -0x3a(%rax), %ecx
cmpl $-0x40, %ecx
jb 0xa600
movslq %eax, %rbx
movl $0x726f64, 0x13(%rsp,%rbx) # imm = 0x726F64
movl $0x646e6576, 0x10(%rsp,%rbx) # imm = 0x646E6576
leaq 0x59a5(%rip), %rsi      # 0xfead
leaq 0x10(%rsp), %rdi
callq 0x96d0
testq %rax, %rax
je 0xa600
movq %rax, %r14
addq %rsp, %rbx
addq $0x10, %rbx
leaq 0x50(%rsp), %r15
pushq $0x20
popq %rsi
movq %r15, %rdi
movq %rax, %rdx
callq 0x9420
movq %r14, %rdi
callq 0x91d0
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x9780
movq %rax, %r14
movl $0x69766564, (%rbx)     # imm = 0x69766564
movl $0x656369, 0x3(%rbx)    # imm = 0x656369
leaq 0x594a(%rip), %rsi      # 0xfead
leaq 0x10(%rsp), %rdi
callq 0x96d0
testq %rax, %rax
je 0xa600
movq %rax, %r15
leaq 0x50(%rsp), %r12
pushq $0x20
popq %rsi
movq %r12, %rdi
movq %rax, %rdx
callq 0x9420
movq %r15, %rdi
callq 0x91d0
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x9780
movq %rax, %r15
leaq 0x66ea(%rip), %r12      # 0x10c94
leaq 0x6701(%rip), %r13      # 0x10cb2
xorl %ebp, %ebp
cmpq $0x18, %rbp
je 0xa600
movq 0xea30(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
leaq 0xe376(%rip), %rax      # 0x18940
movq (%rbp,%rax), %rbx
movq (%rbx), %rcx
movq %r12, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x9480
movl %r14d, %edi
movl %r15d, %esi
callq *0x8(%rbx)
addq $0x8, %rbp
testb %al, %al
je 0xa5b3
movl 0xc(%rsp), %ebp
movl %ebp, %edi
callq *0x10(%rbx)
testq %rax, %rax
jne 0xa62f
jmp 0xa604
movl 0xc(%rsp), %ebp
movq 0xe9e5(%rip), %rax      # 0x18ff0
movq (%rax), %rdi
leaq 0x661e(%rip), %rsi      # 0x10c33
leaq 0x663e(%rip), %rdx      # 0x10c5a
xorl %eax, %eax
callq 0x9480
leaq 0xe32e(%rip), %rax      # 0x18958
movl %ebp, %edi
callq *0x10(%rax)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %ecx, %ebp
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %rbx
movl $0xc00464b4, %r12d      # imm = 0xC00464B4
callq 0xa7d4
leaq 0x10(%rsp), %rdx
movl %r14d, (%rdx)
movl %r15d, 0x4(%rdx)
cmpl $0x34325241, %ebp       # imm = 0x34325241
sete %al
cmpl $0x34325258, %ebp       # imm = 0x34325258
sete %cl
orb %al, %cl
movzbl %cl, %eax
shll $0x5, %eax
movl %eax, 0x8(%rdx)
andl $0x0, 0x1c(%rdx)
xorps %xmm0, %xmm0
movups %xmm0, 0xc(%rdx)
movl 0x8(%rbx), %edi
leaq 0x1bfffe(%r12), %rsi
callq 0x98a0
testl %eax, %eax
je 0xa708
xorl %eax, %eax
jmp 0xa727
movl 0x20(%rsp), %r8d
movl 0x24(%rsp), %r9d
movq %rbx, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %ebp, %ecx
callq 0xa802
testq %rax, %rax
je 0xa734
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl 0x20(%rsp), %eax
leaq 0xc(%rsp), %rdx
movl %eax, (%rdx)
movl 0x8(%rbx), %edi
movl $0xc00464b4, %esi       # imm = 0xC00464B4
callq 0x98a0
jmp 0xa704
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebx
movl %r8d, %ebp
movl %ecx, %r14d
movq %rdx, %r12
movl %esi, %r13d
movq %rdi, %r15
callq 0xa7d4
cmpl $0x2000001, %r13d       # imm = 0x2000001
jne 0xa78e
movl 0x8(%r15), %edi
leaq 0x4(%rsp), %rdx
movl %r12d, %esi
callq 0x97e0
testl %eax, %eax
je 0xa79f
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x4(%rsp), %r8d
movl 0x40(%rsp), %r9d
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0xa802
jmp 0xa790
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movl %r8d, 0x4(%rsp)
movl %ecx, %r12d
movl %edx, %r13d
movl %esi, %ebp
movq %rdi, %r15
pushq $0x70
popq %rdi
callq 0x9570
movq %rax, %rbx
testq %rax, %rax
je 0xa86f
leaq 0xe161(%rip), %rsi      # 0x18998
movq %rbx, %rdi
movl %ebp, %edx
movl %r13d, %ecx
movl %r12d, %r8d
movl %r14d, %r9d
callq 0x998c
movq %r15, 0x60(%rbx)
movl 0x4(%rsp), %eax
movl %eax, 0x68(%rbx)
movq %rbx, %rsi
addq $0x50, %rsi
leaq 0x1e(%rip), %rax        # 0xa881
movq %rax, 0x50(%rbx)
movq %rbx, %rdi
callq 0x97f0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r14
pushq %rbx
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rsi, %rdi
callq 0xa9a9
cmpl $0x2000001, %ebp        # imm = 0x2000001
je 0xa8af
cmpl $0x2000000, %ebp        # imm = 0x2000000
jne 0xa8ce
movl 0x68(%r14), %eax
movl %eax, (%rbx)
movb $0x1, %al
jmp 0xa8d0
movq 0x60(%r14), %rax
movl 0x8(%rax), %edi
movl 0x68(%r14), %esi
movl $0x80000, %edx          # imm = 0x80000
movq %rbx, %rcx
callq 0x90f0
testl %eax, %eax
sete %al
jmp 0xa8d0
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0xa9a9
movl 0x68(%rbx), %eax
leaq 0x8(%rsp), %rdx
movl %eax, (%rdx)
andl $0x0, 0x4(%rdx)
andq $0x0, 0x8(%rdx)
movq 0x60(%rbx), %rax
movl 0x8(%rax), %edi
movl $0xc01064b3, %esi       # imm = 0xC01064B3
callq 0x98a0
testl %eax, %eax
je 0xa911
xorl %r14d, %r14d
jmp 0xa942
movl 0xc(%rbx), %esi
imull 0x10(%rbx), %esi
movq 0x60(%rbx), %rax
movl 0x8(%rax), %r8d
movq 0x10(%rsp), %r9
xorl %r14d, %r14d
pushq $0x3
popq %rdx
pushq $0x1
popq %rcx
xorl %edi, %edi
callq 0x9290
cmpq $-0x1, %rax
je 0xa942
movq %rax, 0x30(%rbx)
movb $0x1, %r14b
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %rdi
movl 0xc(%rbx), %esi
imull 0x10(%rbx), %esi
callq 0x9630
cmpl $-0x1, %eax
je 0xa96b
andq $0x0, 0x30(%rbx)
cmpl $-0x1, %eax
setne %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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 %rbx
subq $0x10, %rsp
movq %rdi, %rbx
callq 0xa9a9
movl 0x68(%rbx), %eax
leaq 0xc(%rsp), %rdx
movl %eax, (%rdx)
movq 0x60(%rbx), %rax
movl 0x8(%rax), %edi
movl $0xc00464b4, %esi       # imm = 0xC00464B4
callq 0x98a0
movq %rbx, %rdi
callq 0x9060
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %rbx
pushq %rax
movl %edi, %ebp
pushq $0x10
popq %rdi
callq 0x9570
testq %rax, %rax
je 0xaa23
movq %rax, %rbx
leaq 0xdfca(%rip), %rsi      # 0x189c8
movq %rax, %rdi
callq 0x9eb8
movl %ebp, %edi
movl $0x8000, %esi           # imm = 0x8000
callq 0x98b0
movq %rax, 0x8(%rbx)
testq %rax, %rax
jne 0xaa25
movq %rbx, %rdi
callq 0x9060
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0xabca
movl $0x8030, %edi           # imm = 0x8030
callq 0x9570
testq %rax, %rax
je 0xaa7a
movq %rax, %rbx
movq %rax, %rdi
addq $0x10, %rdi
movq 0x8(%r14), %rsi
callq 0xb5d4
testb %al, %al
je 0xaa72
leaq 0xdf88(%rip), %rsi      # 0x189f0
movq %rbx, %rdi
callq 0xa397
jmp 0xaa7c
movq %rbx, %rdi
callq 0x9060
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %r8d, %r15d
movl %ecx, %ebx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r12
callq 0xabca
cmpl $0x7f, %r14d
seta %al
btl $0x11, %r15d
setae %cl
andb %al, %cl
movzbl %cl, %eax
leaq 0xc(%rsp), %r9
movl %eax, (%r9)
movq 0x8(%r12), %rdi
movq %rsp, %rax
leaq 0x6de2(%rip), %rsi      # 0x118b2
pushq $0x4
popq %r8
movl %r14d, %edx
movl %ebp, %ecx
pushq $0x0
pushq %rax
callq 0x9390
addq $0x10, %rsp
testq %rax, %rax
je 0xab0c
movq %rax, %r15
movl (%rsp), %ecx
movl %r14d, %edi
movl %ebp, %esi
movl %ebx, %edx
movq %rax, %r8
callq 0xb515
testq %rax, %rax
jne 0xab0e
movq %r15, %rdi
callq 0x94d0
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %ebx
movl %r8d, %ebp
movl %ecx, %r14d
movq %rdx, %r15
movl %esi, %r13d
movq %rdi, %r12
callq 0xabca
cmpl $0x2000001, %r13d       # imm = 0x2000001
jne 0xab9e
movl %ebp, %eax
imull %r14d, %eax
cmpl $0x34325241, %ebx       # imm = 0x34325241
sete %cl
cmpl $0x34325258, %ebx       # imm = 0x34325258
sete %dl
orb %cl, %dl
movzbl %dl, %edx
imull %eax, %edx
shll $0x2, %edx
movq 0x8(%r12), %rdi
movl %r15d, %esi
callq 0x96b0
testq %rax, %rax
je 0xab9e
movq %rax, %r15
movl 0x40(%rsp), %ecx
movl %r14d, %edi
movl %ebp, %esi
movl %ebx, %edx
movq %rax, %r8
callq 0xb515
testq %rax, %rax
jne 0xaba0
movq %r15, %rdi
callq 0x94d0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/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 %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0xb31c
testq %rbx, %rbx
je 0xac37
leaq 0xde12(%rip), %rax      # 0x18a38
cmpq %rax, (%rbx)
je 0xac2f
xorl %eax, %eax
jmp 0xac40
movq %rbx, %rdi
callq 0xb2ee
movq %rbx, 0x8028(%r14)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %ebx
movl %r8d, %ebp
movl %ecx, %r15d
movl %edx, %r13d
movl %esi, 0x10(%rsp)
movq %rdi, %r14
callq 0xb31c
movq 0x8028(%r14), %rax
leaq 0x10(%r14), %rdi
movq %rdi, 0x18(%rsp)
movq 0x60(%rax), %r12
movzwl 0x10(%rax), %eax
movl %eax, 0xc(%rsp)
addl %r13d, %ebp
addl %r15d, %ebx
movq 0x10(%r14), %rax
xorl %esi, %esi
cmpl $0x8, (%rax)
setge %sil
orl $0x6, %esi
callq 0xb34a
leaq 0x14(%rsp), %rsi
leaq 0x24(%rsp), %rdx
movq %r12, %rdi
callq 0x9350
movq 0x18(%r14), %rdi
movl 0x8020(%r14), %eax
leal 0x10(,%rax,4), %esi
pushq $0x2
popq %r8
movq %r12, %rdx
xorl %ecx, %ecx
movl %r8d, %r9d
callq 0x9740
movl 0xc(%rsp), %esi
movl %esi, %ecx
shrl $0x2, %ecx
xorl %eax, %eax
leaq 0x14(%rsp), %rdx
cmpl $0x0, (%rdx)
setne %al
movq 0x10(%r14), %rdx
cmovel %esi, %ecx
shll $0xb, %eax
xorl %esi, %esi
cmpl $0x8, (%rdx)
setge %sil
leal (%rax,%rsi), %edx
addl $0x54300004, %edx       # imm = 0x54300004
orl $0x3f00000, %ecx        # imm = 0x3F00000
shll $0x10, %r15d
movl $0xffff, %eax           # imm = 0xFFFF
andl %eax, %r13d
orl %r15d, %r13d
shll $0x10, %ebx
andl %eax, %ebp
orl %ebx, %ebp
pushq $0x4
popq %rsi
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
movl %r13d, %r8d
movl %ebp, %r9d
xorl %eax, %eax
callq 0xb35e
movq 0x10(%r14), %rax
xorl %esi, %esi
cmpl $0x8, (%rax)
setge %sil
incl %esi
movq 0x30(%r12), %rdx
movq %rdx, %rcx
shrq $0x20, %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0xb35e
movl 0x8020(%r14), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x8020(%r14)
movl 0x10(%rsp), %ecx
movl %ecx, 0x20(%r14,%rax,4)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/michaelforney[P]wld/intel.c
// Function: buffer_map
bool
buffer_map(struct buffer *base)
{
	struct intel_buffer *buffer = intel_buffer(&base->base);

	if (drm_intel_gem_bo_map_gtt(buffer->bo) != 0)
		return false;

	buffer->base.base.map = buffer->bo->virtual;

	return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0xb2ee
movq 0x60(%rbx), %rdi
callq 0x91b0
testl %eax, %eax
jne 0xb2aa
movq 0x60(%rbx), %rcx
movq 0x18(%rcx), %rcx
movq %rcx, 0x30(%rbx)
testl %eax, %eax
sete %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/michaelforney[P]wld/intel.c
// Function: buffer_unmap
bool
buffer_unmap(struct buffer *base)
{
	struct intel_buffer *buffer = intel_buffer(&base->base);

	if (drm_intel_gem_bo_unmap_gtt(buffer->bo) != 0)
		return false;

	buffer->base.base.map = NULL;

	return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0xb2ee
movq 0x60(%rbx), %rdi
callq 0x97d0
testl %eax, %eax
jne 0xb2cc
andq $0x0, 0x30(%rbx)
testl %eax, %eax
sete %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/michaelforney[P]wld/./intel/batch.h
// Function: intel_batch_add_dwords
static inline void
intel_batch_add_dwords(struct intel_batch *batch,
                       uint32_t count, ...)
{
	va_list dwords;
	va_start(dwords, count);
	intel_batch_add_dwords_va(batch, count, dwords);
	va_end(dwords);
}

// Assembly:
subq $0x58, %rsp
leaq -0x60(%rsp), %r10
movq %rdx, 0x10(%r10)
movq %rcx, 0x18(%r10)
movq %r8, 0x20(%r10)
movq %r9, 0x28(%r10)
testb %al, %al
je 0xb3a2
movaps %xmm0, -0x30(%rsp)
movaps %xmm1, -0x20(%rsp)
movaps %xmm2, -0x10(%rsp)
movaps %xmm3, (%rsp)
movaps %xmm4, 0x10(%rsp)
movaps %xmm5, 0x20(%rsp)
movaps %xmm6, 0x30(%rsp)
movaps %xmm7, 0x40(%rsp)
movq %r10, -0x70(%rsp)
leaq 0x60(%rsp), %rcx
movq %rcx, -0x78(%rsp)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, -0x80(%rsp)
movl $0x10, %eax
subl $0x1, %esi
jb 0xb407
cmpl $0x28, %eax
ja 0xb3e0
movq %rcx, %rdx
movl %eax, %ecx
addq %r10, %rcx
addl $0x8, %eax
movl %eax, -0x80(%rsp)
jmp 0xb3e9
leaq 0x8(%rcx), %rdx
movq %rdx, -0x78(%rsp)
movl (%rcx), %ecx
movl 0x8010(%rdi), %r8d
leal 0x1(%r8), %r9d
movl %r9d, 0x8010(%rdi)
movl %ecx, 0x10(%rdi,%r8,4)
movq %rdx, %rcx
jmp 0xb3c5
addq $0x58, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/michaelforney[P]wld/intel.c
// Function: new_buffer
static struct buffer *
new_buffer(uint32_t width, uint32_t height,
           uint32_t format, uint32_t pitch,
           drm_intel_bo *bo)
{
	struct intel_buffer *buffer;

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

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

	return &buffer->base;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r14
movl %ecx, %ebp
movl %edx, %r15d
movl %esi, %r12d
movl %edi, %r13d
pushq $0x68
popq %rdi
callq 0x9570
movq %rax, %rbx
testq %rax, %rax
je 0xb577
leaq 0xd4f3(%rip), %rsi      # 0x18a38
movq %rbx, %rdi
movl %r13d, %edx
movl %r12d, %ecx
movl %r15d, %r8d
movl %ebp, %r9d
callq 0x998c
movq %r14, 0x60(%rbx)
movq %rbx, %rsi
addq $0x50, %rsi
leaq 0x1e(%rip), %rax        # 0xb589
movq %rax, 0x50(%rbx)
movq %rbx, %rdi
callq 0x97f0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/michaelforney[P]wld/intel.c
// Function: export
static bool export(struct wld_exporter *exporter, struct wld_buffer *base,
                   uint32_t type, union wld_object *object)
{
	struct intel_buffer *buffer = intel_buffer(base);

	switch (type) {
	case WLD_DRM_OBJECT_HANDLE:
		object->u32 = buffer->bo->handle;
		return true;
	case WLD_DRM_OBJECT_PRIME_FD:
		if (drm_intel_bo_gem_export_to_prime(buffer->bo, &object->i) != 0)
			return false;
		return true;
	default:
		return false;
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rcx, %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rsi, %rdi
callq 0xb2ee
cmpl $0x2000001, %ebp        # imm = 0x2000001
je 0xb5ba
cmpl $0x2000000, %ebp        # imm = 0x2000000
jne 0xb5cd
movq 0x60(%r14), %rax
movl 0x28(%rax), %eax
movl %eax, (%rbx)
movb $0x1, %al
jmp 0xb5cf
movq 0x60(%r14), %rdi
movq %rbx, %rsi
callq 0x9800
testl %eax, %eax
sete %al
jmp 0xb5cf
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/michaelforney[P]wld/intel/batch.c
// Function: intel_batch_flush
void
intel_batch_flush(struct intel_batch *batch)
{
	if (batch->command_count == 0)
		return;

	intel_batch_add_dword(batch, MI_BATCH_BUFFER_END);

	/* Pad the batch buffer to the next quad-word. */
	if (batch->command_count & 1)
		intel_batch_add_dword(batch, MI_NOOP);

	drm_intel_bo_subdata(batch->bo, 0, batch->command_count << 2,
	                     batch->commands);
	drm_intel_bo_mrb_exec(batch->bo, batch->command_count << 2, NULL, 0, 0,
	                      GEN(batch, 6) ? I915_EXEC_BLT
	                                    : I915_EXEC_DEFAULT);
	drm_intel_gem_bo_clear_relocs(batch->bo, 0);
	batch->command_count = 0;
}

// Assembly:
movl 0x8010(%rdi), %eax
testq %rax, %rax
je 0xbc7b
pushq %rbx
movq %rdi, %rbx
leaq 0x10(%rdi), %rcx
leal 0x1(%rax), %edx
movl %edx, 0x8010(%rdi)
movl $0x5000000, 0x10(%rdi,%rax,4) # imm = 0x5000000
movl 0x8010(%rdi), %edx
testb $0x1, %dl
je 0xbc32
movl %edx, %eax
incl %eax
movl %eax, 0x8010(%rbx)
andl $0x0, 0x10(%rbx,%rdx,4)
movl 0x8010(%rbx), %edx
movq 0x8(%rbx), %rdi
shll $0x2, %edx
xorl %esi, %esi
callq 0x9210
movq (%rbx), %rax
movq 0x8(%rbx), %rdi
movl 0x8010(%rbx), %esi
shll $0x2, %esi
xorl %ecx, %ecx
cmpl $0x6, (%rax)
setge %cl
leal (%rcx,%rcx,2), %r9d
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x92f0
movq 0x8(%rbx), %rdi
xorl %esi, %esi
callq 0x9540
andl $0x0, 0x8010(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/michaelforney[P]wld/nouveau.c
// Function: context_create_renderer
struct wld_renderer *
context_create_renderer(struct wld_context *base)
{
	struct nouveau_context *context = nouveau_context(base);
	struct nouveau_renderer *renderer;
	struct nvc0_fifo fifo = {};
	int ret;

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

	ret = nouveau_object_new(&context->device->object, 0,
	                         NOUVEAU_FIFO_CHANNEL_CLASS, &fifo, sizeof fifo,
	                         &renderer->channel);

	if (ret != 0)
		goto error1;

	ret = nouveau_pushbuf_new(context->client, renderer->channel, 4, 32 * 1024,
	                          true, &renderer->pushbuf);

	if (ret != 0)
		goto error2;

	if (nouveau_bufctx_new(context->client, 1, &renderer->bufctx) != 0)
		goto error3;

	if (!nvc0_2d_initialize(renderer))
		goto error4;

	renderer_initialize(&renderer->base, &wld_renderer_impl);
	renderer->target = NULL;

	return &renderer->base;

error4:
	nouveau_bufctx_del(&renderer->bufctx);
error3:
	nouveau_pushbuf_del(&renderer->pushbuf);
error2:
	nouveau_object_del(&renderer->channel);
error1:
	free(renderer);
error0:
	return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
movq %rdi, %r12
callq 0xbff3
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
pushq $0x38
popq %rdi
callq 0x9570
testq %rax, %rax
je 0xbe5e
movq %rax, %rbx
movq 0x8(%r12), %rdi
leaq 0x10(%rax), %r14
movq %rsp, %rcx
pushq $0x30
popq %r8
xorl %esi, %esi
movl $0x80000001, %edx       # imm = 0x80000001
movq %r14, %r9
callq 0x9150
testl %eax, %eax
jne 0xbe56
movq 0x10(%r12), %rdi
movq 0x10(%rbx), %rsi
leaq 0x18(%rbx), %r15
pushq $0x4
popq %rdx
pushq $0x1
popq %r8
movl $0x8000, %ecx           # imm = 0x8000
movq %r15, %r9
callq 0x9220
testl %eax, %eax
jne 0xbe4e
movq 0x10(%r12), %rdi
leaq 0x20(%rbx), %r12
pushq $0x1
popq %rsi
movq %r12, %rdx
callq 0x94a0
testl %eax, %eax
jne 0xbe46
movq 0x10(%rbx), %rdi
movq %rbx, %r13
addq $0x28, %r13
movl $0x902d, %esi           # imm = 0x902D
movl $0x902d, %edx           # imm = 0x902D
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r13, %r9
callq 0x9150
testl %eax, %eax
jne 0xbe3e
movq (%r15), %rdi
pushq $0x5
popq %rsi
callq 0xc021
testb %al, %al
je 0xbe36
movq 0x18(%rbx), %rdi
movq 0x28(%rbx), %rax
movq 0x8(%rax), %r8
pushq $0x1
popq %rcx
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0xc04a
movq 0x18(%rbx), %rax
movq 0x30(%rax), %rcx
movabsq $-0x7fc09dde7fff9f55, %rdx # imm = 0x803F6221800060AB
movq %rdx, (%rcx)
leaq 0xc(%rcx), %rdx
movq %rdx, 0x30(%rax)
movl $0x80016222, 0x8(%rcx)  # imm = 0x80016222
leaq 0xcc69(%rip), %rsi      # 0x18a90
movq %rbx, %rdi
callq 0xa397
andq $0x0, 0x30(%rbx)
jmp 0xbe60
movq %r13, %rdi
callq 0x93d0
movq %r12, %rdi
callq 0x9700
movq %r15, %rdi
callq 0x9550
movq %r14, %rdi
callq 0x93d0
movq %rbx, %rdi
callq 0x9060
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/michaelforney[P]wld/nouveau.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 nouveau_context *context = nouveau_context(base);
	struct nouveau_buffer *buffer;
	uint32_t bpp = format_bytes_per_pixel(format),
	         pitch = roundup(width * bpp, 64), bo_flags;
	union nouveau_bo_config config = {};

	if (!(buffer = new_buffer(context, width, height, format, pitch)))
		goto error0;

	bo_flags = NOUVEAU_BO_VRAM;

	if (flags & WLD_DRM_FLAG_SCANOUT)
		bo_flags |= NOUVEAU_BO_CONTIG;

	if (height > 0x40 && !(flags & WLD_FLAG_MAP)) {
		config.nvc0.tile_mode = 0x40;
		config.nvc0.memtype = 0xfe;
		height = roundup(height, 0x80);
	} else
		bo_flags |= NOUVEAU_BO_MAP;

	if (nouveau_bo_new(context->device, bo_flags, 0, pitch * height,
	                   &config, &buffer->bo)
	    != 0) {
		goto error1;
	}

	return &buffer->base;

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %r12d
movl %ecx, %r14d
movl %edx, %ebx
movl %esi, %r13d
movq %rdi, %r15
callq 0xbff3
cmpl $0x34325241, %r14d      # imm = 0x34325241
sete %al
cmpl $0x34325258, %r14d      # imm = 0x34325258
sete %cl
orb %al, %cl
movzbl %cl, %eax
imull %r13d, %eax
leal 0x3f(,%rax,4), %ebp
andl $-0x40, %ebp
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movq %r15, %rdi
movl %r13d, %esi
movl %ebx, %edx
movl %r14d, %ecx
movl %ebp, %r8d
callq 0xc89c
testq %rax, %rax
je 0xbf41
movq %rax, %r14
movl %r12d, %esi
andl $0x1, %esi
shll $0x1e, %esi
incl %esi
cmpl $0x41, %ebx
setb %al
shrl $0x10, %r12d
andl $0x1, %r12d
orb %al, %r12b
jne 0xbf14
movabsq $0x40000000fe, %rax     # imm = 0x40000000FE
movq %rax, (%rsp)
addl $0x7f, %ebx
andl $-0x80, %ebx
jmp 0xbf1a
orl $0x80000000, %esi       # imm = 0x80000000
movq 0x8(%r15), %rdi
imull %ebp, %ebx
movq %r14, %r9
addq $0x68, %r9
movq %rsp, %r8
xorl %edx, %edx
movq %rbx, %rcx
callq 0x9370
testl %eax, %eax
je 0xbf44
movq %r14, %rdi
callq 0x9060
xorl %r14d, %r14d
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/michaelforney[P]wld/nouveau.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 nouveau_context *context = (void *)base;
	struct nouveau_buffer *buffer;
	struct nouveau_bo *bo = NULL;

	switch (type) {
	case WLD_DRM_OBJECT_PRIME_FD:
		if (nouveau_bo_prime_handle_ref(context->device,
		                                object.i, &bo)
		    != 0) {
			goto error0;
		}
		break;
	default:
		goto error0;
	}

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

	buffer->bo = bo;

	return &buffer->base;

error1:
	nouveau_bo_ref(NULL, &buffer->bo);
error0:
	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
andq $0x0, (%rsp)
cmpl $0x2000001, %esi        # imm = 0x2000001
jne 0xbf8b
movl %r9d, %ebx
movl %r8d, %ebp
movl %ecx, %r14d
movq %rdi, %r15
movq 0x8(%rdi), %rdi
movq %rsp, %rax
movl %edx, %esi
movq %rax, %rdx
callq 0x9050
testl %eax, %eax
je 0xbf9b
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl 0x30(%rsp), %r8d
movq %r15, %rdi
movl %r14d, %esi
movl %ebp, %edx
movl %ebx, %ecx
callq 0xc89c
testq %rax, %rax
je 0xbfc1
movq %rax, %rbx
movq (%rsp), %rax
movq %rax, 0x68(%rbx)
jmp 0xbf8d
xorl %ebx, %ebx
pushq $0x68
popq %rsi
xorl %edi, %edi
callq 0x9850
jmp 0xbf8d
// File: /workspace/github_c_makefile_star2_O2/michaelforney[P]wld/nouveau.c
// Function: context_destroy
void
context_destroy(struct wld_context *base)
{
	struct nouveau_context *context = nouveau_context(base);

	nouveau_client_del(&context->client);
	nouveau_device_del(&context->device);
	free(context);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0xbff3
leaq 0x10(%rbx), %rdi
callq 0x9790
leaq 0x8(%rbx), %rdi
callq 0x9840
movq %rbx, %rdi
popq %rbx
jmp 0x9060
// File: /workspace/github_c_makefile_star2_O2/michaelforney[P]wld/nouveau.c
// Function: nvc0_methods
static inline void
nvc0_methods(struct nouveau_pushbuf *push,
             uint8_t subchannel, uint16_t start_method,
             uint16_t count, ...)
{
	va_list dwords;
	nv_add_dword(push, nvc0_command(GF100_COMMAND_TYPE_INCREASING,
	                                subchannel, start_method, count));
	va_start(dwords, count);
	nv_add_dwords_va(push, count, dwords);
	va_end(dwords);
}

// Assembly:
subq $0x58, %rsp
leaq -0x60(%rsp), %rsi
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0xc086
movaps %xmm0, -0x30(%rsp)
movaps %xmm1, -0x20(%rsp)
movaps %xmm2, -0x10(%rsp)
movaps %xmm3, (%rsp)
movaps %xmm4, 0x10(%rsp)
movaps %xmm5, 0x20(%rsp)
movaps %xmm6, 0x30(%rsp)
movaps %xmm7, 0x40(%rsp)
movl %ecx, %eax
shll $0x10, %eax
shrl $0x2, %edx
orl %eax, %edx
orl $0x20006000, %edx       # imm = 0x20006000
movq 0x30(%rdi), %rax
leaq 0x4(%rax), %r8
movq %r8, 0x30(%rdi)
movl %edx, (%rax)
movq %rsi, -0x70(%rsp)
leaq 0x60(%rsp), %rax
movq %rax, -0x78(%rsp)
movabsq $0x3000000020, %rax     # imm = 0x3000000020
movq %rax, -0x80(%rsp)
subw $0x1, %cx
jb 0xc103
movl -0x80(%rsp), %edx
cmpq $0x28, %rdx
ja 0xc0e3
movq %rdx, %rax
addq -0x70(%rsp), %rax
addl $0x8, %edx
movl %edx, -0x80(%rsp)
jmp 0xc0f1
movq -0x78(%rsp), %rax
leaq 0x8(%rax), %rdx
movq %rdx, -0x78(%rsp)
movl (%rax), %eax
movq 0x30(%rdi), %rdx
leaq 0x4(%rdx), %rsi
movq %rsi, 0x30(%rdi)
movl %eax, (%rdx)
jmp 0xc0c2
addq $0x58, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/michaelforney[P]wld/nouveau.c
// Function: renderer_set_target
bool
renderer_set_target(struct wld_renderer *base, struct buffer *buffer)
{
	struct nouveau_renderer *renderer = nouveau_renderer(base);

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

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

	return true;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0xc79d
testq %rbx, %rbx
je 0xc147
leaq 0xc9a2(%rip), %rax      # 0x18ad8
cmpq %rax, (%rbx)
je 0xc13f
xorl %eax, %eax
jmp 0xc14d
movq %rbx, %rdi
callq 0xc76f
movq %rbx, 0x30(%r14)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
retq