// File: /workspace/github_c_makefile_star2_O2/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 0x36f55
movl (%rdx), %eax
testl %eax, %eax
je 0x36f20
cmpl $0x1, %eax
jne 0x36f55
movl 0x148(%rdx), %eax
testl %eax, %eax
je 0x36f34
cmpl $0x1, %eax
je 0x36f3f
jmp 0x36f55
movsd 0x148(%rdx), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x36f49
jp 0x36f49
pushq $0x1
popq %rax
movl %eax, 0x148(%rbx)
movl %eax, (%rbx)
movq %rdx, %rdi
callq 0x29d88
jmp 0x36f7e
ucomisd 0x3848f(%rip), %xmm0    # 0x6f3e0
jne 0x36f55
jnp 0x36f3f
movq %r12, %rdi
movq %rdx, %rsi
movq %r14, %rdx
callq 0x3415f
movq %rax, %r15
cmpl $0x0, (%r14)
je 0x36f8a
movq %rbx, %rdi
callq 0x29d88
movq %r15, %rdi
callq 0x29d88
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl (%r15), %eax
cmpl $0x4, %eax
je 0x36fca
cmpl $0x5, %eax
je 0x36fb3
cmpl $0x6, %eax
jne 0x3700f
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x347d5
movq %rax, %r15
cmpl $0x0, (%r14)
jne 0x36f6c
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x34916
movq %rax, %r15
cmpl $0x0, (%r14)
jne 0x36f6c
movq %r15, %rax
testb %bpl, %bpl
cmovneq %rbx, %r15
cmovneq %rax, %rbx
movq 0x48(%r12), %rdi
movq 0x148(%rbx), %rdx
movq 0x148(%r15), %rcx
pushq $0x6a
popq %rsi
movq %r14, %r8
callq 0x2a819
movq %rax, 0x148(%rbx)
cmpl $0x0, (%r14)
jne 0x36f6c
movq %r15, %rdi
jmp 0x36f42
leaq 0x383d8(%rip), %rdx     # 0x6f3ee
pushq $0xf
popq %rsi
movq %r14, %rdi
movl $0x4f0, %ecx            # imm = 0x4F0
callq 0x1429e
jmp 0x36f6c