// File: /workspace/github_c_makefile_star2_O3/markdryan[P]subtilis/frontend/int32_type.c
// Function: prv_pow_const
static subtilis_exp_t *prv_pow_const(subtilis_parser_t *p, subtilis_exp_t *a1,
				     subtilis_exp_t *a2, bool swapped,
				     subtilis_error_t *err)
{
	int32_t accum;
	int32_t i = 0;
	/* a2 must be const */

	switch (a2->type.type) {
	case SUBTILIS_TYPE_CONST_INTEGER:
		if (a2->exp.ir_op.integer == 0) {
			a1->exp.ir_op.integer = 1;
		} else if (a2->exp.ir_op.integer < 0) {
			a1->exp.ir_op.real =
			    pow(a1->exp.ir_op.integer, a2->exp.ir_op.integer);
			a1->type.type = SUBTILIS_TYPE_CONST_REAL;
		} else {
			accum = a1->exp.ir_op.integer;
			for (i = 1; i < a2->exp.ir_op.integer; i++)
				accum *= a1->exp.ir_op.integer;
			a1->exp.ir_op.integer = accum;
		}
		break;
	case SUBTILIS_TYPE_CONST_REAL:
		if (a2->exp.ir_op.real == 0) {
			a1->exp.ir_op.real = 1;
		} else if (a2->exp.ir_op.real != 1) {
			a1->exp.ir_op.real =
			    pow(a1->exp.ir_op.integer, a2->exp.ir_op.real);
			a1->type.type = SUBTILIS_TYPE_CONST_REAL;
		}
		break;
	default:
		subtilis_exp_delete(a1);
		subtilis_exp_delete(a2);
		subtilis_error_set_bad_expression(err, p->l->stream->name,
						  p->l->line);
		return NULL;
	}

	subtilis_exp_delete(a2);
	return a1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movl (%rdx), %eax
testl %eax, %eax
je 0x3a498
cmpl $0x1, %eax
jne 0x3a4c0
movl 0x148(%r14), %edx
testl %edx, %edx
je 0x3a4ff
movl 0x148(%rbx), %ecx
js 0x3a524
cmpl $0x1, %edx
je 0x3a48d
leal 0x2(%rdx), %eax
andl $-0x4, %eax
addl $-0x2, %edx
movd %ecx, %xmm1
movaps 0x3b0f2(%rip), %xmm0    # 0x754e0
movss %xmm1, %xmm0            # xmm0 = xmm1[0],xmm0[1,2,3]
movd %edx, %xmm1
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
movd %ecx, %xmm2
pshufd $0x0, %xmm2, %xmm3      # xmm3 = xmm2[0,0,0,0]
movl $0x4, %ecx
pshufd $0xf5, %xmm3, %xmm4     # xmm4 = xmm3[1,1,3,3]
movaps %xmm0, %xmm2
pmuludq %xmm3, %xmm0
pshufd $0xe8, %xmm0, %xmm0     # xmm0 = xmm0[0,2,2,3]
pshufd $0xf5, %xmm2, %xmm5     # xmm5 = xmm2[1,1,3,3]
pmuludq %xmm4, %xmm5
pshufd $0xe8, %xmm5, %xmm5     # xmm5 = xmm5[0,2,2,3]
punpckldq %xmm5, %xmm0    # xmm0 = xmm0[0],xmm5[0],xmm0[1],xmm5[1]
movl %ecx, %edx
addl $-0x4, %ecx
addl %eax, %edx
addl $-0x4, %edx
cmpl $0x4, %edx
jne 0x3a40e
negl %ecx
movd %ecx, %xmm3
pshufd $0x0, %xmm3, %xmm3      # xmm3 = xmm3[0,0,0,0]
por 0x3b0a2(%rip), %xmm3    # 0x754f0
movdqa 0x391da(%rip), %xmm4    # 0x73630
pxor %xmm4, %xmm1
pxor %xmm4, %xmm3
pcmpgtd %xmm1, %xmm3
pand %xmm3, %xmm2
pandn %xmm0, %xmm3
por %xmm2, %xmm3
pshufd $0xee, %xmm3, %xmm0     # xmm0 = xmm3[2,3,2,3]
pshufd $0xff, %xmm3, %xmm1     # xmm1 = xmm3[3,3,3,3]
pshufd $0xf5, %xmm3, %xmm2     # xmm2 = xmm3[1,1,3,3]
pmuludq %xmm1, %xmm2
pmuludq %xmm3, %xmm0
pmuludq %xmm2, %xmm0
movd %xmm0, %ecx
movl %ecx, 0x148(%rbx)
jmp 0x3a53f
movsd 0x148(%r14), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x3a50b
jp 0x3a50b
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x148(%rbx)
jmp 0x3a53f
movq %r8, %r15
movq %rdi, %r12
movq %rbx, %rdi
callq 0x2b166
movq %r14, %rdi
callq 0x2b166
movq (%r12), %rax
movq 0x30(%rax), %rdx
movl 0x38(%rax), %ecx
leaq 0x3b01b(%rip), %r8      # 0x75503
movq %r15, %rdi
movl $0x19, %esi
movl $0x2ef, %r9d            # imm = 0x2EF
callq 0x145c8
xorl %ebx, %ebx
jmp 0x3a547
movl $0x1, 0x148(%rbx)
jmp 0x3a53f
ucomisd 0x3af1d(%rip), %xmm1    # 0x75430
jne 0x3a517
jnp 0x3a53f
xorps %xmm0, %xmm0
cvtsi2sdl 0x148(%rbx), %xmm0
jmp 0x3a52c
cvtsi2sd %ecx, %xmm0
cvtsi2sd %edx, %xmm1
callq 0x120d0
movsd %xmm0, 0x148(%rbx)
movl $0x0, (%rbx)
movq %r14, %rdi
callq 0x2b166
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq