// File: /workspace/github_c_makefile_star2_O1/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, %r15
testl %ecx, %ecx
jne 0x39059
movl (%rdx), %eax
cmpl $0x1, %eax
jne 0x39037
cmpl $0x0, 0x148(%rdx)
je 0x3912c
testl %eax, %eax
je 0x39110
cmpl $0x1, %eax
jne 0x39051
cmpl $0x1, 0x148(%rdx)
je 0x39157
testl %eax, %eax
je 0x3913b
movq %r15, %rdi
movq %rdx, %rsi
movq %r14, %rdx
callq 0x36269
movq %rax, %r12
cmpl $0x0, (%r14)
je 0x39087
movq %rbx, %rdi
callq 0x2b4c3
movq %r12, %rdi
callq 0x2b4c3
xorl %ebx, %ebx
jmp 0x3915f
movl (%r12), %eax
cmpl $0x4, %eax
je 0x390cc
cmpl $0x5, %eax
je 0x390b5
cmpl $0x6, %eax
jne 0x3916b
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x3691f
movq %rax, %r12
cmpl $0x0, (%r14)
jne 0x39070
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x36a77
movq %rax, %r12
cmpl $0x0, (%r14)
jne 0x39070
movq %r12, %rax
testb %bpl, %bpl
cmovneq %rbx, %r12
cmovneq %rax, %rbx
movq 0x48(%r15), %rdi
movq 0x148(%rbx), %rdx
movq 0x148(%r12), %rcx
movl $0x6a, %esi
movq %r14, %r8
callq 0x2c00f
movq %rax, 0x148(%rbx)
cmpl $0x0, (%r14)
jne 0x39070
movq %r12, %rdi
jmp 0x3915a
movsd 0x148(%rdx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x3903f
jp 0x3903f
movl $0x1, %eax
movl %eax, 0x148(%rbx)
movl %eax, (%rbx)
jmp 0x39157
movsd 0x148(%rdx), %xmm0
ucomisd 0x3c2c5(%rip), %xmm0    # 0x75410
jne 0x39059
jp 0x39059
movq %rdx, %rdi
callq 0x2b4c3
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3c2ac(%rip), %rdx     # 0x7541e
movq %r14, %rdi
movl $0xf, %esi
movl $0x4f0, %ecx            # imm = 0x4F0
callq 0x145f4
jmp 0x39070