#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 */
char *arg_gen(int, int);
char **arg_setup(char *, int);
int atoi(char *);
int errno;
int execve(char *, char **, int /*<<< orphan*/ *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  int rc;
  int iter;
  int test_cfg;
  char **exec_argv = NULL;
  if ((argc >= 1) && (strcmp(argv[0], "testing") == 0))
    return 0;
  if (argc == 3) {
    test_cfg = atoi(argv[2]);
    if (strcmp(argv[1], "count") == 0) {
      exec_argv = arg_setup("count", test_cfg);
      for (iter = 0; iter < test_cfg; iter++)
        exec_argv[iter + 2] = arg_gen(1, 0);
      exec_argv[test_cfg + 2] = NULL;
    } else if (strcmp(argv[1], "size") == 0) {
      exec_argv = arg_setup("size", 1);
      exec_argv[2] = arg_gen(test_cfg, 0);
      exec_argv[3] = NULL;
    } else if (strcmp(argv[1], "hex") == 0) {
      exec_argv = arg_setup("hex", 1);
      exec_argv[2] = arg_gen(test_cfg, 0x20);
      exec_argv[3] = NULL;
    }
    rc = execve(argv[0], exec_argv, NULL);
    return (rc < 0 ? errno : 0);
  }
  return 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x28(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     11a1 <main+0x51>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe7a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11a1 <main+0x51>
movl   $0x0,-0x4(%rbp)
jmp    134f <main+0x1ff>
cmpl   $0x3,-0x8(%rbp)
jne    1348 <main+0x1f8>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1247 <main+0xf7>
mov    -0x1c(%rbp),%esi
lea    0xe25(%rip),%rdi
call   1060 <arg_setup@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    122d <main+0xdd>
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <arg_gen@plt>
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11f3 <main+0xa3>
mov    -0x28(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movq   $0x0,(%rax,%rcx,8)
jmp    1301 <main+0x1b1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdb8(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12a0 <main+0x150>
lea    0xda2(%rip),%rdi
mov    $0x1,%esi
call   1060 <arg_setup@plt>
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
xor    %esi,%esi
call   1050 <arg_gen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x28(%rbp),%rax
movq   $0x0,0x18(%rax)
jmp    12fc <main+0x1ac>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd64(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12f7 <main+0x1a7>
lea    0xd4e(%rip),%rdi
mov    $0x1,%esi
call   1060 <arg_setup@plt>
mov    %rax,-0x28(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x20,%esi
call   1050 <arg_gen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x28(%rbp),%rax
movq   $0x0,0x18(%rax)
jmp    12fc <main+0x1ac>
jmp    1301 <main+0x1b1>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x28(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <execve@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1333 <main+0x1e3>
mov    0x2cb7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
jmp    133d <main+0x1ed>
xor    %eax,%eax
mov    %eax,-0x2c(%rbp)
jmp    133d <main+0x1ed>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    134f <main+0x1ff>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    $0x2,%ebp
test   %edi,%edi
jle    1291 <main+0x141>
mov    %rsi,%r15
mov    %edi,%ebx
mov    (%rsi),%rdi
lea    0xe8c(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11da <main+0x8a>
cmp    $0x3,%ebx
jne    1291 <main+0x141>
mov    0x10(%r15),%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
mov    0x8(%r15),%rdi
lea    0xe6a(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11e1 <main+0x91>
mov    0x8(%r15),%rdi
lea    0xe5b(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1227 <main+0xd7>
mov    0x8(%r15),%rdi
lea    0xe4b(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1242 <main+0xf2>
xor    %r12d,%r12d
jmp    1276 <main+0x126>
xor    %ebp,%ebp
jmp    1291 <main+0x141>
lea    0xe20(%rip),%rdi
mov    %r14d,%esi
call   1060 <arg_setup@plt>
mov    %rax,%r12
test   %r14d,%r14d
jle    121a <main+0xca>
mov    %r14d,%ebx
xor    %ebp,%ebp
nopl   (%rax)
mov    $0x1,%edi
xor    %esi,%esi
call   1050 <arg_gen@plt>
mov    %rax,0x10(%r12,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1200 <main+0xb0>
movslq %r14d,%rax
lea    (%r12,%rax,8),%rax
add    $0x10,%rax
jmp    126f <main+0x11f>
lea    0xde0(%rip),%rdi
mov    $0x1,%esi
call   1060 <arg_setup@plt>
mov    %rax,%r12
mov    %r14d,%edi
xor    %esi,%esi
jmp    125e <main+0x10e>
lea    0xdca(%rip),%rdi
mov    $0x1,%esi
call   1060 <arg_setup@plt>
mov    %rax,%r12
mov    %r14d,%edi
mov    $0x20,%esi
call   1050 <arg_gen@plt>
mov    %rax,0x10(%r12)
mov    %r12,%rax
add    $0x18,%rax
movq   $0x0,(%rax)
mov    (%r15),%rdi
mov    %r12,%rsi
xor    %edx,%edx
call   1030 <execve@plt>
mov    %eax,%ebp
mov    0x2d54(%rip),%rax
sar    $0x1f,%ebp
and    (%rax),%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"testing\00"
@.str.1 = [6 x i8] c"count\00"
@.str.2 = [5 x i8] c"size\00"
@.str.3 = [4 x i8] c"hex\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8** null, i8*** %9
%10 = load i32, i32* %4
%11 = icmp sge i32 %10, 1
br i1 %11, label %12, label %19
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %12
store i32 0, i32* %3
br label %99
19: ; preds = %12, %2
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 3
br i1 %21, label %22, label %98
22: ; preds = %19
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = call i32 @atoi(i8* %25)
store i32 %26, i32* %8
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %55
32: ; preds = %22
%33 = load i32, i32* %8
%34 = call i8** @arg_setup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %33)
store i8** %34, i8*** %9
store i32 0, i32* %7
br label %35
35: ; preds = %46, %32
%36 = load i32, i32* %7
%37 = load i32, i32* %8
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %49
39: ; preds = %35
%40 = call i8* @arg_gen(i32 1, i32 0)
%41 = load i8**, i8*** %9
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 2
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %41, i64 %44
store i8* %40, i8** %45
br label %46
46: ; preds = %39
%47 = load i32, i32* %7
%48 = add nsw i32 %47, 1
store i32 %48, i32* %7
br label %35
49: ; preds = %35
%50 = load i8**, i8*** %9
%51 = load i32, i32* %8
%52 = add nsw i32 %51, 2
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %50, i64 %53
store i8* null, i8** %54
br label %85
55: ; preds = %22
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 1
%58 = load i8*, i8** %57
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %69
61: ; preds = %55
%62 = call i8** @arg_setup(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 1)
store i8** %62, i8*** %9
%63 = load i32, i32* %8
%64 = call i8* @arg_gen(i32 %63, i32 0)
%65 = load i8**, i8*** %9
%66 = getelementptr inbounds i8*, i8** %65, i64 2
store i8* %64, i8** %66
%67 = load i8**, i8*** %9
%68 = getelementptr inbounds i8*, i8** %67, i64 3
store i8* null, i8** %68
br label %84
69: ; preds = %55
%70 = load i8**, i8*** %5
%71 = getelementptr inbounds i8*, i8** %70, i64 1
%72 = load i8*, i8** %71
%73 = call i64 @strcmp(i8* %72, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %83
75: ; preds = %69
%76 = call i8** @arg_setup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 1)
store i8** %76, i8*** %9
%77 = load i32, i32* %8
%78 = call i8* @arg_gen(i32 %77, i32 32)
%79 = load i8**, i8*** %9
%80 = getelementptr inbounds i8*, i8** %79, i64 2
store i8* %78, i8** %80
%81 = load i8**, i8*** %9
%82 = getelementptr inbounds i8*, i8** %81, i64 3
store i8* null, i8** %82
br label %83
83: ; preds = %75, %69
br label %84
84: ; preds = %83, %61
br label %85
85: ; preds = %84, %49
%86 = load i8**, i8*** %5
%87 = getelementptr inbounds i8*, i8** %86, i64 0
%88 = load i8*, i8** %87
%89 = load i8**, i8*** %9
%90 = call i32 @execve(i8* %88, i8** %89, i32* null)
store i32 %90, i32* %6
%91 = load i32, i32* %6
%92 = icmp slt i32 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %85
%94 = load i32, i32* @errno
br label %96
95: ; preds = %85
br label %96
96: ; preds = %95, %93
%97 = phi i32 [ %94, %93 ], [ 0, %95 ]
store i32 %97, i32* %3
br label %99
98: ; preds = %19
store i32 2, i32* %3
br label %99
99: ; preds = %98, %96, %18
%100 = load i32, i32* %3
ret i32 %100
}

LLVM IR (-O2):
@.str = [8 x i8] c"testing\00"
@.str.1 = [6 x i8] c"count\00"
@.str.2 = [5 x i8] c"size\00"
@.str.3 = [4 x i8] c"hex\00"
@errno = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %62
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i64 %6, 0
br i1 %7, label %62, label %8
8: ; preds = %4
%9 = icmp eq i32 %0, 3
br i1 %9, label %10, label %62
10: ; preds = %8
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i64 @strcmp(i8* %15, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %34
18: ; preds = %10
%19 = tail call i8** @arg_setup(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%20 = icmp sgt i32 %13, 0
br i1 %20, label %21, label %30
21: ; preds = %18
%22 = zext i32 %13 to i64
br label %23
23: ; preds = %21, %23
%24 = phi i64 [ 0, %21 ], [ %28, %23 ]
%25 = tail call i8* @arg_gen(i32 1, i32 0)
%26 = add nuw nsw i64 %24, 2
%27 = getelementptr inbounds i8*, i8** %19, i64 %26
store i8* %25, i8** %27
%28 = add nuw nsw i64 %24, 1
%29 = icmp eq i64 %28, %22
br i1 %29, label %30, label %23
30: ; preds = %23, %18
%31 = add nsw i32 %13, 2
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %19, i64 %32
br label %52
34: ; preds = %10
%35 = load i8*, i8** %14
%36 = tail call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %43
38: ; preds = %34
%39 = tail call i8** @arg_setup(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 1)
%40 = tail call i8* @arg_gen(i32 %13, i32 0)
%41 = getelementptr inbounds i8*, i8** %39, i64 2
store i8* %40, i8** %41
%42 = getelementptr inbounds i8*, i8** %39, i64 3
br label %52
43: ; preds = %34
%44 = load i8*, i8** %14
%45 = tail call i64 @strcmp(i8* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%46 = icmp eq i64 %45, 0
br i1 %46, label %47, label %55
47: ; preds = %43
%48 = tail call i8** @arg_setup(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 1)
%49 = tail call i8* @arg_gen(i32 %13, i32 32)
%50 = getelementptr inbounds i8*, i8** %48, i64 2
store i8* %49, i8** %50
%51 = getelementptr inbounds i8*, i8** %48, i64 3
br label %52
52: ; preds = %30, %47, %38
%53 = phi i8** [ %42, %38 ], [ %51, %47 ], [ %33, %30 ]
%54 = phi i8** [ %39, %38 ], [ %48, %47 ], [ %19, %30 ]
store i8* null, i8** %53
br label %55
55: ; preds = %52, %43
%56 = phi i8** [ null, %43 ], [ %54, %52 ]
%57 = load i8*, i8** %1
%58 = tail call i32 @execve(i8* %57, i8** %56, i32* null)
%59 = icmp slt i32 %58, 0
%60 = load i32, i32* @errno
%61 = select i1 %59, i32 %60, i32 0
br label %62
62: ; preds = %2, %8, %4, %55
%63 = phi i32 [ %61, %55 ], [ 0, %4 ], [ 2, %8 ], [ 2, %2 ]
ret i32 %63
}