// File: /workspace/github_c_makefile_star2_O1/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 0xb218(%rip), %xmm1     # 0x26138
callq 0x7160
movsd 0xb20b(%rip), %xmm3     # 0x26138
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 0x1b019
mulsd 0xb1ff(%rip), %xmm0     # 0x26170
movapd -0x10(%rbp), %xmm1
addsd %xmm0, %xmm1
leaq 0xb0c7(%rip), %rcx      # 0x26048
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x1b08a
jp 0x1b08a
movq 0xebb33(%rip), %rdi     # 0x106ad8
jmp 0x1b00f
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x1b01f
jp 0x1b01f
movq 0xf6436(%rip), %rdi     # 0x1113f0
jmp 0x1b00f
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x1b059
jp 0x1b059
movq 0x282d1(%rip), %rdi     # 0x432a8
callq 0x8b01
movq 0xf640d(%rip), %rdi     # 0x1113f0
callq 0x8b01
movq 0xebaf1(%rip), %rdi     # 0x106ae0
jmp 0x1b0bc
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x1b0c3
jp 0x1b0c3
movq 0xebad1(%rip), %rdi     # 0x106ae0
addq $0x10, %rsp
popq %rbp
jmp 0x8b01
addq $0x10, %rsp
popq %rbp
retq
movq 0x28282(%rip), %rdi     # 0x432a8
movapd %xmm1, -0x10(%rbp)
callq 0x8b01
movq 0xf63b9(%rip), %rdi     # 0x1113f0
callq 0x8b01
movq 0x2826d(%rip), %rdi     # 0x432b0
callq 0x8b01
movq 0xf63a1(%rip), %rdi     # 0x1113f0
callq 0x8b01
jmp 0x1b10a
movq 0x28250(%rip), %rdi     # 0x432b0
movapd %xmm1, -0x10(%rbp)
callq 0x8b01
movq 0xf637f(%rip), %rdi     # 0x1113f0
callq 0x8b01
movapd -0x10(%rbp), %xmm0
addsd 0xb0ed(%rip), %xmm0     # 0x26170
movapd %xmm0, -0x10(%rbp)
jmp 0x1b0a7
movq 0x2821f(%rip), %rdi     # 0x432b0
movapd %xmm1, -0x10(%rbp)
callq 0x8b01
movq 0xf634e(%rip), %rdi     # 0x1113f0
callq 0x8b01
callq 0x74ec
movb $0x5, 0x10(%rax)
movapd -0x10(%rbp), %xmm0
movsd %xmm0, (%rax)
movq %rax, %rdi
callq 0x8b01
jmp 0x1b12e
movq 0x281de(%rip), %rdi     # 0x432a8
movapd %xmm1, -0x10(%rbp)
callq 0x8b01
movq 0xf6315(%rip), %rdi     # 0x1113f0
callq 0x8b01
movq 0x281c9(%rip), %rdi     # 0x432b0
callq 0x8b01
movq 0xf62fd(%rip), %rdi     # 0x1113f0
callq 0x8b01
movapd -0x10(%rbp), %xmm0
addsd 0xb06b(%rip), %xmm0     # 0x26170
movapd %xmm0, -0x10(%rbp)
callq 0x74ec
movb $0x5, 0x10(%rax)
movapd -0x10(%rbp), %xmm0
movsd %xmm0, (%rax)
movq %rax, %rdi
callq 0x8b01
movl $0x3, %edi
callq 0x8ad9
movl $0x3, %edi
addq $0x10, %rsp
popq %rbp
jmp 0x8ad9