// File: /workspace/github_cpp_makefile_star2_O2/ocornoc[P]crolol/src/losslessops.cpp
// Function: crolol::backend::pow(long, long)
saferet backend::pow(int64_t n, int64_t m)
{
	if (n < 0 && m % scale != 0) return make_badarg(m);
	else if (n == 0 && m == 0) return clamp(scale);
	else if (n == 0 && m < 0) return make_badarg(m);
	else if (n == scale || m == 0) return clamp(scale);
	else if (m == scale) return clamp(n);
	
	const float128 nf = static_cast<float128>(n) / scale;
	const float128 mf = static_cast<float128>(m) / scale;
	const float128 size = mp::log2(mp::abs(nf)) * mf;
	
	if (size > slmaxlog2) return clamp(slmax);
	else if (mp::abs(size) > slminlog2) return clamp(slmin);
	else return clamp(static_cast<int128>(
		mp::llrint(mp::trunc(mp::pow(nf, mf) * scale))
	));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rdi, 0x8(%rsp)
movq %rsi, (%rsp)
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rsi, %rax
cqto
idivq %rcx
testq %rdi, %rdi
jns 0x70eb
testq %rdx, %rdx
jne 0x7103
movq %rsi, %rax
orq %rdi, %rax
je 0x711c
testq %rdi, %rdi
setne %al
testq %rsi, %rsi
setns %cl
orb %al, %cl
jne 0x7108
pushq $0x3
popq %rdx
jmp 0x7139
testq %rsi, %rsi
setne %al
cmpq $0x3e8, %rdi            # imm = 0x3E8
setne %cl
testb %al, %cl
jne 0x714b
leaq 0x30(%rsp), %rdi
andq $0x0, 0x8(%rdi)
movq $0x3e8, (%rdi)          # imm = 0x3E8
movb $0x0, 0x10(%rdi)
callq 0x6fd9
movq %rax, %rsi
movq %rsi, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
cmpq $0x3e8, %rsi            # imm = 0x3E8
jne 0x7178
movq %rdi, %rcx
negq %rcx
cmovsq %rdi, %rcx
leaq 0x30(%rsp), %rax
andq $0x0, 0x8(%rax)
movq %rcx, (%rax)
shrq $0x3f, %rdi
movb %dil, 0x10(%rax)
movq %rax, %rdi
jmp 0x7131
leaq 0x70(%rsp), %rbx
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x7688
leaq 0xe08d(%rip), %r14      # 0x15220
leaq 0x30(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x7669
leaq 0x50(%rsp), %rbx
movq %rsp, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x7688
leaq 0x70(%rsp), %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x7669
movaps (%r15), %xmm0
leaq 0x90(%rsp), %rsi
movaps %xmm0, (%rsi)
movzwl 0x10(%r15), %eax
movw %ax, 0x10(%rsi)
movb $0x0, 0x12(%rsi)
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x764b
leaq 0x50(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x76e5
leaq 0x1d1d2(%rip), %rsi     # 0x243e0
movq %r14, %rdi
callq 0x7703
testb %al, %al
je 0x7236
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
jmp 0x712d
movaps 0x50(%rsp), %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movzwl 0x60(%rsp), %eax
movw %ax, 0x10(%rdi)
movb $0x0, 0x12(%rdi)
leaq 0x1d1a9(%rip), %rsi     # 0x24400
callq 0x7703
testb %al, %al
je 0x7280
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x1, 0x10(%rdi)
jmp 0x7131
leaq 0xb0(%rsp), %rbx
leaq 0x30(%rsp), %rsi
leaq 0x70(%rsp), %rdx
movq %rbx, %rdi
callq 0x776e
leaq 0xdf7f(%rip), %rdx      # 0x15220
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7750
leaq 0x90(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x7732
movq %rbx, %rdi
callq 0x103f2
movq %rax, %rcx
negq %rcx
cmovsq %rax, %rcx
leaq 0x10(%rsp), %rdi
andq $0x0, 0x8(%rdi)
movq %rcx, (%rdi)
shrq $0x3f, %rax
movb %al, 0x10(%rdi)
jmp 0x7131