#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*/ checktv();
int /*<<< orphan*/ perftv();
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc == 1) {
    checktv();
    perftv();
  } else
    for (int n = 1; n < argc; n++) {
      if (!strcmp(argv[n], "check"))
        checktv();
      if (!strcmp(argv[n], "perf"))
        perftv();
    }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1163 <main+0x33>
mov    $0x0,%al
call   1050 <checktv@plt>
mov    $0x0,%al
call   1030 <perftv@plt>
jmp    11de <main+0xae>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11d9 <main+0xa9>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe77(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    119e <main+0x6e>
mov    $0x0,%al
call   1050 <checktv@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe55(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11c6 <main+0x96>
mov    $0x0,%al
call   1030 <perftv@plt>
jmp    11cb <main+0x9b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116a <main+0x3a>
jmp    11de <main+0xae>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    $0x1,%edi
jne    1150 <main+0x20>
xor    %eax,%eax
call   1050 <checktv@plt>
xor    %eax,%eax
call   1030 <perftv@plt>
jmp    11af <main+0x7f>
jle    11af <main+0x7f>
mov    %rsi,%r12
mov    %edi,%r13d
mov    $0x1,%ebp
lea    0xe9c(%rip),%r14
lea    0xe9b(%rip),%r15
jmp    1179 <main+0x49>
nopl   (%rax)
add    $0x1,%rbp
cmp    %rbp,%r13
je     11af <main+0x7f>
mov    (%r12,%rbp,8),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    1197 <main+0x67>
xor    %eax,%eax
call   1050 <checktv@plt>
mov    (%r12,%rbp,8),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    1170 <main+0x40>
xor    %eax,%eax
call   1030 <perftv@plt>
jmp    1170 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"check\00"
@.str.1 = [5 x i8] c"perf\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 (...) @checktv()
%11 = call i32 (...) @perftv()
br label %42
12: ; preds = %2
store i32 1, i32* %6
br label %13
13: ; preds = %38, %12
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %41
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = call i32 @strcmp(i8* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%24 = icmp ne i32 %23, 0
br i1 %24, label %27, label %25
25: ; preds = %17
%26 = call i32 (...) @checktv()
br label %27
27: ; preds = %25, %17
%28 = load i8**, i8*** %5
%29 = load i32, i32* %6
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %28, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @strcmp(i8* %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%34 = icmp ne i32 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %27
%36 = call i32 (...) @perftv()
br label %37
37: ; preds = %35, %27
br label %38
38: ; preds = %37
%39 = load i32, i32* %6
%40 = add nsw i32 %39, 1
store i32 %40, i32* %6
br label %13
41: ; preds = %13
br label %42
42: ; preds = %41, %9
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"check\00"
@.str.1 = [5 x i8] c"perf\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %29
6: ; preds = %4
%7 = zext i32 %0 to i64
br label %11
8: ; preds = %2
%9 = tail call i32 (...) @checktv()
%10 = tail call i32 (...) @perftv()
br label %29
11: ; preds = %6, %26
%12 = phi i64 [ 1, %6 ], [ %27, %26 ]
%13 = getelementptr inbounds i8*, i8** %1, i64 %12
%14 = load i8*, i8** %13
%15 = tail call i32 @strcmp(i8* dereferenceable(1) %14, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %11
%18 = tail call i32 (...) @checktv()
%19 = load i8*, i8** %13
br label %20
20: ; preds = %17, %11
%21 = phi i8* [ %19, %17 ], [ %14, %11 ]
%22 = tail call i32 @strcmp(i8* dereferenceable(1) %21, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = tail call i32 (...) @perftv()
br label %26
26: ; preds = %20, %24
%27 = add nuw nsw i64 %12, 1
%28 = icmp eq i64 %27, %7
br i1 %28, label %29, label %11
29: ; preds = %26, %4, %8
ret i32 0
}