#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));
    } 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));
    } 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));
    } 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));
    } 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));
    } 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));
    } 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    1591 <main+0x3c1>
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    1548 <main+0x378>
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>
jmp    158c <main+0x3bc>
mov    0x2a11(%rip),%rax
mov    (%rax),%edi
mov    -0x44(%rbp),%edx
mov    -0x40(%rbp),%rcx
lea    0xc62(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
cmpl   $0x1,-0x44(%rbp)
jne    1587 <main+0x3b7>
mov    0x29e9(%rip),%rax
mov    (%rax),%edi
lea    0xc69(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    158c <main+0x3bc>
jmp    192a <main+0x75a>
mov    -0x38(%rbp),%rdi
lea    0xcaf(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1635 <main+0x465>
mov    0x2a0e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x29f7(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1070 <ioctl@plt>
cmp    $0x0,%rax
jge    1615 <main+0x445>
mov    0x29b3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    0x2987(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x74(%rbp),%edi
mov    -0x70(%rbp),%rdx
mov    %rax,%rcx
lea    0xc46(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1630 <main+0x460>
mov    0x2944(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
lea    0xc55(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1925 <main+0x755>
mov    -0x38(%rbp),%rdi
lea    0xc53(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    16e3 <main+0x513>
mov    0x291a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x2953(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1070 <ioctl@plt>
cmp    $0x0,%rax
jge    16bf <main+0x4ef>
mov    0x290f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    0x28e0(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x84(%rbp),%edi
mov    -0x80(%rbp),%rdx
mov    %rax,%rcx
lea    0xbef(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    16de <main+0x50e>
mov    0x289a(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
mov    -0x40(%rbp),%rcx
lea    0xc07(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1920 <main+0x750>
mov    -0x38(%rbp),%rdi
lea    0xc3c(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1797 <main+0x5c7>
mov    0x28c4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x28a5(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1070 <ioctl@plt>
cmp    $0x0,%rax
jge    1773 <main+0x5a3>
mov    0x2861(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    0x282f(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x94(%rbp),%edi
mov    -0x90(%rbp),%rdx
mov    %rax,%rcx
lea    0xbd3(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1792 <main+0x5c2>
mov    0x27e6(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
mov    -0x40(%rbp),%rcx
lea    0xbec(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    191b <main+0x74b>
mov    -0x38(%rbp),%rdi
lea    0xc22(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    184b <main+0x67b>
mov    0x2840(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x27f1(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1070 <ioctl@plt>
cmp    $0x0,%rax
jge    1827 <main+0x657>
mov    0x27ad(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa4(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    0x277b(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0xa4(%rbp),%edi
mov    -0xa0(%rbp),%rdx
mov    %rax,%rcx
lea    0xbb2(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1846 <main+0x676>
mov    0x2732(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%rdx
mov    -0x40(%rbp),%rcx
lea    0xbc4(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1916 <main+0x746>
mov    -0x38(%rbp),%rdi
lea    0x7ef(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    18e5 <main+0x715>
mov    0x2744(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
mov    0x273d(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rdx
call   1070 <ioctl@plt>
cmp    $0x0,%rax
jge    18c9 <main+0x6f9>
mov    0x26f9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa8(%rbp)
mov    0x26d2(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0xa8(%rbp),%edi
mov    %rax,%rdx
lea    0xb88(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    18e0 <main+0x710>
mov    0x2690(%rip),%rax
mov    (%rax),%edi
lea    0xbaa(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
jmp    1911 <main+0x741>
mov    0x26a4(%rip),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rdx
lea    0xbd8(%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    1916 <main+0x746>
jmp    191b <main+0x74b>
jmp    1920 <main+0x750>
jmp    1925 <main+0x755>
jmp    192a <main+0x75a>
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    1696 <main+0x4c6>
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    16e2 <main+0x512>
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    1703 <main+0x533>
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     16c1 <main+0x4f1>
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     154b <main+0x37b>
lea    0x1005(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     15ab <main+0x3db>
lea    0xc6e(%rip),%rsi
mov    %r12,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
jne    171c <main+0x54c>
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     1611 <main+0x441>
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     1516 <main+0x346>
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    1686 <main+0x4b6>
mov    (%rbx),%edi
lea    0xd69(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1686 <main+0x4b6>
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     1588 <main+0x3b8>
mov    0x2aa2(%rip),%rax
mov    (%rax),%edi
lea    0xdb7(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1686 <main+0x4b6>
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     15f1 <main+0x421>
mov    0x2a58(%rip),%rax
mov    (%rax),%edi
lea    0xdcd(%rip),%rsi
jmp    15e6 <main+0x416>
mov    0x2a73(%rip),%rax
mov    (%rax),%ebx
mov    0x2a52(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xc56(%rip),%rsi
mov    %ebx,%edi
mov    %r15d,%edx
mov    %r14,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    1686 <main+0x4b6>
mov    0x2a76(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2a59(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1070 <ioctl@plt>
test   %rax,%rax
js     1639 <main+0x469>
mov    0x29e3(%rip),%rax
mov    (%rax),%edi
lea    0xdf1(%rip),%rsi
jmp    15e6 <main+0x416>
mov    0x2a01(%rip),%rax
mov    (%rax),%ebx
mov    0x29e0(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xca9(%rip),%rsi
jmp    1677 <main+0x4a7>
mov    0x2a46(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x29f9(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebx,%edi
call   1070 <ioctl@plt>
test   %rax,%rax
js     1659 <main+0x489>
mov    0x2983(%rip),%rax
mov    (%rax),%edi
lea    0xe1d(%rip),%rsi
mov    %r14,%rdx
mov    %r14,%rcx
jmp    167f <main+0x4af>
mov    0x2998(%rip),%rax
mov    (%rax),%ebx
mov    0x2977(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xc93(%rip),%rsi
jmp    1677 <main+0x4a7>
mov    0x2978(%rip),%rax
mov    (%rax),%ebx
mov    0x2957(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xe16(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
jmp    14ca <main+0x2fa>
mov    0x2950(%rip),%rax
mov    (%rax),%ebx
mov    0x292f(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xce3(%rip),%rsi
jmp    1677 <main+0x4a7>
mov    0x2930(%rip),%rax
mov    (%rax),%ebx
mov    0x290f(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xd56(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%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    0x28c3(%rip),%rax
mov    (%rax),%edi
lea    0x970(%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    0x28c8(%rip),%rax
mov    (%rax),%edi
lea    0xa89(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10d0 <exit@plt>
mov    0x28a7(%rip),%rax
mov    (%rax),%edi
lea    0x9b9(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2886(%rip),%rax
mov    (%rax),%edi
lea    0x984(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    16b0 <main+0x4e0>
mov    0x286d(%rip),%rax
mov    (%rax),%edi
lea    0xda5(%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>

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 %177
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 %165
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)
br label %176
165: ; preds = %151
%166 = load i32, i32* @stdout
%167 = load i32, i32* %10
%168 = load i8*, i8** %9
%169 = call i32 (i32, i8*, ...) @fprintf(i32 %166, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.13, i64 0, i64 0), i32 %167, i8* %168)
%170 = load i32, i32* %10
%171 = icmp eq i32 %170, 1
br i1 %171, label %172, label %175
172: ; preds = %165
%173 = load i32, i32* @stdout
%174 = call i32 (i32, i8*, ...) @fprintf(i32 %173, i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.14, i64 0, i64 0))
br label %175
175: ; preds = %172, %165
br label %176
176: ; preds = %175, %158
br label %299
177: ; preds = %147
%178 = load i8*, i8** %8
%179 = call i64 @strcasecmp(i8* %178, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
%180 = icmp eq i64 %179, 0
br i1 %180, label %181, label %199
181: ; preds = %177
%182 = load i32, i32* @DEL_VLAN_CMD
%183 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 1
store i32 %182, i32* %183
%184 = load i32, i32* %6
%185 = load i32, i32* @SIOCSIFVLAN
%186 = call i64 @ioctl(i32 %184, i32 %185, %struct.vlan_ioctl_args* %7)
%187 = icmp slt i64 %186, 0
br i1 %187, label %188, label %194
188: ; preds = %181
%189 = load i32, i32* @stderr
%190 = load i8*, i8** %9
%191 = load i32, i32* @errno
%192 = call i8* @strerror(i32 %191)
%193 = call i32 (i32, i8*, ...) @fprintf(i32 %189, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.16, i64 0, i64 0), i8* %190, i8* %192)
br label %198
194: ; preds = %181
%195 = load i32, i32* @stdout
%196 = load i8*, i8** %9
%197 = call i32 (i32, i8*, ...) @fprintf(i32 %195, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0), i8* %196)
br label %198
198: ; preds = %194, %188
br label %298
199: ; preds = %177
%200 = load i8*, i8** %8
%201 = call i64 @strcasecmp(i8* %200, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0))
%202 = icmp eq i64 %201, 0
br i1 %202, label %203, label %222
203: ; preds = %199
%204 = load i32, i32* @SET_VLAN_EGRESS_PRIORITY_CMD
%205 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 1
store i32 %204, i32* %205
%206 = load i32, i32* %6
%207 = load i32, i32* @SIOCSIFVLAN
%208 = call i64 @ioctl(i32 %206, i32 %207, %struct.vlan_ioctl_args* %7)
%209 = icmp slt i64 %208, 0
br i1 %209, label %210, label %216
210: ; preds = %203
%211 = load i32, i32* @stderr
%212 = load i8*, i8** %9
%213 = load i32, i32* @errno
%214 = call i8* @strerror(i32 %213)
%215 = call i32 (i32, i8*, ...) @fprintf(i32 %211, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.19, i64 0, i64 0), i8* %212, i8* %214)
br label %221
216: ; preds = %203
%217 = load i32, i32* @stdout
%218 = load i8*, i8** %9
%219 = load i8*, i8** %9
%220 = call i32 (i32, i8*, ...) @fprintf(i32 %217, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.20, i64 0, i64 0), i8* %218, i8* %219)
br label %221
221: ; preds = %216, %210
br label %297
222: ; preds = %199
%223 = load i8*, i8** %8
%224 = call i64 @strcasecmp(i8* %223, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.21, i64 0, i64 0))
%225 = icmp eq i64 %224, 0
br i1 %225, label %226, label %245
226: ; preds = %222
%227 = load i32, i32* @SET_VLAN_INGRESS_PRIORITY_CMD
%228 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 1
store i32 %227, i32* %228
%229 = load i32, i32* %6
%230 = load i32, i32* @SIOCSIFVLAN
%231 = call i64 @ioctl(i32 %229, i32 %230, %struct.vlan_ioctl_args* %7)
%232 = icmp slt i64 %231, 0
br i1 %232, label %233, label %239
233: ; preds = %226
%234 = load i32, i32* @stderr
%235 = load i8*, i8** %9
%236 = load i32, i32* @errno
%237 = call i8* @strerror(i32 %236)
%238 = call i32 (i32, i8*, ...) @fprintf(i32 %234, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.22, i64 0, i64 0), i8* %235, i8* %237)
br label %244
239: ; preds = %226
%240 = load i32, i32* @stdout
%241 = load i8*, i8** %9
%242 = load i8*, i8** %9
%243 = call i32 (i32, i8*, ...) @fprintf(i32 %240, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.23, i64 0, i64 0), i8* %241, i8* %242)
br label %244
244: ; preds = %239, %233
br label %296
245: ; preds = %222
%246 = load i8*, i8** %8
%247 = call i64 @strcasecmp(i8* %246, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0))
%248 = icmp eq i64 %247, 0
br i1 %248, label %249, label %268
249: ; preds = %245
%250 = load i32, i32* @SET_VLAN_FLAG_CMD
%251 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 1
store i32 %250, i32* %251
%252 = load i32, i32* %6
%253 = load i32, i32* @SIOCSIFVLAN
%254 = call i64 @ioctl(i32 %252, i32 %253, %struct.vlan_ioctl_args* %7)
%255 = icmp slt i64 %254, 0
br i1 %255, label %256, label %262
256: ; preds = %249
%257 = load i32, i32* @stderr
%258 = load i8*, i8** %9
%259 = load i32, i32* @errno
%260 = call i8* @strerror(i32 %259)
%261 = call i32 (i32, i8*, ...) @fprintf(i32 %257, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.25, i64 0, i64 0), i8* %258, i8* %260)
br label %267
262: ; preds = %249
%263 = load i32, i32* @stdout
%264 = load i8*, i8** %9
%265 = load i8*, i8** %9
%266 = call i32 (i32, i8*, ...) @fprintf(i32 %263, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.26, i64 0, i64 0), i8* %264, i8* %265)
br label %267
267: ; preds = %262, %256
br label %295
268: ; preds = %245
%269 = load i8*, i8** %8
%270 = call i64 @strcasecmp(i8* %269, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%271 = icmp eq i64 %270, 0
br i1 %271, label %272, label %288
272: ; preds = %268
%273 = load i32, i32* @SET_VLAN_NAME_TYPE_CMD
%274 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %7, i32 0, i32 1
store i32 %273, i32* %274
%275 = load i32, i32* %6
%276 = load i32, i32* @SIOCSIFVLAN
%277 = call i64 @ioctl(i32 %275, i32 %276, %struct.vlan_ioctl_args* %7)
%278 = icmp slt i64 %277, 0
br i1 %278, label %279, label %284
279: ; preds = %272
%280 = load i32, i32* @stderr
%281 = load i32, i32* @errno
%282 = call i8* @strerror(i32 %281)
%283 = call i32 (i32, i8*, ...) @fprintf(i32 %280, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.27, i64 0, i64 0), i8* %282)
br label %287
284: ; preds = %272
%285 = load i32, i32* @stdout
%286 = call i32 (i32, i8*, ...) @fprintf(i32 %285, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.28, i64 0, i64 0))
br label %287
287: ; preds = %284, %279
br label %294
288: ; preds = %268
%289 = load i32, i32* @stderr
%290 = load i8*, i8** %8
%291 = call i32 (i32, i8*, ...) @fprintf(i32 %289, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.29, i64 0, i64 0), i8* %290)
%292 = call i32 (...) @show_usage()
%293 = call i32 @exit(i32 5)
unreachable
294: ; preds = %287
br label %295
295: ; preds = %294, %267
br label %296
296: ; preds = %295, %244
br label %297
297: ; preds = %296, %221
br label %298
298: ; preds = %297, %198
br label %299
299: ; preds = %298, %176
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 %114
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 %107
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)
br label %204
107: ; preds = %96
%108 = load i32, i32* @stdout
%109 = call i32 (i32, i8*, ...) @fprintf(i32 %108, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.13, i64 0, i64 0), i32 %75, i8* %53)
%110 = icmp eq i32 %75, 1
br i1 %110, label %111, label %204
111: ; preds = %107
%112 = load i32, i32* @stdout
%113 = call i32 (i32, i8*, ...) @fprintf(i32 %112, i8* getelementptr inbounds ([98 x i8], [98 x i8]* @.str.14, i64 0, i64 0))
br label %204
114: ; preds = %93
%115 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
%116 = icmp eq i64 %115, 0
br i1 %116, label %117, label %131
117: ; preds = %114
%118 = load i32, i32* @DEL_VLAN_CMD
%119 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 1
store i32 %118, i32* %119
%120 = load i32, i32* @SIOCSIFVLAN
%121 = call i64 @ioctl(i32 %87, i32 %120, %struct.vlan_ioctl_args* %3)
%122 = icmp slt i64 %121, 0
br i1 %122, label %123, label %128
123: ; preds = %117
%124 = load i32, i32* @stderr
%125 = load i32, i32* @errno
%126 = call i8* @strerror(i32 %125)
%127 = call i32 (i32, i8*, ...) @fprintf(i32 %124, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.16, i64 0, i64 0), i8* %53, i8* %126)
br label %204
128: ; preds = %117
%129 = load i32, i32* @stdout
%130 = call i32 (i32, i8*, ...) @fprintf(i32 %129, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.17, i64 0, i64 0), i8* %53)
br label %204
131: ; preds = %114
%132 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0))
%133 = icmp eq i64 %132, 0
br i1 %133, label %134, label %148
134: ; preds = %131
%135 = load i32, i32* @SET_VLAN_EGRESS_PRIORITY_CMD
%136 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 1
store i32 %135, i32* %136
%137 = load i32, i32* @SIOCSIFVLAN
%138 = call i64 @ioctl(i32 %87, i32 %137, %struct.vlan_ioctl_args* %3)
%139 = icmp slt i64 %138, 0
br i1 %139, label %140, label %145
140: ; preds = %134
%141 = load i32, i32* @stderr
%142 = load i32, i32* @errno
%143 = call i8* @strerror(i32 %142)
%144 = call i32 (i32, i8*, ...) @fprintf(i32 %141, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.19, i64 0, i64 0), i8* %53, i8* %143)
br label %204
145: ; preds = %134
%146 = load i32, i32* @stdout
%147 = call i32 (i32, i8*, ...) @fprintf(i32 %146, i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.20, i64 0, i64 0), i8* %53, i8* %53)
br label %204
148: ; preds = %131
%149 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.21, i64 0, i64 0))
%150 = icmp eq i64 %149, 0
br i1 %150, label %151, label %165
151: ; preds = %148
%152 = load i32, i32* @SET_VLAN_INGRESS_PRIORITY_CMD
%153 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 1
store i32 %152, i32* %153
%154 = load i32, i32* @SIOCSIFVLAN
%155 = call i64 @ioctl(i32 %87, i32 %154, %struct.vlan_ioctl_args* %3)
%156 = icmp slt i64 %155, 0
br i1 %156, label %157, label %162
157: ; preds = %151
%158 = load i32, i32* @stderr
%159 = load i32, i32* @errno
%160 = call i8* @strerror(i32 %159)
%161 = call i32 (i32, i8*, ...) @fprintf(i32 %158, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.22, i64 0, i64 0), i8* %53, i8* %160)
br label %204
162: ; preds = %151
%163 = load i32, i32* @stdout
%164 = call i32 (i32, i8*, ...) @fprintf(i32 %163, i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.23, i64 0, i64 0), i8* %53, i8* %53)
br label %204
165: ; preds = %148
%166 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.24, i64 0, i64 0))
%167 = icmp eq i64 %166, 0
br i1 %167, label %168, label %182
168: ; preds = %165
%169 = load i32, i32* @SET_VLAN_FLAG_CMD
%170 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 1
store i32 %169, i32* %170
%171 = load i32, i32* @SIOCSIFVLAN
%172 = call i64 @ioctl(i32 %87, i32 %171, %struct.vlan_ioctl_args* %3)
%173 = icmp slt i64 %172, 0
br i1 %173, label %174, label %179
174: ; preds = %168
%175 = load i32, i32* @stderr
%176 = load i32, i32* @errno
%177 = call i8* @strerror(i32 %176)
%178 = call i32 (i32, i8*, ...) @fprintf(i32 %175, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.25, i64 0, i64 0), i8* %53, i8* %177)
br label %204
179: ; preds = %168
%180 = load i32, i32* @stdout
%181 = call i32 (i32, i8*, ...) @fprintf(i32 %180, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.26, i64 0, i64 0), i8* %53, i8* %53)
br label %204
182: ; preds = %165
%183 = call i64 @strcasecmp(i8* %15, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%184 = icmp eq i64 %183, 0
br i1 %184, label %185, label %199
185: ; preds = %182
%186 = load i32, i32* @SET_VLAN_NAME_TYPE_CMD
%187 = getelementptr inbounds %struct.vlan_ioctl_args, %struct.vlan_ioctl_args* %3, i64 0, i32 1
store i32 %186, i32* %187
%188 = load i32, i32* @SIOCSIFVLAN
%189 = call i64 @ioctl(i32 %87, i32 %188, %struct.vlan_ioctl_args* %3)
%190 = icmp slt i64 %189, 0
br i1 %190, label %191, label %196
191: ; preds = %185
%192 = load i32, i32* @stderr
%193 = load i32, i32* @errno
%194 = call i8* @strerror(i32 %193)
%195 = call i32 (i32, i8*, ...) @fprintf(i32 %192, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.27, i64 0, i64 0), i8* %194)
br label %204
196: ; preds = %185
%197 = load i32, i32* @stdout
%198 = call i32 (i32, i8*, ...) @fprintf(i32 %197, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.28, i64 0, i64 0))
br label %204
199: ; preds = %182
%200 = load i32, i32* @stderr
%201 = call i32 (i32, i8*, ...) @fprintf(i32 %200, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.29, i64 0, i64 0), i8* %15)
%202 = call i32 (...) @show_usage()
%203 = call i32 @exit(i32 5)
unreachable
204: ; preds = %128, %123, %162, %157, %196, %191, %174, %179, %140, %145, %102, %111, %107
ret i32 0
}