// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/backends/riscos_common/riscos_arm.c
// Function: prv_add_builtin
static void prv_add_builtin(subtilis_ir_section_t *s,
			    subtilis_arm_section_t *arm_s,
			    subtilis_error_t *err)
{
	switch (s->ftype) {
	case SUBTILIS_BUILTINS_IDIV:
		subtilis_arm2_idiv_add(s, arm_s, err);
		break;
	case SUBTILIS_BUILTINS_MEMSETI32:
		subtilis_arm_mem_memseti32(s, arm_s, err);
		break;
	case SUBTILIS_BUILTINS_MEMCPY:
		subtilis_arm_mem_memcpy(s, arm_s, err);
		break;
	case SUBTILIS_BUILTINS_MEMCMP:
		subtilis_arm_mem_memcmp(s, arm_s, err);
		break;
	case SUBTILIS_BUILTINS_COMPARE:
		subtilis_arm_mem_strcmp(s, arm_s, err);
		break;
	case SUBTILIS_BUILTINS_MEMSETI8:
		subtilis_arm_mem_memseti8(s, arm_s, err);
		break;
	case SUBTILIS_BUILTINS_ALLOC:
		prv_alloc(s, arm_s, err);
		break;
	case SUBTILIS_BUILTINS_DEREF:
		prv_deref(s, arm_s, err);
		break;
	case SUBTILIS_BUILTINS_MEMSETI64:
		subtilis_arm_mem_memseti64(s, arm_s, err);
		break;
	default:
		subtilis_error_set_assertion_failed(err);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movl 0x40(%rdi), %eax
cmpq $0x8, %rax
ja 0x6e92a
movq %rsi, %r14
movq %rdi, %r15
leaq 0xad41(%rip), %rcx      # 0x79250
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x5a6cc
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x60635
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x5fa19
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x5ff95
movq 0x10(%r14), %r15
leaq 0x1(%r15), %rax
movq %rax, 0x10(%r14)
subq $0x8, %rsp
movl $0x2, %r9d
movq %r14, %rdi
movl $0x2, %esi
movl $0x4, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
pushq %rbx
pushq $0x8
pushq $0x0
callq 0x4fd3f
addq $0x20, %rsp
cmpl $0x0, (%rbx)
jne 0x6e909
movl $0x3, %ecx
movl $0x2, %r8d
movq %r14, %rdi
movl $0x12, %esi
movl $0xe, %edx
xorl %r9d, %r9d
pushq %rbx
pushq $0x0
callq 0x50516
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6e909
subq $0x8, %rsp
movl $0x3, %r9d
movq %r14, %rdi
movl $0x2, %esi
movl $0x4, %edx
movl $0xe, %ecx
movl $0x1, %r8d
pushq %rbx
pushq $0x1
pushq $0x3
callq 0x4fd3f
addq $0x20, %rsp
cmpl $0x0, (%rbx)
jne 0x6e909
movl $0x3, %ecx
movl $0x2, %r8d
movq %r14, %rdi
movl $0x13, %esi
movl $0xe, %edx
xorl %r9d, %r9d
pushq %rbx
pushq $0x0
callq 0x50516
addq $0x10, %rsp
movq %r14, %rdi
movl $0x16, %esi
movq %rbx, %rdx
callq 0x4f6e2
cmpl $0x0, (%rbx)
jne 0x6e909
movl $0x1, 0x8(%rax)
movb $0x0, 0xc(%rax)
movl $0x0, 0x10(%rax)
movq %r15, 0x18(%rax)
movl $0x1, %edx
movq %r14, %rdi
xorl %esi, %esi
movq %rbx, %rcx
callq 0x703a3
cmpl $0x0, (%rbx)
jne 0x6e909
movl $0x1, %esi
movl $0x2, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x628a2
cmpl $0x0, (%rbx)
jne 0x6e909
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x4f530
cmpl $0x0, (%rbx)
jne 0x6e909
subq $0x8, %rsp
movl $0xf, %r8d
movl $0xe, %r9d
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
pushq %rbx
callq 0x504b3
addq $0x10, %rsp
jmp 0x6e909
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x5f074
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x5f378
movq 0x10(%r14), %r13
leaq 0x2(%r13), %rax
movq %rax, 0x10(%r14)
subq $0x8, %rsp
movl $0x1, %r9d
movq %r14, %rdi
movl $0x4, %esi
movl $0x2, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
pushq %rbx
pushq $0x8
pushq $0x0
callq 0x4fd3f
addq $0x20, %rsp
cmpl $0x0, (%rbx)
jne 0x6e909
subq $0x8, %rsp
movl $0xb, %r9d
movq %r14, %rdi
movl $0x4, %esi
movl $0x2, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
pushq %rbx
pushq $0x8
pushq $0x1
callq 0x4fd3f
addq $0x20, %rsp
cmpl $0x0, (%rbx)
jne 0x6e909
movl $0x2, %esi
movq %r14, %rdi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x703a3
cmpl $0x0, (%rbx)
jne 0x6e909
leaq 0x1(%r13), %r12
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x60edc
cmpl $0x0, (%rbx)
jne 0x6e909
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x4f530
cmpl $0x0, (%rbx)
jne 0x6e909
movl $0x2, %r9d
movq %r14, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
pushq %rbx
pushq $0x1
callq 0x50130
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6e909
movl $0x2, %ecx
movq %r14, %rdi
movl $0x13, %esi
movl $0xe, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rbx
pushq $0x0
callq 0x50516
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6e909
movl $0xb, %ecx
movq %r14, %rdi
movl $0x13, %esi
movl $0xe, %edx
xorl %r8d, %r8d
movl $0x4, %r9d
pushq %rbx
pushq $0x0
callq 0x50516
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6e909
subq $0x8, %rsp
movq %r14, %rdi
movl $0x4, %esi
movl $0x2, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rbx
pushq $0x8
pushq $0x0
callq 0x4fd3f
addq $0x20, %rsp
cmpl $0x0, (%rbx)
jne 0x6e909
subq $0x8, %rsp
movl $0xf, %r8d
movl $0xe, %r9d
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
pushq %rbx
callq 0x504b3
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6e909
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x4f530
cmpl $0x0, (%rbx)
jne 0x6e909
movl $0x2, %ecx
movq %r14, %rdi
movq %r15, %rsi
movl $0xe, %edx
movl $0xb, %r8d
movq %rbx, %r9
callq 0x52497
cmpl $0x0, (%rbx)
je 0x6e94c
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x5f6e1
leaq 0xa943(%rip), %rdx      # 0x79274
movq %rbx, %rdi
movl $0xf, %esi
movl $0x1b6, %ecx            # imm = 0x1B6
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x145a4
movq %r14, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rbx
pushq $0x0
callq 0x50130
addq $0x10, %rsp
jmp 0x6e6bc