#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 mroute_list(int, char **);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ usage();
int do_multiroute(int argc, char **argv) {
  if (argc < 1)
    return mroute_list(0, NULL);
  if (matches(*argv, "list") == 0 || matches(*argv, "show") == 0 ||
      matches(*argv, "lst") == 0)
    return mroute_list(argc - 1, argv + 1);
  if (matches(*argv, "help") == 0)
    usage();
  fprintf(stderr, "Command \"%s\" is unknown, try \"ip mroute help\".\n",
          *argv);
  exit(-1);
}


x86 assembly (clang, -O0):
<do_multiroute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    117c <do_multiroute+0x2c>
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <mroute_list@plt>
mov    %eax,-0x4(%rbp)
jmp    1238 <do_multiroute+0xe8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe76(%rip),%rsi
call   1030 <matches@plt>
cmp    $0x0,%rax
je     11d3 <do_multiroute+0x83>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe5e(%rip),%rsi
call   1030 <matches@plt>
cmp    $0x0,%rax
je     11d3 <do_multiroute+0x83>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe46(%rip),%rsi
call   1030 <matches@plt>
cmp    $0x0,%rax
jne    11ee <do_multiroute+0x9e>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1050 <mroute_list@plt>
mov    %eax,-0x4(%rbp)
jmp    1238 <do_multiroute+0xe8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe12(%rip),%rsi
call   1030 <matches@plt>
cmp    $0x0,%rax
jne    1212 <do_multiroute+0xc2>
mov    $0x0,%al
call   1060 <usage@plt>
mov    0x2dc7(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdea(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_multiroute>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    11a6 <do_multiroute+0x56>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    (%rsi),%rdi
lea    0xe9a(%rip),%rsi
call   1030 <matches@plt>
test   %rax,%rax
je     1198 <do_multiroute+0x48>
mov    (%rbx),%rdi
lea    0xe8b(%rip),%rsi
call   1030 <matches@plt>
test   %rax,%rax
je     1198 <do_multiroute+0x48>
mov    (%rbx),%rdi
lea    0xe7c(%rip),%rsi
call   1030 <matches@plt>
test   %rax,%rax
jne    11b5 <do_multiroute+0x65>
add    $0xffffffff,%ebp
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
jmp    11aa <do_multiroute+0x5a>
xor    %edi,%edi
xor    %esi,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <mroute_list@plt>
mov    (%rbx),%rdi
lea    0xe4f(%rip),%rsi
call   1030 <matches@plt>
test   %rax,%rax
jne    11d0 <do_multiroute+0x80>
xor    %eax,%eax
call   1060 <usage@plt>
mov    0x2e09(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe30(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1070 <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"
@stderr = global i32 0
@.str.4 = [48 x i8] c"Command \22%s\22 is unknown, try \22ip mroute help\22.\0A\00"
define i32 @do_multiroute(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 @mroute_list(i32 0, i8** null)
store i32 %9, i32* %3
br label %44
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 @mroute_list(i32 %27, i8** %29)
store i32 %30, i32* %3
br label %44
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()
br label %38
38: ; preds = %36, %31
%39 = load i32, i32* @stderr
%40 = load i8**, i8*** %5
%41 = load i8*, i8** %40
%42 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i8* %41)
%43 = call i32 @exit(i32 -1)
unreachable
44: ; preds = %25, %8
%45 = load i32, i32* %3
ret i32 %45
}

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"
@stderr = global i32 0
@.str.4 = [48 x i8] c"Command \22%s\22 is unknown, try \22ip mroute help\22.\0A\00"
define i32 @do_multiroute(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @mroute_list(i32 0, i8** null)
br label %33
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 @mroute_list(i32 %19, i8** %20)
br label %33
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 %28
28: ; preds = %26, %22
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %1
%31 = tail call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.4, i64 0, i64 0), i8* %30)
%32 = tail call i32 @exit(i32 -1)
unreachable
33: ; preds = %18, %4
%34 = phi i32 [ %5, %4 ], [ %21, %18 ]
ret i32 %34
}