// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/float64_type.c
// Function: prv_pow
static subtilis_exp_t *prv_pow(subtilis_parser_t *p, subtilis_exp_t *a1,
			       subtilis_exp_t *a2, bool swapped,
			       subtilis_error_t *err)
{
	subtilis_exp_t *tmp;

	if (!swapped) {
		if (((a2->type.type == SUBTILIS_TYPE_CONST_INTEGER) &&
		     (a2->exp.ir_op.integer == 0)) ||
		    (((a2->type.type == SUBTILIS_TYPE_CONST_REAL) &&
		      (a2->exp.ir_op.real == 0.0)))) {
			a1->exp.ir_op.integer = 1;
			a1->type.type = SUBTILIS_TYPE_CONST_INTEGER;
			subtilis_exp_delete(a2);
			return a1;
		} else if (((a2->type.type == SUBTILIS_TYPE_CONST_INTEGER) &&
			    (a2->exp.ir_op.integer == 1)) ||
			   (((a2->type.type == SUBTILIS_TYPE_CONST_REAL) &&
			     (a2->exp.ir_op.real == 1.0)))) {
			subtilis_exp_delete(a2);
			return a1;
		}
	}

	a2 = subtilis_type_if_exp_to_var(p, a2, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	switch (a2->type.type) {
	case SUBTILIS_TYPE_BYTE:
		a2 = subtilis_type_if_to_int(p, a2, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto on_error;
	case SUBTILIS_TYPE_INTEGER:
		a2 = subtilis_type_if_to_float64(p, a2, err);
		if (err->type != SUBTILIS_ERROR_OK)
			goto on_error;
		break;
	case SUBTILIS_TYPE_REAL:
		break;
	default:
		subtilis_error_set_assertion_failed(err);
		goto on_error;
	}

	if (swapped) {
		tmp = a1;
		a1 = a2;
		a2 = tmp;
	}

	a1->exp.ir_op.reg =
	    subtilis_ir_section_add_instr(p->current, SUBTILIS_OP_INSTR_POWR,
					  a1->exp.ir_op, a2->exp.ir_op, err);
	if (err->type != SUBTILIS_ERROR_OK)
		goto on_error;

	subtilis_exp_delete(a2);

	return a1;

on_error:
	subtilis_exp_delete(a1);
	subtilis_exp_delete(a2);
	return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %r8, %r14
movl %ecx, %ebp
movq %rsi, %rbx
movq %rdi, %r12
testl %ecx, %ecx
jne 0x38f38
movl (%rdx), %eax
testl %eax, %eax
je 0x38f01
cmpl $0x1, %eax
jne 0x38f38
movl 0x148(%rdx), %eax
testl %eax, %eax
je 0x38f15
cmpl $0x1, %eax
je 0x38f22
jmp 0x38f38
movsd 0x148(%rdx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x38f2c
jp 0x38f2c
movl $0x1, %eax
movl %eax, 0x148(%rbx)
movl %eax, (%rbx)
movq %rdx, %rdi
callq 0x2b166
jmp 0x38f61
ucomisd 0x3c4fc(%rip), %xmm0    # 0x75430
jne 0x38f38
jnp 0x38f22
movq %r12, %rdi
movq %rdx, %rsi
movq %r14, %rdx
callq 0x36119
movq %rax, %r15
cmpl $0x0, (%r14)
je 0x38f6d
movq %rbx, %rdi
callq 0x2b166
movq %r15, %rdi
callq 0x2b166
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl (%r15), %eax
cmpl $0x4, %eax
je 0x38fad
cmpl $0x5, %eax
je 0x38f96
cmpl $0x6, %eax
jne 0x38ff4
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x367cf
movq %rax, %r15
cmpl $0x0, (%r14)
jne 0x38f4f
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3691a
movq %rax, %r15
cmpl $0x0, (%r14)
jne 0x38f4f
movq %r15, %rax
testb %bpl, %bpl
cmovneq %rbx, %r15
cmovneq %rax, %rbx
movq 0x48(%r12), %rdi
movq 0x148(%rbx), %rdx
movq 0x148(%r15), %rcx
movl $0x6a, %esi
movq %r14, %r8
callq 0x2bc8f
movq %rax, 0x148(%rbx)
cmpl $0x0, (%r14)
jne 0x38f4f
movq %r15, %rdi
jmp 0x38f25
leaq 0x3c443(%rip), %rdx     # 0x7543e
movq %r14, %rdi
movl $0xf, %esi
movl $0x4f0, %ecx            # imm = 0x4F0
callq 0x145a4
jmp 0x38f4f