#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 *basename(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int ip6tables_main(int, char **);
int ip6tables_restore_main(int, char **);
int ip6tables_save_main(int, char **);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  char *progname;
  if (argc == 0) {
    fprintf(stderr, "no argv[0]?");
    exit(1);
  } else {
    progname = basename(argv[0]);
    if (!strcmp(progname, "ip6tables") ||
        strcmp(progname, "ip6tables-static") == 0)
      return ip6tables_main(argc, argv);
    if (!strcmp(progname, "ip6tables-save"))
      return ip6tables_save_main(argc, argv);
    if (!strcmp(progname, "ip6tables-restore"))
      return ip6tables_restore_main(argc, argv);
    fprintf(stderr, "ip6tables multi-purpose version: unknown applet name %s\n",
            progname);
    exit(1);
  }
}


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   $0x0,-0x8(%rbp)
jne    11b1 <main+0x41>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
lea    0xe60(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1080 <basename@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe40(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11f5 <main+0x85>
mov    -0x18(%rbp),%rdi
lea    0xe30(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1209 <main+0x99>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <ip6tables_main@plt>
mov    %eax,-0x4(%rbp)
jmp    128a <main+0x11a>
mov    -0x18(%rbp),%rdi
lea    0xe13(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1237 <main+0xc7>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <ip6tables_save_main@plt>
mov    %eax,-0x4(%rbp)
jmp    128a <main+0x11a>
mov    -0x18(%rbp),%rdi
lea    0xdf4(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1265 <main+0xf5>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <ip6tables_restore_main@plt>
mov    %eax,-0x4(%rbp)
jmp    128a <main+0x11a>
mov    0x2d74(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xdcf(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
je     1206 <main+0x96>
mov    %rsi,%r14
mov    %edi,%ebp
mov    (%rsi),%rdi
call   1080 <basename@plt>
mov    %rax,%rbx
lea    0xe79(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11ea <main+0x7a>
lea    0xe6f(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11ea <main+0x7a>
lea    0xe6c(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11f8 <main+0x88>
lea    0xe67(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    1227 <main+0xb7>
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <ip6tables_restore_main@plt>
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <ip6tables_main@plt>
mov    %ebp,%edi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1070 <ip6tables_save_main@plt>
mov    0x2dd3(%rip),%rax
mov    (%rax),%edi
lea    0xdea(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2db2(%rip),%rax
mov    (%rax),%edi
lea    0xe11(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"no argv[0]?\00"
@.str.1 = [10 x i8] c"ip6tables\00"
@.str.2 = [17 x i8] c"ip6tables-static\00"
@.str.3 = [15 x i8] c"ip6tables-save\00"
@.str.4 = [18 x i8] c"ip6tables-restore\00"
@.str.5 = [57 x i8] c"ip6tables multi-purpose version: unknown applet name %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
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, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i8* @basename(i8* %16)
store i8* %17, i8** %6
%18 = load i8*, i8** %6
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %13
%22 = load i8*, i8** %6
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %21, %13
%26 = load i32, i32* %4
%27 = load i8**, i8*** %5
%28 = call i32 @ip6tables_main(i32 %26, i8** %27)
store i32 %28, i32* %3
br label %50
29: ; preds = %21
%30 = load i8*, i8** %6
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp ne i64 %31, 0
br i1 %32, label %37, label %33
33: ; preds = %29
%34 = load i32, i32* %4
%35 = load i8**, i8*** %5
%36 = call i32 @ip6tables_save_main(i32 %34, i8** %35)
store i32 %36, i32* %3
br label %50
37: ; preds = %29
%38 = load i8*, i8** %6
%39 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%40 = icmp ne i64 %39, 0
br i1 %40, label %45, label %41
41: ; preds = %37
%42 = load i32, i32* %4
%43 = load i8**, i8*** %5
%44 = call i32 @ip6tables_restore_main(i32 %42, i8** %43)
store i32 %44, i32* %3
br label %50
45: ; preds = %37
%46 = load i32, i32* @stderr
%47 = load i8*, i8** %6
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0), i8* %47)
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %41, %33, %25
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"no argv[0]?\00"
@.str.1 = [10 x i8] c"ip6tables\00"
@.str.2 = [17 x i8] c"ip6tables-static\00"
@.str.3 = [15 x i8] c"ip6tables-save\00"
@.str.4 = [18 x i8] c"ip6tables-restore\00"
@.str.5 = [57 x i8] c"ip6tables multi-purpose version: unknown applet name %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i8* @basename(i8* %9)
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %16, label %13
13: ; preds = %8
%14 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13, %8
%17 = tail call i32 @ip6tables_main(i32 %0, i8** %1)
br label %32
18: ; preds = %13
%19 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = tail call i32 @ip6tables_save_main(i32 %0, i8** %1)
br label %32
23: ; preds = %18
%24 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = tail call i32 @ip6tables_restore_main(i32 %0, i8** %1)
br label %32
28: ; preds = %23
%29 = load i32, i32* @stderr
%30 = tail call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.5, i64 0, i64 0), i8* %10)
%31 = tail call i32 @exit(i32 1)
unreachable
32: ; preds = %26, %21, %16
%33 = phi i32 [ %17, %16 ], [ %27, %26 ], [ %22, %21 ]
ret i32 %33
}