#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned int name_type;
  unsigned int VID;
  unsigned int skb_priority;
};
struct vlan_ioctl_args {
  unsigned short vlan_qos;
  int /*<<< orphan*/ cmd;
  TYPE_1__ u;
  int /*<<< orphan*/ device1;
};

/* Variables and functions */
int /*<<< orphan*/ ADD_VLAN_CMD;
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ DEL_VLAN_CMD;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ SET_VLAN_EGRESS_PRIORITY_CMD;
int /*<<< orphan*/ SET_VLAN_FLAG_CMD;
int /*<<< orphan*/ SET_VLAN_INGRESS_PRIORITY_CMD;
int /*<<< orphan*/ SET_VLAN_NAME_TYPE_CMD;
int /*<<< orphan*/ SIOCSIFVLAN;
int /*<<< orphan*/ SOCK_STREAM;
unsigned int VLAN_NAME_TYPE_PLUS_VID;
unsigned int VLAN_NAME_TYPE_PLUS_VID_NO_PAD;
unsigned int VLAN_NAME_TYPE_RAW_PLUS_VID;
unsigned int VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD;
void *atoi(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ ioctl(int, int /*<<< orphan*/, struct vlan_ioctl_args *);
int /*<<< orphan*/ memset(struct vlan_ioctl_args *, int /*<<< orphan*/, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ show_usage();
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ strcasecmp(char *, char *);
int /*<<< orphan*/ strcpy(int /*<<< orphan*/, char *);
char *strerror(int /*<<< orphan*/);
int strlen(char *);
int main(int argc, char **argv) {
  int fd;
  struct vlan_ioctl_args if_request;
  char *cmd = NULL;
  char *if_name = NULL;
  unsigned int vid = 0;
  unsigned int skb_priority;
  unsigned short vlan_qos;
  unsigned int nm_type = VLAN_NAME_TYPE_PLUS_VID;
  char *conf_file_name = "/proc/net/vlan/config";
  memset(&if_request, 0, sizeof(struct vlan_ioctl_args));
  if ((argc < 3) || (argc > 5)) {
    fprintf(stdout, "Expecting argc to be 3-5, inclusive.  Was: %d\n", argc);
    show_usage();
    exit(1);
  } else {
    cmd = argv[1];
    if (strcasecmp(cmd, "set_name_type") == 0) {
      if (strcasecmp(argv[2], "VLAN_PLUS_VID") == 0) {
        nm_type = VLAN_NAME_TYPE_PLUS_VID;
      } else if (strcasecmp(argv[2], "VLAN_PLUS_VID_NO_PAD") == 0) {
        nm_type = VLAN_NAME_TYPE_PLUS_VID_NO_PAD;
      } else if (strcasecmp(argv[2], "DEV_PLUS_VID") == 0) {
        nm_type = VLAN_NAME_TYPE_RAW_PLUS_VID;
      } else if (strcasecmp(argv[2], "DEV_PLUS_VID_NO_PAD") == 0) {
        nm_type = VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD;
      } else {
        fprintf(stderr, "Invalid name type.\n");
        show_usage();
        exit(1);
      }
      if_request.u.name_type = nm_type;
    } else {
      if_name = argv[2];
      if (strlen(if_name) > 15) {
        fprintf(stderr, "ERROR:  if_name must be 15 characters or less.\n");
        exit(1);
      }
      strcpy(if_request.device1, if_name);
    }
    if (argc == 4) {
      vid = atoi(argv[3]);
      if_request.u.VID = vid;
    }
    if (argc == 5) {
      skb_priority = atoi(argv[3]);
      vlan_qos = atoi(argv[4]);
      if_request.u.skb_priority = skb_priority;
      if_request.vlan_qos = vlan_qos;
    }
  }
  if ((fd = open(conf_file_name, O_RDONLY)) < 0) {
    fprintf(stderr,
            "WARNING:  Could not open /proc/net/vlan/config.  Maybe you need "
            "to load the 8021q module, or maybe you are not using PROCFS??\n");
  } else {
    close(fd);
  }
  if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    fprintf(stderr, "FATAL:  Couldn't open a socket..go figure!\n");
    exit(2);
  }
  if (strcasecmp(cmd, "add") == 0) {
    if_request.cmd = ADD_VLAN_CMD;
    if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
      fprintf(stderr, "ERROR: trying to add VLAN #%u to IF -:%s:-  error: %s\n",
              vid, if_name, strerror(errno));
      exit(3);
    } else {
      fprintf(stdout, "Added VLAN with VID == %u to IF -:%s:-\n", vid, if_name);
      if (vid == 1) {
        fprintf(stdout,
                "WARNING:  VLAN 1 does not work with many switches,\nconsider "
                "another number if you have problems.\n");
      }
    }
  } else if (strcasecmp(cmd, "rem") == 0) {
    if_request.cmd = DEL_VLAN_CMD;
    if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
      fprintf(stderr, "ERROR: trying to remove VLAN -:%s:- error: %s\n",
              if_name, strerror(errno));
      exit(4);
    } else {
      fprintf(stdout, "Removed VLAN -:%s:-\n", if_name);
    }
  } else if (strcasecmp(cmd, "set_egress_map") == 0) {
    if_request.cmd = SET_VLAN_EGRESS_PRIORITY_CMD;
    if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
      fprintf(stderr,
              "ERROR: trying to set egress map on device -:%s:- error: %s\n",
              if_name, strerror(errno));
      exit(5);
    } else {
      fprintf(stdout,
              "Set egress mapping on device -:%s:- "
              "Should be visible in /proc/net/vlan/%s\n",
              if_name, if_name);
    }
  } else if (strcasecmp(cmd, "set_ingress_map") == 0) {
    if_request.cmd = SET_VLAN_INGRESS_PRIORITY_CMD;
    if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
      fprintf(stderr,
              "ERROR: trying to set ingress map on device -:%s:- error: %s\n",
              if_name, strerror(errno));
      exit(6);
    } else {
      fprintf(stdout,
              "Set ingress mapping on device -:%s:- "
              "Should be visible in /proc/net/vlan/%s\n",
              if_name, if_name);
    }
  } else if (strcasecmp(cmd, "set_flag") == 0) {
    if_request.cmd = SET_VLAN_FLAG_CMD;
    if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
      fprintf(stderr, "ERROR: trying to set flag on device -:%s:- error: %s\n",
              if_name, strerror(errno));
      exit(7);
    } else {
      fprintf(stdout,
              "Set flag on device -:%s:- "
              "Should be visible in /proc/net/vlan/%s\n",
              if_name, if_name);
    }
  } else if (strcasecmp(cmd, "set_name_type") == 0) {
    if_request.cmd = SET_VLAN_NAME_TYPE_CMD;
    if (ioctl(fd, SIOCSIFVLAN, &if_request) < 0) {
      fprintf(stderr,
              "ERROR: trying to set name type for VLAN subsystem, error: %s\n",
              strerror(errno));
      exit(8);
    } else {
      fprintf(stdout, "Set name-type for VLAN subsystem."
                      " Should be visible in /proc/net/vlan/config\n");
    }
  } else {
    fprintf(stderr, "Unknown command -:%s:-\n", cmd);
    show_usage();
    exit(5);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movl   $0x0,-0x44(%rbp)
mov    0x2d81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
lea    0xded(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1060 <memset@plt>
cmpl   $0x3,-0x8(%rbp)
jl     123b <main+0x6b>
cmpl   $0x5,-0x8(%rbp)
jle    1266 <main+0x96>
mov    0x2d1e(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%edx
lea    0xdc8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x0,%al
call   10a0 <show_usage@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xdc8(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    138a <main+0x1ba>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xdb8(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    12bb <main+0xeb>
mov    0x2cd7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
jmp    137f <main+0x1af>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd97(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    12ea <main+0x11a>
mov    0x2d00(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
jmp    137a <main+0x1aa>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd7d(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1319 <main+0x149>
mov    0x2c91(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
jmp    1375 <main+0x1a5>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd5b(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1348 <main+0x178>
mov    0x2c5a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
jmp    1370 <main+0x1a0>
mov    0x2c41(%rip),%rax
mov    (%rax),%edi
lea    0xd3f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x0,%al
call   10a0 <show_usage@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    1375 <main+0x1a5>
jmp    137a <main+0x1aa>
jmp    137f <main+0x1af>
mov    -0x50(%rbp),%eax
mov    %eax,-0x28(%rbp)
jmp    13d5 <main+0x205>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0xf,%eax
jle    13c9 <main+0x1f9>
mov    0x2be1(%rip),%rax
mov    (%rax),%edi
lea    0xcf3(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    -0x40(%rbp),%rsi
call   1040 <strcpy@plt>
cmpl   $0x4,-0x8(%rbp)
jne    13f5 <main+0x225>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x5,-0x8(%rbp)
jne    142e <main+0x25e>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   10c0 <atoi@plt>
mov    %eax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
call   10c0 <atoi@plt>
mov    %ax,-0x4a(%rbp)
mov    -0x48(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x4a(%rbp),%ax
mov    %ax,-0x30(%rbp)
jmp    1433 <main+0x263>
mov    -0x58(%rbp),%rdi
mov    0x2b92(%rip),%rax
mov    (%rax),%esi
call   10b0 <open@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    146d <main+0x29d>
mov    0x2b38(%rip),%rax
mov    (%rax),%edi
lea    0xc7a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1475 <main+0x2a5>
mov    -0x14(%rbp),%edi
call   1080 <close@plt>
mov    0x2b5c(%rip),%rax
mov    (%rax),%edi
mov    0x2afb(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    14bb <main+0x2eb>
mov    0x2aef(%rip),%rax
mov    (%rax),%edi
lea    0xcb0(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10d0 <exit@plt>
mov    -0x38(%rbp),%rdi
lea    0xcc0(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1596 <main+0x3c6>
mov    0x2a8c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2acd(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1070 <ioctl@plt>
cmp    $0x0,%rax
jge    154d <main+0x37d>
mov    0x2a89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x64(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    0x2a57(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x68(%rbp),%edi
mov    -0x64(%rbp),%edx
mov    -0x60(%rbp),%rcx
mov    %rax,%r8
lea    0xc4e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x3,%edi
call   10d0 <exit@plt>
mov    0x2a0c(%rip),%rax
mov    (%rax),%edi
mov    -0x44(%rbp),%edx
mov    -0x40(%rbp),%rcx
lea    0xc5d(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
cmpl   $0x1,-0x44(%rbp)
jne    158c <main+0x3bc>
mov    0x29e4(%rip),%rax
mov    (%rax),%edi
lea    0xc64(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1591 <main+0x3c1>
jmp    1948 <main+0x778>
mov    -0x38(%rbp),%rdi
lea    0xcaa(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    163f <main+0x46f>
mov    0x2a09(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x29f2(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1070 <ioctl@plt>
cmp    $0x0,%rax
jge    161f <main+0x44f>
mov    0x29ae(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    0x2982(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x74(%rbp),%edi
mov    -0x70(%rbp),%rdx
mov    %rax,%rcx
lea    0xc41(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x4,%edi
call   10d0 <exit@plt>
mov    0x293a(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
lea    0xc4b(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1943 <main+0x773>
mov    -0x38(%rbp),%rdi
lea    0xc49(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    16f2 <main+0x522>
mov    0x2910(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2949(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1070 <ioctl@plt>
cmp    $0x0,%rax
jge    16ce <main+0x4fe>
mov    0x2905(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    0x28d6(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x84(%rbp),%edi
mov    -0x80(%rbp),%rdx
mov    %rax,%rcx
lea    0xbe5(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x5,%edi
call   10d0 <exit@plt>
mov    0x288b(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
mov    -0x40(%rbp),%rcx
lea    0xbf8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    193e <main+0x76e>
mov    -0x38(%rbp),%rdi
lea    0xc2d(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    17ab <main+0x5db>
mov    0x28b5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2896(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1070 <ioctl@plt>
cmp    $0x0,%rax
jge    1787 <main+0x5b7>
mov    0x2852(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    0x2820(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x94(%rbp),%edi
mov    -0x90(%rbp),%rdx
mov    %rax,%rcx
lea    0xbc4(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x6,%edi
call   10d0 <exit@plt>
mov    0x27d2(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
mov    -0x40(%rbp),%rcx
lea    0xbd8(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1939 <main+0x769>
mov    -0x38(%rbp),%rdi
lea    0xc0e(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1864 <main+0x694>
mov    0x282c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x27dd(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1070 <ioctl@plt>
cmp    $0x0,%rax
jge    1840 <main+0x670>
mov    0x2799(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa4(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    0x2767(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0xa4(%rbp),%edi
mov    -0xa0(%rbp),%rdx
mov    %rax,%rcx
lea    0xb9e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x7,%edi
call   10d0 <exit@plt>
mov    0x2719(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
mov    -0x40(%rbp),%rcx
lea    0xbab(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1934 <main+0x764>
mov    -0x38(%rbp),%rdi
lea    0x7d6(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1903 <main+0x733>
mov    0x272b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2724(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1070 <ioctl@plt>
cmp    $0x0,%rax
jge    18e7 <main+0x717>
mov    0x26e0(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa8(%rbp)
mov    0x26b9(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0xa8(%rbp),%edi
mov    %rax,%rdx
lea    0xb6f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x8,%edi
call   10d0 <exit@plt>
mov    0x2672(%rip),%rax
mov    (%rax),%edi
lea    0xb8c(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    192f <main+0x75f>
mov    0x2686(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rdx
lea    0xbba(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    $0x0,%al
call   10a0 <show_usage@plt>
mov    $0x5,%edi
call   10d0 <exit@plt>
jmp    1934 <main+0x764>
jmp    1939 <main+0x769>
jmp    193e <main+0x76e>
jmp    1943 <main+0x773>
jmp    1948 <main+0x778>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    %edi,%r13d
lea    0x8(%rsp),%rdi
xor    %esi,%esi
mov    $0x18,%edx
call   1060 <memset@plt>
lea    -0x6(%r13),%eax
cmp    $0xfffffffc,%eax
jbe    15a8 <main+0x3d8>
mov    0x8(%rbx),%r12
lea    0xe39(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcasecmp@plt>
mov    0x10(%rbx),%r14
test   %rax,%rax
je     123c <main+0x6c>
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    $0x10,%eax
jge    15f4 <main+0x424>
mov    0x1c(%rsp),%edi
mov    %r14,%rsi
call   1040 <strcpy@plt>
jmp    12bb <main+0xeb>
lea    0xe10(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1299 <main+0xc9>
lea    0xe0a(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     12a2 <main+0xd2>
lea    0xe0b(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     12ab <main+0xdb>
lea    0xe04(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
jne    171c <main+0x54c>
mov    0x2d01(%rip),%rax
jmp    12b2 <main+0xe2>
mov    0x2ce8(%rip),%rax
jmp    12b2 <main+0xe2>
mov    0x2d37(%rip),%rax
jmp    12b2 <main+0xe2>
mov    0x2cee(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
xor    %r14d,%r14d
xor    %r15d,%r15d
cmp    $0x5,%r13d
je     12dd <main+0x10d>
cmp    $0x4,%r13d
jne    12fc <main+0x12c>
mov    0x18(%rbx),%rdi
call   10c0 <atoi@plt>
mov    %rax,%r15
mov    %r15d,0x14(%rsp)
jmp    12fc <main+0x12c>
mov    0x18(%rbx),%rdi
call   10c0 <atoi@plt>
mov    %rax,%r13
mov    0x20(%rbx),%rdi
call   10c0 <atoi@plt>
mov    %r13d,0x18(%rsp)
mov    %ax,0x8(%rsp)
mov    0x2ccd(%rip),%rax
mov    (%rax),%esi
lea    0xcf4(%rip),%rdi
call   10b0 <open@plt>
test   %eax,%eax
js     131e <main+0x14e>
mov    %eax,%edi
call   1080 <close@plt>
jmp    1335 <main+0x165>
mov    0x2c6b(%rip),%rax
mov    (%rax),%edi
lea    0xdad(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x2c9c(%rip),%rax
mov    (%rax),%edi
mov    0x2c3b(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
test   %eax,%eax
js     15d3 <main+0x403>
mov    %eax,%ebx
lea    0xe27(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1425 <main+0x255>
lea    0xed4(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     148c <main+0x2bc>
lea    0xf04(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     14d6 <main+0x306>
lea    0xf83(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1513 <main+0x343>
lea    0x1005(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     1550 <main+0x380>
lea    0xc6e(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
jne    16bd <main+0x4ed>
mov    0x2bc1(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2bbc(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1070 <ioctl@plt>
test   %rax,%rax
js     16e8 <main+0x518>
mov    0x2b46(%rip),%rax
mov    (%rax),%edi
lea    0x1060(%rip),%rsi
jmp    1480 <main+0x2b0>
mov    0x2b3c(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2b7f(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1070 <ioctl@plt>
test   %rax,%rax
js     1615 <main+0x445>
mov    0x2b09(%rip),%rbx
mov    (%rbx),%edi
lea    0xd61(%rip),%rsi
mov    %r15d,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
cmp    $0x1,%r15d
jne    1598 <main+0x3c8>
mov    (%rbx),%edi
lea    0xd69(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1598 <main+0x3c8>
mov    0x2b2d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2b18(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1070 <ioctl@plt>
test   %rax,%rax
js     164f <main+0x47f>
mov    0x2aa2(%rip),%rax
mov    (%rax),%edi
lea    0xdb7(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1598 <main+0x3c8>
mov    0x2a93(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2ace(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1070 <ioctl@plt>
test   %rax,%rax
js     1686 <main+0x4b6>
mov    0x2a58(%rip),%rax
mov    (%rax),%edi
lea    0xdcd(%rip),%rsi
jmp    158b <main+0x3bb>
mov    0x2aae(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2a91(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1070 <ioctl@plt>
test   %rax,%rax
js     1738 <main+0x568>
mov    0x2a1b(%rip),%rax
mov    (%rax),%edi
lea    0xe29(%rip),%rsi
jmp    158b <main+0x3bb>
mov    0x2aa1(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2a54(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1070 <ioctl@plt>
test   %rax,%rax
js     176f <main+0x59f>
mov    0x29de(%rip),%rax
mov    (%rax),%edi
lea    0xe78(%rip),%rsi
mov    %r14,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    0x29b1(%rip),%rax
mov    (%rax),%edi
lea    0xa5e(%rip),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
xor    %eax,%eax
call   10a0 <show_usage@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x29b6(%rip),%rax
mov    (%rax),%edi
lea    0xb77(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10d0 <exit@plt>
mov    0x2995(%rip),%rax
mov    (%rax),%edi
lea    0xaa7(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2974(%rip),%rax
mov    (%rax),%ebx
mov    0x2953(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xb57(%rip),%rsi
mov    %ebx,%edi
mov    %r15d,%edx
mov    %r14,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x3,%edi
call   10d0 <exit@plt>
mov    0x293a(%rip),%rax
mov    (%rax),%ebx
mov    0x2919(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xbe2(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x4,%edi
call   10d0 <exit@plt>
mov    0x2903(%rip),%rax
mov    (%rax),%ebx
mov    0x28e2(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xbfe(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x5,%edi
call   10d0 <exit@plt>
mov    0x28cc(%rip),%rax
mov    (%rax),%edi
lea    0xe04(%rip),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
xor    %eax,%eax
call   10a0 <show_usage@plt>
mov    $0x5,%edi
call   10d0 <exit@plt>
mov    0x28a1(%rip),%rax
mov    (%rax),%ebx
mov    0x2880(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xd3f(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x8,%edi
call   10d0 <exit@plt>
mov    0x286d(%rip),%rax
mov    (%rax),%edi
lea    0x96b(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    15c2 <main+0x3f2>
mov    0x2851(%rip),%rax
mov    (%rax),%ebx
mov    0x2830(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xbe4(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x6,%edi
call   10d0 <exit@plt>
mov    0x281a(%rip),%rax
mov    (%rax),%ebx
mov    0x27f9(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xc40(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x7,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.vlan_ioctl_args = type { i16, i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32, i32, i32 }
@VLAN_NAME_TYPE_PLUS_VID = global i32 0
@.str = [22 x i8] c"/proc/net/vlan/config\00"
@stdout = global i32 0
@.str.1 = [47 x i8] c"Expecting argc to be 3-5, inclusive. Was: %d\0A\00"
@.str.2 = [14 x i8] c"set_name_type\00"
@.str.3 = [14 x i8] c"VLAN_PLUS_VID\00"
@.str.4 = [21 x i8] c"VLAN_PLUS_VID_NO_PAD\00"
@VLAN_NAME_TYPE_PLUS_VID_NO_PAD = global i32 0
@.str.5 = [13 x i8] c"DEV_PLUS_VID\00"
@VLAN_NAME_TYPE_RAW_PLUS_VID = global i32 0
@.str.6 = [20 x i8] c"DEV_PLUS_VID_NO_PAD\00"
@VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD = global i32 0
@stderr = global i32 0
@.str.7 = [20 x i8] c"Invalid name type.\0A\00"
@.str.8 = [48 x i8] c"ERROR: if_name must be 15 characters or less.\0A\00"
@O_RDONLY = global i32 0
@.str.9 = [127 x i8] c"WARNING: Could not open /proc/net/vlan/config. Maybe you need to load the 8021q module, or maybe you are not using PROCFS??\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.10 = [44 x i8] c"FATAL: Couldn't open a socket..go figure!\0A\00"
@.str.11 = [4 x i8] c"add\00"
@ADD_VLAN_CMD = global i32 0
@SIOCSIFVLAN = global i32 0
@.str.12 = [55 x i8] c"ERROR: trying to add VLAN #%u to IF -:%s:- error: %s\0A\00"
@errno = global i32 0
@.str.13 = [40 x i8] c"Added VLAN with VID == %u to IF -:%s:-\0A\00"
@.str.14 = [98 x i8] c"WARNING: VLAN 1 does not work with many switches,\0Aconsider another number if you have problems.\0A\00"
@.str.15 = [4 x i8] c"rem\00"
@DEL_VLAN_CMD = global i32 0
@.str.16 = [47 x i8] c"ERROR: trying to remove VLAN -:%s:- error: %s\0A\00"
@.str.17 = [21 x i8] c"Removed VLAN -:%s:-\0A\00"
@.str.18 = [15 x i8] c"set_egress_map\00"
@SET_VLAN_EGRESS_PRIORITY_CMD = global i32 0
@.str.19 = [60 x i8] c"ERROR: trying to set egress map on device -:%s:- error: %s\0A\00"
@.str.20 = [76 x i8] c"Set egress mapping on device -:%s:- Should be visible in /proc/net/vlan/%s\0A\00"
@.str.21 = [16 x i8] c"set_ingress_map\00"
@SET_VLAN_INGRESS_PRIORITY_CMD = global i32 0
@.str.22 = [61 x i8] c"ERROR: trying to set ingress map on device -:%s:- error: %s\0A\00"
@.str.23 = [77 x i8] c"Set ingress mapping on device -:%s:- Should be visible in /proc/net/vlan/%s\0A\00"
@.str.24 = [9 x i8] c"set_flag\00"
@SET_VLAN_FLAG_CMD = global i32 0
@.str.25 = [54 x i8] c"ERROR: trying to set flag on device -:%s:- error: %s\0A\00"
@.str.26 = [66 x i8] c"Set flag on device -:%s:- Should be visible in /proc/net/vlan/%s\0A\00"
@SET_VLAN_NAME_TYPE_CMD = global i32 0
@.str.27 = [62 x i8] c"ERROR: trying to set name type for VLAN subsystem, error: %s\0A\00"
@.str.28 = [78 x i8] c"Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config\0A\00"
@.str.29 = [24 x i8] c"Unknown command -:%s:-\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.vlan_ioctl_args
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16
%13 = alloca i32
%14 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %8
store i8* null, i8** %9
store i32 0, i32* %10
%15 = load i32, i32* @VLAN_NAME_TYPE_PLUS_VID
store i32 %15, i32* %13
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8** %14
%16 = call i32 @memset(%struct.vlan_ioctl_args* %7, i32 0, i32 24)
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, 3
br i1 %18, label %22, label %19
19: ; preds = %2
%20 = load i32, i32* %4
%21 = icmp sgt i32 %20, 5
br i1 %21, label %22, label %28
22: ; preds = %19, %2
%23 = load i32, i32* @stdout
%24 = load i32, i32* %4
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = call i32 (...) @show_usage()
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %19
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
store i8* %31, i8** %8
%32 = load i8*, i8** %8
%33 = call i64 @strcasecmp(i8* %32, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %79
35: ; preds = %28
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i64 @strcasecmp(i8* %38, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %35
%42 = load i32, i32* @VLAN_NAME_TYPE_PLUS_VID
store i32 %42, i32* %13
br label %75
43: ; preds = %35
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 2
%46 = load i8*, i8** %45
%47 = call i64 @strcasecmp(i8* %46, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %43
%50 = load i32, i32* @VLAN_NAME_TYPE_PLUS_VID_NO_PAD
store i32 %50, i32* %13
br label %74
51: ; preds = %43
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 2
%54 = load i8*, i8** %53
%55 = call i64 @strcasecmp(i8* %54, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %51
%58 = load i32, i32* @VLAN_NAME_TYPE_RAW_PLUS_VID
store i32 %58, i32* %13
br label %73
59: ; preds = %51
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 2
%62 = load i8*, i8** %61
%63 = call i64 @strcasecmp(i8* %62, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %59
%66 = load i32, i32* @VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD
store i32 %66, i32* %13
br label %72
67: ; preds = %59
%68 = load i32, i32* @stderr
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%70 = call i32 (...) @show_usage()
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %65
br label %73
73: ; preds = %72, %57
br label %74
74: ; preds = %73, %49
br label %75
75: ; preds = %74, %41
%76 = load i32, i32* %13
%77 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 2
%78 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %77, i32 0, i32 0
store i32 %76, i32* %78
br label %95
79: ; preds = %28
%80 = load i8**, i8*** %5
%81 = getelementptr inbounds i8*, i8** %80, i64 2
%82 = load i8*, i8** %81
store i8* %82, i8** %9
%83 = load i8*, i8** %9
%84 = call i32 @strlen(i8* %83)
%85 = icmp sgt i32 %84, 15
br i1 %85, label %86, label %90
86: ; preds = %79
%87 = load i32, i32* @stderr
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0))
%89 = call i32 @exit(i32 1)
unreachable
90: ; preds = %79
%91 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 3
%92 = load i32, i32* %91
%93 = load i8*, i8** %9
%94 = call i32 @strcpy(i32 %92, i8* %93)
br label %95
95: ; preds = %90, %75
%96 = load i32, i32* %4
%97 = icmp eq i32 %96, 4
br i1 %97, label %98, label %107
98: ; preds = %95
%99 = load i8**, i8*** %5
%100 = getelementptr inbounds i8*, i8** %99, i64 3
%101 = load i8*, i8** %100
%102 = call i8* @atoi(i8* %101)
%103 = ptrtoint i8* %102 to i32
store i32 %103, i32* %10
%104 = load i32, i32* %10
%105 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 2
%106 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %105, i32 0, i32 1
store i32 %104, i32* %106
br label %107
107: ; preds = %98, %95
%108 = load i32, i32* %4
%109 = icmp eq i32 %108, 5
br i1 %109, label %110, label %126
110: ; preds = %107
%111 = load i8**, i8*** %5
%112 = getelementptr inbounds i8*, i8** %111, i64 3
%113 = load i8*, i8** %112
%114 = call i8* @atoi(i8* %113)
%115 = ptrtoint i8* %114 to i32
store i32 %115, i32* %11
%116 = load i8**, i8*** %5
%117 = getelementptr inbounds i8*, i8** %116, i64 4
%118 = load i8*, i8** %117
%119 = call i8* @atoi(i8* %118)
%120 = ptrtoint i8* %119 to i16
store i16 %120, i16* %12
%121 = load i32, i32* %11
%122 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 2
%123 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %122, i32 0, i32 2
store i32 %121, i32* %123
%124 = load i16, i16* %12
%125 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 0
store i16 %124, i16* %125
br label %126
126: ; preds = %110, %107
br label %127
127: ; preds = %126
%128 = load i8*, i8** %14
%129 = load i32, i32* @O_RDONLY
%130 = call i32 @open(i8* %128, i32 %129)
store i32 %130, i32* %6
%131 = icmp slt i32 %130, 0
br i1 %131, label %132, label %135
132: ; preds = %127
%133 = load i32, i32* @stderr
%134 = call i32 (i32, i8*, ...) @fprintf(i32 %133, i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str.9, i64 0, i64 0))
br label %138
135: ; preds = %127
%136 = load i32, i32* %6
%137 = call i32 @close(i32 %136)
br label %138
138: ; preds = %135, %132
%139 = load i32, i32* @AF_INET
%140 = load i32, i32* @SOCK_STREAM
%141 = call i32 @socket(i32 %139, i32 %140, i32 0)
store i32 %141, i32* %6
%142 = icmp slt i32 %141, 0
br i1 %142, label %143, label %147
143: ; preds = %138
%144 = load i32, i32* @stderr
%145 = call i32 (i32, i8*, ...) @fprintf(i32 %144, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.10, i64 0, i64 0))
%146 = call i32 @exit(i32 2)
unreachable
147: ; preds = %138
%148 = load i8*, i8** %8
%149 = call i64 @strcasecmp(i8* %148, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%150 = icmp eq i64 %149, 0
br i1 %150, label %151, label %178
151: ; preds = %147
%152 = load i32, i32* @ADD_VLAN_CMD
%153 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 1
store i32 %152, i32* %153
%154 = load i32, i32* %6
%155 = load i32, i32* @SIOCSIFVLAN
%156 = call i64 @ioctl(i32 %154, i32 %155, %struct.vlan_ioctl_args* %7)
%157 = icmp slt i64 %156, 0
br i1 %157, label %158, label %166
158: ; preds = %151
%159 = load i32, i32* @stderr
%160 = load i32, i32* %10
%161 = load i8*, i8** %9
%162 = load i32, i32* @errno
%163 = call i8* @strerror(i32 %162)
%164 = call i32 (i32, i8*, ...) @fprintf(i32 %159, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.12, i64 0, i64 0), i32 %160, i8* %161, i8* %163)
%165 = call i32 @exit(i32 3)
unreachable
166: ; preds = %151
%167 = load i32, i32* @stdout
%168 = load i32, i32* %10
%169 = load i8*, i8** %9
%170 = call i32 (i32, i8*, ...) @fprintf(i32 %167, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.13, i64 0, i64 0), i32 %168, i8* %169)
%171 = load i32, i32* %10
%172 = icmp eq i32 %171, 1
br i1 %172, label %173, label %176
173: ; preds = %166
%174 = load i32, i32* @stdout
%175 = call i32 (i32, i8*, ...) @fprintf(i32 %174, i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.14, i64 0, i64 0))
br label %176
176: ; preds = %173, %166
br label %177
177: ; preds = %176
br label %305
178: ; preds = %147
%179 = load i8*, i8** %8
%180 = call i64 @strcasecmp(i8* %179, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
%181 = icmp eq i64 %180, 0
br i1 %181, label %182, label %201
182: ; preds = %178
%183 = load i32, i32* @DEL_VLAN_CMD
%184 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 1
store i32 %183, i32* %184
%185 = load i32, i32* %6
%186 = load i32, i32* @SIOCSIFVLAN
%187 = call i64 @ioctl(i32 %185, i32 %186, %struct.vlan_ioctl_args* %7)
%188 = icmp slt i64 %187, 0
br i1 %188, label %189, label %196
189: ; preds = %182
%190 = load i32, i32* @stderr
%191 = load i8*, i8** %9
%192 = load i32, i32* @errno
%193 = call i8* @strerror(i32 %192)
%194 = call i32 (i32, i8*, ...) @fprintf(i32 %190, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.16, i64 0, i64 0), i8* %191, i8* %193)
%195 = call i32 @exit(i32 4)
unreachable
196: ; preds = %182
%197 = load i32, i32* @stdout
%198 = load i8*, i8** %9
%199 = call i32 (i32, i8*, ...) @fprintf(i32 %197, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0), i8* %198)
br label %200
200: ; preds = %196
br label %304
201: ; preds = %178
%202 = load i8*, i8** %8
%203 = call i64 @strcasecmp(i8* %202, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0))
%204 = icmp eq i64 %203, 0
br i1 %204, label %205, label %225
205: ; preds = %201
%206 = load i32, i32* @SET_VLAN_EGRESS_PRIORITY_CMD
%207 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 1
store i32 %206, i32* %207
%208 = load i32, i32* %6
%209 = load i32, i32* @SIOCSIFVLAN
%210 = call i64 @ioctl(i32 %208, i32 %209, %struct.vlan_ioctl_args* %7)
%211 = icmp slt i64 %210, 0
br i1 %211, label %212, label %219
212: ; preds = %205
%213 = load i32, i32* @stderr
%214 = load i8*, i8** %9
%215 = load i32, i32* @errno
%216 = call i8* @strerror(i32 %215)
%217 = call i32 (i32, i8*, ...) @fprintf(i32 %213, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.19, i64 0, i64 0), i8* %214, i8* %216)
%218 = call i32 @exit(i32 5)
unreachable
219: ; preds = %205
%220 = load i32, i32* @stdout
%221 = load i8*, i8** %9
%222 = load i8*, i8** %9
%223 = call i32 (i32, i8*, ...) @fprintf(i32 %220, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.20, i64 0, i64 0), i8* %221, i8* %222)
br label %224
224: ; preds = %219
br label %303
225: ; preds = %201
%226 = load i8*, i8** %8
%227 = call i64 @strcasecmp(i8* %226, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.21, i64 0, i64 0))
%228 = icmp eq i64 %227, 0
br i1 %228, label %229, label %249
229: ; preds = %225
%230 = load i32, i32* @SET_VLAN_INGRESS_PRIORITY_CMD
%231 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 1
store i32 %230, i32* %231
%232 = load i32, i32* %6
%233 = load i32, i32* @SIOCSIFVLAN
%234 = call i64 @ioctl(i32 %232, i32 %233, %struct.vlan_ioctl_args* %7)
%235 = icmp slt i64 %234, 0
br i1 %235, label %236, label %243
236: ; preds = %229
%237 = load i32, i32* @stderr
%238 = load i8*, i8** %9
%239 = load i32, i32* @errno
%240 = call i8* @strerror(i32 %239)
%241 = call i32 (i32, i8*, ...) @fprintf(i32 %237, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.22, i64 0, i64 0), i8* %238, i8* %240)
%242 = call i32 @exit(i32 6)
unreachable
243: ; preds = %229
%244 = load i32, i32* @stdout
%245 = load i8*, i8** %9
%246 = load i8*, i8** %9
%247 = call i32 (i32, i8*, ...) @fprintf(i32 %244, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.23, i64 0, i64 0), i8* %245, i8* %246)
br label %248
248: ; preds = %243
br label %302
249: ; preds = %225
%250 = load i8*, i8** %8
%251 = call i64 @strcasecmp(i8* %250, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0))
%252 = icmp eq i64 %251, 0
br i1 %252, label %253, label %273
253: ; preds = %249
%254 = load i32, i32* @SET_VLAN_FLAG_CMD
%255 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 1
store i32 %254, i32* %255
%256 = load i32, i32* %6
%257 = load i32, i32* @SIOCSIFVLAN
%258 = call i64 @ioctl(i32 %256, i32 %257, %struct.vlan_ioctl_args* %7)
%259 = icmp slt i64 %258, 0
br i1 %259, label %260, label %267
260: ; preds = %253
%261 = load i32, i32* @stderr
%262 = load i8*, i8** %9
%263 = load i32, i32* @errno
%264 = call i8* @strerror(i32 %263)
%265 = call i32 (i32, i8*, ...) @fprintf(i32 %261, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.25, i64 0, i64 0), i8* %262, i8* %264)
%266 = call i32 @exit(i32 7)
unreachable
267: ; preds = %253
%268 = load i32, i32* @stdout
%269 = load i8*, i8** %9
%270 = load i8*, i8** %9
%271 = call i32 (i32, i8*, ...) @fprintf(i32 %268, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.26, i64 0, i64 0), i8* %269, i8* %270)
br label %272
272: ; preds = %267
br label %301
273: ; preds = %249
%274 = load i8*, i8** %8
%275 = call i64 @strcasecmp(i8* %274, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%276 = icmp eq i64 %275, 0
br i1 %276, label %277, label %294
277: ; preds = %273
%278 = load i32, i32* @SET_VLAN_NAME_TYPE_CMD
%279 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 1
store i32 %278, i32* %279
%280 = load i32, i32* %6
%281 = load i32, i32* @SIOCSIFVLAN
%282 = call i64 @ioctl(i32 %280, i32 %281, %struct.vlan_ioctl_args* %7)
%283 = icmp slt i64 %282, 0
br i1 %283, label %284, label %290
284: ; preds = %277
%285 = load i32, i32* @stderr
%286 = load i32, i32* @errno
%287 = call i8* @strerror(i32 %286)
%288 = call i32 (i32, i8*, ...) @fprintf(i32 %285, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.27, i64 0, i64 0), i8* %287)
%289 = call i32 @exit(i32 8)
unreachable
290: ; preds = %277
%291 = load i32, i32* @stdout
%292 = call i32 (i32, i8*, ...) @fprintf(i32 %291, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.28, i64 0, i64 0))
br label %293
293: ; preds = %290
br label %300
294: ; preds = %273
%295 = load i32, i32* @stderr
%296 = load i8*, i8** %8
%297 = call i32 (i32, i8*, ...) @fprintf(i32 %295, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.29, i64 0, i64 0), i8* %296)
%298 = call i32 (...) @show_usage()
%299 = call i32 @exit(i32 5)
unreachable
300: ; preds = %293
br label %301
301: ; preds = %300, %272
br label %302
302: ; preds = %301, %248
br label %303
303: ; preds = %302, %224
br label %304
304: ; preds = %303, %200
br label %305
305: ; preds = %304, %177
ret i32 0
}

LLVM IR (-O2):
%struct.vlan_ioctl_args = type { i16, i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32, i32, i32 }
@VLAN_NAME_TYPE_PLUS_VID = global i32 0
@.str = [22 x i8] c"/proc/net/vlan/config\00"
@stdout = global i32 0
@.str.1 = [47 x i8] c"Expecting argc to be 3-5, inclusive. Was: %d\0A\00"
@.str.2 = [14 x i8] c"set_name_type\00"
@.str.3 = [14 x i8] c"VLAN_PLUS_VID\00"
@.str.4 = [21 x i8] c"VLAN_PLUS_VID_NO_PAD\00"
@VLAN_NAME_TYPE_PLUS_VID_NO_PAD = global i32 0
@.str.5 = [13 x i8] c"DEV_PLUS_VID\00"
@VLAN_NAME_TYPE_RAW_PLUS_VID = global i32 0
@.str.6 = [20 x i8] c"DEV_PLUS_VID_NO_PAD\00"
@VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD = global i32 0
@stderr = global i32 0
@.str.7 = [20 x i8] c"Invalid name type.\0A\00"
@.str.8 = [48 x i8] c"ERROR: if_name must be 15 characters or less.\0A\00"
@O_RDONLY = global i32 0
@.str.9 = [127 x i8] c"WARNING: Could not open /proc/net/vlan/config. Maybe you need to load the 8021q module, or maybe you are not using PROCFS??\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.10 = [44 x i8] c"FATAL: Couldn't open a socket..go figure!\0A\00"
@.str.11 = [4 x i8] c"add\00"
@ADD_VLAN_CMD = global i32 0
@SIOCSIFVLAN = global i32 0
@.str.12 = [55 x i8] c"ERROR: trying to add VLAN #%u to IF -:%s:- error: %s\0A\00"
@errno = global i32 0
@.str.13 = [40 x i8] c"Added VLAN with VID == %u to IF -:%s:-\0A\00"
@.str.14 = [98 x i8] c"WARNING: VLAN 1 does not work with many switches,\0Aconsider another number if you have problems.\0A\00"
@.str.15 = [4 x i8] c"rem\00"
@DEL_VLAN_CMD = global i32 0
@.str.16 = [47 x i8] c"ERROR: trying to remove VLAN -:%s:- error: %s\0A\00"
@.str.17 = [21 x i8] c"Removed VLAN -:%s:-\0A\00"
@.str.18 = [15 x i8] c"set_egress_map\00"
@SET_VLAN_EGRESS_PRIORITY_CMD = global i32 0
@.str.19 = [60 x i8] c"ERROR: trying to set egress map on device -:%s:- error: %s\0A\00"
@.str.20 = [76 x i8] c"Set egress mapping on device -:%s:- Should be visible in /proc/net/vlan/%s\0A\00"
@.str.21 = [16 x i8] c"set_ingress_map\00"
@SET_VLAN_INGRESS_PRIORITY_CMD = global i32 0
@.str.22 = [61 x i8] c"ERROR: trying to set ingress map on device -:%s:- error: %s\0A\00"
@.str.23 = [77 x i8] c"Set ingress mapping on device -:%s:- Should be visible in /proc/net/vlan/%s\0A\00"
@.str.24 = [9 x i8] c"set_flag\00"
@SET_VLAN_FLAG_CMD = global i32 0
@.str.25 = [54 x i8] c"ERROR: trying to set flag on device -:%s:- error: %s\0A\00"
@.str.26 = [66 x i8] c"Set flag on device -:%s:- Should be visible in /proc/net/vlan/%s\0A\00"
@SET_VLAN_NAME_TYPE_CMD = global i32 0
@.str.27 = [62 x i8] c"ERROR: trying to set name type for VLAN subsystem, error: %s\0A\00"
@.str.28 = [78 x i8] c"Set name-type for VLAN subsystem. Should be visible in /proc/net/vlan/config\0A\00"
@.str.29 = [24 x i8] c"Unknown command -:%s:-\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.vlan_ioctl_args
%4 = bitcast %struct.vlan_ioctl_args* %3 to i8*
%5 = call i32 @memset(%struct.vlan_ioctl_args* %3, i32 0, i32 24)
%6 = add i32 %0, -6
%7 = icmp ult i32 %6, -3
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* @stdout
%10 = call i32 (i32, i8*, ...) @fprintf(i32 %9, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%11 = call i32 (...) @show_usage()
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
%18 = getelementptr inbounds i8*, i8** %1, i64 2
%19 = load i8*, i8** %18
br i1 %17, label %20, label %41
20: ; preds = %13
%21 = call i64 @strcasecmp(i8* %19, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %37, label %23
23: ; preds = %20
%24 = call i64 @strcasecmp(i8* %19, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %37, label %26
26: ; preds = %23
%27 = call i64 @strcasecmp(i8* %19, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %37, label %29
29: ; preds = %26
%30 = call i64 @strcasecmp(i8* %19, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %37, label %32
32: ; preds = %29
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
%35 = call i32 (...) @show_usage()
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %29, %26, %23, %20
%38 = phi i32* [ @VLAN_NAME_TYPE_PLUS_VID, %20 ], [ @VLAN_NAME_TYPE_PLUS_VID_NO_PAD, %23 ], [ @VLAN_NAME_TYPE_RAW_PLUS_VID, %26 ], [ @VLAN_NAME_TYPE_RAW_PLUS_VID_NO_PAD, %29 ]
%39 = load i32, i32* %38
%40 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 2, i32 0
store i32 %39, i32* %40
br label %52
41: ; preds = %13
%42 = call i32 @strlen(i8* %19)
%43 = icmp sgt i32 %42, 15
br i1 %43, label %44, label %48
44: ; preds = %41
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.8, i64 0, i64 0))
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %41
%49 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 3
%50 = load i32, i32* %49
%51 = call i32 @strcpy(i32 %50, i8* %19)
br label %52
52: ; preds = %48, %37
%53 = phi i8* [ null, %37 ], [ %19, %48 ]
switch i32 %0, label %74 [
i32 4, label %54
i32 5, label %61
]
54: ; preds = %52
%55 = getelementptr inbounds i8*, i8** %1, i64 3
%56 = load i8*, i8** %55
%57 = call i8* @atoi(i8* %56)
%58 = ptrtoint i8* %57 to i64
%59 = trunc i64 %58 to i32
%60 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 2, i32 1
store i32 %59, i32* %60
br label %74
61: ; preds = %52
%62 = getelementptr inbounds i8*, i8** %1, i64 3
%63 = load i8*, i8** %62
%64 = call i8* @atoi(i8* %63)
%65 = ptrtoint i8* %64 to i64
%66 = trunc i64 %65 to i32
%67 = getelementptr inbounds i8*, i8** %1, i64 4
%68 = load i8*, i8** %67
%69 = call i8* @atoi(i8* %68)
%70 = ptrtoint i8* %69 to i64
%71 = trunc i64 %70 to i16
%72 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 2, i32 2
store i32 %66, i32* %72
%73 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 0
store i16 %71, i16* %73
br label %74
74: ; preds = %52, %54, %61
%75 = phi i32 [ %59, %54 ], [ 0, %61 ], [ 0, %52 ]
%76 = load i32, i32* @O_RDONLY
%77 = call i32 @open(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %76)
%78 = icmp slt i32 %77, 0
br i1 %78, label %79, label %82
79: ; preds = %74
%80 = load i32, i32* @stderr
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str.9, i64 0, i64 0))
br label %84
82: ; preds = %74
%83 = call i32 @close(i32 %77)
br label %84
84: ; preds = %82, %79
%85 = load i32, i32* @AF_INET
%86 = load i32, i32* @SOCK_STREAM
%87 = call i32 @socket(i32 %85, i32 %86, i32 0)
%88 = icmp slt i32 %87, 0
br i1 %88, label %89, label %93
89: ; preds = %84
%90 = load i32, i32* @stderr
%91 = call i32 (i32, i8*, ...) @fprintf(i32 %90, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.10, i64 0, i64 0))
%92 = call i32 @exit(i32 2)
unreachable
93: ; preds = %84
%94 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %115
96: ; preds = %93
%97 = load i32, i32* @ADD_VLAN_CMD
%98 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 1
store i32 %97, i32* %98
%99 = load i32, i32* @SIOCSIFVLAN
%100 = call i64 @ioctl(i32 %87, i32 %99, %struct.vlan_ioctl_args* %3)
%101 = icmp slt i64 %100, 0
br i1 %101, label %102, label %108
102: ; preds = %96
%103 = load i32, i32* @stderr
%104 = load i32, i32* @errno
%105 = call i8* @strerror(i32 %104)
%106 = call i32 (i32, i8*, ...) @fprintf(i32 %103, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.12, i64 0, i64 0), i32 %75, i8* %53, i8* %105)
%107 = call i32 @exit(i32 3)
unreachable
108: ; preds = %96
%109 = load i32, i32* @stdout
%110 = call i32 (i32, i8*, ...) @fprintf(i32 %109, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.13, i64 0, i64 0), i32 %75, i8* %53)
%111 = icmp eq i32 %75, 1
br i1 %111, label %112, label %210
112: ; preds = %108
%113 = load i32, i32* @stdout
%114 = call i32 (i32, i8*, ...) @fprintf(i32 %113, i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.14, i64 0, i64 0))
br label %210
115: ; preds = %93
%116 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
%117 = icmp eq i64 %116, 0
br i1 %117, label %118, label %133
118: ; preds = %115
%119 = load i32, i32* @DEL_VLAN_CMD
%120 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 1
store i32 %119, i32* %120
%121 = load i32, i32* @SIOCSIFVLAN
%122 = call i64 @ioctl(i32 %87, i32 %121, %struct.vlan_ioctl_args* %3)
%123 = icmp slt i64 %122, 0
br i1 %123, label %124, label %130
124: ; preds = %118
%125 = load i32, i32* @stderr
%126 = load i32, i32* @errno
%127 = call i8* @strerror(i32 %126)
%128 = call i32 (i32, i8*, ...) @fprintf(i32 %125, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.16, i64 0, i64 0), i8* %53, i8* %127)
%129 = call i32 @exit(i32 4)
unreachable
130: ; preds = %118
%131 = load i32, i32* @stdout
%132 = call i32 (i32, i8*, ...) @fprintf(i32 %131, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0), i8* %53)
br label %210
133: ; preds = %115
%134 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0))
%135 = icmp eq i64 %134, 0
br i1 %135, label %136, label %151
136: ; preds = %133
%137 = load i32, i32* @SET_VLAN_EGRESS_PRIORITY_CMD
%138 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 1
store i32 %137, i32* %138
%139 = load i32, i32* @SIOCSIFVLAN
%140 = call i64 @ioctl(i32 %87, i32 %139, %struct.vlan_ioctl_args* %3)
%141 = icmp slt i64 %140, 0
br i1 %141, label %142, label %148
142: ; preds = %136
%143 = load i32, i32* @stderr
%144 = load i32, i32* @errno
%145 = call i8* @strerror(i32 %144)
%146 = call i32 (i32, i8*, ...) @fprintf(i32 %143, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.19, i64 0, i64 0), i8* %53, i8* %145)
%147 = call i32 @exit(i32 5)
unreachable
148: ; preds = %136
%149 = load i32, i32* @stdout
%150 = call i32 (i32, i8*, ...) @fprintf(i32 %149, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.20, i64 0, i64 0), i8* %53, i8* %53)
br label %210
151: ; preds = %133
%152 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.21, i64 0, i64 0))
%153 = icmp eq i64 %152, 0
br i1 %153, label %154, label %169
154: ; preds = %151
%155 = load i32, i32* @SET_VLAN_INGRESS_PRIORITY_CMD
%156 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 1
store i32 %155, i32* %156
%157 = load i32, i32* @SIOCSIFVLAN
%158 = call i64 @ioctl(i32 %87, i32 %157, %struct.vlan_ioctl_args* %3)
%159 = icmp slt i64 %158, 0
br i1 %159, label %160, label %166
160: ; preds = %154
%161 = load i32, i32* @stderr
%162 = load i32, i32* @errno
%163 = call i8* @strerror(i32 %162)
%164 = call i32 (i32, i8*, ...) @fprintf(i32 %161, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.22, i64 0, i64 0), i8* %53, i8* %163)
%165 = call i32 @exit(i32 6)
unreachable
166: ; preds = %154
%167 = load i32, i32* @stdout
%168 = call i32 (i32, i8*, ...) @fprintf(i32 %167, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.23, i64 0, i64 0), i8* %53, i8* %53)
br label %210
169: ; preds = %151
%170 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0))
%171 = icmp eq i64 %170, 0
br i1 %171, label %172, label %187
172: ; preds = %169
%173 = load i32, i32* @SET_VLAN_FLAG_CMD
%174 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 1
store i32 %173, i32* %174
%175 = load i32, i32* @SIOCSIFVLAN
%176 = call i64 @ioctl(i32 %87, i32 %175, %struct.vlan_ioctl_args* %3)
%177 = icmp slt i64 %176, 0
br i1 %177, label %178, label %184
178: ; preds = %172
%179 = load i32, i32* @stderr
%180 = load i32, i32* @errno
%181 = call i8* @strerror(i32 %180)
%182 = call i32 (i32, i8*, ...) @fprintf(i32 %179, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.25, i64 0, i64 0), i8* %53, i8* %181)
%183 = call i32 @exit(i32 7)
unreachable
184: ; preds = %172
%185 = load i32, i32* @stdout
%186 = call i32 (i32, i8*, ...) @fprintf(i32 %185, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.26, i64 0, i64 0), i8* %53, i8* %53)
br label %210
187: ; preds = %169
%188 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%189 = icmp eq i64 %188, 0
br i1 %189, label %190, label %205
190: ; preds = %187
%191 = load i32, i32* @SET_VLAN_NAME_TYPE_CMD
%192 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 1
store i32 %191, i32* %192
%193 = load i32, i32* @SIOCSIFVLAN
%194 = call i64 @ioctl(i32 %87, i32 %193, %struct.vlan_ioctl_args* %3)
%195 = icmp slt i64 %194, 0
br i1 %195, label %196, label %202
196: ; preds = %190
%197 = load i32, i32* @stderr
%198 = load i32, i32* @errno
%199 = call i8* @strerror(i32 %198)
%200 = call i32 (i32, i8*, ...) @fprintf(i32 %197, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.27, i64 0, i64 0), i8* %199)
%201 = call i32 @exit(i32 8)
unreachable
202: ; preds = %190
%203 = load i32, i32* @stdout
%204 = call i32 (i32, i8*, ...) @fprintf(i32 %203, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.28, i64 0, i64 0))
br label %210
205: ; preds = %187
%206 = load i32, i32* @stderr
%207 = call i32 (i32, i8*, ...) @fprintf(i32 %206, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.29, i64 0, i64 0), i8* %15)
%208 = call i32 (...) @show_usage()
%209 = call i32 @exit(i32 5)
unreachable
210: ; preds = %130, %166, %202, %184, %148, %112, %108
ret i32 0
}