// File: /workspace/github_c_makefile_star2_O1/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 0x6ed32
movq %rsi, %r14
movq %rdi, %r15
leaq 0xa8d9(%rip), %rcx      # 0x791f0
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 0x5a618
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x6061d
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x5fa01
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x5ff7d
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 0x4fe13
addq $0x20, %rsp
cmpl $0x0, (%rbx)
jne 0x6ed11
movl $0x3, %ecx
movl $0x2, %r8d
movq %r14, %rdi
movl $0x12, %esi
movl $0xe, %edx
xorl %r9d, %r9d
pushq %rbx
pushq $0x0
callq 0x5067b
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6ed11
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 0x4fe13
addq $0x20, %rsp
cmpl $0x0, (%rbx)
jne 0x6ed11
movl $0x3, %ecx
movl $0x2, %r8d
movq %r14, %rdi
movl $0x13, %esi
movl $0xe, %edx
xorl %r9d, %r9d
pushq %rbx
pushq $0x0
callq 0x5067b
addq $0x10, %rsp
movq %r14, %rdi
movl $0x16, %esi
movq %rbx, %rdx
callq 0x4f73a
cmpl $0x0, (%rbx)
jne 0x6ed11
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 0x70795
cmpl $0x0, (%rbx)
jne 0x6ed11
movl $0x1, %esi
movl $0x2, %edx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x6288a
cmpl $0x0, (%rbx)
jne 0x6ed11
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x4f587
cmpl $0x0, (%rbx)
jne 0x6ed11
subq $0x8, %rsp
movl $0xf, %r8d
movl $0xe, %r9d
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
pushq %rbx
callq 0x5060d
addq $0x10, %rsp
jmp 0x6ed11
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x5f05c
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x5f360
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 0x4fe13
addq $0x20, %rsp
cmpl $0x0, (%rbx)
jne 0x6ed11
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 0x4fe13
addq $0x20, %rsp
cmpl $0x0, (%rbx)
jne 0x6ed11
movl $0x2, %esi
movq %r14, %rdi
xorl %edx, %edx
movq %rbx, %rcx
callq 0x70795
cmpl $0x0, (%rbx)
jne 0x6ed11
leaq 0x1(%r13), %r12
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x60ec4
cmpl $0x0, (%rbx)
jne 0x6ed11
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x4f587
cmpl $0x0, (%rbx)
jne 0x6ed11
movl $0x2, %r9d
movq %r14, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
pushq %rbx
pushq $0x1
callq 0x50249
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6ed11
movl $0x2, %ecx
movq %r14, %rdi
movl $0x13, %esi
movl $0xe, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rbx
pushq $0x0
callq 0x5067b
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6ed11
movl $0xb, %ecx
movq %r14, %rdi
movl $0x13, %esi
movl $0xe, %edx
xorl %r8d, %r8d
movl $0x4, %r9d
pushq %rbx
pushq $0x0
callq 0x5067b
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6ed11
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 0x4fe13
addq $0x20, %rsp
cmpl $0x0, (%rbx)
jne 0x6ed11
subq $0x8, %rsp
movl $0xf, %r8d
movl $0xe, %r9d
movq %r14, %rdi
movl $0xd, %esi
movl $0xe, %edx
xorl %ecx, %ecx
pushq %rbx
callq 0x5060d
addq $0x10, %rsp
cmpl $0x0, (%rbx)
jne 0x6ed11
movq %r14, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x4f587
cmpl $0x0, (%rbx)
jne 0x6ed11
movl $0x2, %ecx
movq %r14, %rdi
movq %r15, %rsi
movl $0xe, %edx
movl $0xb, %r8d
movq %rbx, %r9
callq 0x5261d
cmpl $0x0, (%rbx)
je 0x6ed54
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 0x5f6c9
leaq 0xa4db(%rip), %rdx      # 0x79214
movq %rbx, %rdi
movl $0xf, %esi
movl $0x1b6, %ecx            # imm = 0x1B6
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x145f4
movq %r14, %rdi
movl $0xd, %esi
movl $0xf, %edx
movl $0xe, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq %rbx
pushq $0x0
callq 0x50249
addq $0x10, %rsp
jmp 0x6eac4