// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/rec_type.c
// Function: subtilis_rec_type_swap
void subtilis_rec_type_swap(subtilis_parser_t *p, const subtilis_type_t *type,
			    size_t reg1, size_t reg2, subtilis_error_t *err)
{
	subtilis_ir_operand_t ptr1;
	subtilis_ir_operand_t ptr2;
	size_t offset;
	size_t i;
	size_t size = subtilis_type_rec_size(type);

	offset = size - (size & 3);
	if (size >= 4) {
		ptr1.reg = reg1;
		ptr2.reg = reg2;
		reg1 = subtilis_ir_section_add_instr2(
		    p->current, SUBTILIS_OP_INSTR_MOV, ptr1, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
		reg2 = subtilis_ir_section_add_instr2(
		    p->current, SUBTILIS_OP_INSTR_MOV, ptr2, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;

		prv_rec_swap_32(p, offset, reg1, reg2, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
	}

	i = 0;
	for (; offset < size; offset++, i++) {
		subtilis_exp_swap_int8_mem(p, reg1, reg2, i, err);
		if (err->type != SUBTILIS_ERROR_OK)
			return;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %rbx
movq %rcx, (%rsp)
movq %rdx, %r12
movq %rdi, %r14
movq %rsi, %rdi
callq 0x2fee3
movq %rax, %r15
cmpq $0x4, %rax
jb 0x466c8
movq 0x48(%r14), %rdi
movl $0x1d, %esi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x2be09
cmpl $0x0, (%rbx)
jne 0x46702
movq %rax, %r12
movq 0x48(%r14), %rdi
movl $0x1d, %esi
movq (%rsp), %rdx
movq %rbx, %rcx
callq 0x2be09
movq %rax, (%rsp)
cmpl $0x0, (%rbx)
jne 0x46702
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, %r13
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, 0x10(%rsp)
movq 0x48(%r14), %rdi
callq 0x2cc99
movq %rax, 0x8(%rsp)
movq 0x48(%r14), %rdi
movl %r15d, %ecx
andl $-0x4, %ecx
movl $0x9, %esi
movq %r12, %rdx
movq %rbx, %r8
callq 0x2bc8f
cmpl $0x0, (%rbx)
jne 0x46702
movq %rax, %rbp
movq 0x48(%r14), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x46702
movq 0x48(%r14), %rdi
movl $0x3b, %esi
movq %r12, %rdx
movq %rbp, %rcx
movq %rbx, %r8
callq 0x2bc8f
cmpl $0x0, (%rbx)
jne 0x46702
movq 0x48(%r14), %rdi
movl $0x43, %esi
movq %rax, %rdx
movq 0x10(%rsp), %rcx
movq 0x8(%rsp), %r8
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x46702
movq 0x48(%r14), %rdi
movq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x46702
movq %r14, %rdi
movq %r12, %rsi
movq (%rsp), %rdx
xorl %ecx, %ecx
movq %rbx, %r8
callq 0x1f8f1
cmpl $0x0, (%rbx)
jne 0x46702
movq 0x48(%r14), %rdi
movl $0x4, %r8d
movl $0x9, %esi
movq %r12, %rdx
movq %r12, %rcx
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x46702
movq 0x48(%r14), %rdi
movl $0x4, %r8d
movl $0x9, %esi
movq (%rsp), %rcx
movq %rcx, %rdx
movq %rbx, %r9
callq 0x2bd42
cmpl $0x0, (%rbx)
jne 0x46702
movq 0x48(%r14), %rdi
movl $0x45, %esi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x2be1f
cmpl $0x0, (%rbx)
jne 0x46702
movq 0x48(%r14), %rdi
movq 0x8(%rsp), %rsi
movq %rbx, %rdx
callq 0x2cca6
cmpl $0x0, (%rbx)
jne 0x46702
movq %r15, %r13
andq $-0x4, %r13
cmpq %r15, %r13
je 0x46702
xorl %ebp, %ebp
movq %r14, %rdi
movq %r12, %rsi
movq (%rsp), %rdx
movl %ebp, %ecx
movq %rbx, %r8
callq 0x1f99c
cmpl $0x0, (%rbx)
jne 0x46702
leaq 0x1(,%rbp), %rax
addq %r13, %rax
incq %rbp
cmpq %r15, %rax
jb 0x466d6
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)