// File: /workspace/github_cpp_makefile_star2_O3/ef-gy[P]libefgy/src/test-case/transformation.cpp
// Function: testAffineConstruction(std::ostream&)
bool testAffineConstruction(std::ostream &log) {
  linear<double, 3> phi;

  for (int i = 0; i < 3; i++) {
    for (int k = 0; k < 3; k++) {
      phi.matrix[i][k] = i * k;
    }
  }

  affine<double, 3> psi(phi);

  bool allCorrect = true;

  // check if matrix entries of linear map are in place
  for (int i = 0; i < 3; i++) {
    for (int k = 0; k < 3; k++) {
      allCorrect &= (psi.matrix[i][k] == i * k);
    }
  }

  // check for zeroes in the last row and column
  for (int i = 0; i < 3; i++) {
    allCorrect &= (psi.matrix[i][3] == 0);
    allCorrect &= (psi.matrix[3][i] == 0);
  }

  allCorrect &= (psi.matrix[3][3] == 1);

  if (!allCorrect) {
    log << "An error occurred in constructing an affine transformation";
    log << " from a linear map.\n";

    return false;
  } else {
    return true;
  }
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %rax
xorl %ecx, %ecx
movdqa 0xf1a3(%rip), %xmm4     # 0x14010
movdqa 0xf1ab(%rip), %xmm0     # 0x14020
movdqa 0xf1b3(%rip), %xmm1     # 0x14030
pshufd $0xf5, %xmm1, %xmm2     # xmm2 = xmm1[1,1,3,3]
movq 0xf1f6(%rip), %xmm5     # 0x14080
movdqa 0xf1ae(%rip), %xmm3     # 0x14040
xorl %edx, %edx
leaq -0x8(%rcx), %rsi
xorl %edi, %edi
movdqa %xmm4, %xmm6
movdqa %xmm6, %xmm7
pxor %xmm0, %xmm7
movdqa %xmm1, %xmm8
pcmpgtd %xmm7, %xmm8
pshufd $0xf5, %xmm7, %xmm7     # xmm7 = xmm7[1,1,3,3]
pcmpeqd %xmm2, %xmm7
pand %xmm8, %xmm7
movd %xmm7, %r8d
testb $0x1, %r8b
je 0x4edf
movdqa %xmm5, %xmm8
cmpq %rdi, %rcx
je 0x4ed8
pxor %xmm8, %xmm8
movq %xmm8, -0x8(%rax,%rdi)
pextrw $0x4, %xmm7, %r8d
testb $0x1, %r8b
je 0x4efd
movdqa %xmm5, %xmm7
cmpq %rdi, %rsi
je 0x4ef8
pxor %xmm7, %xmm7
movq %xmm7, (%rax,%rdi)
paddq %xmm3, %xmm6
addq $0x10, %rdi
cmpq $0x20, %rdi
jne 0x4e9e
incq %rdx
addq $0x8, %rcx
addq $0x18, %rax
cmpq $0x3, %rdx
jne 0x4e94
xorl %eax, %eax
leaq 0x8(%rsp), %rcx
movdqa 0xf0e1(%rip), %xmm4     # 0x14010
xorl %edx, %edx
xorl %esi, %esi
xorl %edi, %edi
movdqa %xmm4, %xmm5
movdqa %xmm5, %xmm6
pxor %xmm0, %xmm6
movdqa %xmm1, %xmm7
pcmpgtd %xmm6, %xmm7
pshufd $0xf5, %xmm6, %xmm6     # xmm6 = xmm6[1,1,3,3]
pcmpeqd %xmm2, %xmm6
pand %xmm7, %xmm6
movd %xmm6, %r8d
testb $0x1, %r8b
je 0x4f6e
xorps %xmm7, %xmm7
cvtsi2sd %esi, %xmm7
movsd %xmm7, -0x8(%rcx,%rdi,8)
pextrw $0x4, %xmm6, %r8d
testb $0x1, %r8b
je 0x4f8b
leal (%rdx,%rsi), %r8d
xorps %xmm6, %xmm6
cvtsi2sd %r8d, %xmm6
movsd %xmm6, (%rcx,%rdi,8)
addq $0x2, %rdi
paddq %xmm3, %xmm5
addl %eax, %esi
cmpq $0x4, %rdi
jne 0x4f39
incq %rdx
addl $0x2, %eax
addq $0x18, %rcx
cmpq $0x3, %rdx
jne 0x4f31
movq %rsp, %rax
xorl %ecx, %ecx
movq 0x10(%rax), %rdx
movq %rdx, 0x58(%rsp,%rcx)
movdqu (%rax), %xmm0
movdqu %xmm0, 0x48(%rsp,%rcx)
addq $0x18, %rax
addq $0x20, %rcx
cmpq $0x60, %rcx
jne 0x4fb0
xorl %eax, %eax
leaq 0x48(%rsp), %rcx
movq %rax, 0x18(%rcx)
movq %rax, 0x38(%rcx)
pxor %xmm0, %xmm0
movdqu %xmm0, 0x58(%rcx)
movdqu %xmm0, 0x68(%rcx)
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
movq %rdx, 0x78(%rcx)
movb $0x1, %bpl
xorl %edx, %edx
xorl %esi, %esi
xorl %edi, %edi
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
ucomisd (%rcx,%rdi,8), %xmm0
setnp %r8b
sete %r9b
andb %r8b, %r9b
andb %r9b, %bpl
incq %rdi
addl %eax, %esi
cmpq $0x3, %rdi
jne 0x5005
incq %rdx
incl %eax
addq $0x20, %rcx
cmpq $0x3, %rdx
jne 0x5001
movq $-0x18, %rax
pxor %xmm0, %xmm0
movsd 0xc0(%rsp,%rax), %xmm1
cmpeqpd %xmm0, %xmm1
movsd 0xc0(%rsp,%rax,4), %xmm2
cmpeqpd %xmm0, %xmm2
andpd %xmm1, %xmm2
movd %xmm2, %ecx
andb %cl, %bpl
addq $0x8, %rax
jne 0x5044
testb $0x1, %bpl
jne 0x509f
leaq 0xf1b2(%rip), %rsi      # 0x14230
movl $0x3a, %edx
movq %rbx, %rdi
callq 0x42a0
leaq 0xf1d9(%rip), %rsi      # 0x1426b
movl $0x14, %edx
movq %rbx, %rdi
callq 0x42a0
andb $0x1, %bpl
movl %ebp, %eax
addq $0xc8, %rsp
popq %rbx
popq %rbp
retq
nop