// File: /workspace/github_c_makefile_star2_O2/orangeduck[P]mpc/tests/ptest.c
// Function: pt_run
int pt_run(void) {

  int i;
  double total;
  test_t test;

  puts("");
  puts("    +-------------------------------------------+");
  puts("    | ptest          MicroTesting Magic for C   |");
  puts("    |                                           |");
  puts("    | http://github.com/orangeduck/ptest        |");
  puts("    |                                           |");
  puts("    | Daniel Holden (contact@theorangeduck.com) |");
  puts("    +-------------------------------------------+");

  signal(SIGFPE,  ptest_signal);
  signal(SIGILL,  ptest_signal);
  signal(SIGSEGV, ptest_signal);

  start = clock();
  strcpy(current_suite, "");

  for(i = 0; i < num_tests; i++) {

    test = tests[i];

    /* Check for transition to a new suite */
    if (strcmp(test.suite, current_suite)) {

      /* Don't increment any counter for first entrance */
      if (strcmp(current_suite, "")) {
        if (suite_passing) {
          num_suites_passes++;
        } else {
          num_suites_fails++;
        }
      }

      suite_passing = 1;
      strcpy(current_suite, test.suite);
      printf("\n\n  ===== %s =====\n\n", current_suite);
    }

    /* Run Test */

    test_passing = 1;
    strcpy(assert_err, "");
    strcpy(assert_err_buff, "");
    assert_err_num = 0;
    printf("    | %s ... ", test.name);
    fflush(stdout);

    test.func();

    suite_passing = suite_passing && test_passing;

    if (test_passing) {
      num_tests_passes++;
      pt_color(GREEN);
      puts("Passed!");
      pt_color(DEFAULT);
    } else {
      num_tests_fails++;
      pt_color(RED);
      printf("Failed! \n\n%s\n", assert_err);
      pt_color(DEFAULT);
    }

  }

  if (suite_passing) {
    num_suites_passes++;
  } else {
    num_suites_fails++;
  }

  end = clock();

  puts("");
  puts("  +---------------------------------------------------+");
  puts("  |                      Summary                      |");
  puts("  +---------++------------+-------------+-------------+");

  printf("  | Suites  ||");
  pt_color(YELLOW);  printf(" Total %4d ",  num_suites);
  pt_color(DEFAULT); putchar('|');
  pt_color(GREEN);   printf(" Passed %4d ", num_suites_passes);
  pt_color(DEFAULT); putchar('|');
  pt_color(RED);     printf(" Failed %4d ", num_suites_fails);
  pt_color(DEFAULT); puts("|");

  printf("  | Tests   ||");
  pt_color(YELLOW);  printf(" Total %4d ",  num_tests);
  pt_color(DEFAULT); putchar('|');
  pt_color(GREEN);   printf(" Passed %4d ", num_tests_passes);
  pt_color(DEFAULT); putchar('|');
  pt_color(RED);     printf(" Failed %4d ", num_tests_fails);
  pt_color(DEFAULT); puts("|");

  printf("  | Asserts ||");
  pt_color(YELLOW);  printf(" Total %4d ",  num_asserts);
  pt_color(DEFAULT); putchar('|');
  pt_color(GREEN);   printf(" Passed %4d ", num_assert_passes);
  pt_color(DEFAULT); putchar('|');
  pt_color(RED);     printf(" Failed %4d ", num_assert_fails);
  pt_color(DEFAULT); puts("|");

  puts("  +---------++------------+-------------+-------------+");
  puts("");

  total = (double)(end - start) / CLOCKS_PER_SEC;

  printf("      Total Running Time: %0.3fs\n\n", total);

  if (num_suites_fails > 0) { return 1; } else { return 0; }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
pushq $0xa
popq %rdi
callq 0x1030
leaq 0xad7f(%rip), %rbx      # 0xefad
movq %rbx, %rdi
callq 0x1070
leaq 0xada2(%rip), %rdi      # 0xefdf
callq 0x1070
leaq 0xadc8(%rip), %r14      # 0xf011
movq %r14, %rdi
callq 0x1070
leaq 0xadeb(%rip), %rdi      # 0xf043
callq 0x1070
movq %r14, %rdi
callq 0x1070
leaq 0xae09(%rip), %rdi      # 0xf075
callq 0x1070
movq %rbx, %rdi
callq 0x1070
leaq 0x3e6(%rip), %rbx       # 0x4666
pushq $0x8
popq %rdi
movq %rbx, %rsi
callq 0x1140
pushq $0x4
popq %rdi
movq %rbx, %rsi
callq 0x1140
pushq $0xb
popq %rdi
movq %rbx, %rsi
callq 0x1140
callq 0x1090
movq %rax, 0x216f7b(%rip)    # 0x21b228
movb $0x0, 0x216f7c(%rip)    # 0x21b230
leaq 0x208(%rsp), %r14
leaq 0x12f5d(%rip), %r15     # 0x17220
xorl %r13d, %r13d
leaq 0x216f63(%rip), %rbp    # 0x21b230
leaq 0x217160(%rip), %rbx    # 0x21b434
xorl %r12d, %r12d
movslq 0x12f36(%rip), %rax     # 0x17214
cmpq %rax, %r12
jge 0x440a
movl $0x408, %edx            # imm = 0x408
movq %rsp, %rdi
movq %r15, %rsi
callq 0x1180
movq %r14, %rdi
movq %rbp, %rsi
callq 0x1130
testl %eax, %eax
je 0x434c
cmpb $0x0, 0x216f23(%rip)    # 0x21b230
je 0x4326
cmpl $0x0, 0x21711a(%rip)    # 0x21b430
movq %rbx, %rax
leaq 0x217118(%rip), %rcx    # 0x21b438
cmoveq %rcx, %rax
incl (%rax)
movl $0x1, 0x217100(%rip)    # 0x21b430
movq %rbp, %rdi
movq %r14, %rsi
callq 0x1060
leaq 0xad65(%rip), %rdi      # 0xf0a7
movq %rbp, %rsi
xorl %eax, %eax
callq 0x10d0
movl $0x1, 0x11e9e(%rip)     # 0x161f4
movb %r13b, 0x126b3(%rip)    # 0x16a10
movb %r13b, 0x11e9c(%rip)    # 0x16200
andl $0x0, 0x12695(%rip)     # 0x16a00
leaq 0xad4a(%rip), %rdi      # 0xf0bc
leaq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x10d0
movq 0x11c5b(%rip), %rax     # 0x15fe0
movq (%rax), %rdi
callq 0x11a0
callq *(%rsp)
cmpl $0x0, 0x217099(%rip)    # 0x21b430
setne %al
movl 0x11e54(%rip), %ecx     # 0x161f4
testl %ecx, %ecx
setne %dl
andb %al, %dl
movzbl %dl, %eax
movl %eax, 0x217080(%rip)    # 0x21b430
testl %ecx, %ecx
je 0x43d0
incl 0x217082(%rip)          # 0x21b43c
pushq $0x2
popq %rdi
callq 0x470b
leaq 0xad01(%rip), %rdi      # 0xf0ca
callq 0x1070
jmp 0x43f3
incl 0x21706a(%rip)          # 0x21b440
pushq $0x4
popq %rdi
callq 0x470b
leaq 0xaced(%rip), %rdi      # 0xf0d2
leaq 0x12624(%rip), %rsi     # 0x16a10
xorl %eax, %eax
callq 0x10d0
pushq $0x10
popq %rdi
callq 0x470b
incq %r12
addq $0x408, %r15            # imm = 0x408
jmp 0x42d7
cmpl $0x0, 0x21701f(%rip)    # 0x21b430
leaq 0x217020(%rip), %rax    # 0x21b438
cmoveq %rax, %rbx
incl (%rbx)
callq 0x1090
movq %rax, 0x21701e(%rip)    # 0x21b448
pushq $0xa
popq %rdi
callq 0x1030
leaq 0xaca7(%rip), %rdi      # 0xf0e0
callq 0x1070
leaq 0xacd3(%rip), %rdi      # 0xf118
callq 0x1070
leaq 0xacff(%rip), %rdi      # 0xf150
callq 0x1070
leaq 0xad2b(%rip), %rdi      # 0xf188
xorl %eax, %eax
callq 0x10d0
pushq $0x6
popq %rdi
callq 0x470b
movl 0x216dae(%rip), %esi    # 0x21b220
leaq 0xad1e(%rip), %rdi      # 0xf197
xorl %eax, %eax
callq 0x10d0
pushq $0x10
popq %rbp
movl %ebp, %edi
callq 0x470b
pushq $0x7c
popq %r15
movl %r15d, %edi
callq 0x1030
pushq $0x2
popq %rdi
callq 0x470b
movl 0x216f90(%rip), %esi    # 0x21b434
leaq 0xacf8(%rip), %rbx      # 0xf1a3
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10d0
movl %ebp, %edi
callq 0x470b
movl %r15d, %edi
callq 0x1030
pushq $0x4
popq %r14
movl %r14d, %edi
callq 0x470b
movl 0x216f62(%rip), %esi    # 0x21b438
leaq 0xacd3(%rip), %r12      # 0xf1b0
movq %r12, %rdi
xorl %eax, %eax
callq 0x10d0
movl %ebp, %edi
callq 0x470b
leaq 0xab4c(%rip), %r13      # 0xf041
movq %r13, %rdi
callq 0x1070
leaq 0xacb9(%rip), %rdi      # 0xf1bd
xorl %eax, %eax
callq 0x10d0
pushq $0x6
popq %rdi
callq 0x470b
movl 0x12cfb(%rip), %esi     # 0x17214
leaq 0xac77(%rip), %rdi      # 0xf197
xorl %eax, %eax
callq 0x10d0
movl %ebp, %edi
callq 0x470b
movl %r15d, %edi
callq 0x1030
pushq $0x2
popq %rdi
callq 0x470b
movl 0x216ef8(%rip), %esi    # 0x21b43c
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10d0
movl %ebp, %edi
callq 0x470b
movl %r15d, %edi
callq 0x1030
movl %r14d, %edi
callq 0x470b
movl 0x216ed5(%rip), %esi    # 0x21b440
movq %r12, %rdi
xorl %eax, %eax
callq 0x10d0
movl %ebp, %edi
callq 0x470b
movq %r13, %rdi
callq 0x1070
leaq 0xac41(%rip), %rdi      # 0xf1cc
xorl %eax, %eax
callq 0x10d0
pushq $0x6
popq %rdi
callq 0x470b
movl 0x11c50(%rip), %esi     # 0x161f0
leaq 0xabf0(%rip), %rdi      # 0xf197
xorl %eax, %eax
callq 0x10d0
movl %ebp, %edi
callq 0x470b
movl %r15d, %edi
callq 0x1030
pushq $0x2
popq %rdi
callq 0x470b
movl 0x11c2d(%rip), %esi     # 0x161f8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10d0
movl %ebp, %edi
callq 0x470b
movl %r15d, %edi
callq 0x1030
movl %r14d, %edi
callq 0x470b
movl 0x12c1e(%rip), %esi     # 0x17210
movq %r12, %rdi
xorl %eax, %eax
callq 0x10d0
movl %ebp, %edi
callq 0x470b
movq %r13, %rdi
callq 0x1070
leaq 0xab3e(%rip), %rdi      # 0xf150
callq 0x1070
pushq $0xa
popq %rdi
callq 0x1030
movq 0x216e22(%rip), %rax    # 0x21b448
subq 0x216bfb(%rip), %rax    # 0x21b228
cvtsi2sd %rax, %xmm0
divsd 0xa8a6(%rip), %xmm0     # 0xeee0
leaq 0xab9a(%rip), %rdi      # 0xf1db
movb $0x1, %al
callq 0x10d0
xorl %eax, %eax
cmpl $0x0, 0x216de7(%rip)    # 0x21b438
setg %al
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq