// File: /workspace/github_c_makefile_star2_O0/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 $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movsd (%rax), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
movsd 0x1a0da(%rip), %xmm1    # 0x45100
callq 0x7160
movsd %xmm0, -0x10(%rbp)
xorps %xmm0, %xmm0
ucomisd -0x10(%rbp), %xmm0
jbe 0x2b04c
movsd 0x1a0be(%rip), %xmm0    # 0x45100
addsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x10(%rbp), %xmm0
addsd %xmm0, %xmm0
callq 0x72f0
movsd %xmm0, -0x18(%rbp)
movsd -0x10(%rbp), %xmm0
movsd -0x18(%rbp), %xmm1
movsd 0x1a047(%rip), %xmm2    # 0x450b8
mulsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x20(%rbp)
cvttsd2si -0x18(%rbp), %eax
movl %eax, %ecx
movq %rcx, -0x28(%rbp)
subl $0x3, %eax
ja 0x2b248
movq -0x28(%rbp), %rax
leaq 0x19f8f(%rip), %rcx     # 0x4502c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movsd -0x20(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2b0c2
jp 0x2b0c2
movl $0x1, %edi
callq 0xca50
jmp 0x2b0ec
movq 0x361e7(%rip), %rdi     # 0x612b0
callq 0x9110
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xca50
movsd -0x20(%rbp), %xmm0
callq 0xe5e0
movl $0x3, %edi
callq 0x90d0
jmp 0x2b248
movsd -0x20(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2b10f
jp 0x2b10f
movq 0xf99d8(%rip), %rdi     # 0x124ae0
callq 0x9110
jmp 0x2b165
movq 0x36192(%rip), %rdi     # 0x612a8
callq 0x9110
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xca50
movq 0x36184(%rip), %rdi     # 0x612b0
callq 0x9110
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xca50
movsd -0x20(%rbp), %xmm0
movsd 0x19f80(%rip), %xmm1    # 0x450c8
subsd %xmm1, %xmm0
callq 0xe5e0
movl $0x3, %edi
callq 0x90d0
movl $0x3, %edi
callq 0x90d0
jmp 0x2b248
movsd -0x20(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2b186
jp 0x2b186
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xca50
jmp 0x2b1d0
movq 0x3611b(%rip), %rdi     # 0x612a8
callq 0x9110
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xca50
movq 0x3610d(%rip), %rdi     # 0x612b0
callq 0x9110
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xca50
movsd -0x20(%rbp), %xmm0
callq 0xe5e0
movl $0x3, %edi
callq 0x90d0
movl $0x3, %edi
callq 0x90d0
jmp 0x2b248
movsd -0x20(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2b210
jp 0x2b210
movq 0x360bf(%rip), %rdi     # 0x612a8
callq 0x9110
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xca50
movq 0xf98e1(%rip), %rdi     # 0x124ae0
callq 0x9110
movl $0x3, %edi
callq 0x90d0
jmp 0x2b246
movq 0x36099(%rip), %rdi     # 0x612b0
callq 0x9110
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0xca50
movsd -0x20(%rbp), %xmm0
movsd 0x19e95(%rip), %xmm1    # 0x450c8
subsd %xmm1, %xmm0
callq 0xe5e0
movl $0x3, %edi
callq 0x90d0
jmp 0x2b248
addq $0x30, %rsp
popq %rbp
retq
nop