// File: ef-gy[P]libefgy/src/test-case/unit.cpp
// Function: testUnitBinary(std::ostream&)
bool testUnitBinary(std::ostream &log) {
  byte<fraction>::kibi kib_2(fraction(2));

  if (fraction(2) != fraction(kib_2)) {
    log << "variable was not initialised to the expected value: " << kib_2
        << " instead of 2/1\n";
    return false;
  }

  byte<fraction>::unit b_2 = kib_2;

  if (fraction(2048) != b_2) {
    log << "variable was not converted to the expected value: " << b_2
        << " instead of 2048/1\n";
    return false;
  }

  byte<fraction>::mebi mib_2 = kib_2;

  if (fraction(1, 512) != mib_2) {
    log << "variable was not converted to the expected value: " << mib_2
        << " instead of 1/512\n";
    return false;
  }

  byte<fraction>::kilo kb_2 = kib_2;

  if (fraction(256, 125) != kb_2) {
    log << "variable was not converted to the expected value: " << kb_2
        << " instead of 256/125\n";
    return false;
  }

  byte<fraction>::mega mb_2 = kib_2;

  if (fraction(32, 15625) != mb_2) {
    log << "variable was not converted to the expected value: " << mb_2
        << " instead of 32/15625\n";
    return false;
  }

  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
movl $0x2, %esi
callq 0x6fb0
leaq -0x20(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x7830
leaq -0x40(%rbp), %rdi
movl $0x2, %esi
callq 0x6fb0
movq -0x20(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x74f0
testb $0x1, %al
jne 0x65ab
jmp 0x65df
movq -0x10(%rbp), %rdi
leaq 0x2f045(%rip), %rsi     # 0x355fb
callq 0x5360
movq %rax, %rdi
leaq -0x20(%rbp), %rsi
callq 0x7560
movq %rax, %rdi
leaq 0x2f05f(%rip), %rsi     # 0x35630
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x6798
leaq -0x60(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x7860
leaq -0x70(%rbp), %rdi
movl $0x800, %esi            # imm = 0x800
callq 0x6fb0
leaq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x78c0
testb $0x1, %al
jne 0x660d
jmp 0x6641
movq -0x10(%rbp), %rdi
leaq 0x2f029(%rip), %rsi     # 0x35641
callq 0x5360
movq %rax, %rdi
leaq -0x60(%rbp), %rsi
callq 0x7560
movq %rax, %rdi
leaq 0x2f041(%rip), %rsi     # 0x35674
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x6798
leaq -0x80(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x78f0
leaq -0x90(%rbp), %rdi
movl $0x1, %esi
movl $0x200, %edx            # imm = 0x200
callq 0x7480
leaq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x7950
testb $0x1, %al
jne 0x667a
jmp 0x66ae
movq -0x10(%rbp), %rdi
leaq 0x2efbc(%rip), %rsi     # 0x35641
callq 0x5360
movq %rax, %rdi
leaq -0x80(%rbp), %rsi
callq 0x7560
movq %rax, %rdi
leaq 0x2efe8(%rip), %rsi     # 0x35688
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x6798
leaq -0xa0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x7980
leaq -0xb0(%rbp), %rdi
movl $0x100, %esi            # imm = 0x100
movl $0x7d, %edx
callq 0x7480
leaq -0xb0(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x7a40
testb $0x1, %al
jne 0x66ed
jmp 0x6721
movq -0x10(%rbp), %rdi
leaq 0x2ef49(%rip), %rsi     # 0x35641
callq 0x5360
movq %rax, %rdi
leaq -0xa0(%rbp), %rsi
callq 0x7560
movq %rax, %rdi
leaq 0x2ef85(%rip), %rsi     # 0x3569b
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x6798
leaq -0xc0(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x7a70
leaq -0xd0(%rbp), %rdi
movl $0x20, %esi
movl $0x3d09, %edx           # imm = 0x3D09
callq 0x7480
leaq -0xd0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x7b30
testb $0x1, %al
jne 0x6760
jmp 0x6794
movq -0x10(%rbp), %rdi
leaq 0x2eed6(%rip), %rsi     # 0x35641
callq 0x5360
movq %rax, %rdi
leaq -0xc0(%rbp), %rsi
callq 0x7560
movq %rax, %rdi
leaq 0x2ef27(%rip), %rsi     # 0x356b0
callq 0x5360
movb $0x0, -0x1(%rbp)
jmp 0x6798
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)