// File: /workspace/github_c_makefile_star2_O3/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
leaq 0xb773(%rip), %rax      # 0x17a68
cmpq %rax, (%rdi)
jne 0xc475
movq %rdi, %r12
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
movl $0x38, %edi
callq 0x9570
testq %rax, %rax
je 0xc3da
movq %rax, %rbx
movq 0x8(%r12), %rdi
leaq 0x10(%rax), %r14
movq %rsp, %rcx
xorl %esi, %esi
movl $0x80000001, %edx       # imm = 0x80000001
movl $0x30, %r8d
movq %r14, %r9
callq 0x9150
testl %eax, %eax
jne 0xc3d2
movq 0x10(%r12), %rdi
movq 0x10(%rbx), %rsi
leaq 0x18(%rbx), %r15
movl $0x4, %edx
movl $0x8000, %ecx           # imm = 0x8000
movl $0x1, %r8d
movq %r15, %r9
callq 0x9220
testl %eax, %eax
jne 0xc3ca
movq 0x10(%r12), %rdi
leaq 0x20(%rbx), %r12
movl $0x1, %esi
movq %r12, %rdx
callq 0x94a0
testl %eax, %eax
jne 0xc3c2
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
je 0xc3ed
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
movq (%r15), %rdi
movq 0x38(%rdi), %rax
subq 0x30(%rdi), %rax
cmpq $0x14, %rax
jg 0xc41d
movl $0x5, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x9860
testl %eax, %eax
je 0xc41a
movq %r13, %rdi
callq 0x93d0
jmp 0xc3ba
movq (%r15), %rdi
movq 0x28(%rbx), %rax
movq 0x8(%rax), %r8
xorl %esi, %esi
xorl %edx, %edx
movl $0x1, %ecx
xorl %eax, %eax
callq 0xc655
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 0xb630(%rip), %rsi      # 0x17a90
movq %rbx, %rdi
callq 0xa5ee
movq $0x0, 0x30(%rbx)
jmp 0xc3dc
leaq 0x4847(%rip), %rdi      # 0x10cc3
leaq 0x4f7d(%rip), %rsi      # 0x11400
leaq 0x4f80(%rip), %rcx      # 0x1140a
movl $0x4a, %edx
callq 0x9380