// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
movq %rsi, %rax
imulq %rcx
testq %rdi, %rdi
jns 0x8036
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
imulq $0x3e8, %rdx, %rax      # imm = 0x3E8
movq %rsi, %rcx
subq %rax, %rcx
jne 0x8057
movl $0x3e8, %eax            # imm = 0x3E8
movq %rsi, %rcx
orq %rdi, %rcx
je 0x8305
testq %rdi, %rdi
setne %cl
testq %rsi, %rsi
setns %dl
orb %cl, %dl
jne 0x8064
movl $0x3, %edx
movq %rsi, %rax
jmp 0x8307
testq %rsi, %rsi
sete %cl
cmpq $0x3e8, %rdi            # imm = 0x3E8
sete %dl
orb %cl, %dl
jne 0x8305
cmpq $0x3e8, %rsi            # imm = 0x3E8
jne 0x80ba
movq %rdi, %rcx
negq %rcx
cmovsq %rdi, %rcx
movq %rcx, %rax
negq %rax
movabsq $0x7fffffffffffffff, %rdx # imm = 0x7FFFFFFFFFFFFFFF
leaq 0x1(%rdx), %rsi
testq %rdi, %rdi
cmovnsq %rdx, %rsi
cmovnsq %rcx, %rax
testq %rcx, %rcx
cmovsq %rsi, %rax
jmp 0x8305
xorps %xmm0, %xmm0
leaq 0x60(%rsp), %r14
movaps %xmm0, (%r14)
movw $0x4000, %bp            # imm = 0x4000
movw %bp, 0x10(%r14)
xorl %r13d, %r13d
movb %r13b, 0x12(%r14)
leaq 0x18(%rsp), %rsi
movq %r14, %rdi
callq 0x13c7a
leaq 0xa0(%rsp), %r15
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
movw %bp, 0x10(%r15)
movb %r13b, 0x12(%r15)
movl $0x3e8, %eax            # imm = 0x3E8
leaq 0x40(%rsp), %rbx
movq %rax, (%rbx)
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x1365f
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
movw %bp, 0x10(%rbx)
movb %r13b, 0x12(%rbx)
leaq 0x40(%rsp), %rbx
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x13c7a
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movw %bp, 0x10(%r14)
movb %r13b, 0x12(%r14)
leaq 0x20(%rsp), %r12
movl $0x3e8, %eax            # imm = 0x3E8
movq %rax, (%r12)
leaq 0x60(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x1365f
movaps (%r15), %xmm0
leaq 0x80(%rsp), %rsi
movaps %xmm0, (%rsi)
movzwl 0x10(%r15), %eax
movw %ax, 0x10(%rsi)
movb %r13b, 0x12(%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, (%r12)
movw %bp, 0x10(%r12)
movb %r13b, 0x12(%r12)
leaq 0x20(%rsp), %r15
movq %r15, %rdi
callq 0x895d
callq 0x8d83
movq %r15, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0xc9ff
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
movw %bp, 0x10(%rbx)
movb %r13b, 0x12(%rbx)
leaq 0x40(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x8fd2
movzwl 0x10(%rbx), %eax
cmpl $0x4002, %eax           # imm = 0x4002
je 0x821c
movzwl 0x1e1d7(%rip), %ecx     # 0x263c0
cmpl $0x4002, %ecx           # imm = 0x4002
je 0x821c
leaq 0x1e1b8(%rip), %rsi     # 0x263b0
leaq 0x40(%rsp), %rdi
callq 0x9850
testl %eax, %eax
jle 0x8217
xorl %edx, %edx
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
jmp 0x8307
movzwl 0x50(%rsp), %eax
movaps 0x40(%rsp), %xmm0
movaps %xmm0, 0x20(%rsp)
movw %ax, 0x30(%rsp)
movb $0x0, 0x32(%rsp)
movzwl %ax, %eax
cmpl $0x4002, %eax           # imm = 0x4002
je 0x826e
movzwl 0x1e19f(%rip), %eax     # 0x263e0
cmpl $0x4002, %eax           # imm = 0x4002
je 0x826e
leaq 0x1e181(%rip), %rsi     # 0x263d0
leaq 0x20(%rsp), %rdi
callq 0x9850
testl %eax, %eax
jle 0x826e
xorl %edx, %edx
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
jmp 0x8307
xorps %xmm0, %xmm0
leaq 0xc0(%rsp), %rbx
movaps %xmm0, (%rbx)
movw $0x4000, 0x10(%rbx)     # imm = 0x4000
movb $0x0, 0x12(%rbx)
leaq 0xa0(%rsp), %rsi
leaq 0x60(%rsp), %rdx
movq %rbx, %rdi
callq 0x16d71
leaq 0x10f7e(%rip), %rdx     # 0x19220
leaq 0x80(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8898
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x881f
leaq 0xf(%rsp), %rsi
movq %rbx, %rdi
callq 0x13edf
movq %rax, %rcx
movq %rax, %rdx
negq %rdx
cmovsq %rax, %rdx
movq %rdx, %rax
negq %rax
movabsq $0x7fffffffffffffff, %rsi # imm = 0x7FFFFFFFFFFFFFFF
leaq 0x1(%rsi), %rdi
testq %rcx, %rcx
cmovnsq %rsi, %rdi
cmovnsq %rdx, %rax
testq %rdx, %rdx
cmovsq %rdi, %rax
xorl %edx, %edx
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq