#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*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ matches(char *, char *);
int netns_add(int, char **);
int netns_delete(int, char **);
int netns_exec(int, char **);
int netns_identify(int, char **);
int netns_list(int, char **);
int netns_monitor(int, char **);
int netns_pids(int, char **);
int /*<<< orphan*/ stderr;
int usage();
int do_netns(int argc, char **argv) {
  if (argc < 1)
    return netns_list(0, NULL);
  if ((matches(*argv, "list") == 0) || (matches(*argv, "show") == 0) ||
      (matches(*argv, "lst") == 0))
    return netns_list(argc - 1, argv + 1);
  if (matches(*argv, "help") == 0)
    return usage();
  if (matches(*argv, "add") == 0)
    return netns_add(argc - 1, argv + 1);
  if (matches(*argv, "delete") == 0)
    return netns_delete(argc - 1, argv + 1);
  if (matches(*argv, "identify") == 0)
    return netns_identify(argc - 1, argv + 1);
  if (matches(*argv, "pids") == 0)
    return netns_pids(argc - 1, argv + 1);
  if (matches(*argv, "exec") == 0)
    return netns_exec(argc - 1, argv + 1);
  if (matches(*argv, "monitor") == 0)
    return netns_monitor(argc - 1, argv + 1);
  fprintf(stderr, "Command \"%s\" is unknown, try \"ip netns help\".\n", *argv);
  exit(-1);
}


x86 assembly (clang, -O0):
<do_netns>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    11dc <do_netns+0x2c>
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%esi
call   10d0 <netns_list@plt>
mov    %eax,-0x4(%rbp)
jmp    13f0 <do_netns+0x240>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe16(%rip),%rsi
call   1050 <matches@plt>
cmp    $0x0,%rax
je     1233 <do_netns+0x83>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdfe(%rip),%rsi
call   1050 <matches@plt>
cmp    $0x0,%rax
je     1233 <do_netns+0x83>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xde6(%rip),%rsi
call   1050 <matches@plt>
cmp    $0x0,%rax
jne    124e <do_netns+0x9e>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   10d0 <netns_list@plt>
mov    %eax,-0x4(%rbp)
jmp    13f0 <do_netns+0x240>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xdb2(%rip),%rsi
call   1050 <matches@plt>
cmp    $0x0,%rax
jne    127a <do_netns+0xca>
mov    $0x0,%al
call   1090 <usage@plt>
mov    %eax,-0x4(%rbp)
jmp    13f0 <do_netns+0x240>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd8b(%rip),%rsi
call   1050 <matches@plt>
cmp    $0x0,%rax
jne    12b2 <do_netns+0x102>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1070 <netns_add@plt>
mov    %eax,-0x4(%rbp)
jmp    13f0 <do_netns+0x240>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd57(%rip),%rsi
call   1050 <matches@plt>
cmp    $0x0,%rax
jne    12ea <do_netns+0x13a>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1030 <netns_delete@plt>
mov    %eax,-0x4(%rbp)
jmp    13f0 <do_netns+0x240>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xd26(%rip),%rsi
call   1050 <matches@plt>
cmp    $0x0,%rax
jne    1322 <do_netns+0x172>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1040 <netns_identify@plt>
mov    %eax,-0x4(%rbp)
jmp    13f0 <do_netns+0x240>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xcf7(%rip),%rsi
call   1050 <matches@plt>
cmp    $0x0,%rax
jne    135a <do_netns+0x1aa>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   10a0 <netns_pids@plt>
mov    %eax,-0x4(%rbp)
jmp    13f0 <do_netns+0x240>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xcc4(%rip),%rsi
call   1050 <matches@plt>
cmp    $0x0,%rax
jne    1392 <do_netns+0x1e2>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1060 <netns_exec@plt>
mov    %eax,-0x4(%rbp)
jmp    13f0 <do_netns+0x240>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xc91(%rip),%rsi
call   1050 <matches@plt>
cmp    $0x0,%rax
jne    13ca <do_netns+0x21a>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   10b0 <netns_monitor@plt>
mov    %eax,-0x4(%rbp)
jmp    13f0 <do_netns+0x240>
mov    0x2c0f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xc58(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_netns>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    12d5 <do_netns+0x125>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    (%rsi),%rdi
lea    0xe36(%rip),%rsi
call   1050 <matches@plt>
test   %rax,%rax
je     12c7 <do_netns+0x117>
mov    (%rbx),%rdi
lea    0xe23(%rip),%rsi
call   1050 <matches@plt>
test   %rax,%rax
je     12c7 <do_netns+0x117>
mov    (%rbx),%rdi
lea    0xe10(%rip),%rsi
call   1050 <matches@plt>
test   %rax,%rax
je     12c7 <do_netns+0x117>
mov    (%rbx),%rdi
lea    0xdfc(%rip),%rsi
call   1050 <matches@plt>
test   %rax,%rax
je     12e4 <do_netns+0x134>
mov    (%rbx),%rdi
lea    0xde9(%rip),%rsi
call   1050 <matches@plt>
test   %rax,%rax
je     12f1 <do_netns+0x141>
mov    (%rbx),%rdi
lea    0xdd5(%rip),%rsi
call   1050 <matches@plt>
test   %rax,%rax
je     1308 <do_netns+0x158>
mov    (%rbx),%rdi
lea    0xdc4(%rip),%rsi
call   1050 <matches@plt>
test   %rax,%rax
je     131f <do_netns+0x16f>
mov    (%rbx),%rdi
lea    0xdb5(%rip),%rsi
call   1050 <matches@plt>
test   %rax,%rax
je     1336 <do_netns+0x186>
mov    (%rbx),%rdi
lea    0xda2(%rip),%rsi
call   1050 <matches@plt>
test   %rax,%rax
je     134d <do_netns+0x19d>
mov    (%rbx),%rdi
lea    0xd8f(%rip),%rsi
call   1050 <matches@plt>
test   %rax,%rax
jne    1364 <do_netns+0x1b4>
add    $0xffffffff,%ebp
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    10b0 <netns_monitor@plt>
add    $0xffffffff,%ebp
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
jmp    12d9 <do_netns+0x129>
xor    %edi,%edi
xor    %esi,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    10d0 <netns_list@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1090 <usage@plt>
add    $0xffffffff,%ebp
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <netns_add@plt>
add    $0xffffffff,%ebp
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <netns_delete@plt>
add    $0xffffffff,%ebp
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <netns_identify@plt>
add    $0xffffffff,%ebp
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    10a0 <netns_pids@plt>
add    $0xffffffff,%ebp
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <netns_exec@plt>
mov    0x2c75(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xcc2(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"list\00"
@.str.1 = [5 x i8] c"show\00"
@.str.2 = [4 x i8] c"lst\00"
@.str.3 = [5 x i8] c"help\00"
@.str.4 = [4 x i8] c"add\00"
@.str.5 = [7 x i8] c"delete\00"
@.str.6 = [9 x i8] c"identify\00"
@.str.7 = [5 x i8] c"pids\00"
@.str.8 = [5 x i8] c"exec\00"
@.str.9 = [8 x i8] c"monitor\00"
@stderr = global i32 0
@.str.10 = [47 x i8] c"Command \22%s\22 is unknown, try \22ip netns help\22.\0A\00"
define i32 @do_netns(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @netns_list(i32 0, i8** null)
store i32 %9, i32* %3
br label %110
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = call i64 @matches(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %25, label %15
15: ; preds = %10
%16 = load i8**, i8*** %5
%17 = load i8*, i8** %16
%18 = call i64 @matches(i8* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %25, label %20
20: ; preds = %15
%21 = load i8**, i8*** %5
%22 = load i8*, i8** %21
%23 = call i64 @matches(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %20, %15, %10
%26 = load i32, i32* %4
%27 = sub nsw i32 %26, 1
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = call i32 @netns_list(i32 %27, i8** %29)
store i32 %30, i32* %3
br label %110
31: ; preds = %20
%32 = load i8**, i8*** %5
%33 = load i8*, i8** %32
%34 = call i64 @matches(i8* %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 (...) @usage()
store i32 %37, i32* %3
br label %110
38: ; preds = %31
%39 = load i8**, i8*** %5
%40 = load i8*, i8** %39
%41 = call i64 @matches(i8* %40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %49
43: ; preds = %38
%44 = load i32, i32* %4
%45 = sub nsw i32 %44, 1
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 1
%48 = call i32 @netns_add(i32 %45, i8** %47)
store i32 %48, i32* %3
br label %110
49: ; preds = %38
%50 = load i8**, i8*** %5
%51 = load i8*, i8** %50
%52 = call i64 @matches(i8* %51, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %60
54: ; preds = %49
%55 = load i32, i32* %4
%56 = sub nsw i32 %55, 1
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 1
%59 = call i32 @netns_delete(i32 %56, i8** %58)
store i32 %59, i32* %3
br label %110
60: ; preds = %49
%61 = load i8**, i8*** %5
%62 = load i8*, i8** %61
%63 = call i64 @matches(i8* %62, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %71
65: ; preds = %60
%66 = load i32, i32* %4
%67 = sub nsw i32 %66, 1
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 1
%70 = call i32 @netns_identify(i32 %67, i8** %69)
store i32 %70, i32* %3
br label %110
71: ; preds = %60
%72 = load i8**, i8*** %5
%73 = load i8*, i8** %72
%74 = call i64 @matches(i8* %73, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %82
76: ; preds = %71
%77 = load i32, i32* %4
%78 = sub nsw i32 %77, 1
%79 = load i8**, i8*** %5
%80 = getelementptr inbounds i8*, i8** %79, i64 1
%81 = call i32 @netns_pids(i32 %78, i8** %80)
store i32 %81, i32* %3
br label %110
82: ; preds = %71
%83 = load i8**, i8*** %5
%84 = load i8*, i8** %83
%85 = call i64 @matches(i8* %84, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%86 = icmp eq i64 %85, 0
br i1 %86, label %87, label %93
87: ; preds = %82
%88 = load i32, i32* %4
%89 = sub nsw i32 %88, 1
%90 = load i8**, i8*** %5
%91 = getelementptr inbounds i8*, i8** %90, i64 1
%92 = call i32 @netns_exec(i32 %89, i8** %91)
store i32 %92, i32* %3
br label %110
93: ; preds = %82
%94 = load i8**, i8*** %5
%95 = load i8*, i8** %94
%96 = call i64 @matches(i8* %95, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %104
98: ; preds = %93
%99 = load i32, i32* %4
%100 = sub nsw i32 %99, 1
%101 = load i8**, i8*** %5
%102 = getelementptr inbounds i8*, i8** %101, i64 1
%103 = call i32 @netns_monitor(i32 %100, i8** %102)
store i32 %103, i32* %3
br label %110
104: ; preds = %93
%105 = load i32, i32* @stderr
%106 = load i8**, i8*** %5
%107 = load i8*, i8** %106
%108 = call i32 @fprintf(i32 %105, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.10, i64 0, i64 0), i8* %107)
%109 = call i32 @exit(i32 -1)
unreachable
110: ; preds = %98, %87, %76, %65, %54, %43, %36, %25, %8
%111 = load i32, i32* %3
ret i32 %111
}

LLVM IR (-O2):
@.str = [5 x i8] c"list\00"
@.str.1 = [5 x i8] c"show\00"
@.str.2 = [4 x i8] c"lst\00"
@.str.3 = [5 x i8] c"help\00"
@.str.4 = [4 x i8] c"add\00"
@.str.5 = [7 x i8] c"delete\00"
@.str.6 = [9 x i8] c"identify\00"
@.str.7 = [5 x i8] c"pids\00"
@.str.8 = [5 x i8] c"exec\00"
@.str.9 = [8 x i8] c"monitor\00"
@stderr = global i32 0
@.str.10 = [47 x i8] c"Command \22%s\22 is unknown, try \22ip netns help\22.\0A\00"
define i32 @do_netns(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @netns_list(i32 0, i8** null)
br label %81
6: ; preds = %2
%7 = load i8*, i8** %1
%8 = tail call i64 @matches(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %18, label %10
10: ; preds = %6
%11 = load i8*, i8** %1
%12 = tail call i64 @matches(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i8*, i8** %1
%16 = tail call i64 @matches(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %14, %10, %6
%19 = add nsw i32 %0, -1
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = tail call i32 @netns_list(i32 %19, i8** %20)
br label %81
22: ; preds = %14
%23 = load i8*, i8** %1
%24 = tail call i64 @matches(i8* %23, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = tail call i32 (...) @usage()
br label %81
28: ; preds = %22
%29 = load i8*, i8** %1
%30 = tail call i64 @matches(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %36
32: ; preds = %28
%33 = add nsw i32 %0, -1
%34 = getelementptr inbounds i8*, i8** %1, i64 1
%35 = tail call i32 @netns_add(i32 %33, i8** %34)
br label %81
36: ; preds = %28
%37 = load i8*, i8** %1
%38 = tail call i64 @matches(i8* %37, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %44
40: ; preds = %36
%41 = add nsw i32 %0, -1
%42 = getelementptr inbounds i8*, i8** %1, i64 1
%43 = tail call i32 @netns_delete(i32 %41, i8** %42)
br label %81
44: ; preds = %36
%45 = load i8*, i8** %1
%46 = tail call i64 @matches(i8* %45, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %44
%49 = add nsw i32 %0, -1
%50 = getelementptr inbounds i8*, i8** %1, i64 1
%51 = tail call i32 @netns_identify(i32 %49, i8** %50)
br label %81
52: ; preds = %44
%53 = load i8*, i8** %1
%54 = tail call i64 @matches(i8* %53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %60
56: ; preds = %52
%57 = add nsw i32 %0, -1
%58 = getelementptr inbounds i8*, i8** %1, i64 1
%59 = tail call i32 @netns_pids(i32 %57, i8** %58)
br label %81
60: ; preds = %52
%61 = load i8*, i8** %1
%62 = tail call i64 @matches(i8* %61, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %68
64: ; preds = %60
%65 = add nsw i32 %0, -1
%66 = getelementptr inbounds i8*, i8** %1, i64 1
%67 = tail call i32 @netns_exec(i32 %65, i8** %66)
br label %81
68: ; preds = %60
%69 = load i8*, i8** %1
%70 = tail call i64 @matches(i8* %69, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0))
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %68
%73 = add nsw i32 %0, -1
%74 = getelementptr inbounds i8*, i8** %1, i64 1
%75 = tail call i32 @netns_monitor(i32 %73, i8** %74)
br label %81
76: ; preds = %68
%77 = load i32, i32* @stderr
%78 = load i8*, i8** %1
%79 = tail call i32 @fprintf(i32 %77, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.10, i64 0, i64 0), i8* %78)
%80 = tail call i32 @exit(i32 -1)
unreachable
81: ; preds = %72, %64, %56, %48, %40, %32, %26, %18, %4
%82 = phi i32 [ %5, %4 ], [ %21, %18 ], [ %27, %26 ], [ %35, %32 ], [ %43, %40 ], [ %51, %48 ], [ %59, %56 ], [ %67, %64 ], [ %75, %72 ]
ret i32 %82
}