// File: afborchert[P]fmt/test_suite.cpp
// Function: bool general_testcase<char, std::nullptr_t>(bool, bool, int&, bool, int, char const*, std::nullptr_t&&)
bool general_testcase(bool implementation_defined,
      bool with_offset, int& offset,
      bool to_string, int string_len,
      const CharT* format, Values&&... values) {
   ++testcases;
   std::basic_ostringstream<CharT> os;
   errno = 0;
   int off1 = 0; int off2 = 0;
   int count1 = 0;
   if (to_string) {
      CharT* buf = new CharT[string_len + 8];
      std::fill_n(buf, string_len + 8, 42);
      count1 = fmt::snprintf(buf, string_len, format, std::forward<Values>(values)...);
      if (count1 > 0) {
	 int i = 0;
	 while (i < string_len) {
	    if (!buf[i]) break;
	    ++i;
	 }
	 if (i < string_len) {
	    for (i = string_len; i < string_len + 8; ++i) {
	       if (buf[i] != 42) {
		  buffer_overrun(format, string_len, i);
		  print_values(1, values...);
		  return false;
	       }
	    }
	    os << buf;
	 }
      }
      delete[] buf;
   } else {
      count1 = fmt::printf(os, format, std::forward<Values>(values)...);
   }
   if (with_offset) off1 = offset;
   int err1 = errno;
   errno = 0;
   int count2 = sprint(nullptr, 0, format, std::forward<Values>(values)...); 
   if (with_offset) off2 = offset;
   int err2 = errno;
   if (count1 < 0 || count2 < 0) {
      if (count1 != count2) {
	 count_mismatch(implementation_defined, format, count1, count2);
	 print_values(1, values...);
	 if (implementation_defined) ++warnings;
	 return false;
      }
      if (err1 != err2) {
	 errno_mismatch(implementation_defined, format, err1, err2);
	 print_values(1, values...);
	 if (implementation_defined) ++warnings;
	 return false;
      }
      ++successful;
      return true;
   }

   /* compare the resulting strings */
   int buflen, len;
   if (to_string) {
      buflen = string_len + 1; len = string_len;
   } else {
      buflen = len = count2 + 1;
   }
   CharT* buf = new CharT[buflen] {};
   sprint(buf, len, format, values...);
   std::basic_string<CharT> osstr(os.str());
   bool ok = compare(buf, osstr.c_str()) == 0;
   if (!ok) {
      diff_analysis(implementation_defined, format, count1, count2,
	 osstr.c_str(), buf);
      if (implementation_defined) ++warnings;
   }
   delete[] buf;
   if (with_offset && off1 != off2) {
      offset_mismatch(format, off1, off2);
      ok = false;
   }
   if (!ok) print_values(1, values...);
   if (ok) ++successful;
   return ok;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x270, %rsp            # imm = 0x270
movb %cl, %al
movb %sil, %cl
movb %dil, %sil
movq 0x10(%rbp), %rdi
andb $0x1, %sil
movb %sil, -0x2(%rbp)
andb $0x1, %cl
movb %cl, -0x3(%rbp)
movq %rdx, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movl %r8d, -0x18(%rbp)
movq %r9, -0x20(%rbp)
movl 0x53a10(%rip), %eax     # 0x954bc
addl $0x1, %eax
movl %eax, 0x53a07(%rip)     # 0x954bc
leaq -0x198(%rbp), %rdi
callq 0x8640
callq 0x8060
movl $0x0, (%rax)
movl $0x0, -0x19c(%rbp)
movl $0x0, -0x1a0(%rbp)
movl $0x0, -0x1a4(%rbp)
testb $0x1, -0x11(%rbp)
je 0x41c8e
movl -0x18(%rbp), %eax
addl $0x8, %eax
movslq %eax, %rdi
callq 0x8030
movq %rax, -0x218(%rbp)
jmp 0x41b0b
movq -0x218(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x1b0(%rbp), %rdi
movl -0x18(%rbp), %esi
addl $0x8, %esi
movl $0x2a, -0x1c0(%rbp)
leaq -0x1c0(%rbp), %rdx
callq 0x1a930
jmp 0x41b3e
movq -0x1b0(%rbp), %rdi
movslq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq 0x10(%rbp), %rcx
callq 0x42090
movl %eax, -0x21c(%rbp)
jmp 0x41b5e
movl -0x21c(%rbp), %eax
movl %eax, -0x1a4(%rbp)
cmpl $0x0, -0x1a4(%rbp)
jle 0x41c6c
movl $0x0, -0x1c4(%rbp)
movl -0x1c4(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x41bca
movq -0x1b0(%rbp), %rax
movslq -0x1c4(%rbp), %rcx
cmpb $0x0, (%rax,%rcx)
jne 0x41bb9
jmp 0x41bca
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
jmp 0x42070
movl -0x1c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c4(%rbp)
jmp 0x41b81
movl -0x1c4(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x41c6a
movl -0x18(%rbp), %eax
movl %eax, -0x1c4(%rbp)
movl -0x1c4(%rbp), %eax
movl -0x18(%rbp), %ecx
addl $0x8, %ecx
cmpl %ecx, %eax
jge 0x41c53
movq -0x1b0(%rbp), %rax
movslq -0x1c4(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x2a, %eax
je 0x41c40
movq -0x20(%rbp), %rdi
movl -0x18(%rbp), %esi
movl -0x1c4(%rbp), %edx
callq 0x8c20
jmp 0x41c1d
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edi
callq 0x42280
jmp 0x41c2d
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1c8(%rbp)
jmp 0x42056
jmp 0x41c42
movl -0x1c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c4(%rbp)
jmp 0x41be2
movq -0x1b0(%rbp), %rsi
leaq -0x198(%rbp), %rdi
callq 0x8410
jmp 0x41c68
jmp 0x41c6a
jmp 0x41c6c
movq -0x1b0(%rbp), %rax
movq %rax, -0x228(%rbp)
cmpq $0x0, %rax
je 0x41c8c
movq -0x228(%rbp), %rdi
callq 0x85e0
jmp 0x41cb6
movq -0x20(%rbp), %rsi
movq 0x10(%rbp), %rdx
leaq -0x198(%rbp), %rdi
callq 0x42300
movl %eax, -0x22c(%rbp)
jmp 0x41caa
movl -0x22c(%rbp), %eax
movl %eax, -0x1a4(%rbp)
testb $0x1, -0x3(%rbp)
je 0x41cc8
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x19c(%rbp)
callq 0x8060
movl (%rax), %eax
movl %eax, -0x1cc(%rbp)
callq 0x8060
movl $0x0, (%rax)
movq -0x20(%rbp), %rdx
movq 0x10(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x42a10
movl %eax, -0x230(%rbp)
jmp 0x41cfc
movl -0x230(%rbp), %eax
movl %eax, -0x1d0(%rbp)
testb $0x1, -0x3(%rbp)
je 0x41d1a
movq -0x10(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1a0(%rbp)
callq 0x8060
movl (%rax), %eax
movl %eax, -0x1d4(%rbp)
cmpl $0x0, -0x1a4(%rbp)
jl 0x41d3d
cmpl $0x0, -0x1d0(%rbp)
jge 0x41e27
movl -0x1a4(%rbp), %eax
cmpl -0x1d0(%rbp), %eax
je 0x41da1
movq -0x20(%rbp), %rsi
movl -0x1a4(%rbp), %edx
movl -0x1d0(%rbp), %ecx
movzbl -0x2(%rbp), %edi
andl $0x1, %edi
callq 0x8c80
jmp 0x41d69
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edi
callq 0x42280
jmp 0x41d79
testb $0x1, -0x2(%rbp)
je 0x41d8e
movl 0x5373b(%rip), %eax     # 0x954c0
addl $0x1, %eax
movl %eax, 0x53732(%rip)     # 0x954c0
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1c8(%rbp)
jmp 0x42056
movl -0x1cc(%rbp), %eax
cmpl -0x1d4(%rbp), %eax
je 0x41e05
movq -0x20(%rbp), %rsi
movl -0x1cc(%rbp), %edx
movl -0x1d4(%rbp), %ecx
movzbl -0x2(%rbp), %edi
andl $0x1, %edi
callq 0x8d40
jmp 0x41dcd
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edi
callq 0x42280
jmp 0x41ddd
testb $0x1, -0x2(%rbp)
je 0x41df2
movl 0x536d7(%rip), %eax     # 0x954c0
addl $0x1, %eax
movl %eax, 0x536ce(%rip)     # 0x954c0
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1c8(%rbp)
jmp 0x42056
movl 0x536ad(%rip), %eax     # 0x954b8
addl $0x1, %eax
movl %eax, 0x536a4(%rip)     # 0x954b8
movb $0x1, -0x1(%rbp)
movl $0x1, -0x1c8(%rbp)
jmp 0x42056
testb $0x1, -0x11(%rbp)
je 0x41e44
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1d8(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x1dc(%rbp)
jmp 0x41e59
movl -0x1d0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1dc(%rbp)
movl %eax, -0x1d8(%rbp)
movslq -0x1d8(%rbp), %rdi
movq %rdi, -0x240(%rbp)
callq 0x8030
movq %rax, -0x238(%rbp)
jmp 0x41e75
movq -0x238(%rbp), %rdi
movq -0x240(%rbp), %rdx
xorl %esi, %esi
callq 0x8200
movq -0x238(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq -0x1e8(%rbp), %rdi
movslq -0x1dc(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq 0x10(%rbp), %rcx
callq 0x42a50
jmp 0x41eb5
leaq -0x208(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x8460
jmp 0x41eca
movq -0x1e8(%rbp), %rax
movq %rax, -0x248(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x8150
movq -0x248(%rbp), %rdi
movq %rax, %rsi
callq 0x8a60
cmpl $0x0, %eax
sete %al
andb $0x1, %al
movb %al, -0x209(%rbp)
testb $0x1, -0x209(%rbp)
jne 0x41fb0
movq -0x20(%rbp), %rax
movq %rax, -0x258(%rbp)
movl -0x1a4(%rbp), %eax
movl %eax, -0x250(%rbp)
movl -0x1d0(%rbp), %eax
movl %eax, -0x24c(%rbp)
movzbl -0x2(%rbp), %eax
movl %eax, -0x25c(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x8150
movl -0x25c(%rbp), %edi
movq -0x258(%rbp), %rsi
movl -0x250(%rbp), %edx
movl -0x24c(%rbp), %ecx
movq %rax, %r8
movq -0x1e8(%rbp), %r9
andl $0x1, %edi
callq 0x8ac0
jmp 0x41f74
testb $0x1, -0x2(%rbp)
je 0x41fae
movl 0x53540(%rip), %eax     # 0x954c0
addl $0x1, %eax
movl %eax, 0x53537(%rip)     # 0x954c0
jmp 0x41fae
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x8220
jmp 0x42070
jmp 0x41fb0
movq -0x1e8(%rbp), %rax
movq %rax, -0x268(%rbp)
cmpq $0x0, %rax
je 0x41fd0
movq -0x268(%rbp), %rdi
callq 0x85e0
testb $0x1, -0x3(%rbp)
je 0x42002
movl -0x19c(%rbp), %eax
cmpl -0x1a0(%rbp), %eax
je 0x42002
movq -0x20(%rbp), %rdi
movl -0x19c(%rbp), %esi
movl -0x1a0(%rbp), %edx
callq 0x8e00
jmp 0x41ffb
movb $0x0, -0x209(%rbp)
testb $0x1, -0x209(%rbp)
jne 0x4201d
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edi
callq 0x42280
jmp 0x4201b
jmp 0x4201d
testb $0x1, -0x209(%rbp)
je 0x42035
movl 0x5348c(%rip), %eax     # 0x954b8
addl $0x1, %eax
movl %eax, 0x53483(%rip)     # 0x954b8
movb -0x209(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movl $0x1, -0x1c8(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x8220
leaq -0x198(%rbp), %rdi
callq 0x80c0
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x270, %rsp            # imm = 0x270
popq %rbp
retq
leaq -0x198(%rbp), %rdi
callq 0x80c0
movq -0x1b8(%rbp), %rdi
callq 0x8800
nopl (%rax,%rax)