#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ parse_argument(char *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ runtest(char *, char *, int);
int main(int argc, char **argv) {
  char binname[1000];
  char testname[100];
  int numtests;
  int i;
  int failures;
  if (argc < 2) {
    printf("Usage: runsuite <test binary> ...\n");
    exit(1);
  }
  numtests = argc - 1;
  printf("TAP version 13\n");
  printf("1..%d\n", numtests);
  failures = 0;
  for (i = 1; i <= numtests; i++) {
    parse_argument(argv[i], testname, binname);
    if (runtest(binname, testname, i) != 0)
      failures++;
  }
  exit(failures > 254 ? 254 : failures);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x480,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    117b <main+0x3b>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x474(%rbp)
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x474(%rbp),%esi
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x47c(%rbp)
movl   $0x1,-0x478(%rbp)
mov    -0x478(%rbp),%eax
cmp    -0x474(%rbp),%eax
jg     123c <main+0xfc>
mov    -0x10(%rbp),%rax
movslq -0x478(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x470(%rbp),%rsi
lea    -0x400(%rbp),%rdx
call   1030 <parse_argument@plt>
lea    -0x400(%rbp),%rdi
lea    -0x470(%rbp),%rsi
mov    -0x478(%rbp),%edx
call   1050 <runtest@plt>
cmp    $0x0,%rax
je     1223 <main+0xe3>
mov    -0x47c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x47c(%rbp)
jmp    1228 <main+0xe8>
mov    -0x478(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x478(%rbp)
jmp    11bd <main+0x7d>
cmpl   $0xfe,-0x47c(%rbp)
jle    125c <main+0x11c>
mov    $0xfe,%eax
mov    %eax,-0x480(%rbp)
jmp    1268 <main+0x128>
mov    -0x47c(%rbp),%eax
mov    %eax,-0x480(%rbp)
mov    -0x480(%rbp),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x458,%rsp
cmp    $0x1,%edi
jg     117c <main+0x2c>
lea    0xea9(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    %rsi,%r14
mov    %edi,%ebx
lea    -0x1(%rbx),%r15d
lea    0xe7b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe68(%rip),%rdi
xor    %ebp,%ebp
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %ebx,%r13d
mov    $0x1,%ebx
mov    %rsp,%r15
lea    0x70(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r14,%rbx,8),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <parse_argument@plt>
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
call   1060 <runtest@plt>
cmp    $0x1,%rax
sbb    $0xffffffff,%ebp
add    $0x1,%rbx
cmp    %rbx,%r13
jne    11c0 <main+0x70>
cmp    $0xfe,%ebp
mov    $0xfe,%edi
cmovb  %ebp,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"Usage: runsuite <test binary> ...\0A\00"
@.str.1 = [16 x i8] c"TAP version 13\0A\00"
@.str.2 = [7 x i8] c"1..%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1000 x i8]
%7 = alloca [100 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 2
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i32, i32* %4
%18 = sub nsw i32 %17, 1
store i32 %18, i32* %8
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%20 = load i32, i32* %8
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %20)
store i32 0, i32* %10
store i32 1, i32* %9
br label %22
22: ; preds = %44, %16
%23 = load i32, i32* %9
%24 = load i32, i32* %8
%25 = icmp sle i32 %23, %24
br i1 %25, label %26, label %47
26: ; preds = %22
%27 = load i8**, i8*** %5
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %27, i64 %29
%31 = load i8*, i8** %30
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%33 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%34 = call i32 @parse_argument(i8* %31, i8* %32, i8* %33)
%35 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%37 = load i32, i32* %9
%38 = call i64 @runtest(i8* %35, i8* %36, i32 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %26
%41 = load i32, i32* %10
%42 = add nsw i32 %41, 1
store i32 %42, i32* %10
br label %43
43: ; preds = %40, %26
br label %44
44: ; preds = %43
%45 = load i32, i32* %9
%46 = add nsw i32 %45, 1
store i32 %46, i32* %9
br label %22
47: ; preds = %22
%48 = load i32, i32* %10
%49 = icmp sgt i32 %48, 254
br i1 %49, label %50, label %51
50: ; preds = %47
br label %53
51: ; preds = %47
%52 = load i32, i32* %10
br label %53
53: ; preds = %51, %50
%54 = phi i32 [ 254, %50 ], [ %52, %51 ]
%55 = call i32 @exit(i32 %54)
unreachable
}

LLVM IR (-O2):
@.str.2 = [7 x i8] c"1..%d\0A\00"
@str = [15 x i8] c"TAP version 13\00"
@str.3 = [34 x i8] c"Usage: runsuite <test binary> ...\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1000 x i8]
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%7 = icmp slt i32 %0, 2
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.3, i64 0, i64 0))
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = add nsw i32 %0, -1
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%15 = zext i32 %0 to i64
br label %16
16: ; preds = %11, %16
%17 = phi i64 [ 1, %11 ], [ %27, %16 ]
%18 = phi i32 [ 0, %11 ], [ %26, %16 ]
%19 = getelementptr inbounds i8*, i8** %1, i64 %17
%20 = load i8*, i8** %19
%21 = call i32 @parse_argument(i8* %20, i8* %6, i8* %5)
%22 = trunc i64 %17 to i32
%23 = call i64 @runtest(i8* %5, i8* %6, i32 %22)
%24 = icmp ne i64 %23, 0
%25 = zext i1 %24 to i32
%26 = add nuw nsw i32 %18, %25
%27 = add nuw nsw i64 %17, 1
%28 = icmp eq i64 %27, %15
br i1 %28, label %29, label %16
29: ; preds = %16
%30 = icmp ult i32 %26, 254
%31 = select i1 %30, i32 %26, i32 254
%32 = call i32 @exit(i32 %31)
unreachable
}