// File: /workspace/github_cpp_makefile_star2_O1/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 $0xf8, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movabsq $0x20c49ba5e353f7cf, %rcx # imm = 0x20C49BA5E353F7CF
movq %rsi, %rax
imulq %rcx
testq %rdi, %rdi
jns 0x8159
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 0x8176
movl $0x3e8, %eax            # imm = 0x3E8
movq %rsi, %rcx
orq %rdi, %rcx
je 0x81d8
testq %rdi, %rdi
setne %cl
testq %rsi, %rsi
setns %dl
orb %cl, %dl
jne 0x8180
movl $0x3, %edx
movq %rsi, %rax
jmp 0x81da
testq %rsi, %rsi
sete %cl
cmpq $0x3e8, %rdi            # imm = 0x3E8
sete %dl
orb %cl, %dl
jne 0x81d8
cmpq $0x3e8, %rsi            # imm = 0x3E8
jne 0x81ec
movq %rdi, %rcx
negq %rcx
cmovsq %rdi, %rcx
testq %rdi, %rdi
cmovnsq %rdi, %rcx
shrq $0x3f, %rdi
movabsq $0x7fffffffffffffff, %rdx # imm = 0x7FFFFFFFFFFFFFFF
leaq 0x1(%rdx), %rsi
movq %rcx, %rax
negq %rax
testq %rdi, %rdi
cmoveq %rdx, %rsi
cmoveq %rcx, %rax
testq %rcx, %rcx
cmovsq %rsi, %rax
xorl %edx, %edx
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %r15
movaps %xmm0, (%r15)
movw $0x4000, %bp            # imm = 0x4000
movw %bp, 0x10(%r15)
xorl %r13d, %r13d
movb %r13b, 0x12(%r15)
leaq 0x28(%rsp), %rsi
movq %r15, %rdi
callq 0x13db4
leaq 0x90(%rsp), %r14
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movw %bp, 0x10(%r14)
movb %r13b, 0x12(%r14)
movl $0x3e8, %eax            # imm = 0x3E8
leaq 0x30(%rsp), %rbx
movq %rax, (%rbx)
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1379f
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
movw %bp, 0x10(%rbx)
movb %r13b, 0x12(%rbx)
leaq 0x30(%rsp), %rbx
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x13db4
xorps %xmm0, %xmm0
movaps %xmm0, (%r15)
movw %bp, 0x10(%r15)
movb %r13b, 0x12(%r15)
movq %rsp, %r12
movl $0x3e8, %eax            # imm = 0x3E8
movq %rax, (%r12)
leaq 0x50(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x1379f
leaq 0x70(%rsp), %rsi
movb %r13b, 0x12(%rsi)
movaps (%r14), %xmm0
movaps %xmm0, (%rsi)
movzwl 0x10(%r14), %eax
movw %ax, 0x10(%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, (%r12)
movw %bp, 0x10(%r12)
movb %r13b, 0x12(%r12)
movq %rsp, %r14
movq %r14, %rdi
callq 0x8ad9
callq 0x8f44
movq %r14, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0xcc43
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
movw %bp, 0x10(%rbx)
movb %r13b, 0x12(%rbx)
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x91a8
cmpw $0x4002, 0x10(%rbx)     # imm = 0x4002
je 0x834e
movzwl 0x1f0af(%rip), %eax     # 0x273c0
cmpl $0x4002, %eax           # imm = 0x4002
je 0x834e
leaq 0x1f091(%rip), %rsi     # 0x273b0
leaq 0x30(%rsp), %rdi
callq 0x9a0c
testl %eax, %eax
jle 0x834e
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
movq %rsp, %rdi
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
jmp 0x843b
movb $0x0, 0x12(%rsp)
movaps 0x30(%rsp), %xmm0
movaps %xmm0, (%rsp)
movzwl 0x40(%rsp), %eax
movw %ax, 0x10(%rsp)
cmpl $0x4002, %eax           # imm = 0x4002
je 0x83af
movzwl 0x1f06c(%rip), %eax     # 0x273e0
cmpl $0x4002, %eax           # imm = 0x4002
je 0x83af
leaq 0x1f04e(%rip), %rsi     # 0x273d0
movq %rsp, %rdi
callq 0x9a0c
testl %eax, %eax
jle 0x83af
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rsp, %rdi
movq %rax, (%rdi)
movq $0x0, 0x8(%rdi)
movb $0x1, 0x10(%rdi)
jmp 0x843b
xorps %xmm0, %xmm0
leaq 0xb0(%rsp), %rbx
movaps %xmm0, (%rbx)
movw $0x4000, 0x10(%rbx)     # imm = 0x4000
movb $0x0, 0x12(%rbx)
leaq 0x90(%rsp), %rsi
leaq 0x50(%rsp), %rdx
movq %rbx, %rdi
callq 0x16f39
leaq 0x11e3d(%rip), %rdx     # 0x1a220
leaq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8a13
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x897d
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14033
movq %rax, %rcx
negq %rcx
cmovsq %rax, %rcx
testq %rax, %rax
cmovnsq %rax, %rcx
movq %rcx, (%r14)
movq $0x0, 0x8(%r14)
shrq $0x3f, %rax
movb %al, 0x10(%r14)
movq %rsp, %rdi
callq 0x7f24
jmp 0x81da