#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 */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ RunMultiThreaded(int, int);
int /*<<< orphan*/ RunWithOneServer(int, int);
int /*<<< orphan*/ RunWithOneShotServers(int, int);
int /*<<< orphan*/ Usage(char *);
int atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int);
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int strlen(char *);
int strspn(char *, char *);
int main(int argc, char **argv) {
  char *types = "OMT";
  int i, inner = 75, outer = 10, timediff;
  struct timeval tv0, tv1;
  if (argc == 4) {
    inner = atoi(argv[3]);
    if (inner <= 0) {
      Usage(argv[0]);
    }
    argc--;
  }
  if (argc == 3) {
    outer = atoi(argv[2]);
    if (outer <= 0) {
      Usage(argv[0]);
    }
    argc--;
  }
  if (argc == 2) {
    types = argv[1];
    if (strspn(types, "OMT") != strlen(types)) {
      Usage(argv[0]);
    }
    argc--;
  }
  if (argc != 1) {
    Usage(argv[0]);
  }
  gettimeofday(&tv0, NULL);
  for (i = 0; i < strlen(types); ++i) {
    switch (types[i]) {
    case 'O':
      RunWithOneServer(outer, inner);
      break;
    case 'M':
      RunWithOneShotServers(outer, inner);
      break;
    case 'T':
      RunMultiThreaded(outer, inner);
      break;
    }
  }
  gettimeofday(&tv1, NULL);
  timediff = (tv1.tv_sec - tv0.tv_sec) * 1000000 + tv1.tv_usec - tv0.tv_usec;
  fprintf(stderr, "Total time = %d.%06ds\n", timediff / 1000000,
          timediff % 1000000);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe43(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x4b,-0x20(%rbp)
movl   $0xa,-0x24(%rbp)
cmpl   $0x4,-0x8(%rbp)
jne    1208 <main+0x68>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jg     11ff <main+0x5f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <Usage@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    1241 <main+0xa1>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jg     1238 <main+0x98>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <Usage@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    1295 <main+0xf5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xd9e(%rip),%rsi
call   1060 <strspn@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
cmp    %ecx,%eax
je     128c <main+0xec>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <Usage@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     12ab <main+0x10b>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1070 <Usage@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
cmp    %ecx,%eax
jge    1358 <main+0x1b8>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x44(%rbp)
sub    $0x4d,%eax
je     132a <main+0x18a>
jmp    12f8 <main+0x158>
mov    -0x44(%rbp),%eax
sub    $0x4f,%eax
je     131a <main+0x17a>
jmp    1309 <main+0x169>
mov    -0x44(%rbp),%eax
sub    $0x54,%eax
je     133a <main+0x19a>
jmp    1345 <main+0x1a5>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1080 <RunWithOneServer@plt>
jmp    1345 <main+0x1a5>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1050 <RunWithOneShotServers@plt>
jmp    1345 <main+0x1a5>
mov    -0x24(%rbp),%edi
mov    -0x20(%rbp),%esi
call   10a0 <RunMultiThreaded@plt>
jmp    134a <main+0x1aa>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    12bf <main+0x11f>
lea    -0x38(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
mov    -0x38(%rbp),%eax
sub    -0x30(%rbp),%eax
imul   $0xf4240,%eax,%eax
add    -0x34(%rbp),%eax
sub    -0x2c(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    0x2c5f(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %eax,-0x48(%rbp)
mov    -0x28(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x48(%rbp),%edx
lea    0xc5c(%rip),%rsi
call   1090 <fprintf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    $0xa,%r13d
mov    $0x4b,%r14d
lea    0xe4c(%rip),%rbx
add    $0xffffffff,%edi
cmp    $0x3,%edi
ja     122f <main+0x8f>
lea    0xe2d(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    0x18(%r15),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r14d
test   %eax,%eax
jg     11f4 <main+0x54>
mov    (%r15),%rdi
call   1070 <Usage@plt>
mov    0x10(%r15),%rdi
call   10b0 <atoi@plt>
mov    %eax,%r13d
test   %eax,%eax
jg     120c <main+0x6c>
mov    (%r15),%rdi
call   1070 <Usage@plt>
mov    0x8(%r15),%rbx
lea    0xdf9(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strspn@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    %eax,%r12d
je     1237 <main+0x97>
mov    (%r15),%rdi
call   1070 <Usage@plt>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    12ad <main+0x10d>
xor    %ebp,%ebp
jmp    127e <main+0xde>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13d,%edi
mov    %r14d,%esi
call   10a0 <RunMultiThreaded@plt>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    12ad <main+0x10d>
movsbl (%rbx,%rbp,1),%eax
cmp    $0x4d,%eax
je     12a0 <main+0x100>
cmp    $0x54,%eax
je     1260 <main+0xc0>
cmp    $0x4f,%eax
jne    126b <main+0xcb>
mov    %r13d,%edi
mov    %r14d,%esi
call   1080 <RunWithOneServer@plt>
jmp    126b <main+0xcb>
xchg   %ax,%ax
mov    %r13d,%edi
mov    %r14d,%esi
call   1050 <RunWithOneShotServers@plt>
jmp    126b <main+0xcb>
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    0x8(%rsp),%eax
sub    0x10(%rsp),%eax
imul   $0xf4240,%eax,%eax
add    0xc(%rsp),%eax
sub    0x14(%rsp),%eax
mov    0x2d0a(%rip),%rcx
mov    (%rcx),%edi
movslq %eax,%rcx
imul   $0x431bde83,%rcx,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x32,%rdx
add    %eax,%edx
imul   $0xf4240,%edx,%eax
sub    %eax,%ecx
lea    0xd16(%rip),%rsi
call   1090 <fprintf@plt>
xor    %edi,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@.str = [4 x i8] c"OMT\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"Total time = %d.%06ds\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.timeval
%12 = alloca %struct.timeval
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %6
store i32 75, i32* %8
store i32 10, i32* %9
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, 4
br i1 %14, label %15, label %30
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 3
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %8
%20 = load i32, i32* %8
%21 = icmp sle i32 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %15
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @Usage(i8* %25)
br label %27
27: ; preds = %22, %15
%28 = load i32, i32* %4
%29 = add nsw i32 %28, -1
store i32 %29, i32* %4
br label %30
30: ; preds = %27, %2
%31 = load i32, i32* %4
%32 = icmp eq i32 %31, 3
br i1 %32, label %33, label %48
33: ; preds = %30
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
store i32 %37, i32* %9
%38 = load i32, i32* %9
%39 = icmp sle i32 %38, 0
br i1 %39, label %40, label %45
40: ; preds = %33
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 0
%43 = load i8*, i8** %42
%44 = call i32 @Usage(i8* %43)
br label %45
45: ; preds = %40, %33
%46 = load i32, i32* %4
%47 = add nsw i32 %46, -1
store i32 %47, i32* %4
br label %48
48: ; preds = %45, %30
%49 = load i32, i32* %4
%50 = icmp eq i32 %49, 2
br i1 %50, label %51, label %68
51: ; preds = %48
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 1
%54 = load i8*, i8** %53
store i8* %54, i8** %6
%55 = load i8*, i8** %6
%56 = call i32 @strspn(i8* %55, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%57 = load i8*, i8** %6
%58 = call i32 @strlen(i8* %57)
%59 = icmp ne i32 %56, %58
br i1 %59, label %60, label %65
60: ; preds = %51
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 0
%63 = load i8*, i8** %62
%64 = call i32 @Usage(i8* %63)
br label %65
65: ; preds = %60, %51
%66 = load i32, i32* %4
%67 = add nsw i32 %66, -1
store i32 %67, i32* %4
br label %68
68: ; preds = %65, %48
%69 = load i32, i32* %4
%70 = icmp ne i32 %69, 1
br i1 %70, label %71, label %76
71: ; preds = %68
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 0
%74 = load i8*, i8** %73
%75 = call i32 @Usage(i8* %74)
br label %76
76: ; preds = %71, %68
%77 = call i32 @gettimeofday(%struct.timeval* %11, i32* null)
store i32 0, i32* %7
br label %78
78: ; preds = %103, %76
%79 = load i32, i32* %7
%80 = load i8*, i8** %6
%81 = call i32 @strlen(i8* %80)
%82 = icmp slt i32 %79, %81
br i1 %82, label %83, label %106
83: ; preds = %78
%84 = load i8*, i8** %6
%85 = load i32, i32* %7
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %84, i64 %86
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
switch i32 %89, label %102 [
i32 79, label %90
i32 77, label %94
i32 84, label %98
]
90: ; preds = %83
%91 = load i32, i32* %9
%92 = load i32, i32* %8
%93 = call i32 @RunWithOneServer(i32 %91, i32 %92)
br label %102
94: ; preds = %83
%95 = load i32, i32* %9
%96 = load i32, i32* %8
%97 = call i32 @RunWithOneShotServers(i32 %95, i32 %96)
br label %102
98: ; preds = %83
%99 = load i32, i32* %9
%100 = load i32, i32* %8
%101 = call i32 @RunMultiThreaded(i32 %99, i32 %100)
br label %102
102: ; preds = %83, %98, %94, %90
br label %103
103: ; preds = %102
%104 = load i32, i32* %7
%105 = add nsw i32 %104, 1
store i32 %105, i32* %7
br label %78
106: ; preds = %78
%107 = call i32 @gettimeofday(%struct.timeval* %12, i32* null)
%108 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 0
%109 = load i32, i32* %108
%110 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 0
%111 = load i32, i32* %110
%112 = sub nsw i32 %109, %111
%113 = mul nsw i32 %112, 1000000
%114 = getelementptr inbounds %struct.timeval, %struct.timeval* %12, i32 0, i32 1
%115 = load i32, i32* %114
%116 = add nsw i32 %113, %115
%117 = getelementptr inbounds %struct.timeval, %struct.timeval* %11, i32 0, i32 1
%118 = load i32, i32* %117
%119 = sub nsw i32 %116, %118
store i32 %119, i32* %10
%120 = load i32, i32* @stderr
%121 = load i32, i32* %10
%122 = sdiv i32 %121, 1000000
%123 = load i32, i32* %10
%124 = srem i32 %123, 1000000
%125 = call i32 @fprintf(i32 %120, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %122, i32 %124)
%126 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@.str = [4 x i8] c"OMT\00"
@stderr = global i32 0
@.str.1 = [23 x i8] c"Total time = %d.%06ds\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = bitcast %struct.timeval* %3 to i8*
%6 = bitcast %struct.timeval* %4 to i8*
switch i32 %0, label %32 [
i32 4, label %7
i32 3, label %15
i32 2, label %24
i32 1, label %38
]
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 3
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = icmp slt i32 %10, 1
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i8*, i8** %1
%14 = tail call i32 @Usage(i8* %13)
br label %15
15: ; preds = %2, %7, %12
%16 = phi i32 [ %10, %12 ], [ %10, %7 ], [ 75, %2 ]
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
%19 = tail call i32 @atoi(i8* %18)
%20 = icmp slt i32 %19, 1
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = load i8*, i8** %1
%23 = tail call i32 @Usage(i8* %22)
br label %24
24: ; preds = %2, %15, %21
%25 = phi i32 [ %19, %21 ], [ %19, %15 ], [ 10, %2 ]
%26 = phi i32 [ %16, %21 ], [ %16, %15 ], [ 75, %2 ]
%27 = getelementptr inbounds i8*, i8** %1, i64 1
%28 = load i8*, i8** %27
%29 = tail call i32 @strspn(i8* %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%30 = tail call i32 @strlen(i8* %28)
%31 = icmp eq i32 %29, %30
br i1 %31, label %38, label %32
32: ; preds = %2, %24
%33 = phi i8* [ %28, %24 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %2 ]
%34 = phi i32 [ %26, %24 ], [ 75, %2 ]
%35 = phi i32 [ %25, %24 ], [ 10, %2 ]
%36 = load i8*, i8** %1
%37 = tail call i32 @Usage(i8* %36)
br label %38
38: ; preds = %32, %2, %24
%39 = phi i8* [ %28, %24 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %2 ], [ %33, %32 ]
%40 = phi i32 [ %26, %24 ], [ 75, %2 ], [ %34, %32 ]
%41 = phi i32 [ %25, %24 ], [ 10, %2 ], [ %35, %32 ]
%42 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%43 = tail call i32 @strlen(i8* %39)
%44 = icmp sgt i32 %43, 0
br i1 %44, label %45, label %61
45: ; preds = %38, %56
%46 = phi i64 [ %57, %56 ], [ 0, %38 ]
%47 = getelementptr inbounds i8, i8* %39, i64 %46
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
switch i32 %49, label %56 [
i32 79, label %50
i32 77, label %52
i32 84, label %54
]
50: ; preds = %45
%51 = tail call i32 @RunWithOneServer(i32 %41, i32 %40)
br label %56
52: ; preds = %45
%53 = tail call i32 @RunWithOneShotServers(i32 %41, i32 %40)
br label %56
54: ; preds = %45
%55 = tail call i32 @RunMultiThreaded(i32 %41, i32 %40)
br label %56
56: ; preds = %50, %52, %54, %45
%57 = add nuw nsw i64 %46, 1
%58 = tail call i32 @strlen(i8* %39)
%59 = sext i32 %58 to i64
%60 = icmp slt i64 %57, %59
br i1 %60, label %45, label %61
61: ; preds = %56, %38
%62 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%63 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%64 = load i32, i32* %63
%65 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%66 = load i32, i32* %65
%67 = sub nsw i32 %64, %66
%68 = mul nsw i32 %67, 1000000
%69 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%70 = load i32, i32* %69
%71 = add nsw i32 %68, %70
%72 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%73 = load i32, i32* %72
%74 = sub i32 %71, %73
%75 = load i32, i32* @stderr
%76 = sdiv i32 %74, 1000000
%77 = srem i32 %74, 1000000
%78 = tail call i32 @fprintf(i32 %75, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %76, i32 %77)
%79 = tail call i32 @exit(i32 0)
unreachable
}