// File: PeterDenton[P]Nu-Pert/src/Tilde.cpp
// Function: Tilde::W(double, int)
Matrix<std::complex<double> > W(double a, int order)
{
	assert (order >= 0 && order <= 1); // order valid for 0, 1

	Matrix<std::complex<double> > W(3, 3);
	double coef;

	switch (order)
	{
		case 1:
			W(0, 2) += c13 * s13 * Dmsqee / Dlca(a);
			W(2, 0) -= c13 * s13 * Dmsqee / Dlca(a);

			coef = eps * c12 * s12 * Dmsqee;
			W(0, 1) += coef * c13 / Dlba(a);
			W(1, 0) -= coef * c13 / Dlba(a);
			W(1, 2) -= coef * s13 / Dlcb(a);
			W(2, 1) += coef * s13 / Dlcb(a);

		case 0:
			// zeroth order
			for (int i = 0; i < 3; i++)
				W(i, i) += 1;
	}
	return W;
}

// Assembly:
subq $0xe8, %rsp
movq %rdi, 0xa0(%rsp)
movq %rdi, %rax
movq %rax, 0xa8(%rsp)
movq %rdi, 0xe0(%rsp)
movsd %xmm0, 0xd8(%rsp)
movl %esi, 0xd4(%rsp)
xorl %eax, %eax
cmpl $0x0, 0xd4(%rsp)
movb %al, 0xb7(%rsp)
jl 0xfdd7
cmpl $0x1, 0xd4(%rsp)
setle %al
movb %al, 0xb7(%rsp)
movb 0xb7(%rsp), %al
testb $0x1, %al
jne 0xfde4
jmp 0xfde6
jmp 0xfe05
leaq 0x2741(%rip), %rdi      # 0x1252e
leaq 0x2db5(%rip), %rsi      # 0x12ba9
movl $0x26, %edx
leaq 0x2db7(%rip), %rcx      # 0x12bb7
callq 0x20d0
movq 0xa0(%rsp), %rdi
movb $0x0, 0xd3(%rsp)
movl $0x3, %edx
movq %rdx, %rsi
callq 0xcaa0
movl 0xd4(%rsp), %eax
movl %eax, 0x9c(%rsp)
testl %eax, %eax
je 0x10159
jmp 0xfe3a
movl 0x9c(%rsp), %eax
subl $0x1, %eax
jne 0x101d9
jmp 0xfe4c
leaq 0x7385(%rip), %rax      # 0x171d8
movsd (%rax), %xmm0
leaq 0x7362(%rip), %rax      # 0x171c0
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
leaq 0x7393(%rip), %rax      # 0x17200
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0xfd00
movq 0xa0(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x80(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x88(%rsp)
xorl %eax, %eax
movl %eax, %esi
movl $0x2, %edx
callq 0xce30
movq %rax, 0x90(%rsp)
jmp 0xfec5
movsd 0x88(%rsp), %xmm0
movq 0x90(%rsp), %rdi
callq 0x4680
jmp 0xfedd
leaq 0x72f4(%rip), %rax      # 0x171d8
movsd (%rax), %xmm0
leaq 0x72d1(%rip), %rax      # 0x171c0
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
leaq 0x7302(%rip), %rax      # 0x17200
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x68(%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0xfd00
movq 0xa0(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x68(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x70(%rsp)
xorl %eax, %eax
movl %eax, %edx
movl $0x2, %esi
callq 0xce30
movq %rax, 0x78(%rsp)
jmp 0xff4a
movsd 0x70(%rsp), %xmm0
movq 0x78(%rsp), %rdi
callq 0x91d0
jmp 0xff5c
leaq 0x72a5(%rip), %rax      # 0x17208
movsd (%rax), %xmm0
leaq 0x725a(%rip), %rax      # 0x171c8
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
leaq 0x7233(%rip), %rax      # 0x171b0
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
leaq 0x7274(%rip), %rax      # 0x17200
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0xc8(%rsp)
movsd 0xc8(%rsp), %xmm0
leaq 0x722b(%rip), %rax      # 0x171d8
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x50(%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0xfcc0
movq 0xa0(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x50(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x58(%rsp)
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
callq 0xce30
movq %rax, 0x60(%rsp)
jmp 0xfff9
movsd 0x58(%rsp), %xmm0
movq 0x60(%rsp), %rdi
callq 0x4680
jmp 0x1000b
movsd 0xc8(%rsp), %xmm0
leaq 0x71bd(%rip), %rax      # 0x171d8
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0xfcc0
movq 0xa0(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x38(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x40(%rsp)
xorl %eax, %eax
movl %eax, %edx
movl $0x1, %esi
callq 0xce30
movq %rax, 0x48(%rsp)
jmp 0x10067
movsd 0x40(%rsp), %xmm0
movq 0x48(%rsp), %rdi
callq 0x91d0
jmp 0x10079
movsd 0xc8(%rsp), %xmm0
leaq 0x7137(%rip), %rax      # 0x171c0
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0xfd40
movq 0xa0(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x20(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x28(%rsp)
movl $0x1, %esi
movl $0x2, %edx
callq 0xce30
movq %rax, 0x30(%rsp)
jmp 0x100d6
movsd 0x28(%rsp), %xmm0
movq 0x30(%rsp), %rdi
callq 0x91d0
jmp 0x100e8
movsd 0xc8(%rsp), %xmm0
leaq 0x70c8(%rip), %rax      # 0x171c0
movsd (%rax), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rsp)
movsd 0xd8(%rsp), %xmm0
callq 0xfd40
movq 0xa0(%rsp), %rdi
movaps %xmm0, %xmm1
movsd 0x8(%rsp), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rsp)
movl $0x2, %esi
movl $0x1, %edx
callq 0xce30
movq %rax, 0x18(%rsp)
jmp 0x10145
movsd 0x10(%rsp), %xmm0
movq 0x18(%rsp), %rdi
callq 0x4680
jmp 0x10157
jmp 0x10159
movl $0x0, 0xb8(%rsp)
cmpl $0x3, 0xb8(%rsp)
jge 0x101d7
movq 0xa0(%rsp), %rdi
movslq 0xb8(%rsp), %rdx
movq %rdx, %rsi
callq 0xce30
movq %rax, (%rsp)
jmp 0x1018c
movq (%rsp), %rdi
movsd 0x1e80(%rip), %xmm0     # 0x12018
callq 0x4680
jmp 0x1019f
jmp 0x101a1
movl 0xb8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xb8(%rsp)
jmp 0x10164
movq 0xa0(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xc0(%rsp)
movl %eax, 0xbc(%rsp)
callq 0xce00
jmp 0x10208
jmp 0x101d9
movb $0x1, 0xd3(%rsp)
testb $0x1, 0xd3(%rsp)
jne 0x101f8
movq 0xa0(%rsp), %rdi
callq 0xce00
movq 0xa8(%rsp), %rax
addq $0xe8, %rsp
retq
movq 0xc0(%rsp), %rdi
callq 0x22b0
nopw %cs:(%rax,%rax)