// File: /workspace/github_c_makefile_star2_O3/georgeweigt[P]eigenmath/eigenmath.c
// Function: normalize_clock_double
void
normalize_clock_double(struct atom *EXPO)
{
	double expo, n, r;

	expo = EXPO->u.d;

	// expo = expo mod 2

	expo = fmod(expo, 2.0);

	// convert negative rotation to positive

	if (expo < 0.0)
		expo += 2.0;

	n = floor(2.0 * expo); // number of 90 degree turns

	r = expo - n / 2.0; // remainder

	switch ((int) n) {

	case 0:
		if (r == 0.0)
			push_integer(1);
		else {
			push_symbol(POWER);
			push_integer(-1);
			push_double(r);
			list(3);
		}
		break;

	case 1:
		if (r == 0.0)
			push(imaginaryunit);
		else {
			push_symbol(MULTIPLY);
			push_integer(-1);
			push_symbol(POWER);
			push_integer(-1);
			push_double(r - 0.5);
			list(3);
			list(3);
		}
		break;

	case 2:
		if (r == 0.0)
			push_integer(-1);
		else {
			push_symbol(MULTIPLY);
			push_integer(-1);
			push_symbol(POWER);
			push_integer(-1);
			push_double(r);
			list(3);
			list(3);
		}
		break;

	case 3:
		if (r == 0.0) {
			push_symbol(MULTIPLY);
			push_integer(-1);
			push(imaginaryunit);
			list(3);
		} else {
			push_symbol(POWER);
			push_integer(-1);
			push_double(r - 0.5);
			list(3);
		}
		break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movsd (%rdi), %xmm0
movsd 0xd177(%rip), %xmm1     # 0x2a158
callq 0x7160
movsd 0xd16a(%rip), %xmm3     # 0x2a158
addsd %xmm0, %xmm3
xorpd %xmm1, %xmm1
movapd %xmm0, %xmm2
cmpltsd %xmm1, %xmm2
andpd %xmm2, %xmm3
andnpd %xmm0, %xmm2
orpd %xmm3, %xmm2
movapd %xmm2, -0x10(%rbp)
movapd %xmm2, %xmm0
addsd %xmm2, %xmm0
callq 0x7300
cvttsd2si %xmm0, %eax
cmpl $0x3, %eax
ja 0x1d0da
mulsd 0xd15e(%rip), %xmm0     # 0x2a190
movapd -0x10(%rbp), %xmm1
addsd %xmm0, %xmm1
leaq 0xd022(%rip), %rcx      # 0x2a064
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x1d14b
jp 0x1d14b
movq 0xeea72(%rip), %rdi     # 0x10bad8
jmp 0x1d0d0
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x1d0e0
jp 0x1d0e0
movq 0xf9375(%rip), %rdi     # 0x1163f0
jmp 0x1d0d0
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x1d11a
jp 0x1d11a
movq 0x2b210(%rip), %rdi     # 0x482a8
callq 0x8ba5
movq 0xf934c(%rip), %rdi     # 0x1163f0
callq 0x8ba5
movq 0xeea30(%rip), %rdi     # 0x10bae0
jmp 0x1d17d
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x1d184
jp 0x1d184
movq 0xeea10(%rip), %rdi     # 0x10bae0
addq $0x10, %rsp
popq %rbp
jmp 0x8ba5
addq $0x10, %rsp
popq %rbp
retq
movq 0x2b1c1(%rip), %rdi     # 0x482a8
movapd %xmm1, -0x10(%rbp)
callq 0x8ba5
movq 0xf92f8(%rip), %rdi     # 0x1163f0
callq 0x8ba5
movq 0x2b1ac(%rip), %rdi     # 0x482b0
callq 0x8ba5
movq 0xf92e0(%rip), %rdi     # 0x1163f0
callq 0x8ba5
jmp 0x1d1cb
movq 0x2b18f(%rip), %rdi     # 0x482b0
movapd %xmm1, -0x10(%rbp)
callq 0x8ba5
movq 0xf92be(%rip), %rdi     # 0x1163f0
callq 0x8ba5
movapd -0x10(%rbp), %xmm0
addsd 0xd04c(%rip), %xmm0     # 0x2a190
movapd %xmm0, -0x10(%rbp)
jmp 0x1d168
movq 0x2b15e(%rip), %rdi     # 0x482b0
movapd %xmm1, -0x10(%rbp)
callq 0x8ba5
movq 0xf928d(%rip), %rdi     # 0x1163f0
callq 0x8ba5
callq 0x74dc
movb $0x5, 0x10(%rax)
movapd -0x10(%rbp), %xmm0
movsd %xmm0, (%rax)
movq %rax, %rdi
callq 0x8ba5
jmp 0x1d1ef
movq 0x2b11d(%rip), %rdi     # 0x482a8
movapd %xmm1, -0x10(%rbp)
callq 0x8ba5
movq 0xf9254(%rip), %rdi     # 0x1163f0
callq 0x8ba5
movq 0x2b108(%rip), %rdi     # 0x482b0
callq 0x8ba5
movq 0xf923c(%rip), %rdi     # 0x1163f0
callq 0x8ba5
movapd -0x10(%rbp), %xmm0
addsd 0xcfca(%rip), %xmm0     # 0x2a190
movapd %xmm0, -0x10(%rbp)
callq 0x74dc
movb $0x5, 0x10(%rax)
movapd -0x10(%rbp), %xmm0
movsd %xmm0, (%rax)
movq %rax, %rdi
callq 0x8ba5
movl $0x3, %edi
callq 0x8b7d
movl $0x3, %edi
addq $0x10, %rsp
popq %rbp
jmp 0x8b7d