#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 pollfd {
  int fd;
  scalar_t__ revents;
  int /*<<< orphan*/ events;
};
struct option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ const member_1;
};
struct TYPE_2__ {
  int operation;
};
struct hv_vss_msg {
  int error;
  TYPE_1__ vss_hdr;
};
typedef int /*<<< orphan*/ kernel_modver;
typedef int /*<<< orphan*/ __u32;

/* Variables and functions */
scalar_t__ EINVAL;
int EXIT_FAILURE;
int HV_E_FAIL;
int HV_S_OK;
int /*<<< orphan*/ LOG_ERR;
int /*<<< orphan*/ LOG_INFO;
int /*<<< orphan*/ LOG_USER;
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ POLLIN;
#define VSS_OP_FREEZE 131
#define VSS_OP_HOT_BACKUP 130
int VSS_OP_REGISTER1;
#define VSS_OP_THAW 129
int /*<<< orphan*/ close(int);
scalar_t__ daemon(int, int /*<<< orphan*/);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int getopt_long(int, char **, char *, struct option *, int *);
int /*<<< orphan*/ getpid();
#define no_argument 128
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ openlog(char *, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ poll(struct pollfd *, int, int);
int /*<<< orphan*/ print_usage(char **);
int read(int, struct hv_vss_msg *, int);
char *strerror(scalar_t__);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *, ...);
int vss_operate(int);
int write(int, struct hv_vss_msg *, int);
int main(int argc, char *argv[]) {
  int vss_fd, len;
  int error;
  struct pollfd pfd;
  int op;
  struct hv_vss_msg vss_msg[1];
  int daemonize = 1, long_index = 0, opt;
  int in_handshake = 1;
  __u32 kernel_modver;
  static struct option long_options[] = {{"help", no_argument, 0, 'h'},
                                         {"no-daemon", no_argument, 0, 'n'},
                                         {0, 0, 0, 0}};
  while ((opt = getopt_long(argc, argv, "hn", long_options, &long_index)) !=
         -1) {
    switch (opt) {
    case 'n':
      daemonize = 0;
      break;
    case 'h':
    default:
      print_usage(argv);
      exit(EXIT_FAILURE);
    }
  }
  if (daemonize && daemon(1, 0)) {
    return 1;
  }
  openlog("Hyper-V VSS", 0, LOG_USER);
  syslog(LOG_INFO, "VSS starting; pid is:%d", getpid());
  vss_fd = open("/dev/vmbus/hv_vss", O_RDWR);
  if (vss_fd < 0) {
    syslog(LOG_ERR, "open /dev/vmbus/hv_vss failed; error: %d %s", errno,
           strerror(errno));
    exit(EXIT_FAILURE);
  }
  vss_msg->vss_hdr.operation = VSS_OP_REGISTER1;
  len = write(vss_fd, vss_msg, sizeof(struct hv_vss_msg));
  if (len < 0) {
    syslog(LOG_ERR, "registration to kernel failed; error: %d %s", errno,
           strerror(errno));
    close(vss_fd);
    exit(EXIT_FAILURE);
  }
  pfd.fd = vss_fd;
  while (1) {
    pfd.events = POLLIN;
    pfd.revents = 0;
    if (poll(&pfd, 1, -1) < 0) {
      syslog(LOG_ERR, "poll failed; error:%d %s", errno, strerror(errno));
      if (errno == EINVAL) {
        close(vss_fd);
        exit(EXIT_FAILURE);
      } else {
        continue;
      }
    }
    len = read(vss_fd, vss_msg, sizeof(struct hv_vss_msg));
    if (in_handshake) {
      if (len != sizeof(kernel_modver)) {
        syslog(LOG_ERR, "invalid version negotiation");
        exit(EXIT_FAILURE);
      }
      kernel_modver = *(__u32 *)vss_msg;
      in_handshake = 0;
      syslog(LOG_INFO, "VSS: kernel module version: %d", kernel_modver);
      continue;
    }
    if (len != sizeof(struct hv_vss_msg)) {
      syslog(LOG_ERR, "read failed; error:%d %s", errno, strerror(errno));
      close(vss_fd);
      return EXIT_FAILURE;
    }
    op = vss_msg->vss_hdr.operation;
    error = HV_S_OK;
    switch (op) {
    case VSS_OP_FREEZE:
    case VSS_OP_THAW:
      error = vss_operate(op);
      syslog(LOG_INFO, "VSS: op=%s: %s\n",
             op == VSS_OP_FREEZE ? "FREEZE" : "THAW",
             error ? "failed" : "succeeded");
      if (error) {
        error = HV_E_FAIL;
        syslog(LOG_ERR, "op=%d failed!", op);
        syslog(LOG_ERR, "report it with these files:");
        syslog(LOG_ERR, "/etc/fstab and /proc/mounts");
      }
      break;
    case VSS_OP_HOT_BACKUP:
      syslog(LOG_INFO, "VSS: op=CHECK HOT BACKUP\n");
      break;
    default:
      syslog(LOG_ERR, "Illegal op:%d\n", op);
    }
    vss_msg->error = error;
    len = write(vss_fd, vss_msg, sizeof(struct hv_vss_msg));
    if (len != sizeof(struct hv_vss_msg)) {
      syslog(LOG_ERR, "write failed; error: %d %s", errno, strerror(errno));
      exit(EXIT_FAILURE);
    }
  }
  close(vss_fd);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x1,-0x58(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdf3(%rip),%rdx
lea    0x2e7d(%rip),%rcx
lea    -0x50(%rbp),%r8
call   1050 <getopt_long@plt>
mov    %eax,-0x54(%rbp)
cmp    $0xffffffff,%eax
je     128a <main+0xaa>
mov    -0x54(%rbp),%eax
mov    %eax,-0x60(%rbp)
sub    $0x68,%eax
je     1269 <main+0x89>
jmp    124c <main+0x6c>
mov    -0x60(%rbp),%eax
sub    $0x6e,%eax
jne    126e <main+0x8e>
jmp    125d <main+0x7d>
movl   $0x0,-0x4c(%rbp)
jmp    1285 <main+0xa5>
jmp    126e <main+0x8e>
mov    -0x10(%rbp),%rdi
call   10f0 <print_usage@plt>
mov    0x2d32(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
jmp    120e <main+0x2e>
cmpl   $0x0,-0x4c(%rbp)
je     12b6 <main+0xd6>
mov    $0x1,%edi
xor    %esi,%esi
call   1090 <daemon@plt>
cmp    $0x0,%rax
je     12b6 <main+0xd6>
movl   $0x1,-0x4(%rbp)
jmp    1762 <main+0x582>
mov    0x2d23(%rip),%rax
mov    (%rax),%edx
lea    0xd4c(%rip),%rdi
xor    %esi,%esi
call   10c0 <openlog@plt>
mov    0x2ccc(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x64(%rbp),%edi
mov    %eax,%edx
lea    0xd32(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    0x2cee(%rip),%rax
mov    (%rax),%esi
lea    0xd33(%rip),%rdi
call   10b0 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1364 <main+0x184>
mov    0x2c6c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
mov    0x2c98(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x70(%rbp)
mov    0x2c8a(%rip),%rax
mov    (%rax),%rdi
call   1100 <strerror@plt>
mov    -0x74(%rbp),%edi
mov    -0x70(%rbp),%rdx
mov    %rax,%rcx
lea    0xcf9(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    0x2c53(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    0x2c6d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x48(%rbp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    13eb <main+0x20b>
mov    0x2bf3(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    0x2c1c(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x80(%rbp)
mov    0x2c0e(%rip),%rax
mov    (%rax),%rdi
call   1100 <strerror@plt>
mov    -0x84(%rbp),%edi
mov    -0x80(%rbp),%rdx
mov    %rax,%rcx
lea    0xca6(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    0x2bcc(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    0x2bd8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
lea    -0x38(%rbp),%rdi
mov    $0x1,%esi
mov    $0xffffffff,%edx
call   10a0 <poll@plt>
cmp    $0x0,%rax
jge    14a4 <main+0x2c4>
mov    0x2b5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
mov    0x2b88(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x90(%rbp)
mov    0x2b77(%rip),%rax
mov    (%rax),%rdi
call   1100 <strerror@plt>
mov    -0x94(%rbp),%edi
mov    -0x90(%rbp),%rdx
mov    %rax,%rcx
lea    0xc38(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    0x2b4a(%rip),%rax
mov    (%rax),%rax
mov    0x2b28(%rip),%rcx
cmp    (%rcx),%rax
jne    149f <main+0x2bf>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    0x2b18(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
jmp    13f1 <main+0x211>
mov    -0x14(%rbp),%edi
lea    -0x48(%rbp),%rsi
mov    $0x8,%edx
call   1070 <read@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x58(%rbp)
je     1521 <main+0x341>
movslq -0x18(%rbp),%rax
cmp    $0x4,%rax
je     14f5 <main+0x315>
mov    0x2ab1(%rip),%rax
mov    (%rax),%edi
lea    0xbd9(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    0x2ac2(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x48(%rbp),%eax
mov    %eax,-0x5c(%rbp)
movl   $0x0,-0x58(%rbp)
mov    0x2a97(%rip),%rax
mov    (%rax),%edi
mov    -0x5c(%rbp),%edx
lea    0xbc0(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
jmp    13f1 <main+0x211>
movslq -0x18(%rbp),%rax
cmp    $0x8,%rax
je     1595 <main+0x3b5>
mov    0x2a52(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa4(%rbp)
mov    0x2a7b(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xa0(%rbp)
mov    0x2a6a(%rip),%rax
mov    (%rax),%rdi
call   1100 <strerror@plt>
mov    -0xa4(%rbp),%edi
mov    -0xa0(%rbp),%rdx
mov    %rax,%rcx
lea    0xb7f(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
mov    0x2a25(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1762 <main+0x582>
mov    -0x44(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    0x29ee(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0xa8(%rbp)
sub    $0x81,%eax
je     15ec <main+0x40c>
jmp    15c0 <main+0x3e0>
mov    -0xa8(%rbp),%eax
sub    $0x82,%eax
je     16a4 <main+0x4c4>
jmp    15d6 <main+0x3f6>
mov    -0xa8(%rbp),%eax
sub    $0x83,%eax
jne    16c0 <main+0x4e0>
jmp    15ec <main+0x40c>
mov    -0x3c(%rbp),%edi
call   10d0 <vss_operate@plt>
mov    %eax,-0x1c(%rbp)
mov    0x29a2(%rip),%rax
mov    (%rax),%edi
mov    -0x3c(%rbp),%ecx
lea    0xb1a(%rip),%rdx
lea    0xb0c(%rip),%rax
cmp    $0x83,%ecx
cmove  %rax,%rdx
mov    -0x1c(%rbp),%esi
lea    0xb0b(%rip),%rcx
lea    0xafd(%rip),%rax
cmp    $0x0,%esi
cmovne %rax,%rcx
lea    0xad3(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
cmpl   $0x0,-0x1c(%rbp)
je     169f <main+0x4bf>
mov    0x2966(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x292a(%rip),%rax
mov    (%rax),%edi
mov    -0x3c(%rbp),%edx
lea    0xad0(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    0x2910(%rip),%rax
mov    (%rax),%edi
lea    0xac7(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    0x28f9(%rip),%rax
mov    (%rax),%edi
lea    0xacc(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
jmp    16da <main+0x4fa>
mov    0x28f5(%rip),%rax
mov    (%rax),%edi
lea    0xacc(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
jmp    16da <main+0x4fa>
mov    0x28c1(%rip),%rax
mov    (%rax),%edi
mov    -0x3c(%rbp),%edx
lea    0xac7(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x48(%rbp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    $0x8,%rax
je     175d <main+0x57d>
mov    0x287f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xb4(%rbp)
mov    0x28a8(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0xb0(%rbp)
mov    0x2897(%rip),%rax
mov    (%rax),%rdi
call   1100 <strerror@plt>
mov    -0xb4(%rbp),%edi
mov    -0xb0(%rbp),%rdx
mov    %rax,%rcx
lea    0xa61(%rip),%rsi
mov    $0x0,%al
call   1080 <syslog@plt>
mov    0x285a(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
jmp    13f1 <main+0x211>
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r13
mov    %edi,%ebp
movl   $0x0,0x1c(%rsp)
xor    %ecx,%ecx
lea    0xe0b(%rip),%r14
lea    0x2e95(%rip),%r15
lea    0x1c(%rsp),%r12
mov    %ecx,%ebx
mov    %ebp,%edi
mov    %r13,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %r12,%r8
call   1050 <getopt_long@plt>
mov    $0x1,%cl
cmp    $0x6e,%eax
je     1210 <main+0x30>
cmp    $0xffffffff,%eax
jne    156c <main+0x38c>
test   $0x1,%bl
jne    1254 <main+0x74>
mov    $0x1,%ebx
mov    $0x1,%edi
xor    %esi,%esi
call   1090 <daemon@plt>
test   %rax,%rax
jne    1544 <main+0x364>
mov    0x2d85(%rip),%rax
mov    (%rax),%edx
lea    0xdae(%rip),%rdi
xor    %esi,%esi
call   10c0 <openlog@plt>
mov    0x2d2e(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xd9c(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <syslog@plt>
mov    0x2d54(%rip),%rax
mov    (%rax),%esi
lea    0xd99(%rip),%rdi
call   10b0 <open@plt>
test   %eax,%eax
js     158f <main+0x3af>
mov    %eax,%ebx
mov    0x2d25(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x14(%rsp)
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
mov    $0x8,%edx
call   1030 <write@plt>
test   %eax,%eax
js     15b6 <main+0x3d6>
mov    %ebx,0xc(%rsp)
mov    %ebx,0x20(%rsp)
lea    0x20(%rsp),%r15
mov    0x2cda(%rip),%r12
lea    0xdb3(%rip),%r13
mov    0x2cb4(%rip),%r14
movl   $0x0,0x8(%rsp)
jmp    1334 <main+0x154>
xchg   %ax,%ax
mov    0x2c81(%rip),%rax
mov    (%rax),%ebp
mov    (%r12),%rbx
mov    %rbx,%rdi
call   1100 <strerror@plt>
mov    %ebp,%edi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <syslog@plt>
mov    (%r12),%rax
cmp    (%r14),%rax
je     1555 <main+0x375>
mov    0x2c95(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x30(%rsp)
movq   $0x0,0x28(%rsp)
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0xffffffff,%edx
call   10a0 <poll@plt>
test   %rax,%rax
js     1300 <main+0x120>
mov    0xc(%rsp),%edi
lea    0x10(%rsp),%rsi
mov    $0x8,%edx
call   1070 <read@plt>
testb  $0x1,0x8(%rsp)
je     1453 <main+0x273>
cmp    $0x8,%eax
jne    1507 <main+0x327>
mov    0x14(%rsp),%ebp
cmp    $0x83,%ebp
je     13b5 <main+0x1d5>
mov    0x2bf5(%rip),%rax
mov    (%rax),%ebx
cmp    $0x82,%ebp
je     1482 <main+0x2a2>
cmp    $0x81,%ebp
jne    149b <main+0x2bb>
mov    %ebp,%edi
call   10d0 <vss_operate@plt>
mov    %eax,%ebx
cmp    $0x83,%ebp
lea    0xd59(%rip),%rdx
lea    0xd4b(%rip),%rax
cmove  %rax,%rdx
mov    0x2bc3(%rip),%rax
mov    (%rax),%edi
test   %ebx,%ebx
lea    0xd41(%rip),%rcx
lea    0xd41(%rip),%rax
cmove  %rax,%rcx
lea    0xd13(%rip),%rsi
xor    %eax,%eax
call   1080 <syslog@plt>
test   %ebx,%ebx
mov    $0x0,%ebx
je     14b4 <main+0x2d4>
mov    0x2ba3(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
mov    0x2b66(%rip),%rbx
mov    (%rbx),%edi
lea    0xd0f(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <syslog@plt>
mov    (%rbx),%edi
lea    0xd0b(%rip),%rsi
xor    %eax,%eax
call   1080 <syslog@plt>
mov    (%rbx),%edi
mov    0x8(%rsp),%ebx
lea    0xd13(%rip),%rsi
jmp    1492 <main+0x2b2>
cmp    $0x4,%eax
jne    1576 <main+0x396>
mov    0x10(%rsp),%edx
mov    0x2b39(%rip),%rax
mov    (%rax),%edi
lea    0xc65(%rip),%rsi
xor    %eax,%eax
call   1080 <syslog@plt>
mov    $0x1,%al
mov    %eax,0x8(%rsp)
jmp    1334 <main+0x154>
mov    0x2b17(%rip),%rax
mov    (%rax),%edi
lea    0xcee(%rip),%rsi
xor    %eax,%eax
call   1080 <syslog@plt>
jmp    14b4 <main+0x2d4>
mov    0x2ae6(%rip),%rax
mov    (%rax),%edi
lea    0xcef(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1080 <syslog@plt>
mov    %ebx,0x10(%rsp)
mov    0xc(%rsp),%edi
lea    0x10(%rsp),%rsi
mov    $0x8,%edx
call   1030 <write@plt>
mov    $0x1,%cl
mov    %ecx,0x8(%rsp)
cmp    $0x8,%eax
je     1334 <main+0x154>
mov    0x2aa7(%rip),%rax
mov    (%rax),%ebx
mov    (%r12),%rbp
mov    %rbp,%rdi
call   1100 <strerror@plt>
lea    0xcb3(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <syslog@plt>
jmp    155e <main+0x37e>
mov    0x2a7a(%rip),%rax
mov    (%rax),%ebx
mov    (%r12),%rbp
mov    %rbp,%rdi
call   1100 <strerror@plt>
lea    0xbd1(%rip),%rsi
mov    %ebx,%edi
mov    %rbp,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <syslog@plt>
mov    0xc(%rsp),%edi
call   1060 <close@plt>
mov    0x2a6e(%rip),%rax
mov    (%rax),%ebx
mov    %ebx,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0xc(%rsp),%edi
call   1060 <close@plt>
mov    0x2a4b(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    %r13,%rdi
call   10f0 <print_usage@plt>
jmp    155e <main+0x37e>
mov    0x2a0b(%rip),%rax
mov    (%rax),%edi
lea    0xb33(%rip),%rsi
xor    %eax,%eax
call   1080 <syslog@plt>
jmp    155e <main+0x37e>
mov    0x29f2(%rip),%rax
mov    (%rax),%ebx
mov    0x2a21(%rip),%rax
mov    (%rax),%rbp
mov    %rbp,%rdi
call   1100 <strerror@plt>
lea    0xa97(%rip),%rsi
jmp    14f6 <main+0x316>
mov    0x29cb(%rip),%rax
mov    (%rax),%r14d
mov    0x29f9(%rip),%rax
mov    (%rax),%rbp
mov    %rbp,%rdi
call   1100 <strerror@plt>
lea    0xa9b(%rip),%rsi
mov    %r14d,%edi
mov    %rbp,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <syslog@plt>
mov    %ebx,%edi
jmp    1559 <main+0x379>

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
%struct.pollfd = type { i32, i64, i32 }
%struct.hv_vss_msg = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@main.long_options = internal global [3 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 -128, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i32 0, i32 0), i8 -128, i32 0, i32 110 }, %struct.option zeroinitializer]
@.str = [5 x i8] c"help\00"
@.str.1 = [10 x i8] c"no-daemon\00"
@.str.2 = [3 x i8] c"hn\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [12 x i8] c"Hyper-V VSS\00"
@LOG_USER = global i32 0
@LOG_INFO = global i32 0
@.str.4 = [24 x i8] c"VSS starting; pid is:%d\00"
@.str.5 = [18 x i8] c"/dev/vmbus/hv_vss\00"
@O_RDWR = global i32 0
@LOG_ERR = global i32 0
@.str.6 = [44 x i8] c"open /dev/vmbus/hv_vss failed; error: %d %s\00"
@errno = global i64 0
@VSS_OP_REGISTER1 = global i32 0
@.str.7 = [44 x i8] c"registration to kernel failed; error: %d %s\00"
@POLLIN = global i32 0
@.str.8 = [25 x i8] c"poll failed; error:%d %s\00"
@EINVAL = global i64 0
@.str.9 = [28 x i8] c"invalid version negotiation\00"
@.str.10 = [31 x i8] c"VSS: kernel module version: %d\00"
@.str.11 = [25 x i8] c"read failed; error:%d %s\00"
@HV_S_OK = global i32 0
@.str.12 = [16 x i8] c"VSS: op=%s: %s\0A\00"
@.str.13 = [7 x i8] c"FREEZE\00"
@.str.14 = [5 x i8] c"THAW\00"
@.str.15 = [7 x i8] c"failed\00"
@.str.16 = [10 x i8] c"succeeded\00"
@HV_E_FAIL = global i32 0
@.str.17 = [14 x i8] c"op=%d failed!\00"
@.str.18 = [28 x i8] c"report it with these files:\00"
@.str.19 = [28 x i8] c"/etc/fstab and /proc/mounts\00"
@.str.20 = [26 x i8] c"VSS: op=CHECK HOT BACKUP\0A\00"
@.str.21 = [15 x i8] c"Illegal op:%d\0A\00"
@.str.22 = [27 x i8] c"write failed; error: %d %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.pollfd
%10 = alloca i32
%11 = alloca [1 x %struct.hv_vss_msg]
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %12
store i32 0, i32* %13
store i32 1, i32* %15
br label %17
17: ; preds = %31, %2
%18 = load i32, i32* %4
%19 = load i8**, i8*** %5
%20 = call i32 @getopt_long(i32 %18, i8** %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %struct.option* getelementptr inbounds ([3 x %struct.option], [3 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %13)
store i32 %20, i32* %14
%21 = icmp ne i32 %20, -1
br i1 %21, label %22, label %32
22: ; preds = %17
%23 = load i32, i32* %14
switch i32 %23, label %26 [
i32 110, label %24
i32 104, label %25
]
24: ; preds = %22
store i32 0, i32* %12
br label %31
25: ; preds = %22
br label %26
26: ; preds = %22, %25
%27 = load i8**, i8*** %5
%28 = call i32 @print_usage(i8** %27)
%29 = load i32, i32* @EXIT_FAILURE
%30 = call i32 @exit(i32 %29)
unreachable
31: ; preds = %24
br label %17
32: ; preds = %17
%33 = load i32, i32* %12
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = call i64 @daemon(i32 1, i32 0)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %35
store i32 1, i32* %3
br label %194
39: ; preds = %35, %32
%40 = load i32, i32* @LOG_USER
%41 = call i32 @openlog(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 %40)
%42 = load i32, i32* @LOG_INFO
%43 = call i32 (...) @getpid()
%44 = call i32 (i32, i8*, ...) @syslog(i32 %42, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %43)
%45 = load i32, i32* @O_RDWR
%46 = call i32 @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %45)
store i32 %46, i32* %6
%47 = load i32, i32* %6
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %57
49: ; preds = %39
%50 = load i32, i32* @LOG_ERR
%51 = load i64, i64* @errno
%52 = load i64, i64* @errno
%53 = call i8* @strerror(i64 %52)
%54 = call i32 (i32, i8*, ...) @syslog(i32 %50, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i64 %51, i8* %53)
%55 = load i32, i32* @EXIT_FAILURE
%56 = call i32 @exit(i32 %55)
unreachable
57: ; preds = %39
%58 = load i32, i32* @VSS_OP_REGISTER1
%59 = getelementptr inbounds [1 x %struct.hv_vss_msg], [1 x %struct.hv_vss_msg]* %11, i64 0, i64 0
%60 = getelementptr inbounds %struct.hv_vss_msg, %struct.hv_vss_msg* %59, i32 0, i32 1
%61 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %60, i32 0, i32 0
store i32 %58, i32* %61
%62 = load i32, i32* %6
%63 = getelementptr inbounds [1 x %struct.hv_vss_msg], [1 x %struct.hv_vss_msg]* %11, i64 0, i64 0
%64 = call i32 @write(i32 %62, %struct.hv_vss_msg* %63, i32 8)
store i32 %64, i32* %7
%65 = load i32, i32* %7
%66 = icmp slt i32 %65, 0
br i1 %66, label %67, label %77
67: ; preds = %57
%68 = load i32, i32* @LOG_ERR
%69 = load i64, i64* @errno
%70 = load i64, i64* @errno
%71 = call i8* @strerror(i64 %70)
%72 = call i32 (i32, i8*, ...) @syslog(i32 %68, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), i64 %69, i8* %71)
%73 = load i32, i32* %6
%74 = call i32 @close(i32 %73)
%75 = load i32, i32* @EXIT_FAILURE
%76 = call i32 @exit(i32 %75)
unreachable
77: ; preds = %57
%78 = load i32, i32* %6
%79 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %9, i32 0, i32 0
store i32 %78, i32* %79
br label %80
80: ; preds = %77, %100, %116, %193
%81 = load i32, i32* @POLLIN
%82 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %9, i32 0, i32 2
store i32 %81, i32* %82
%83 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %9, i32 0, i32 1
store i64 0, i64* %83
%84 = call i64 @poll(%struct.pollfd* %9, i32 1, i32 -1)
%85 = icmp slt i64 %84, 0
br i1 %85, label %86, label %101
86: ; preds = %80
%87 = load i32, i32* @LOG_ERR
%88 = load i64, i64* @errno
%89 = load i64, i64* @errno
%90 = call i8* @strerror(i64 %89)
%91 = call i32 (i32, i8*, ...) @syslog(i32 %87, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i64 %88, i8* %90)
%92 = load i64, i64* @errno
%93 = load i64, i64* @EINVAL
%94 = icmp eq i64 %92, %93
br i1 %94, label %95, label %100
95: ; preds = %86
%96 = load i32, i32* %6
%97 = call i32 @close(i32 %96)
%98 = load i32, i32* @EXIT_FAILURE
%99 = call i32 @exit(i32 %98)
unreachable
100: ; preds = %86
br label %80
101: ; preds = %80
%102 = load i32, i32* %6
%103 = getelementptr inbounds [1 x %struct.hv_vss_msg], [1 x %struct.hv_vss_msg]* %11, i64 0, i64 0
%104 = call i32 @read(i32 %102, %struct.hv_vss_msg* %103, i32 8)
store i32 %104, i32* %7
%105 = load i32, i32* %15
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %123
107: ; preds = %101
%108 = load i32, i32* %7
%109 = sext i32 %108 to i64
%110 = icmp ne i64 %109, 4
br i1 %110, label %111, label %116
111: ; preds = %107
%112 = load i32, i32* @LOG_ERR
%113 = call i32 (i32, i8*, ...) @syslog(i32 %112, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
%114 = load i32, i32* @EXIT_FAILURE
%115 = call i32 @exit(i32 %114)
unreachable
116: ; preds = %107
%117 = getelementptr inbounds [1 x %struct.hv_vss_msg], [1 x %struct.hv_vss_msg]* %11, i64 0, i64 0
%118 = bitcast %struct.hv_vss_msg* %117 to i32*
%119 = load i32, i32* %118
store i32 %119, i32* %16
store i32 0, i32* %15
%120 = load i32, i32* @LOG_INFO
%121 = load i32, i32* %16
%122 = call i32 (i32, i8*, ...) @syslog(i32 %120, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i32 %121)
br label %80
123: ; preds = %101
%124 = load i32, i32* %7
%125 = sext i32 %124 to i64
%126 = icmp ne i64 %125, 8
br i1 %126, label %127, label %136
127: ; preds = %123
%128 = load i32, i32* @LOG_ERR
%129 = load i64, i64* @errno
%130 = load i64, i64* @errno
%131 = call i8* @strerror(i64 %130)
%132 = call i32 (i32, i8*, ...) @syslog(i32 %128, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i64 %129, i8* %131)
%133 = load i32, i32* %6
%134 = call i32 @close(i32 %133)
%135 = load i32, i32* @EXIT_FAILURE
store i32 %135, i32* %3
br label %194
136: ; preds = %123
%137 = getelementptr inbounds [1 x %struct.hv_vss_msg], [1 x %struct.hv_vss_msg]* %11, i64 0, i64 0
%138 = getelementptr inbounds %struct.hv_vss_msg, %struct.hv_vss_msg* %137, i32 0, i32 1
%139 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %138, i32 0, i32 0
%140 = load i32, i32* %139
store i32 %140, i32* %10
%141 = load i32, i32* @HV_S_OK
store i32 %141, i32* %8
%142 = load i32, i32* %10
switch i32 %142, label %171 [
i32 131, label %143
i32 129, label %143
i32 130, label %168
]
143: ; preds = %136, %136
%144 = load i32, i32* %10
%145 = call i32 @vss_operate(i32 %144)
store i32 %145, i32* %8
%146 = load i32, i32* @LOG_INFO
%147 = load i32, i32* %10
%148 = icmp eq i32 %147, 131
%149 = zext i1 %148 to i64
%150 = select i1 %148, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0)
%151 = load i32, i32* %8
%152 = icmp ne i32 %151, 0
%153 = zext i1 %152 to i64
%154 = select i1 %152, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0)
%155 = call i32 (i32, i8*, ...) @syslog(i32 %146, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8* %150, i8* %154)
%156 = load i32, i32* %8
%157 = icmp ne i32 %156, 0
br i1 %157, label %158, label %167
158: ; preds = %143
%159 = load i32, i32* @HV_E_FAIL
store i32 %159, i32* %8
%160 = load i32, i32* @LOG_ERR
%161 = load i32, i32* %10
%162 = call i32 (i32, i8*, ...) @syslog(i32 %160, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0), i32 %161)
%163 = load i32, i32* @LOG_ERR
%164 = call i32 (i32, i8*, ...) @syslog(i32 %163, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.18, i64 0, i64 0))
%165 = load i32, i32* @LOG_ERR
%166 = call i32 (i32, i8*, ...) @syslog(i32 %165, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.19, i64 0, i64 0))
br label %167
167: ; preds = %158, %143
br label %175
168: ; preds = %136
%169 = load i32, i32* @LOG_INFO
%170 = call i32 (i32, i8*, ...) @syslog(i32 %169, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.20, i64 0, i64 0))
br label %175
171: ; preds = %136
%172 = load i32, i32* @LOG_ERR
%173 = load i32, i32* %10
%174 = call i32 (i32, i8*, ...) @syslog(i32 %172, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i32 %173)
br label %175
175: ; preds = %171, %168, %167
%176 = load i32, i32* %8
%177 = getelementptr inbounds [1 x %struct.hv_vss_msg], [1 x %struct.hv_vss_msg]* %11, i64 0, i64 0
%178 = getelementptr inbounds %struct.hv_vss_msg, %struct.hv_vss_msg* %177, i32 0, i32 0
store i32 %176, i32* %178
%179 = load i32, i32* %6
%180 = getelementptr inbounds [1 x %struct.hv_vss_msg], [1 x %struct.hv_vss_msg]* %11, i64 0, i64 0
%181 = call i32 @write(i32 %179, %struct.hv_vss_msg* %180, i32 8)
store i32 %181, i32* %7
%182 = load i32, i32* %7
%183 = sext i32 %182 to i64
%184 = icmp ne i64 %183, 8
br i1 %184, label %185, label %193
185: ; preds = %175
%186 = load i32, i32* @LOG_ERR
%187 = load i64, i64* @errno
%188 = load i64, i64* @errno
%189 = call i8* @strerror(i64 %188)
%190 = call i32 (i32, i8*, ...) @syslog(i32 %186, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.22, i64 0, i64 0), i64 %187, i8* %189)
%191 = load i32, i32* @EXIT_FAILURE
%192 = call i32 @exit(i32 %191)
unreachable
193: ; preds = %175
br label %80
194: ; preds = %127, %38
%195 = load i32, i32* %3
ret i32 %195
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
%struct.pollfd = type { i32, i64, i32 }
%struct.hv_vss_msg = type { i32, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i32 }
@main.long_options = internal global [3 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 -128, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i32 0, i32 0), i8 -128, i32 0, i32 110 }, %struct.option zeroinitializer]
@.str = [5 x i8] c"help\00"
@.str.1 = [10 x i8] c"no-daemon\00"
@.str.2 = [3 x i8] c"hn\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [12 x i8] c"Hyper-V VSS\00"
@LOG_USER = global i32 0
@LOG_INFO = global i32 0
@.str.4 = [24 x i8] c"VSS starting; pid is:%d\00"
@.str.5 = [18 x i8] c"/dev/vmbus/hv_vss\00"
@O_RDWR = global i32 0
@LOG_ERR = global i32 0
@.str.6 = [44 x i8] c"open /dev/vmbus/hv_vss failed; error: %d %s\00"
@errno = global i64 0
@VSS_OP_REGISTER1 = global i32 0
@.str.7 = [44 x i8] c"registration to kernel failed; error: %d %s\00"
@POLLIN = global i32 0
@.str.8 = [25 x i8] c"poll failed; error:%d %s\00"
@EINVAL = global i64 0
@.str.9 = [28 x i8] c"invalid version negotiation\00"
@.str.10 = [31 x i8] c"VSS: kernel module version: %d\00"
@.str.11 = [25 x i8] c"read failed; error:%d %s\00"
@HV_S_OK = global i32 0
@.str.12 = [16 x i8] c"VSS: op=%s: %s\0A\00"
@.str.13 = [7 x i8] c"FREEZE\00"
@.str.14 = [5 x i8] c"THAW\00"
@.str.15 = [7 x i8] c"failed\00"
@.str.16 = [10 x i8] c"succeeded\00"
@HV_E_FAIL = global i32 0
@.str.17 = [14 x i8] c"op=%d failed!\00"
@.str.18 = [28 x i8] c"report it with these files:\00"
@.str.19 = [28 x i8] c"/etc/fstab and /proc/mounts\00"
@.str.20 = [26 x i8] c"VSS: op=CHECK HOT BACKUP\0A\00"
@.str.21 = [15 x i8] c"Illegal op:%d\0A\00"
@.str.22 = [27 x i8] c"write failed; error: %d %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca %struct.pollfd
%4 = alloca [1 x %struct.hv_vss_msg]
%5 = alloca i32
%6 = bitcast %struct.pollfd* %3 to i8*
%7 = bitcast [1 x %struct.hv_vss_msg]* %4 to i8*
%8 = bitcast i32* %5 to i8*
store i32 0, i32* %5
br label %9
9: ; preds = %9, %2
%10 = phi i1 [ false, %2 ], [ true, %9 ]
%11 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %struct.option* getelementptr inbounds ([3 x %struct.option], [3 x %struct.option]* @main.long_options, i64 0, i64 0), i32* %5)
switch i32 %11, label %12 [
i32 -1, label %16
i32 110, label %9
]
12: ; preds = %9
%13 = call i32 @print_usage(i8** %1)
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %9
br i1 %10, label %20, label %17
17: ; preds = %16
%18 = call i64 @daemon(i32 1, i32 0)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %132
20: ; preds = %17, %16
%21 = load i32, i32* @LOG_USER
%22 = call i32 @openlog(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 %21)
%23 = load i32, i32* @LOG_INFO
%24 = call i32 (...) @getpid()
%25 = call i32 (i32, i8*, ...) @syslog(i32 %23, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32 %24)
%26 = load i32, i32* @O_RDWR
%27 = call i32 @open(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %26)
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %36
29: ; preds = %20
%30 = load i32, i32* @LOG_ERR
%31 = load i64, i64* @errno
%32 = call i8* @strerror(i64 %31)
%33 = call i32 (i32, i8*, ...) @syslog(i32 %30, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), i64 %31, i8* %32)
%34 = load i32, i32* @EXIT_FAILURE
%35 = call i32 @exit(i32 %34)
unreachable
36: ; preds = %20
%37 = load i32, i32* @VSS_OP_REGISTER1
%38 = getelementptr inbounds [1 x %struct.hv_vss_msg], [1 x %struct.hv_vss_msg]* %4, i64 0, i64 0
%39 = getelementptr inbounds [1 x %struct.hv_vss_msg], [1 x %struct.hv_vss_msg]* %4, i64 0, i64 0, i32 1, i32 0
store i32 %37, i32* %39
%40 = call i32 @write(i32 %27, %struct.hv_vss_msg* %38, i32 8)
%41 = icmp slt i32 %40, 0
br i1 %41, label %42, label %50
42: ; preds = %36
%43 = load i32, i32* @LOG_ERR
%44 = load i64, i64* @errno
%45 = call i8* @strerror(i64 %44)
%46 = call i32 (i32, i8*, ...) @syslog(i32 %43, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), i64 %44, i8* %45)
%47 = call i32 @close(i32 %27)
%48 = load i32, i32* @EXIT_FAILURE
%49 = call i32 @exit(i32 %48)
unreachable
50: ; preds = %36
%51 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %3, i64 0, i32 0
store i32 %27, i32* %51
%52 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %3, i64 0, i32 2
%53 = getelementptr inbounds %struct.pollfd, %struct.pollfd* %3, i64 0, i32 1
%54 = getelementptr inbounds [1 x %struct.hv_vss_msg], [1 x %struct.hv_vss_msg]* %4, i64 0, i64 0, i32 0
br label %55
55: ; preds = %86, %50
%56 = phi i1 [ false, %50 ], [ true, %86 ]
br label %57
57: ; preds = %55, %61
%58 = load i32, i32* @POLLIN
store i32 %58, i32* %52
store i64 0, i64* %53
%59 = call i64 @poll(%struct.pollfd* %3, i32 1, i32 -1)
%60 = icmp slt i64 %59, 0
br i1 %60, label %61, label %73
61: ; preds = %57
%62 = load i32, i32* @LOG_ERR
%63 = load i64, i64* @errno
%64 = call i8* @strerror(i64 %63)
%65 = call i32 (i32, i8*, ...) @syslog(i32 %62, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i64 %63, i8* %64)
%66 = load i64, i64* @errno
%67 = load i64, i64* @EINVAL
%68 = icmp eq i64 %66, %67
br i1 %68, label %69, label %57
69: ; preds = %61
%70 = call i32 @close(i32 %27)
%71 = load i32, i32* @EXIT_FAILURE
%72 = call i32 @exit(i32 %71)
unreachable
73: ; preds = %57
%74 = call i32 @read(i32 %27, %struct.hv_vss_msg* %38, i32 8)
br i1 %56, label %87, label %75
75: ; preds = %73
%76 = icmp eq i32 %74, 4
br i1 %76, label %82, label %77
77: ; preds = %75
%78 = load i32, i32* @LOG_ERR
%79 = call i32 (i32, i8*, ...) @syslog(i32 %78, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.9, i64 0, i64 0))
%80 = load i32, i32* @EXIT_FAILURE
%81 = call i32 @exit(i32 %80)
unreachable
82: ; preds = %75
%83 = load i32, i32* %54
%84 = load i32, i32* @LOG_INFO
%85 = call i32 (i32, i8*, ...) @syslog(i32 %84, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i32 %83)
br label %86
86: ; preds = %82, %121
br label %55
87: ; preds = %73
%88 = icmp eq i32 %74, 8
br i1 %88, label %96, label %89
89: ; preds = %87
%90 = load i32, i32* @LOG_ERR
%91 = load i64, i64* @errno
%92 = call i8* @strerror(i64 %91)
%93 = call i32 (i32, i8*, ...) @syslog(i32 %90, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0), i64 %91, i8* %92)
%94 = call i32 @close(i32 %27)
%95 = load i32, i32* @EXIT_FAILURE
br label %132
96: ; preds = %87
%97 = load i32, i32* %39
%98 = load i32, i32* @HV_S_OK
switch i32 %97, label %118 [
i32 131, label %99
i32 129, label %99
i32 130, label %115
]
99: ; preds = %96, %96
%100 = call i32 @vss_operate(i32 %97)
%101 = load i32, i32* @LOG_INFO
%102 = icmp eq i32 %97, 131
%103 = select i1 %102, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0)
%104 = icmp eq i32 %100, 0
%105 = select i1 %104, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0)
%106 = call i32 (i32, i8*, ...) @syslog(i32 %101, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i8* %103, i8* %105)
br i1 %104, label %121, label %107
107: ; preds = %99
%108 = load i32, i32* @HV_E_FAIL
%109 = load i32, i32* @LOG_ERR
%110 = call i32 (i32, i8*, ...) @syslog(i32 %109, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0), i32 %97)
%111 = load i32, i32* @LOG_ERR
%112 = call i32 (i32, i8*, ...) @syslog(i32 %111, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.18, i64 0, i64 0))
%113 = load i32, i32* @LOG_ERR
%114 = call i32 (i32, i8*, ...) @syslog(i32 %113, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.19, i64 0, i64 0))
br label %121
115: ; preds = %96
%116 = load i32, i32* @LOG_INFO
%117 = call i32 (i32, i8*, ...) @syslog(i32 %116, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.20, i64 0, i64 0))
br label %121
118: ; preds = %96
%119 = load i32, i32* @LOG_ERR
%120 = call i32 (i32, i8*, ...) @syslog(i32 %119, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.21, i64 0, i64 0), i32 %97)
br label %121
121: ; preds = %99, %107, %118, %115
%122 = phi i32 [ %98, %118 ], [ %98, %115 ], [ %108, %107 ], [ 0, %99 ]
store i32 %122, i32* %54
%123 = call i32 @write(i32 %27, %struct.hv_vss_msg* %38, i32 8)
%124 = icmp eq i32 %123, 8
br i1 %124, label %86, label %125
125: ; preds = %121
%126 = load i32, i32* @LOG_ERR
%127 = load i64, i64* @errno
%128 = call i8* @strerror(i64 %127)
%129 = call i32 (i32, i8*, ...) @syslog(i32 %126, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.22, i64 0, i64 0), i64 %127, i8* %128)
%130 = load i32, i32* @EXIT_FAILURE
%131 = call i32 @exit(i32 %130)
unreachable
132: ; preds = %17, %89
%133 = phi i32 [ %95, %89 ], [ 1, %17 ]
ret i32 %133
}