#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_FAILURE;
char *basename(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int iptables_main(int, char **);
int iptables_restore_main(int, char **);
int iptables_save_main(int, char **);
int iptables_xml_main(int, char **);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  char *progname;
  if (argc < 1) {
    fprintf(stderr, "ERROR: This should not happen.\n");
    exit(EXIT_FAILURE);
  }
  progname = basename(argv[0]);
  if (strcmp(progname, "iptables") == 0)
    return iptables_main(argc, argv);
  if (strcmp(progname, "iptables-save") == 0)
    return iptables_save_main(argc, argv);
  if (strcmp(progname, "iptables-restore") == 0)
    return iptables_restore_main(argc, argv);
  if (strcmp(progname, "iptables-xml") == 0)
    return iptables_xml_main(argc, argv);
  ++argv;
  --argc;
  if (argc < 1) {
    fprintf(stderr, "ERROR: No subcommand given.\n");
    exit(EXIT_FAILURE);
  }
  progname = basename(argv[0]);
  if (strcmp(progname, "main") == 0)
    return iptables_main(argc, argv);
  if (strcmp(progname, "save") == 0)
    return iptables_save_main(argc, argv);
  if (strcmp(progname, "restore") == 0)
    return iptables_restore_main(argc, argv);
  if (strcmp(progname, "xml") == 0)
    return iptables_xml_main(argc, argv);
  fprintf(stderr,
          "iptables multi-purpose version: "
          "unknown subcommand \"%s\"\n",
          progname);
  exit(EXIT_FAILURE);
}


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)
jge    11c5 <main+0x45>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xe50(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e1a(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <basename@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe40(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1203 <main+0x83>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <iptables_main@plt>
mov    %eax,-0x4(%rbp)
jmp    13c2 <main+0x242>
mov    -0x18(%rbp),%rdi
lea    0xe1b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1231 <main+0xb1>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1090 <iptables_save_main@plt>
mov    %eax,-0x4(%rbp)
jmp    13c2 <main+0x242>
mov    -0x18(%rbp),%rdi
lea    0xdfb(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    125f <main+0xdf>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <iptables_restore_main@plt>
mov    %eax,-0x4(%rbp)
jmp    13c2 <main+0x242>
mov    -0x18(%rbp),%rdi
lea    0xdde(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    128d <main+0x10d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10a0 <iptables_xml_main@plt>
mov    %eax,-0x4(%rbp)
jmp    13c2 <main+0x242>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    12d1 <main+0x151>
mov    0x2d2d(%rip),%rax
mov    (%rax),%edi
lea    0xd99(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d0e(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <basename@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xd86(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    130f <main+0x18f>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <iptables_main@plt>
mov    %eax,-0x4(%rbp)
jmp    13c2 <main+0x242>
mov    -0x18(%rbp),%rdi
lea    0xd18(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    133d <main+0x1bd>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1090 <iptables_save_main@plt>
mov    %eax,-0x4(%rbp)
jmp    13c2 <main+0x242>
mov    -0x18(%rbp),%rdi
lea    0xcf8(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    136b <main+0x1eb>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <iptables_restore_main@plt>
mov    %eax,-0x4(%rbp)
jmp    13c2 <main+0x242>
mov    -0x18(%rbp),%rdi
lea    0xcdb(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1399 <main+0x219>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10a0 <iptables_xml_main@plt>
mov    %eax,-0x4(%rbp)
jmp    13c2 <main+0x242>
mov    0x2c40(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xcca(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2c1d(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    12ba <main+0x13a>
mov    %rsi,%r15
mov    %edi,%ebp
mov    (%rsi),%rdi
call   1060 <basename@plt>
mov    %rax,%rbx
lea    0xe7a(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     127e <main+0xfe>
lea    0xe6b(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1292 <main+0x112>
lea    0xe61(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12a6 <main+0x126>
lea    0xe5a(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     126a <main+0xea>
cmp    $0x1,%ebp
jbe    12df <main+0x15f>
add    $0x8,%r15
add    $0xffffffff,%ebp
mov    (%r15),%rdi
call   1060 <basename@plt>
mov    %rax,%r14
lea    0xe55(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     127e <main+0xfe>
lea    0xe01(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1292 <main+0x112>
lea    0xdfb(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12a6 <main+0x126>
lea    0xdf8(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    12f1 <main+0x171>
mov    %ebp,%edi
mov    %r15,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    10a0 <iptables_xml_main@plt>
mov    %ebp,%edi
mov    %r15,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <iptables_main@plt>
mov    %ebp,%edi
mov    %r15,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1090 <iptables_save_main@plt>
mov    %ebp,%edi
mov    %r15,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <iptables_restore_main@plt>
mov    0x2d1f(%rip),%rax
mov    (%rax),%edi
lea    0xd36(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x2d00(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
mov    0x2cfa(%rip),%rax
mov    (%rax),%edi
lea    0xd66(%rip),%rsi
jmp    12ca <main+0x14a>
mov    0x2ce8(%rip),%rax
mov    (%rax),%edi
lea    0xd76(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    12d1 <main+0x151>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"ERROR: This should not happen.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [9 x i8] c"iptables\00"
@.str.2 = [14 x i8] c"iptables-save\00"
@.str.3 = [17 x i8] c"iptables-restore\00"
@.str.4 = [13 x i8] c"iptables-xml\00"
@.str.5 = [29 x i8] c"ERROR: No subcommand given.\0A\00"
@.str.6 = [5 x i8] c"main\00"
@.str.7 = [5 x i8] c"save\00"
@.str.8 = [8 x i8] c"restore\00"
@.str.9 = [4 x i8] c"xml\00"
@.str.10 = [57 x i8] c"iptables multi-purpose version: unknown subcommand \22%s\22\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 slt i32 %7, 1
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i8* @basename(i8* %17)
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %14
%23 = load i32, i32* %4
%24 = load i8**, i8*** %5
%25 = call i32 @iptables_main(i32 %23, i8** %24)
store i32 %25, i32* %3
br label %104
26: ; preds = %14
%27 = load i8*, i8** %6
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = load i32, i32* %4
%32 = load i8**, i8*** %5
%33 = call i32 @iptables_save_main(i32 %31, i8** %32)
store i32 %33, i32* %3
br label %104
34: ; preds = %26
%35 = load i8*, i8** %6
%36 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %34
%39 = load i32, i32* %4
%40 = load i8**, i8*** %5
%41 = call i32 @iptables_restore_main(i32 %39, i8** %40)
store i32 %41, i32* %3
br label %104
42: ; preds = %34
%43 = load i8*, i8** %6
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %42
%47 = load i32, i32* %4
%48 = load i8**, i8*** %5
%49 = call i32 @iptables_xml_main(i32 %47, i8** %48)
store i32 %49, i32* %3
br label %104
50: ; preds = %42
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i32 1
store i8** %52, i8*** %5
%53 = load i32, i32* %4
%54 = add nsw i32 %53, -1
store i32 %54, i32* %4
%55 = load i32, i32* %4
%56 = icmp slt i32 %55, 1
br i1 %56, label %57, label %62
57: ; preds = %50
%58 = load i32, i32* @stderr
%59 = call i32 (i32, i8*, ...) @fprintf(i32 %58, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%60 = load i32, i32* @EXIT_FAILURE
%61 = call i32 @exit(i32 %60)
unreachable
62: ; preds = %50
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 0
%65 = load i8*, i8** %64
%66 = call i8* @basename(i8* %65)
store i8* %66, i8** %6
%67 = load i8*, i8** %6
%68 = call i64 @strcmp(i8* %67, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %74
70: ; preds = %62
%71 = load i32, i32* %4
%72 = load i8**, i8*** %5
%73 = call i32 @iptables_main(i32 %71, i8** %72)
store i32 %73, i32* %3
br label %104
74: ; preds = %62
%75 = load i8*, i8** %6
%76 = call i64 @strcmp(i8* %75, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %82
78: ; preds = %74
%79 = load i32, i32* %4
%80 = load i8**, i8*** %5
%81 = call i32 @iptables_save_main(i32 %79, i8** %80)
store i32 %81, i32* %3
br label %104
82: ; preds = %74
%83 = load i8*, i8** %6
%84 = call i64 @strcmp(i8* %83, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %90
86: ; preds = %82
%87 = load i32, i32* %4
%88 = load i8**, i8*** %5
%89 = call i32 @iptables_restore_main(i32 %87, i8** %88)
store i32 %89, i32* %3
br label %104
90: ; preds = %82
%91 = load i8*, i8** %6
%92 = call i64 @strcmp(i8* %91, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%93 = icmp eq i64 %92, 0
br i1 %93, label %94, label %98
94: ; preds = %90
%95 = load i32, i32* %4
%96 = load i8**, i8*** %5
%97 = call i32 @iptables_xml_main(i32 %95, i8** %96)
store i32 %97, i32* %3
br label %104
98: ; preds = %90
%99 = load i32, i32* @stderr
%100 = load i8*, i8** %6
%101 = call i32 (i32, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.10, i64 0, i64 0), i8* %100)
%102 = load i32, i32* @EXIT_FAILURE
%103 = call i32 @exit(i32 %102)
unreachable
104: ; preds = %94, %86, %78, %70, %46, %38, %30, %22
%105 = load i32, i32* %3
ret i32 %105
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"ERROR: This should not happen.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [9 x i8] c"iptables\00"
@.str.2 = [14 x i8] c"iptables-save\00"
@.str.3 = [17 x i8] c"iptables-restore\00"
@.str.4 = [13 x i8] c"iptables-xml\00"
@.str.5 = [29 x i8] c"ERROR: No subcommand given.\0A\00"
@.str.6 = [5 x i8] c"main\00"
@.str.7 = [5 x i8] c"save\00"
@.str.8 = [8 x i8] c"restore\00"
@.str.9 = [4 x i8] c"xml\00"
@.str.10 = [57 x i8] c"iptables multi-purpose version: unknown subcommand \22%s\22\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp slt i32 %0, 1
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = load i8*, i8** %1
%11 = tail call i8* @basename(i8* %10)
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %9
%15 = tail call i32 @iptables_main(i32 %0, i8** %1)
br label %67
16: ; preds = %9
%17 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i32 @iptables_save_main(i32 %0, i8** %1)
br label %67
21: ; preds = %16
%22 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = tail call i32 @iptables_restore_main(i32 %0, i8** %1)
br label %67
26: ; preds = %21
%27 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = tail call i32 @iptables_xml_main(i32 %0, i8** %1)
br label %67
31: ; preds = %26
%32 = getelementptr inbounds i8*, i8** %1, i64 1
%33 = add nsw i32 %0, -1
%34 = icmp ult i32 %0, 2
br i1 %34, label %35, label %40
35: ; preds = %31
%36 = load i32, i32* @stderr
%37 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%38 = load i32, i32* @EXIT_FAILURE
%39 = tail call i32 @exit(i32 %38)
unreachable
40: ; preds = %31
%41 = load i8*, i8** %32
%42 = tail call i8* @basename(i8* %41)
%43 = tail call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %47
45: ; preds = %40
%46 = tail call i32 @iptables_main(i32 %33, i8** %32)
br label %67
47: ; preds = %40
%48 = tail call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = tail call i32 @iptables_save_main(i32 %33, i8** %32)
br label %67
52: ; preds = %47
%53 = tail call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = tail call i32 @iptables_restore_main(i32 %33, i8** %32)
br label %67
57: ; preds = %52
%58 = tail call i64 @strcmp(i8* %42, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
%59 = icmp eq i64 %58, 0
br i1 %59, label %60, label %62
60: ; preds = %57
%61 = tail call i32 @iptables_xml_main(i32 %33, i8** %32)
br label %67
62: ; preds = %57
%63 = load i32, i32* @stderr
%64 = tail call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.10, i64 0, i64 0), i8* %42)
%65 = load i32, i32* @EXIT_FAILURE
%66 = tail call i32 @exit(i32 %65)
unreachable
67: ; preds = %60, %55, %50, %45, %29, %24, %19, %14
%68 = phi i32 [ %15, %14 ], [ %20, %19 ], [ %25, %24 ], [ %30, %29 ], [ %46, %45 ], [ %51, %50 ], [ %56, %55 ], [ %61, %60 ]
ret i32 %68
}