#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int uint16_t;
struct option {
  char *member_0;
  float member_3;
  int /*<<< orphan*/ *member_2;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
int /*<<< orphan*/ INADDR_ANY;
int O_NOCTTY;
int O_NONBLOCK;
int O_RDWR;
int /*<<< orphan*/ SHUT_RDWR;
int /*<<< orphan*/ SIGPIPE;
int /*<<< orphan*/ SIG_IGN;
int STDERR_FILENO;
int STDIN_FILENO;
int STDOUT_FILENO;
int /*<<< orphan*/ TIOCMGET;
int /*<<< orphan*/ TIOCMSET;
int TIOCM_CD;
int TIOCM_CTS;
int TIOCM_DSR;
int TIOCM_DTR;
int TIOCM_RI;
int TIOCM_RTS;
int /*<<< orphan*/ abort();
int accept(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ addlogline(char *, char *);
double atof(int /*<<< orphan*/);
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int getopt_long(int, char **, char *, struct option *, int *);
int /*<<< orphan*/ inet_addr(int /*<<< orphan*/);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, int *);
int /*<<< orphan*/ no_argument;
int open(char *, int);
int /*<<< orphan*/ optarg;
int optind;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ required_argument;
int /*<<< orphan*/ shutdown(int, int /*<<< orphan*/);
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sleep(long);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strdup(int /*<<< orphan*/);
int stsmon_listentoport(int /*<<< orphan*/, int);
int /*<<< orphan*/ usage_exit(int, char *);
int /*<<< orphan*/ usleep(long);
int main(int argc, char *argv[]) {
  int serialfd;
  int status;
  int listencts = -1;
  int listencd = -1;
  int listenri = -1;
  int listendsr = -1;
  char *logfile = NULL;
  char *device = "/dev/ttyS0";
  int foreground = 0;
  long waittime = 100;
  uint32_t bindaddr = INADDR_ANY;
  uint16_t baseport = 13000;
  char *namects = "CTS";
  char *namecd = "CD";
  char *nameri = "RI";
  char *namedsr = "DSR";
  struct option long_options[] = {{"foreground", no_argument, NULL, 'f'},
                                  {"device", required_argument, NULL, 'd'},
                                  {"bind", required_argument, NULL, 'b'},
                                  {"baseport", required_argument, NULL, 'p'},
                                  {"logfile", required_argument, NULL, 'l'},
                                  {"interval", required_argument, NULL, 'i'},
                                  {"namects", required_argument, NULL, 1000},
                                  {"namecd", required_argument, NULL, 1001},
                                  {"nameri", required_argument, NULL, 1002},
                                  {"namedsr", required_argument, NULL, 1003},
                                  {"help", no_argument, NULL, 'h'},
                                  {"version", no_argument, NULL, 'v'},
                                  {0, 0, 0, 0}};
  while (1) {
    int option_index = 0, c;
    c = getopt_long(argc, argv, "fd:b:p:l:i:hv", long_options, &option_index);
    if (c == -1)
      break;
    switch (c) {
    case 'f':
      foreground = !0;
      break;
    case 'd':
      device = strdup(optarg);
      break;
    case 'b':
      bindaddr = inet_addr(optarg);
      break;
    case 'p':
      baseport = atoi(optarg);
      break;
    case 'l':
      logfile = strdup(optarg);
      break;
    case 'i':
      waittime = (long)(atof(optarg) * 100.0);
      break;
    case 1000:
      namects = strdup(optarg);
      break;
    case 1001:
      namecd = strdup(optarg);
      break;
    case 1002:
      nameri = strdup(optarg);
      break;
    case 1003:
      namedsr = strdup(optarg);
      break;
    case 'h':
      usage_exit(0, argv[0]);
    case 'v':
      fputs("stsmon\n", stdout);
      exit(0);
    case '?':
      fprintf(stderr, "Try `%s --help' for more information.\n", argv[0]);
      exit(1);
    default:
      abort();
    }
  }
  if (optind != argc)
    usage_exit(1, argv[0]);
  signal(SIGPIPE, SIG_IGN);
  serialfd = open(device, O_RDWR | O_NOCTTY | O_NONBLOCK);
  if (serialfd < 0) {
    perror(device);
    exit(-1);
  }
  addlogline("Starting stsmon", logfile);
  if (!foreground) {
    close(STDIN_FILENO);
    close(STDOUT_FILENO);
    close(STDERR_FILENO);
    if (fork())
      exit(0);
  }
  ioctl(serialfd, TIOCMGET, &status);
  status |= TIOCM_DTR;
  status &= ~TIOCM_RTS;
  ioctl(serialfd, TIOCMSET, &status);
  while (1) {
    char line[128];
    ioctl(serialfd, TIOCMGET, &status);
    if (status & TIOCM_CTS) {
      if (listencts < 0) {
        listencts = stsmon_listentoport(bindaddr, baseport + 0);
        snprintf(line, 128, "%s on", namects);
        addlogline(line, logfile);
      }
    } else {
      if (listencts >= 0) {
        close(listencts);
        listencts = -1;
        snprintf(line, 128, "%s off", namects);
        addlogline(line, logfile);
      }
    }
    while (listencts >= 0) {
      int fd = accept(listencts, NULL, NULL);
      if (fd < 0)
        break;
      shutdown(fd, SHUT_RDWR);
      close(fd);
    }
    if (status & TIOCM_CD) {
      if (listencd < 0) {
        listencd = stsmon_listentoport(bindaddr, baseport + 1);
        snprintf(line, 128, "%s on", namecd);
        addlogline(line, logfile);
      }
    } else {
      if (listencd >= 0) {
        close(listencd);
        listencd = -1;
        snprintf(line, 128, "%s off", namecd);
        addlogline(line, logfile);
      }
    }
    while (listencd >= 0) {
      int fd = accept(listencd, NULL, NULL);
      if (fd < 0)
        break;
      shutdown(fd, SHUT_RDWR);
      close(fd);
    }
    if (status & TIOCM_RI) {
      if (listenri < 0) {
        listenri = stsmon_listentoport(bindaddr, baseport + 2);
        snprintf(line, 128, "%s on", nameri);
        addlogline(line, logfile);
      }
    } else {
      if (listenri >= 0) {
        close(listenri);
        listenri = -1;
        snprintf(line, 128, "%s off", nameri);
        addlogline(line, logfile);
      }
    }
    while (listenri >= 0) {
      int fd = accept(listenri, NULL, NULL);
      if (fd < 0)
        break;
      shutdown(fd, SHUT_RDWR);
      close(fd);
    }
    if (status & TIOCM_DSR) {
      if (listendsr < 0) {
        listendsr = stsmon_listentoport(bindaddr, baseport + 3);
        snprintf(line, 128, "%s on", namedsr);
        addlogline(line, logfile);
      }
    } else {
      if (listendsr >= 0) {
        close(listendsr);
        listendsr = -1;
        snprintf(line, 128, "%s off", namedsr);
        addlogline(line, logfile);
      }
    }
    while (listendsr >= 0) {
      int fd = accept(listendsr, NULL, NULL);
      if (fd < 0)
        break;
      shutdown(fd, SHUT_RDWR);
      close(fd);
    }
    if (waittime / 100)
      sleep(waittime / 100);
    if (waittime % 100)
      usleep((waittime % 100) * 10000);
  }
  close(serialfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
movl   $0xffffffff,-0x20(%rbp)
movl   $0xffffffff,-0x24(%rbp)
movl   $0xffffffff,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
lea    0xd44(%rip),%rax
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movq   $0x64,-0x48(%rbp)
mov    0x2cc2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
movl   $0x32c8,-0x50(%rbp)
lea    0xd22(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xd1b(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xd13(%rip),%rax
mov    %rax,-0x68(%rbp)
lea    0xd0b(%rip),%rax
mov    %rax,-0x70(%rbp)
lea    -0x210(%rbp),%rdi
lea    0xcfd(%rip),%rax
mov    %rax,-0x210(%rbp)
mov    0x2c16(%rip),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,-0x208(%rbp)
ff
movq   $0x0,-0x200(%rbp)
movl   $0x66,-0x1f8(%rbp)
add    $0x20,%rdi
lea    0xcce(%rip),%rax
mov    %rax,-0x1f0(%rbp)
mov    0x2c14(%rip),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,-0x1e8(%rbp)
ff
movq   $0x0,-0x1e0(%rbp)
movl   $0x64,-0x1d8(%rbp)
add    $0x20,%rdi
lea    0xc9b(%rip),%rax
mov    %rax,-0x1d0(%rbp)
mov    0x2bda(%rip),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,-0x1c8(%rbp)
ff
movq   $0x0,-0x1c0(%rbp)
movl   $0x62,-0x1b8(%rbp)
add    $0x20,%rdi
lea    0xc66(%rip),%rax
mov    %rax,-0x1b0(%rbp)
mov    0x2ba0(%rip),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,-0x1a8(%rbp)
ff
movq   $0x0,-0x1a0(%rbp)
movl   $0x70,-0x198(%rbp)
add    $0x20,%rdi
lea    0xc35(%rip),%rax
mov    %rax,-0x190(%rbp)
mov    0x2b66(%rip),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,-0x188(%rbp)
ff
movq   $0x0,-0x180(%rbp)
movl   $0x6c,-0x178(%rbp)
add    $0x20,%rdi
lea    0xc03(%rip),%rax
mov    %rax,-0x170(%rbp)
mov    0x2b2c(%rip),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,-0x168(%rbp)
ff
movq   $0x0,-0x160(%rbp)
movl   $0x69,-0x158(%rbp)
add    $0x20,%rdi
lea    0xbd2(%rip),%rax
mov    %rax,-0x150(%rbp)
mov    0x2af2(%rip),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,-0x148(%rbp)
ff
movq   $0x0,-0x140(%rbp)
movl   $0x3e8,-0x138(%rbp)
add    $0x20,%rdi
lea    0xba0(%rip),%rax
mov    %rax,-0x130(%rbp)
mov    0x2ab8(%rip),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,-0x128(%rbp)
ff
movq   $0x0,-0x120(%rbp)
movl   $0x3e9,-0x118(%rbp)
add    $0x20,%rdi
lea    0xb6d(%rip),%rax
mov    %rax,-0x110(%rbp)
mov    0x2a7e(%rip),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,-0x108(%rbp)
ff
movq   $0x0,-0x100(%rbp)
movl   $0x3ea,-0xf8(%rbp)
add    $0x20,%rdi
lea    0xb3a(%rip),%rax
mov    %rax,-0xf0(%rbp)
mov    0x2a44(%rip),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,-0xe8(%rbp)
ff
movq   $0x0,-0xe0(%rbp)
movl   $0x3eb,-0xd8(%rbp)
add    $0x20,%rdi
lea    0xb08(%rip),%rax
mov    %rax,-0xd0(%rbp)
mov    0x29d2(%rip),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,-0xc8(%rbp)
ff
movq   $0x0,-0xc0(%rbp)
movl   $0x68,-0xb8(%rbp)
add    $0x20,%rdi
lea    0xad3(%rip),%rax
mov    %rax,-0xb0(%rbp)
mov    0x2998(%rip),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,-0xa8(%rbp)
ff
movq   $0x0,-0xa0(%rbp)
movl   $0x76,-0x98(%rbp)
add    $0x20,%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   20a0 <memset@plt>
movl   $0x0,-0x214(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x210(%rbp),%rcx
lea    0xa7d(%rip),%rdx
lea    -0x214(%rbp),%r8
call   2070 <getopt_long@plt>
mov    %eax,-0x218(%rbp)
cmpl   $0xffffffff,-0x218(%rbp)
jne    2624 <main+0x3a4>
jmp    287c <main+0x5fc>
mov    -0x218(%rbp),%eax
mov    %eax,-0x2b4(%rbp)
sub    $0x3f,%eax
je     284a <main+0x5ca>
jmp    263e <main+0x3be>
mov    -0x2b4(%rbp),%eax
sub    $0x62,%eax
je     2759 <main+0x4d9>
jmp    2652 <main+0x3d2>
mov    -0x2b4(%rbp),%eax
sub    $0x64,%eax
je     2742 <main+0x4c2>
jmp    2666 <main+0x3e6>
mov    -0x2b4(%rbp),%eax
sub    $0x66,%eax
je     2736 <main+0x4b6>
jmp    267a <main+0x3fa>
mov    -0x2b4(%rbp),%eax
sub    $0x68,%eax
je     2820 <main+0x5a0>
jmp    268e <main+0x40e>
mov    -0x2b4(%rbp),%eax
sub    $0x69,%eax
je     279c <main+0x51c>
jmp    26a2 <main+0x422>
mov    -0x2b4(%rbp),%eax
sub    $0x6c,%eax
je     2785 <main+0x505>
jmp    26b6 <main+0x436>
mov    -0x2b4(%rbp),%eax
sub    $0x70,%eax
je     276f <main+0x4ef>
jmp    26ca <main+0x44a>
mov    -0x2b4(%rbp),%eax
sub    $0x76,%eax
je     282e <main+0x5ae>
jmp    26de <main+0x45e>
mov    -0x2b4(%rbp),%eax
sub    $0x3e8,%eax
je     27c4 <main+0x544>
jmp    26f4 <main+0x474>
mov    -0x2b4(%rbp),%eax
sub    $0x3e9,%eax
je     27db <main+0x55b>
jmp    270a <main+0x48a>
mov    -0x2b4(%rbp),%eax
sub    $0x3ea,%eax
je     27f2 <main+0x572>
jmp    2720 <main+0x4a0>
mov    -0x2b4(%rbp),%eax
sub    $0x3eb,%eax
je     2809 <main+0x589>
jmp    2870 <main+0x5f0>
movl   $0x1,-0x3c(%rbp)
jmp    2877 <main+0x5f7>
mov    0x28af(%rip),%rax
mov    (%rax),%edi
call   2160 <strdup@plt>
mov    %rax,-0x38(%rbp)
jmp    2877 <main+0x5f7>
mov    0x2898(%rip),%rax
mov    (%rax),%edi
call   20d0 <inet_addr@plt>
mov    %eax,-0x4c(%rbp)
jmp    2877 <main+0x5f7>
mov    0x2882(%rip),%rax
mov    (%rax),%edi
call   2140 <atoi@plt>
mov    %eax,-0x50(%rbp)
jmp    2877 <main+0x5f7>
mov    0x286c(%rip),%rax
mov    (%rax),%edi
call   2160 <strdup@plt>
mov    %rax,-0x30(%rbp)
jmp    2877 <main+0x5f7>
mov    0x2855(%rip),%rax
mov    (%rax),%edi
call   2050 <atof@plt>
movsd  0x84e(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,-0x48(%rbp)
jmp    2877 <main+0x5f7>
mov    0x282d(%rip),%rax
mov    (%rax),%edi
call   2160 <strdup@plt>
mov    %rax,-0x58(%rbp)
jmp    2877 <main+0x5f7>
mov    0x2816(%rip),%rax
mov    (%rax),%edi
call   2160 <strdup@plt>
mov    %rax,-0x60(%rbp)
jmp    2877 <main+0x5f7>
mov    0x27ff(%rip),%rax
mov    (%rax),%edi
call   2160 <strdup@plt>
mov    %rax,-0x68(%rbp)
jmp    2877 <main+0x5f7>
mov    0x27e8(%rip),%rax
mov    (%rax),%edi
call   2160 <strdup@plt>
mov    %rax,-0x70(%rbp)
jmp    2877 <main+0x5f7>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
xor    %edi,%edi
call   2100 <usage_exit@plt>
mov    0x270b(%rip),%rax
mov    (%rax),%esi
lea    0x84d(%rip),%rdi
call   2090 <fputs@plt>
xor    %edi,%edi
call   2150 <exit@plt>
mov    0x270f(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0x832(%rip),%rsi
call   20f0 <fprintf@plt>
mov    $0x1,%edi
call   2150 <exit@plt>
mov    $0x0,%al
call   2030 <abort@plt>
jmp    25e1 <main+0x361>
mov    0x270d(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
je     289f <main+0x61f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    $0x1,%edi
call   2100 <usage_exit@plt>
mov    0x26b2(%rip),%rax
mov    (%rax),%edi
mov    0x26d9(%rip),%rax
mov    (%rax),%esi
call   20e0 <signal@plt>
mov    -0x38(%rbp),%rdi
mov    0x270f(%rip),%rax
mov    (%rax),%esi
mov    0x269e(%rip),%rax
or     (%rax),%esi
mov    0x26f5(%rip),%rax
or     (%rax),%esi
call   2110 <open@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    28fa <main+0x67a>
mov    -0x38(%rbp),%rdi
call   2120 <perror@plt>
mov    $0xffffffff,%edi
call   2150 <exit@plt>
mov    -0x30(%rbp),%rsi
lea    0x7b5(%rip),%rdi
call   21a0 <addlogline@plt>
cmpl   $0x0,-0x3c(%rbp)
jne    295b <main+0x6db>
mov    0x2615(%rip),%rax
mov    (%rax),%edi
call   20c0 <close@plt>
mov    0x26bf(%rip),%rax
mov    (%rax),%edi
call   20c0 <close@plt>
mov    0x2619(%rip),%rax
mov    (%rax),%edi
call   20c0 <close@plt>
mov    $0x0,%al
call   2180 <fork@plt>
cmp    $0x0,%rax
je     2956 <main+0x6d6>
xor    %edi,%edi
call   2150 <exit@plt>
jmp    295b <main+0x6db>
mov    -0x14(%rbp),%edi
mov    0x2613(%rip),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rdx
call   20b0 <ioctl@plt>
mov    0x2621(%rip),%rax
mov    (%rax),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    0x2622(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    0x261d(%rip),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rdx
call   20b0 <ioctl@plt>
mov    -0x14(%rbp),%edi
mov    0x25c8(%rip),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rdx
call   20b0 <ioctl@plt>
mov    -0x18(%rbp),%eax
mov    0x2573(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2a1c <main+0x79c>
cmpl   $0x0,-0x1c(%rbp)
jge    2a17 <main+0x797>
mov    -0x4c(%rbp),%edi
mov    -0x50(%rbp),%esi
add    $0x0,%esi
call   2040 <stsmon_listentoport@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x2a0(%rbp),%rdi
mov    -0x58(%rbp),%rcx
mov    $0x80,%esi
lea    0x6c8(%rip),%rdx
call   2080 <snprintf@plt>
lea    -0x2a0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   21a0 <addlogline@plt>
jmp    2a66 <main+0x7e6>
cmpl   $0x0,-0x1c(%rbp)
jl     2a61 <main+0x7e1>
mov    -0x1c(%rbp),%edi
call   20c0 <close@plt>
movl   $0xffffffff,-0x1c(%rbp)
lea    -0x2a0(%rbp),%rdi
mov    -0x58(%rbp),%rcx
mov    $0x80,%esi
lea    0x684(%rip),%rdx
call   2080 <snprintf@plt>
lea    -0x2a0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   21a0 <addlogline@plt>
jmp    2a66 <main+0x7e6>
jmp    2a6b <main+0x7eb>
cmpl   $0x0,-0x1c(%rbp)
jl     2ac0 <main+0x840>
mov    -0x1c(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   2130 <accept@plt>
mov    %eax,-0x2a4(%rbp)
cmpl   $0x0,-0x2a4(%rbp)
jge    2a9c <main+0x81c>
jmp    2ac0 <main+0x840>
mov    -0x2a4(%rbp),%edi
mov    0x2537(%rip),%rax
mov    (%rax),%esi
call   2060 <shutdown@plt>
mov    -0x2a4(%rbp),%edi
call   20c0 <close@plt>
jmp    2a6b <main+0x7eb>
mov    -0x18(%rbp),%eax
mov    0x245e(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2b21 <main+0x8a1>
cmpl   $0x0,-0x20(%rbp)
jge    2b1c <main+0x89c>
mov    -0x4c(%rbp),%edi
mov    -0x50(%rbp),%esi
add    $0x1,%esi
call   2040 <stsmon_listentoport@plt>
mov    %eax,-0x20(%rbp)
lea    -0x2a0(%rbp),%rdi
mov    -0x60(%rbp),%rcx
mov    $0x80,%esi
lea    0x5c3(%rip),%rdx
call   2080 <snprintf@plt>
lea    -0x2a0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   21a0 <addlogline@plt>
jmp    2b6b <main+0x8eb>
cmpl   $0x0,-0x20(%rbp)
jl     2b66 <main+0x8e6>
mov    -0x20(%rbp),%edi
call   20c0 <close@plt>
movl   $0xffffffff,-0x20(%rbp)
lea    -0x2a0(%rbp),%rdi
mov    -0x60(%rbp),%rcx
mov    $0x80,%esi
lea    0x57f(%rip),%rdx
call   2080 <snprintf@plt>
lea    -0x2a0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   21a0 <addlogline@plt>
jmp    2b6b <main+0x8eb>
jmp    2b70 <main+0x8f0>
cmpl   $0x0,-0x20(%rbp)
jl     2bc5 <main+0x945>
mov    -0x20(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   2130 <accept@plt>
mov    %eax,-0x2a8(%rbp)
cmpl   $0x0,-0x2a8(%rbp)
jge    2ba1 <main+0x921>
jmp    2bc5 <main+0x945>
mov    -0x2a8(%rbp),%edi
mov    0x2432(%rip),%rax
mov    (%rax),%esi
call   2060 <shutdown@plt>
mov    -0x2a8(%rbp),%edi
call   20c0 <close@plt>
jmp    2b70 <main+0x8f0>
mov    -0x18(%rbp),%eax
mov    0x23f1(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2c26 <main+0x9a6>
cmpl   $0x0,-0x24(%rbp)
jge    2c21 <main+0x9a1>
mov    -0x4c(%rbp),%edi
mov    -0x50(%rbp),%esi
add    $0x2,%esi
call   2040 <stsmon_listentoport@plt>
mov    %eax,-0x24(%rbp)
lea    -0x2a0(%rbp),%rdi
mov    -0x68(%rbp),%rcx
mov    $0x80,%esi
lea    0x4be(%rip),%rdx
call   2080 <snprintf@plt>
lea    -0x2a0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   21a0 <addlogline@plt>
jmp    2c70 <main+0x9f0>
cmpl   $0x0,-0x24(%rbp)
jl     2c6b <main+0x9eb>
mov    -0x24(%rbp),%edi
call   20c0 <close@plt>
movl   $0xffffffff,-0x24(%rbp)
lea    -0x2a0(%rbp),%rdi
mov    -0x68(%rbp),%rcx
mov    $0x80,%esi
lea    0x47a(%rip),%rdx
call   2080 <snprintf@plt>
lea    -0x2a0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   21a0 <addlogline@plt>
jmp    2c70 <main+0x9f0>
jmp    2c75 <main+0x9f5>
cmpl   $0x0,-0x24(%rbp)
jl     2cca <main+0xa4a>
mov    -0x24(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   2130 <accept@plt>
mov    %eax,-0x2ac(%rbp)
cmpl   $0x0,-0x2ac(%rbp)
jge    2ca6 <main+0xa26>
jmp    2cca <main+0xa4a>
mov    -0x2ac(%rbp),%edi
mov    0x232d(%rip),%rax
mov    (%rax),%esi
call   2060 <shutdown@plt>
mov    -0x2ac(%rbp),%edi
call   20c0 <close@plt>
jmp    2c75 <main+0x9f5>
mov    -0x18(%rbp),%eax
mov    0x22dc(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     2d2b <main+0xaab>
cmpl   $0x0,-0x28(%rbp)
jge    2d26 <main+0xaa6>
mov    -0x4c(%rbp),%edi
mov    -0x50(%rbp),%esi
add    $0x3,%esi
call   2040 <stsmon_listentoport@plt>
mov    %eax,-0x28(%rbp)
lea    -0x2a0(%rbp),%rdi
mov    -0x70(%rbp),%rcx
mov    $0x80,%esi
lea    0x3b9(%rip),%rdx
call   2080 <snprintf@plt>
lea    -0x2a0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   21a0 <addlogline@plt>
jmp    2d75 <main+0xaf5>
cmpl   $0x0,-0x28(%rbp)
jl     2d70 <main+0xaf0>
mov    -0x28(%rbp),%edi
call   20c0 <close@plt>
movl   $0xffffffff,-0x28(%rbp)
lea    -0x2a0(%rbp),%rdi
mov    -0x70(%rbp),%rcx
mov    $0x80,%esi
lea    0x375(%rip),%rdx
call   2080 <snprintf@plt>
lea    -0x2a0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   21a0 <addlogline@plt>
jmp    2d75 <main+0xaf5>
jmp    2d7a <main+0xafa>
cmpl   $0x0,-0x28(%rbp)
jl     2dcf <main+0xb4f>
mov    -0x28(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   2130 <accept@plt>
mov    %eax,-0x2b0(%rbp)
cmpl   $0x0,-0x2b0(%rbp)
jge    2dab <main+0xb2b>
jmp    2dcf <main+0xb4f>
mov    -0x2b0(%rbp),%edi
mov    0x2228(%rip),%rax
mov    (%rax),%esi
call   2060 <shutdown@plt>
mov    -0x2b0(%rbp),%edi
call   20c0 <close@plt>
jmp    2d7a <main+0xafa>
mov    -0x48(%rbp),%rax
mov    $0x64,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rax
je     2dfd <main+0xb7d>
mov    -0x48(%rbp),%rax
mov    $0x64,%ecx
cqto
idiv   %rcx
mov    %rax,%rdi
call   2170 <sleep@plt>
mov    -0x48(%rbp),%rax
mov    $0x64,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rdx
je     2e2f <main+0xbaf>
mov    -0x48(%rbp),%rax
mov    $0x64,%ecx
cqto
idiv   %rcx
imul   $0x2710,%rdx,%rdi
call   2190 <usleep@plt>
jmp    29a6 <main+0x726>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2a8,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x2d13(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
lea    0xe77(%rip),%rax
mov    %rax,0x80(%rsp)
mov    0x2c9f(%rip),%rax
cvtsi2ssl (%rax),%xmm0
movss  %xmm0,0x88(%rsp)
movq   $0x0,0x90(%rsp)
movl   $0x66,0x98(%rsp)
lea    0xe48(%rip),%rax
mov    %rax,0xa0(%rsp)
mov    0x2c9d(%rip),%rax
cvtsi2ssl (%rax),%xmm1
movss  %xmm1,0xa8(%rsp)
movq   $0x0,0xb0(%rsp)
movl   $0x64,0xb8(%rsp)
lea    0xe15(%rip),%rax
mov    %rax,0xc0(%rsp)
movss  %xmm1,0xc8(%rsp)
movq   $0x0,0xd0(%rsp)
movl   $0x62,0xd8(%rsp)
lea    0xdeb(%rip),%rax
mov    %rax,0xe0(%rsp)
movss  %xmm1,0xe8(%rsp)
movq   $0x0,0xf0(%rsp)
movl   $0x70,0xf8(%rsp)
lea    0xdc5(%rip),%rax
mov    %rax,0x100(%rsp)
movss  %xmm1,0x108(%rsp)
movq   $0x0,0x110(%rsp)
movl   $0x6c,0x118(%rsp)
lea    0xd9e(%rip),%rax
mov    %rax,0x120(%rsp)
movss  %xmm1,0x128(%rsp)
movq   $0x0,0x130(%rsp)
movl   $0x69,0x138(%rsp)
lea    0xd78(%rip),%rax
mov    %rax,0x140(%rsp)
movss  %xmm1,0x148(%rsp)
movq   $0x0,0x150(%rsp)
movl   $0x3e8,0x158(%rsp)
lea    0xd51(%rip),%rax
mov    %rax,0x160(%rsp)
movss  %xmm1,0x168(%rsp)
movq   $0x0,0x170(%rsp)
movl   $0x3e9,0x178(%rsp)
lea    0xd29(%rip),%rax
mov    %rax,0x180(%rsp)
movss  %xmm1,0x188(%rsp)
movq   $0x0,0x190(%rsp)
movl   $0x3ea,0x198(%rsp)
lea    0xd01(%rip),%rax
mov    %rax,0x1a0(%rsp)
movss  %xmm1,0x1a8(%rsp)
movq   $0x0,0x1b0(%rsp)
movl   $0x3eb,0x1b8(%rsp)
lea    0xcda(%rip),%rax
mov    %rax,0x1c0(%rsp)
movss  %xmm0,0x1c8(%rsp)
movq   $0x0,0x1d0(%rsp)
movl   $0x68,0x1d8(%rsp)
lea    0xcb0(%rip),%rax
mov    %rax,0x1e0(%rsp)
movss  %xmm0,0x1e8(%rsp)
movq   $0x0,0x1f0(%rsp)
movl   $0x76,0x1f8(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x210(%rsp)
movaps %xmm0,0x200(%rsp)
lea    0xc16(%rip),%rax
mov    %rax,0x50(%rsp)
lea    0xc07(%rip),%rax
mov    %rax,0x48(%rsp)
lea    0xbf8(%rip),%rax
mov    %rax,0x40(%rsp)
lea    0xbe8(%rip),%rax
mov    %rax,0x38(%rsp)
mov    $0x32c8,%eax
mov    %rax,0x30(%rsp)
mov    $0x64,%eax
mov    %rax,0x28(%rsp)
xor    %r15d,%r15d
lea    0xbba(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0x80(%rsp),%r12
lea    0x220(%rsp),%r13
lea    0xaae(%rip),%r14
xor    %eax,%eax
mov    %rax,0x10(%rsp)
jmp    1586 <main+0x316>
mov    0x2a8e(%rip),%rax
mov    (%rax),%edi
call   1150 <strdup@plt>
mov    %rax,0x10(%rsp)
cs nopw 0x0(%rax,%rax,1)
mov    %r15d,%eax
mov    %eax,%r15d
movl   $0x0,0x220(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
lea    0xbd0(%rip),%rdx
mov    %r12,%rcx
mov    %r13,%r8
call   1070 <getopt_long@plt>
lea    -0x3f(%rax),%ecx
cmp    $0x37,%ecx
ja     15e0 <main+0x370>
mov    $0x1,%eax
movslq (%r14,%rcx,4),%rcx
add    %r14,%rcx
jmp    *%rcx
mov    0x2a33(%rip),%rax
mov    (%rax),%edi
call   10c0 <inet_addr@plt>
mov    %eax,0xc(%rsp)
jmp    1580 <main+0x310>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x3e8(%rax),%ecx
cmp    $0x3,%ecx
ja     16b4 <main+0x444>
lea    0xaf2(%rip),%rdx
movslq (%rdx,%rcx,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    0x29f2(%rip),%rax
mov    (%rax),%edi
call   1150 <strdup@plt>
mov    %rax,0x38(%rsp)
jmp    1580 <main+0x310>
mov    0x29da(%rip),%rax
mov    (%rax),%edi
call   1130 <atoi@plt>
mov    %rax,0x30(%rsp)
jmp    1580 <main+0x310>
mov    0x29c2(%rip),%rax
mov    (%rax),%edi
call   1150 <strdup@plt>
mov    %rax,0x18(%rsp)
jmp    1580 <main+0x310>
mov    0x29aa(%rip),%rax
mov    (%rax),%edi
call   1050 <atof@plt>
mulsd  0x9a3(%rip),%xmm0
cvttsd2si %xmm0,%rax
mov    %rax,0x28(%rsp)
jmp    1580 <main+0x310>
mov    0x2985(%rip),%rax
mov    (%rax),%edi
call   1150 <strdup@plt>
mov    %rax,0x48(%rsp)
jmp    1580 <main+0x310>
mov    0x296d(%rip),%rax
mov    (%rax),%edi
call   1150 <strdup@plt>
mov    %rax,0x40(%rsp)
jmp    1580 <main+0x310>
mov    0x2955(%rip),%rax
mov    (%rax),%edi
call   1150 <strdup@plt>
mov    %rax,0x50(%rsp)
jmp    1580 <main+0x310>
cmp    $0xffffffff,%eax
jne    1c85 <main+0xa15>
mov    0x28cc(%rip),%rax
cmp    %ebp,(%rax)
je     16d5 <main+0x465>
mov    (%rbx),%rsi
mov    $0x1,%edi
call   10f0 <usage_exit@plt>
mov    0x287c(%rip),%rax
mov    (%rax),%edi
mov    0x28a3(%rip),%rax
mov    (%rax),%esi
call   10d0 <signal@plt>
mov    0x28dd(%rip),%rax
mov    0x286e(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x28c3(%rip),%rax
or     (%rax),%esi
mov    0x18(%rsp),%rbx
mov    %rbx,%rdi
call   1100 <open@plt>
mov    %eax,0x24(%rsp)
test   %eax,%eax
js     1cd4 <main+0xa64>
lea    0xa83(%rip),%rdi
mov    0x10(%rsp),%rsi
call   1190 <addlogline@plt>
test   %r15d,%r15d
jne    1770 <main+0x500>
mov    0x27f3(%rip),%rax
mov    (%rax),%edi
call   10b0 <close@plt>
mov    0x289d(%rip),%rax
mov    (%rax),%edi
call   10b0 <close@plt>
mov    0x27f7(%rip),%rax
mov    (%rax),%edi
call   10b0 <close@plt>
xor    %eax,%eax
call   1170 <fork@plt>
test   %rax,%rax
jne    1ce6 <main+0xa76>
mov    0x2801(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rbp
mov    0x24(%rsp),%ebx
mov    %ebx,%edi
mov    %rbp,%rdx
call   10a0 <ioctl@plt>
mov    0x2805(%rip),%rax
mov    0x8(%rsp),%ecx
or     (%rax),%ecx
mov    0x2808(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %ecx,%eax
mov    %eax,0x8(%rsp)
mov    0x2807(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    %rbp,%rdx
call   10a0 <ioctl@plt>
mov    0x30(%rsp),%rax
lea    0x1(%rax),%ecx
mov    %ecx,0x64(%rsp)
lea    0x2(%rax),%ecx
mov    %ecx,0x60(%rsp)
add    $0x3,%eax
mov    %eax,0x5c(%rsp)
movabs $0xa3d70a3d70a3d70b,%rcx
0a d7 a3
mov    0x28(%rsp),%rsi
mov    %rsi,%rax
imul   %rcx
lea    0x63(%rsi),%rax
mov    %rax,0x78(%rsp)
add    %rsi,%rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x6,%rdx
add    %rax,%rdx
mov    %rdx,0x68(%rsp)
imul   $0x64,%rdx,%rax
sub    %rax,%rsi
mov    %rsi,0x28(%rsp)
imul   $0x2710,%rsi,%rax
mov    %rax,0x70(%rsp)
mov    $0xffffffff,%edi
mov    0x27b1(%rip),%r13
mov    $0xffffffff,%ebp
mov    $0xffffffff,%r12d
mov    $0xffffffff,%r14d
mov    %edi,0x18(%rsp)
mov    0x272d(%rip),%rax
mov    (%rax),%esi
mov    0x24(%rsp),%edi
lea    0x8(%rsp),%rdx
call   10a0 <ioctl@plt>
mov    0x26d6(%rip),%rax
mov    (%rax),%eax
test   %eax,0x8(%rsp)
je     1910 <main+0x6a0>
test   %r14d,%r14d
jns    18bb <main+0x64b>
mov    0xc(%rsp),%edi
mov    0x30(%rsp),%rsi
call   1040 <stsmon_listentoport@plt>
mov    %eax,%r14d
lea    0x220(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
lea    0x91f(%rip),%rdx
mov    0x38(%rsp),%rcx
call   1080 <snprintf@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   1190 <addlogline@plt>
test   %r14d,%r14d
js     1960 <main+0x6f0>
mov    %r14d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1120 <accept@plt>
test   %eax,%eax
js     1960 <main+0x6f0>
mov    %eax,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%r13),%esi
mov    %r15d,%edi
call   1060 <shutdown@plt>
mov    %r15d,%edi
call   10b0 <close@plt>
mov    %r14d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1120 <accept@plt>
mov    %eax,%r15d
test   %eax,%eax
jns    18e0 <main+0x670>
jmp    1960 <main+0x6f0>
nopl   0x0(%rax)
test   %r14d,%r14d
js     1960 <main+0x6f0>
mov    %r14d,%edi
call   10b0 <close@plt>
lea    0x220(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
lea    0x88c(%rip),%rdx
mov    0x38(%rsp),%rcx
call   1080 <snprintf@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   1190 <addlogline@plt>
mov    $0xffffffff,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x25c1(%rip),%rax
mov    (%rax),%eax
test   %eax,0x8(%rsp)
je     1a10 <main+0x7a0>
test   %r12d,%r12d
jns    19bf <main+0x74f>
mov    0xc(%rsp),%edi
mov    0x64(%rsp),%esi
call   1040 <stsmon_listentoport@plt>
mov    %eax,%r12d
lea    0x220(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
lea    0x81b(%rip),%rdx
mov    0x40(%rsp),%rcx
call   1080 <snprintf@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   1190 <addlogline@plt>
test   %r12d,%r12d
js     1a60 <main+0x7f0>
mov    %r12d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1120 <accept@plt>
test   %eax,%eax
js     1a60 <main+0x7f0>
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x0(%r13),%esi
mov    %ebx,%edi
call   1060 <shutdown@plt>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    %r12d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1120 <accept@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    19e0 <main+0x770>
jmp    1a60 <main+0x7f0>
cs nopw 0x0(%rax,%rax,1)
test   %r12d,%r12d
js     1a60 <main+0x7f0>
mov    %r12d,%edi
call   10b0 <close@plt>
lea    0x220(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
lea    0x78c(%rip),%rdx
mov    0x40(%rsp),%rcx
call   1080 <snprintf@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   1190 <addlogline@plt>
mov    $0xffffffff,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x2559(%rip),%rax
mov    (%rax),%eax
test   %eax,0x8(%rsp)
je     1b00 <main+0x890>
test   %ebp,%ebp
jns    1abc <main+0x84c>
mov    0xc(%rsp),%edi
mov    0x60(%rsp),%esi
call   1040 <stsmon_listentoport@plt>
mov    %eax,%ebp
lea    0x220(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
lea    0x71d(%rip),%rdx
mov    0x48(%rsp),%rcx
call   1080 <snprintf@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   1190 <addlogline@plt>
test   %ebp,%ebp
js     1b40 <main+0x8d0>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1120 <accept@plt>
test   %eax,%eax
js     1b40 <main+0x8d0>
mov    %eax,%ebx
nopl   (%rax)
mov    0x0(%r13),%esi
mov    %ebx,%edi
call   1060 <shutdown@plt>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1120 <accept@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1ad0 <main+0x860>
jmp    1b40 <main+0x8d0>
cs nopw 0x0(%rax,%rax,1)
nop
test   %ebp,%ebp
js     1b40 <main+0x8d0>
mov    %ebp,%edi
call   10b0 <close@plt>
lea    0x220(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
lea    0x69e(%rip),%rdx
mov    0x48(%rsp),%rcx
call   1080 <snprintf@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   1190 <addlogline@plt>
mov    $0xffffffff,%ebp
xchg   %ax,%ax
mov    0x2469(%rip),%rax
mov    (%rax),%eax
test   %eax,0x8(%rsp)
je     1c00 <main+0x990>
mov    0x18(%rsp),%edi
test   %edi,%edi
jns    1ba1 <main+0x931>
mov    0xc(%rsp),%edi
mov    0x5c(%rsp),%esi
call   1040 <stsmon_listentoport@plt>
mov    %eax,%r15d
lea    0x220(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
lea    0x638(%rip),%rdx
mov    0x50(%rsp),%rcx
call   1080 <snprintf@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   1190 <addlogline@plt>
mov    %r15d,%edi
test   %r15d,%r15d
js     1c08 <main+0x998>
mov    %edi,%r15d
xor    %esi,%esi
xor    %edx,%edx
call   1120 <accept@plt>
test   %eax,%eax
js     1be4 <main+0x974>
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%r13),%esi
mov    %ebx,%edi
call   1060 <shutdown@plt>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    %r15d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1120 <accept@plt>
mov    %eax,%ebx
test   %eax,%eax
jns    1bc0 <main+0x950>
mov    %r15d,%edi
cmpq   $0xc7,0x78(%rsp)
jae    1c13 <main+0x9a3>
jmp    1c21 <main+0x9b1>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x18(%rsp),%edi
test   %edi,%edi
jns    1c40 <main+0x9d0>
cmpq   $0xc7,0x78(%rsp)
jb     1c21 <main+0x9b1>
mov    %edi,%ebx
mov    0x68(%rsp),%rdi
call   1160 <sleep@plt>
mov    %ebx,%edi
cmpq   $0x0,0x28(%rsp)
je     1840 <main+0x5d0>
mov    %edi,%ebx
mov    0x70(%rsp),%rdi
call   1180 <usleep@plt>
mov    %ebx,%edi
jmp    1840 <main+0x5d0>
call   10b0 <close@plt>
lea    0x220(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
lea    0x564(%rip),%rdx
mov    0x50(%rsp),%rcx
call   1080 <snprintf@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%rsi
call   1190 <addlogline@plt>
mov    $0xffffffff,%edi
cmpq   $0xc7,0x78(%rsp)
jae    1c13 <main+0x9a3>
jmp    1c21 <main+0x9b1>
xor    %eax,%eax
call   1030 <abort@plt>
mov    0x22cd(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0x4e4(%rip),%rsi
call   10e0 <fprintf@plt>
mov    $0x1,%edi
call   1140 <exit@plt>
mov    (%rbx),%rsi
xor    %edi,%edi
call   10f0 <usage_exit@plt>
mov    0x2281(%rip),%rax
mov    (%rax),%esi
lea    0x4b3(%rip),%rdi
call   1090 <fputs@plt>
xor    %edi,%edi
call   1140 <exit@plt>
mov    %rbx,%rdi
call   1110 <perror@plt>
mov    $0xffffffff,%edi
call   1140 <exit@plt>
xor    %edi,%edi
call   1140 <exit@plt>

LLVM IR (-O0):
%struct.option = type { i8*, float, i32*, i32 }
@.str = [11 x i8] c"/dev/ttyS0\00"
@INADDR_ANY = global i32 0
@.str.1 = [4 x i8] c"CTS\00"
@.str.2 = [3 x i8] c"CD\00"
@.str.3 = [3 x i8] c"RI\00"
@.str.4 = [4 x i8] c"DSR\00"
@.str.5 = [11 x i8] c"foreground\00"
@no_argument = global i32 0
@.str.6 = [7 x i8] c"device\00"
@required_argument = global i32 0
@.str.7 = [5 x i8] c"bind\00"
@.str.8 = [9 x i8] c"baseport\00"
@.str.9 = [8 x i8] c"logfile\00"
@.str.10 = [9 x i8] c"interval\00"
@.str.11 = [8 x i8] c"namects\00"
@.str.12 = [7 x i8] c"namecd\00"
@.str.13 = [7 x i8] c"nameri\00"
@.str.14 = [8 x i8] c"namedsr\00"
@.str.15 = [5 x i8] c"help\00"
@.str.16 = [8 x i8] c"version\00"
@.str.17 = [14 x i8] c"fd:b:p:l:i:hv\00"
@optarg = global i32 0
@.str.18 = [8 x i8] c"stsmon\0A\00"
@stdout = global i32 0
@stderr = global i32 0
@.str.19 = [39 x i8] c"Try `%s --help' for more information.\0A\00"
@optind = global i32 0
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@O_NONBLOCK = global i32 0
@.str.20 = [16 x i8] c"Starting stsmon\00"
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
@TIOCMGET = global i32 0
@TIOCM_DTR = global i32 0
@TIOCM_RTS = global i32 0
@TIOCMSET = global i32 0
@TIOCM_CTS = global i32 0
@.str.21 = [6 x i8] c"%s on\00"
@.str.22 = [7 x i8] c"%s off\00"
@SHUT_RDWR = global i32 0
@TIOCM_CD = global i32 0
@TIOCM_RI = global i32 0
@TIOCM_DSR = global i32 0
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 i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i64
%16 = alloca i32
%17 = alloca i32
%18 = alloca i8*
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i8*
%22 = alloca [13 x %struct.option]
%23 = alloca i32
%24 = alloca i32
%25 = alloca [128 x i8]
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %8
store i32 -1, i32* %9
store i32 -1, i32* %10
store i32 -1, i32* %11
store i8* null, i8** %12
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %13
store i32 0, i32* %14
store i64 100, i64* %15
%30 = load i32, i32* @INADDR_ANY
store i32 %30, i32* %16
store i32 13000, i32* %17
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %18
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %19
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %20
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8** %21
%31 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %22, i64 0, i64 0
%32 = getelementptr inbounds %struct.option, %struct.option* %31, i32 0, i32 0
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8** %32
%33 = getelementptr inbounds %struct.option, %struct.option* %31, i32 0, i32 1
%34 = load i32, i32* @no_argument
%35 = sitofp i32 %34 to float
store float %35, float* %33
%36 = getelementptr inbounds %struct.option, %struct.option* %31, i32 0, i32 2
store i32* null, i32** %36
%37 = getelementptr inbounds %struct.option, %struct.option* %31, i32 0, i32 3
store i32 102, i32* %37
%38 = getelementptr inbounds %struct.option, %struct.option* %31, i64 1
%39 = getelementptr inbounds %struct.option, %struct.option* %38, i32 0, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8** %39
%40 = getelementptr inbounds %struct.option, %struct.option* %38, i32 0, i32 1
%41 = load i32, i32* @required_argument
%42 = sitofp i32 %41 to float
store float %42, float* %40
%43 = getelementptr inbounds %struct.option, %struct.option* %38, i32 0, i32 2
store i32* null, i32** %43
%44 = getelementptr inbounds %struct.option, %struct.option* %38, i32 0, i32 3
store i32 100, i32* %44
%45 = getelementptr inbounds %struct.option, %struct.option* %38, i64 1
%46 = getelementptr inbounds %struct.option, %struct.option* %45, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8** %46
%47 = getelementptr inbounds %struct.option, %struct.option* %45, i32 0, i32 1
%48 = load i32, i32* @required_argument
%49 = sitofp i32 %48 to float
store float %49, float* %47
%50 = getelementptr inbounds %struct.option, %struct.option* %45, i32 0, i32 2
store i32* null, i32** %50
%51 = getelementptr inbounds %struct.option, %struct.option* %45, i32 0, i32 3
store i32 98, i32* %51
%52 = getelementptr inbounds %struct.option, %struct.option* %45, i64 1
%53 = getelementptr inbounds %struct.option, %struct.option* %52, i32 0, i32 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8** %53
%54 = getelementptr inbounds %struct.option, %struct.option* %52, i32 0, i32 1
%55 = load i32, i32* @required_argument
%56 = sitofp i32 %55 to float
store float %56, float* %54
%57 = getelementptr inbounds %struct.option, %struct.option* %52, i32 0, i32 2
store i32* null, i32** %57
%58 = getelementptr inbounds %struct.option, %struct.option* %52, i32 0, i32 3
store i32 112, i32* %58
%59 = getelementptr inbounds %struct.option, %struct.option* %52, i64 1
%60 = getelementptr inbounds %struct.option, %struct.option* %59, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8** %60
%61 = getelementptr inbounds %struct.option, %struct.option* %59, i32 0, i32 1
%62 = load i32, i32* @required_argument
%63 = sitofp i32 %62 to float
store float %63, float* %61
%64 = getelementptr inbounds %struct.option, %struct.option* %59, i32 0, i32 2
store i32* null, i32** %64
%65 = getelementptr inbounds %struct.option, %struct.option* %59, i32 0, i32 3
store i32 108, i32* %65
%66 = getelementptr inbounds %struct.option, %struct.option* %59, i64 1
%67 = getelementptr inbounds %struct.option, %struct.option* %66, i32 0, i32 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8** %67
%68 = getelementptr inbounds %struct.option, %struct.option* %66, i32 0, i32 1
%69 = load i32, i32* @required_argument
%70 = sitofp i32 %69 to float
store float %70, float* %68
%71 = getelementptr inbounds %struct.option, %struct.option* %66, i32 0, i32 2
store i32* null, i32** %71
%72 = getelementptr inbounds %struct.option, %struct.option* %66, i32 0, i32 3
store i32 105, i32* %72
%73 = getelementptr inbounds %struct.option, %struct.option* %66, i64 1
%74 = getelementptr inbounds %struct.option, %struct.option* %73, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i8** %74
%75 = getelementptr inbounds %struct.option, %struct.option* %73, i32 0, i32 1
%76 = load i32, i32* @required_argument
%77 = sitofp i32 %76 to float
store float %77, float* %75
%78 = getelementptr inbounds %struct.option, %struct.option* %73, i32 0, i32 2
store i32* null, i32** %78
%79 = getelementptr inbounds %struct.option, %struct.option* %73, i32 0, i32 3
store i32 1000, i32* %79
%80 = getelementptr inbounds %struct.option, %struct.option* %73, i64 1
%81 = getelementptr inbounds %struct.option, %struct.option* %80, i32 0, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8** %81
%82 = getelementptr inbounds %struct.option, %struct.option* %80, i32 0, i32 1
%83 = load i32, i32* @required_argument
%84 = sitofp i32 %83 to float
store float %84, float* %82
%85 = getelementptr inbounds %struct.option, %struct.option* %80, i32 0, i32 2
store i32* null, i32** %85
%86 = getelementptr inbounds %struct.option, %struct.option* %80, i32 0, i32 3
store i32 1001, i32* %86
%87 = getelementptr inbounds %struct.option, %struct.option* %80, i64 1
%88 = getelementptr inbounds %struct.option, %struct.option* %87, i32 0, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i8** %88
%89 = getelementptr inbounds %struct.option, %struct.option* %87, i32 0, i32 1
%90 = load i32, i32* @required_argument
%91 = sitofp i32 %90 to float
store float %91, float* %89
%92 = getelementptr inbounds %struct.option, %struct.option* %87, i32 0, i32 2
store i32* null, i32** %92
%93 = getelementptr inbounds %struct.option, %struct.option* %87, i32 0, i32 3
store i32 1002, i32* %93
%94 = getelementptr inbounds %struct.option, %struct.option* %87, i64 1
%95 = getelementptr inbounds %struct.option, %struct.option* %94, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %95
%96 = getelementptr inbounds %struct.option, %struct.option* %94, i32 0, i32 1
%97 = load i32, i32* @required_argument
%98 = sitofp i32 %97 to float
store float %98, float* %96
%99 = getelementptr inbounds %struct.option, %struct.option* %94, i32 0, i32 2
store i32* null, i32** %99
%100 = getelementptr inbounds %struct.option, %struct.option* %94, i32 0, i32 3
store i32 1003, i32* %100
%101 = getelementptr inbounds %struct.option, %struct.option* %94, i64 1
%102 = getelementptr inbounds %struct.option, %struct.option* %101, i32 0, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i8** %102
%103 = getelementptr inbounds %struct.option, %struct.option* %101, i32 0, i32 1
%104 = load i32, i32* @no_argument
%105 = sitofp i32 %104 to float
store float %105, float* %103
%106 = getelementptr inbounds %struct.option, %struct.option* %101, i32 0, i32 2
store i32* null, i32** %106
%107 = getelementptr inbounds %struct.option, %struct.option* %101, i32 0, i32 3
store i32 104, i32* %107
%108 = getelementptr inbounds %struct.option, %struct.option* %101, i64 1
%109 = getelementptr inbounds %struct.option, %struct.option* %108, i32 0, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i8** %109
%110 = getelementptr inbounds %struct.option, %struct.option* %108, i32 0, i32 1
%111 = load i32, i32* @no_argument
%112 = sitofp i32 %111 to float
store float %112, float* %110
%113 = getelementptr inbounds %struct.option, %struct.option* %108, i32 0, i32 2
store i32* null, i32** %113
%114 = getelementptr inbounds %struct.option, %struct.option* %108, i32 0, i32 3
store i32 118, i32* %114
%115 = getelementptr inbounds %struct.option, %struct.option* %108, i64 1
%116 = bitcast %struct.option* %115 to i8*
br label %117
117: ; preds = %2, %175
store i32 0, i32* %23
%118 = load i32, i32* %4
%119 = load i8**, i8*** %5
%120 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %22, i64 0, i64 0
%121 = call i32 @getopt_long(i32 %118, i8** %119, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0), %struct.option* %120, i32* %23)
store i32 %121, i32* %24
%122 = load i32, i32* %24
%123 = icmp eq i32 %122, -1
br i1 %123, label %124, label %125
124: ; preds = %117
br label %176
125: ; preds = %117
%126 = load i32, i32* %24
switch i32 %126, label %173 [
i32 102, label %127
i32 100, label %128
i32 98, label %131
i32 112, label %134
i32 108, label %137
i32 105, label %140
i32 1000, label %145
i32 1001, label %148
i32 1002, label %151
i32 1003, label %154
i32 104, label %157
i32 118, label %162
i32 63, label %166
]
127: ; preds = %125
store i32 1, i32* %14
br label %175
128: ; preds = %125
%129 = load i32, i32* @optarg
%130 = call i8* @strdup(i32 %129)
store i8* %130, i8** %13
br label %175
131: ; preds = %125
%132 = load i32, i32* @optarg
%133 = call i32 @inet_addr(i32 %132)
store i32 %133, i32* %16
br label %175
134: ; preds = %125
%135 = load i32, i32* @optarg
%136 = call i32 @atoi(i32 %135)
store i32 %136, i32* %17
br label %175
137: ; preds = %125
%138 = load i32, i32* @optarg
%139 = call i8* @strdup(i32 %138)
store i8* %139, i8** %12
br label %175
140: ; preds = %125
%141 = load i32, i32* @optarg
%142 = call double @atof(i32 %141)
%143 = fmul double %142, 1.000000e+02
%144 = fptosi double %143 to i64
store i64 %144, i64* %15
br label %175
145: ; preds = %125
%146 = load i32, i32* @optarg
%147 = call i8* @strdup(i32 %146)
store i8* %147, i8** %18
br label %175
148: ; preds = %125
%149 = load i32, i32* @optarg
%150 = call i8* @strdup(i32 %149)
store i8* %150, i8** %19
br label %175
151: ; preds = %125
%152 = load i32, i32* @optarg
%153 = call i8* @strdup(i32 %152)
store i8* %153, i8** %20
br label %175
154: ; preds = %125
%155 = load i32, i32* @optarg
%156 = call i8* @strdup(i32 %155)
store i8* %156, i8** %21
br label %175
157: ; preds = %125
%158 = load i8**, i8*** %5
%159 = getelementptr inbounds i8*, i8** %158, i64 0
%160 = load i8*, i8** %159
%161 = call i32 @usage_exit(i32 0, i8* %160)
br label %162
162: ; preds = %125, %157
%163 = load i32, i32* @stdout
%164 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0), i32 %163)
%165 = call i32 @exit(i32 0)
unreachable
166: ; preds = %125
%167 = load i32, i32* @stderr
%168 = load i8**, i8*** %5
%169 = getelementptr inbounds i8*, i8** %168, i64 0
%170 = load i8*, i8** %169
%171 = call i32 @fprintf(i32 %167, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.19, i64 0, i64 0), i8* %170)
%172 = call i32 @exit(i32 1)
unreachable
173: ; preds = %125
%174 = call i32 (...) @abort()
unreachable
175: ; preds = %154, %151, %148, %145, %140, %137, %134, %131, %128, %127
br label %117
176: ; preds = %124
%177 = load i32, i32* @optind
%178 = load i32, i32* %4
%179 = icmp ne i32 %177, %178
br i1 %179, label %180, label %185
180: ; preds = %176
%181 = load i8**, i8*** %5
%182 = getelementptr inbounds i8*, i8** %181, i64 0
%183 = load i8*, i8** %182
%184 = call i32 @usage_exit(i32 1, i8* %183)
br label %185
185: ; preds = %180, %176
%186 = load i32, i32* @SIGPIPE
%187 = load i32, i32* @SIG_IGN
%188 = call i32 @signal(i32 %186, i32 %187)
%189 = load i8*, i8** %13
%190 = load i32, i32* @O_RDWR
%191 = load i32, i32* @O_NOCTTY
%192 = or i32 %190, %191
%193 = load i32, i32* @O_NONBLOCK
%194 = or i32 %192, %193
%195 = call i32 @open(i8* %189, i32 %194)
store i32 %195, i32* %6
%196 = load i32, i32* %6
%197 = icmp slt i32 %196, 0
br i1 %197, label %198, label %202
198: ; preds = %185
%199 = load i8*, i8** %13
%200 = call i32 @perror(i8* %199)
%201 = call i32 @exit(i32 -1)
unreachable
202: ; preds = %185
%203 = load i8*, i8** %12
%204 = call i32 @addlogline(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0), i8* %203)
%205 = load i32, i32* %14
%206 = icmp ne i32 %205, 0
br i1 %206, label %219, label %207
207: ; preds = %202
%208 = load i32, i32* @STDIN_FILENO
%209 = call i32 @close(i32 %208)
%210 = load i32, i32* @STDOUT_FILENO
%211 = call i32 @close(i32 %210)
%212 = load i32, i32* @STDERR_FILENO
%213 = call i32 @close(i32 %212)
%214 = call i64 (...) @fork()
%215 = icmp ne i64 %214, 0
br i1 %215, label %216, label %218
216: ; preds = %207
%217 = call i32 @exit(i32 0)
unreachable
218: ; preds = %207
br label %219
219: ; preds = %218, %202
%220 = load i32, i32* %6
%221 = load i32, i32* @TIOCMGET
%222 = call i32 @ioctl(i32 %220, i32 %221, i32* %7)
%223 = load i32, i32* @TIOCM_DTR
%224 = load i32, i32* %7
%225 = or i32 %224, %223
store i32 %225, i32* %7
%226 = load i32, i32* @TIOCM_RTS
%227 = xor i32 %226, -1
%228 = load i32, i32* %7
%229 = and i32 %228, %227
store i32 %229, i32* %7
%230 = load i32, i32* %6
%231 = load i32, i32* @TIOCMSET
%232 = call i32 @ioctl(i32 %230, i32 %231, i32* %7)
br label %233
233: ; preds = %219, %449
%234 = load i32, i32* %6
%235 = load i32, i32* @TIOCMGET
%236 = call i32 @ioctl(i32 %234, i32 %235, i32* %7)
%237 = load i32, i32* %7
%238 = load i32, i32* @TIOCM_CTS
%239 = and i32 %237, %238
%240 = icmp ne i32 %239, 0
br i1 %240, label %241, label %256
241: ; preds = %233
%242 = load i32, i32* %8
%243 = icmp slt i32 %242, 0
br i1 %243, label %244, label %255
244: ; preds = %241
%245 = load i32, i32* %16
%246 = load i32, i32* %17
%247 = add nsw i32 %246, 0
%248 = call i32 @stsmon_listentoport(i32 %245, i32 %247)
store i32 %248, i32* %8
%249 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%250 = load i8*, i8** %18
%251 = call i32 @snprintf(i8* %249, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i8* %250)
%252 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%253 = load i8*, i8** %12
%254 = call i32 @addlogline(i8* %252, i8* %253)
br label %255
255: ; preds = %244, %241
br label %269
256: ; preds = %233
%257 = load i32, i32* %8
%258 = icmp sge i32 %257, 0
br i1 %258, label %259, label %268
259: ; preds = %256
%260 = load i32, i32* %8
%261 = call i32 @close(i32 %260)
store i32 -1, i32* %8
%262 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%263 = load i8*, i8** %18
%264 = call i32 @snprintf(i8* %262, i32 128, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0), i8* %263)
%265 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%266 = load i8*, i8** %12
%267 = call i32 @addlogline(i8* %265, i8* %266)
br label %268
268: ; preds = %259, %256
br label %269
269: ; preds = %268, %255
br label %270
270: ; preds = %279, %269
%271 = load i32, i32* %8
%272 = icmp sge i32 %271, 0
br i1 %272, label %273, label %285
273: ; preds = %270
%274 = load i32, i32* %8
%275 = call i32 @accept(i32 %274, i32* null, i32* null)
store i32 %275, i32* %26
%276 = load i32, i32* %26
%277 = icmp slt i32 %276, 0
br i1 %277, label %278, label %279
278: ; preds = %273
br label %285
279: ; preds = %273
%280 = load i32, i32* %26
%281 = load i32, i32* @SHUT_RDWR
%282 = call i32 @shutdown(i32 %280, i32 %281)
%283 = load i32, i32* %26
%284 = call i32 @close(i32 %283)
br label %270
285: ; preds = %278, %270
%286 = load i32, i32* %7
%287 = load i32, i32* @TIOCM_CD
%288 = and i32 %286, %287
%289 = icmp ne i32 %288, 0
br i1 %289, label %290, label %305
290: ; preds = %285
%291 = load i32, i32* %9
%292 = icmp slt i32 %291, 0
br i1 %292, label %293, label %304
293: ; preds = %290
%294 = load i32, i32* %16
%295 = load i32, i32* %17
%296 = add nsw i32 %295, 1
%297 = call i32 @stsmon_listentoport(i32 %294, i32 %296)
store i32 %297, i32* %9
%298 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%299 = load i8*, i8** %19
%300 = call i32 @snprintf(i8* %298, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i8* %299)
%301 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%302 = load i8*, i8** %12
%303 = call i32 @addlogline(i8* %301, i8* %302)
br label %304
304: ; preds = %293, %290
br label %318
305: ; preds = %285
%306 = load i32, i32* %9
%307 = icmp sge i32 %306, 0
br i1 %307, label %308, label %317
308: ; preds = %305
%309 = load i32, i32* %9
%310 = call i32 @close(i32 %309)
store i32 -1, i32* %9
%311 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%312 = load i8*, i8** %19
%313 = call i32 @snprintf(i8* %311, i32 128, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0), i8* %312)
%314 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%315 = load i8*, i8** %12
%316 = call i32 @addlogline(i8* %314, i8* %315)
br label %317
317: ; preds = %308, %305
br label %318
318: ; preds = %317, %304
br label %319
319: ; preds = %328, %318
%320 = load i32, i32* %9
%321 = icmp sge i32 %320, 0
br i1 %321, label %322, label %334
322: ; preds = %319
%323 = load i32, i32* %9
%324 = call i32 @accept(i32 %323, i32* null, i32* null)
store i32 %324, i32* %27
%325 = load i32, i32* %27
%326 = icmp slt i32 %325, 0
br i1 %326, label %327, label %328
327: ; preds = %322
br label %334
328: ; preds = %322
%329 = load i32, i32* %27
%330 = load i32, i32* @SHUT_RDWR
%331 = call i32 @shutdown(i32 %329, i32 %330)
%332 = load i32, i32* %27
%333 = call i32 @close(i32 %332)
br label %319
334: ; preds = %327, %319
%335 = load i32, i32* %7
%336 = load i32, i32* @TIOCM_RI
%337 = and i32 %335, %336
%338 = icmp ne i32 %337, 0
br i1 %338, label %339, label %354
339: ; preds = %334
%340 = load i32, i32* %10
%341 = icmp slt i32 %340, 0
br i1 %341, label %342, label %353
342: ; preds = %339
%343 = load i32, i32* %16
%344 = load i32, i32* %17
%345 = add nsw i32 %344, 2
%346 = call i32 @stsmon_listentoport(i32 %343, i32 %345)
store i32 %346, i32* %10
%347 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%348 = load i8*, i8** %20
%349 = call i32 @snprintf(i8* %347, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i8* %348)
%350 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%351 = load i8*, i8** %12
%352 = call i32 @addlogline(i8* %350, i8* %351)
br label %353
353: ; preds = %342, %339
br label %367
354: ; preds = %334
%355 = load i32, i32* %10
%356 = icmp sge i32 %355, 0
br i1 %356, label %357, label %366
357: ; preds = %354
%358 = load i32, i32* %10
%359 = call i32 @close(i32 %358)
store i32 -1, i32* %10
%360 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%361 = load i8*, i8** %20
%362 = call i32 @snprintf(i8* %360, i32 128, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0), i8* %361)
%363 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%364 = load i8*, i8** %12
%365 = call i32 @addlogline(i8* %363, i8* %364)
br label %366
366: ; preds = %357, %354
br label %367
367: ; preds = %366, %353
br label %368
368: ; preds = %377, %367
%369 = load i32, i32* %10
%370 = icmp sge i32 %369, 0
br i1 %370, label %371, label %383
371: ; preds = %368
%372 = load i32, i32* %10
%373 = call i32 @accept(i32 %372, i32* null, i32* null)
store i32 %373, i32* %28
%374 = load i32, i32* %28
%375 = icmp slt i32 %374, 0
br i1 %375, label %376, label %377
376: ; preds = %371
br label %383
377: ; preds = %371
%378 = load i32, i32* %28
%379 = load i32, i32* @SHUT_RDWR
%380 = call i32 @shutdown(i32 %378, i32 %379)
%381 = load i32, i32* %28
%382 = call i32 @close(i32 %381)
br label %368
383: ; preds = %376, %368
%384 = load i32, i32* %7
%385 = load i32, i32* @TIOCM_DSR
%386 = and i32 %384, %385
%387 = icmp ne i32 %386, 0
br i1 %387, label %388, label %403
388: ; preds = %383
%389 = load i32, i32* %11
%390 = icmp slt i32 %389, 0
br i1 %390, label %391, label %402
391: ; preds = %388
%392 = load i32, i32* %16
%393 = load i32, i32* %17
%394 = add nsw i32 %393, 3
%395 = call i32 @stsmon_listentoport(i32 %392, i32 %394)
store i32 %395, i32* %11
%396 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%397 = load i8*, i8** %21
%398 = call i32 @snprintf(i8* %396, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i8* %397)
%399 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%400 = load i8*, i8** %12
%401 = call i32 @addlogline(i8* %399, i8* %400)
br label %402
402: ; preds = %391, %388
br label %416
403: ; preds = %383
%404 = load i32, i32* %11
%405 = icmp sge i32 %404, 0
br i1 %405, label %406, label %415
406: ; preds = %403
%407 = load i32, i32* %11
%408 = call i32 @close(i32 %407)
store i32 -1, i32* %11
%409 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%410 = load i8*, i8** %21
%411 = call i32 @snprintf(i8* %409, i32 128, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0), i8* %410)
%412 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%413 = load i8*, i8** %12
%414 = call i32 @addlogline(i8* %412, i8* %413)
br label %415
415: ; preds = %406, %403
br label %416
416: ; preds = %415, %402
br label %417
417: ; preds = %426, %416
%418 = load i32, i32* %11
%419 = icmp sge i32 %418, 0
br i1 %419, label %420, label %432
420: ; preds = %417
%421 = load i32, i32* %11
%422 = call i32 @accept(i32 %421, i32* null, i32* null)
store i32 %422, i32* %29
%423 = load i32, i32* %29
%424 = icmp slt i32 %423, 0
br i1 %424, label %425, label %426
425: ; preds = %420
br label %432
426: ; preds = %420
%427 = load i32, i32* %29
%428 = load i32, i32* @SHUT_RDWR
%429 = call i32 @shutdown(i32 %427, i32 %428)
%430 = load i32, i32* %29
%431 = call i32 @close(i32 %430)
br label %417
432: ; preds = %425, %417
%433 = load i64, i64* %15
%434 = sdiv i64 %433, 100
%435 = icmp ne i64 %434, 0
br i1 %435, label %436, label %440
436: ; preds = %432
%437 = load i64, i64* %15
%438 = sdiv i64 %437, 100
%439 = call i32 @sleep(i64 %438)
br label %440
440: ; preds = %436, %432
%441 = load i64, i64* %15
%442 = srem i64 %441, 100
%443 = icmp ne i64 %442, 0
br i1 %443, label %444, label %449
444: ; preds = %440
%445 = load i64, i64* %15
%446 = srem i64 %445, 100
%447 = mul nsw i64 %446, 10000
%448 = call i32 @usleep(i64 %447)
br label %449
449: ; preds = %444, %440
br label %233
}

LLVM IR (-O2):
%struct.option = type { i8*, float, i32*, i32 }
@.str = [11 x i8] c"/dev/ttyS0\00"
@INADDR_ANY = global i32 0
@.str.1 = [4 x i8] c"CTS\00"
@.str.2 = [3 x i8] c"CD\00"
@.str.3 = [3 x i8] c"RI\00"
@.str.4 = [4 x i8] c"DSR\00"
@.str.5 = [11 x i8] c"foreground\00"
@no_argument = global i32 0
@.str.6 = [7 x i8] c"device\00"
@required_argument = global i32 0
@.str.7 = [5 x i8] c"bind\00"
@.str.8 = [9 x i8] c"baseport\00"
@.str.9 = [8 x i8] c"logfile\00"
@.str.10 = [9 x i8] c"interval\00"
@.str.11 = [8 x i8] c"namects\00"
@.str.12 = [7 x i8] c"namecd\00"
@.str.13 = [7 x i8] c"nameri\00"
@.str.14 = [8 x i8] c"namedsr\00"
@.str.15 = [5 x i8] c"help\00"
@.str.16 = [8 x i8] c"version\00"
@.str.17 = [14 x i8] c"fd:b:p:l:i:hv\00"
@optarg = global i32 0
@.str.18 = [8 x i8] c"stsmon\0A\00"
@stdout = global i32 0
@stderr = global i32 0
@.str.19 = [39 x i8] c"Try `%s --help' for more information.\0A\00"
@optind = global i32 0
@SIGPIPE = global i32 0
@SIG_IGN = global i32 0
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@O_NONBLOCK = global i32 0
@.str.20 = [16 x i8] c"Starting stsmon\00"
@STDIN_FILENO = global i32 0
@STDOUT_FILENO = global i32 0
@STDERR_FILENO = global i32 0
@TIOCMGET = global i32 0
@TIOCM_DTR = global i32 0
@TIOCM_RTS = global i32 0
@TIOCMSET = global i32 0
@TIOCM_CTS = global i32 0
@.str.21 = [6 x i8] c"%s on\00"
@.str.22 = [7 x i8] c"%s off\00"
@SHUT_RDWR = global i32 0
@TIOCM_CD = global i32 0
@TIOCM_RI = global i32 0
@TIOCM_DSR = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca [13 x %struct.option]
%5 = alloca i32
%6 = alloca [128 x i8]
%7 = bitcast i32* %3 to i8*
%8 = load i32, i32* @INADDR_ANY
%9 = bitcast [13 x %struct.option]* %4 to i8*
%10 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 0
%11 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 0, i32 0
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8** %11
%12 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 0, i32 1
%13 = load i32, i32* @no_argument
%14 = sitofp i32 %13 to float
store float %14, float* %12
%15 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 0, i32 2
store i32* null, i32** %15
%16 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 0, i32 3
store i32 102, i32* %16
%17 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 1, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8** %17
%18 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 1, i32 1
%19 = load i32, i32* @required_argument
%20 = sitofp i32 %19 to float
store float %20, float* %18
%21 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 1, i32 2
store i32* null, i32** %21
%22 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 1, i32 3
store i32 100, i32* %22
%23 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 2, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8** %23
%24 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 2, i32 1
store float %20, float* %24
%25 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 2, i32 2
store i32* null, i32** %25
%26 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 2, i32 3
store i32 98, i32* %26
%27 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 3, i32 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8** %27
%28 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 3, i32 1
store float %20, float* %28
%29 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 3, i32 2
store i32* null, i32** %29
%30 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 3, i32 3
store i32 112, i32* %30
%31 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 4, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8** %31
%32 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 4, i32 1
store float %20, float* %32
%33 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 4, i32 2
store i32* null, i32** %33
%34 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 4, i32 3
store i32 108, i32* %34
%35 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 5, i32 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8** %35
%36 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 5, i32 1
store float %20, float* %36
%37 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 5, i32 2
store i32* null, i32** %37
%38 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 5, i32 3
store i32 105, i32* %38
%39 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 6, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i8** %39
%40 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 6, i32 1
store float %20, float* %40
%41 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 6, i32 2
store i32* null, i32** %41
%42 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 6, i32 3
store i32 1000, i32* %42
%43 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 7, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8** %43
%44 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 7, i32 1
store float %20, float* %44
%45 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 7, i32 2
store i32* null, i32** %45
%46 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 7, i32 3
store i32 1001, i32* %46
%47 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 8, i32 0
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i8** %47
%48 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 8, i32 1
store float %20, float* %48
%49 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 8, i32 2
store i32* null, i32** %49
%50 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 8, i32 3
store i32 1002, i32* %50
%51 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 9, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.14, i64 0, i64 0), i8** %51
%52 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 9, i32 1
store float %20, float* %52
%53 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 9, i32 2
store i32* null, i32** %53
%54 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 9, i32 3
store i32 1003, i32* %54
%55 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 10, i32 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0), i8** %55
%56 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 10, i32 1
store float %14, float* %56
%57 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 10, i32 2
store i32* null, i32** %57
%58 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 10, i32 3
store i32 104, i32* %58
%59 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 11, i32 0
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i8** %59
%60 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 11, i32 1
store float %14, float* %60
%61 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 11, i32 2
store i32* null, i32** %61
%62 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 11, i32 3
store i32 118, i32* %62
%63 = getelementptr inbounds [13 x %struct.option], [13 x %struct.option]* %4, i64 0, i64 12
%64 = bitcast %struct.option* %63 to i8*
%65 = bitcast i32* %5 to i8*
br label %66
66: ; preds = %121, %2
%67 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %2 ], [ %122, %121 ]
%68 = phi i32 [ 0, %2 ], [ %123, %121 ]
%69 = phi i64 [ 100, %2 ], [ %124, %121 ]
%70 = phi i32 [ %8, %2 ], [ %125, %121 ]
%71 = phi i32 [ 13000, %2 ], [ %126, %121 ]
%72 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), %2 ], [ %127, %121 ]
%73 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %2 ], [ %128, %121 ]
%74 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %2 ], [ %129, %121 ]
%75 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %2 ], [ %130, %121 ]
%76 = phi i8* [ null, %2 ], [ %131, %121 ]
store i32 0, i32* %5
%77 = call i32 @getopt_long(i32 %0, i8** %1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0), %struct.option* %10, i32* %5)
switch i32 %77, label %119 [
i32 -1, label %132
i32 102, label %121
i32 100, label %78
i32 98, label %81
i32 112, label %84
i32 108, label %87
i32 105, label %90
i32 1000, label %95
i32 1001, label %98
i32 1002, label %101
i32 1003, label %104
i32 104, label %107
i32 118, label %110
i32 63, label %114
]
78: ; preds = %66
%79 = load i32, i32* @optarg
%80 = call i8* @strdup(i32 %79)
br label %121
81: ; preds = %66
%82 = load i32, i32* @optarg
%83 = call i32 @inet_addr(i32 %82)
br label %121
84: ; preds = %66
%85 = load i32, i32* @optarg
%86 = call i32 @atoi(i32 %85)
br label %121
87: ; preds = %66
%88 = load i32, i32* @optarg
%89 = call i8* @strdup(i32 %88)
br label %121
90: ; preds = %66
%91 = load i32, i32* @optarg
%92 = call double @atof(i32 %91)
%93 = fmul double %92, 1.000000e+02
%94 = fptosi double %93 to i64
br label %121
95: ; preds = %66
%96 = load i32, i32* @optarg
%97 = call i8* @strdup(i32 %96)
br label %121
98: ; preds = %66
%99 = load i32, i32* @optarg
%100 = call i8* @strdup(i32 %99)
br label %121
101: ; preds = %66
%102 = load i32, i32* @optarg
%103 = call i8* @strdup(i32 %102)
br label %121
104: ; preds = %66
%105 = load i32, i32* @optarg
%106 = call i8* @strdup(i32 %105)
br label %121
107: ; preds = %66
%108 = load i8*, i8** %1
%109 = call i32 @usage_exit(i32 0, i8* %108)
br label %110
110: ; preds = %66, %107
%111 = load i32, i32* @stdout
%112 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.18, i64 0, i64 0), i32 %111)
%113 = call i32 @exit(i32 0)
unreachable
114: ; preds = %66
%115 = load i32, i32* @stderr
%116 = load i8*, i8** %1
%117 = call i32 @fprintf(i32 %115, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.19, i64 0, i64 0), i8* %116)
%118 = call i32 @exit(i32 1)
unreachable
119: ; preds = %66
%120 = call i32 (...) @abort()
unreachable
121: ; preds = %78, %81, %84, %87, %90, %95, %98, %101, %104, %66
%122 = phi i8* [ %67, %104 ], [ %67, %101 ], [ %67, %98 ], [ %67, %95 ], [ %67, %90 ], [ %67, %87 ], [ %67, %84 ], [ %67, %81 ], [ %80, %78 ], [ %67, %66 ]
%123 = phi i32 [ %68, %104 ], [ %68, %101 ], [ %68, %98 ], [ %68, %95 ], [ %68, %90 ], [ %68, %87 ], [ %68, %84 ], [ %68, %81 ], [ %68, %78 ], [ 1, %66 ]
%124 = phi i64 [ %69, %104 ], [ %69, %101 ], [ %69, %98 ], [ %69, %95 ], [ %94, %90 ], [ %69, %87 ], [ %69, %84 ], [ %69, %81 ], [ %69, %78 ], [ %69, %66 ]
%125 = phi i32 [ %70, %104 ], [ %70, %101 ], [ %70, %98 ], [ %70, %95 ], [ %70, %90 ], [ %70, %87 ], [ %70, %84 ], [ %83, %81 ], [ %70, %78 ], [ %70, %66 ]
%126 = phi i32 [ %71, %104 ], [ %71, %101 ], [ %71, %98 ], [ %71, %95 ], [ %71, %90 ], [ %71, %87 ], [ %86, %84 ], [ %71, %81 ], [ %71, %78 ], [ %71, %66 ]
%127 = phi i8* [ %72, %104 ], [ %72, %101 ], [ %72, %98 ], [ %97, %95 ], [ %72, %90 ], [ %72, %87 ], [ %72, %84 ], [ %72, %81 ], [ %72, %78 ], [ %72, %66 ]
%128 = phi i8* [ %73, %104 ], [ %73, %101 ], [ %100, %98 ], [ %73, %95 ], [ %73, %90 ], [ %73, %87 ], [ %73, %84 ], [ %73, %81 ], [ %73, %78 ], [ %73, %66 ]
%129 = phi i8* [ %74, %104 ], [ %103, %101 ], [ %74, %98 ], [ %74, %95 ], [ %74, %90 ], [ %74, %87 ], [ %74, %84 ], [ %74, %81 ], [ %74, %78 ], [ %74, %66 ]
%130 = phi i8* [ %106, %104 ], [ %75, %101 ], [ %75, %98 ], [ %75, %95 ], [ %75, %90 ], [ %75, %87 ], [ %75, %84 ], [ %75, %81 ], [ %75, %78 ], [ %75, %66 ]
%131 = phi i8* [ %76, %104 ], [ %76, %101 ], [ %76, %98 ], [ %76, %95 ], [ %76, %90 ], [ %89, %87 ], [ %76, %84 ], [ %76, %81 ], [ %76, %78 ], [ %76, %66 ]
br label %66
132: ; preds = %66
%133 = load i32, i32* @optind
%134 = icmp eq i32 %133, %0
br i1 %134, label %138, label %135
135: ; preds = %132
%136 = load i8*, i8** %1
%137 = call i32 @usage_exit(i32 1, i8* %136)
br label %138
138: ; preds = %135, %132
%139 = load i32, i32* @SIGPIPE
%140 = load i32, i32* @SIG_IGN
%141 = call i32 @signal(i32 %139, i32 %140)
%142 = load i32, i32* @O_RDWR
%143 = load i32, i32* @O_NOCTTY
%144 = or i32 %143, %142
%145 = load i32, i32* @O_NONBLOCK
%146 = or i32 %144, %145
%147 = call i32 @open(i8* %67, i32 %146)
%148 = icmp slt i32 %147, 0
br i1 %148, label %149, label %152
149: ; preds = %138
%150 = call i32 @perror(i8* %67)
%151 = call i32 @exit(i32 -1)
unreachable
152: ; preds = %138
%153 = call i32 @addlogline(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0), i8* %76)
%154 = icmp eq i32 %68, 0
br i1 %154, label %155, label %166
155: ; preds = %152
%156 = load i32, i32* @STDIN_FILENO
%157 = call i32 @close(i32 %156)
%158 = load i32, i32* @STDOUT_FILENO
%159 = call i32 @close(i32 %158)
%160 = load i32, i32* @STDERR_FILENO
%161 = call i32 @close(i32 %160)
%162 = call i64 (...) @fork()
%163 = icmp eq i64 %162, 0
br i1 %163, label %166, label %164
164: ; preds = %155
%165 = call i32 @exit(i32 0)
unreachable
166: ; preds = %155, %152
%167 = load i32, i32* @TIOCMGET
%168 = call i32 @ioctl(i32 %147, i32 %167, i32* %3)
%169 = load i32, i32* @TIOCM_DTR
%170 = load i32, i32* %3
%171 = or i32 %170, %169
%172 = load i32, i32* @TIOCM_RTS
%173 = xor i32 %172, -1
%174 = and i32 %171, %173
store i32 %174, i32* %3
%175 = load i32, i32* @TIOCMSET
%176 = call i32 @ioctl(i32 %147, i32 %175, i32* %3)
%177 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%178 = add nsw i32 %71, 1
%179 = add nsw i32 %71, 2
%180 = add nsw i32 %71, 3
%181 = add i64 %69, 99
%182 = icmp ult i64 %181, 199
%183 = sdiv i64 %69, 100
%184 = srem i64 %69, 100
%185 = icmp eq i64 %184, 0
%186 = mul nsw i64 %184, 10000
br label %187
187: ; preds = %319, %166
%188 = phi i32 [ -1, %166 ], [ %313, %319 ]
%189 = phi i32 [ -1, %166 ], [ %283, %319 ]
%190 = phi i32 [ -1, %166 ], [ %253, %319 ]
%191 = phi i32 [ -1, %166 ], [ %223, %319 ]
%192 = load i32, i32* @TIOCMGET
%193 = call i32 @ioctl(i32 %147, i32 %192, i32* %3)
%194 = load i32, i32* %3
%195 = load i32, i32* @TIOCM_CTS
%196 = and i32 %195, %194
%197 = icmp eq i32 %196, 0
br i1 %197, label %200, label %198
198: ; preds = %187
%199 = icmp slt i32 %191, 0
br i1 %199, label %206, label %211
200: ; preds = %187
%201 = icmp sgt i32 %191, -1
br i1 %201, label %202, label %222
202: ; preds = %200
%203 = call i32 @close(i32 %191)
%204 = call i32 @snprintf(i8* %177, i32 128, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0), i8* %72)
%205 = call i32 @addlogline(i8* %177, i8* %76)
br label %222
206: ; preds = %198
%207 = call i32 @stsmon_listentoport(i32 %70, i32 %71)
%208 = call i32 @snprintf(i8* %177, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i8* %72)
%209 = call i32 @addlogline(i8* %177, i8* %76)
%210 = icmp sgt i32 %207, -1
br i1 %210, label %211, label %222
211: ; preds = %198, %206
%212 = phi i32 [ %207, %206 ], [ %191, %198 ]
%213 = call i32 @accept(i32 %212, i32* null, i32* null)
%214 = icmp slt i32 %213, 0
br i1 %214, label %222, label %215
215: ; preds = %211, %215
%216 = phi i32 [ %220, %215 ], [ %213, %211 ]
%217 = load i32, i32* @SHUT_RDWR
%218 = call i32 @shutdown(i32 %216, i32 %217)
%219 = call i32 @close(i32 %216)
%220 = call i32 @accept(i32 %212, i32* null, i32* null)
%221 = icmp slt i32 %220, 0
br i1 %221, label %222, label %215
222: ; preds = %215, %211, %200, %202, %206
%223 = phi i32 [ %207, %206 ], [ %191, %200 ], [ -1, %202 ], [ %212, %211 ], [ %212, %215 ]
%224 = load i32, i32* %3
%225 = load i32, i32* @TIOCM_CD
%226 = and i32 %225, %224
%227 = icmp eq i32 %226, 0
br i1 %227, label %230, label %228
228: ; preds = %222
%229 = icmp slt i32 %190, 0
br i1 %229, label %236, label %241
230: ; preds = %222
%231 = icmp sgt i32 %190, -1
br i1 %231, label %232, label %252
232: ; preds = %230
%233 = call i32 @close(i32 %190)
%234 = call i32 @snprintf(i8* %177, i32 128, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0), i8* %73)
%235 = call i32 @addlogline(i8* %177, i8* %76)
br label %252
236: ; preds = %228
%237 = call i32 @stsmon_listentoport(i32 %70, i32 %178)
%238 = call i32 @snprintf(i8* %177, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i8* %73)
%239 = call i32 @addlogline(i8* %177, i8* %76)
%240 = icmp sgt i32 %237, -1
br i1 %240, label %241, label %252
241: ; preds = %228, %236
%242 = phi i32 [ %237, %236 ], [ %190, %228 ]
%243 = call i32 @accept(i32 %242, i32* null, i32* null)
%244 = icmp slt i32 %243, 0
br i1 %244, label %252, label %245
245: ; preds = %241, %245
%246 = phi i32 [ %250, %245 ], [ %243, %241 ]
%247 = load i32, i32* @SHUT_RDWR
%248 = call i32 @shutdown(i32 %246, i32 %247)
%249 = call i32 @close(i32 %246)
%250 = call i32 @accept(i32 %242, i32* null, i32* null)
%251 = icmp slt i32 %250, 0
br i1 %251, label %252, label %245
252: ; preds = %245, %241, %230, %232, %236
%253 = phi i32 [ %237, %236 ], [ %190, %230 ], [ -1, %232 ], [ %242, %241 ], [ %242, %245 ]
%254 = load i32, i32* %3
%255 = load i32, i32* @TIOCM_RI
%256 = and i32 %255, %254
%257 = icmp eq i32 %256, 0
br i1 %257, label %260, label %258
258: ; preds = %252
%259 = icmp slt i32 %189, 0
br i1 %259, label %266, label %271
260: ; preds = %252
%261 = icmp sgt i32 %189, -1
br i1 %261, label %262, label %282
262: ; preds = %260
%263 = call i32 @close(i32 %189)
%264 = call i32 @snprintf(i8* %177, i32 128, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0), i8* %74)
%265 = call i32 @addlogline(i8* %177, i8* %76)
br label %282
266: ; preds = %258
%267 = call i32 @stsmon_listentoport(i32 %70, i32 %179)
%268 = call i32 @snprintf(i8* %177, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i8* %74)
%269 = call i32 @addlogline(i8* %177, i8* %76)
%270 = icmp sgt i32 %267, -1
br i1 %270, label %271, label %282
271: ; preds = %258, %266
%272 = phi i32 [ %267, %266 ], [ %189, %258 ]
%273 = call i32 @accept(i32 %272, i32* null, i32* null)
%274 = icmp slt i32 %273, 0
br i1 %274, label %282, label %275
275: ; preds = %271, %275
%276 = phi i32 [ %280, %275 ], [ %273, %271 ]
%277 = load i32, i32* @SHUT_RDWR
%278 = call i32 @shutdown(i32 %276, i32 %277)
%279 = call i32 @close(i32 %276)
%280 = call i32 @accept(i32 %272, i32* null, i32* null)
%281 = icmp slt i32 %280, 0
br i1 %281, label %282, label %275
282: ; preds = %275, %271, %260, %262, %266
%283 = phi i32 [ %267, %266 ], [ %189, %260 ], [ -1, %262 ], [ %272, %271 ], [ %272, %275 ]
%284 = load i32, i32* %3
%285 = load i32, i32* @TIOCM_DSR
%286 = and i32 %285, %284
%287 = icmp eq i32 %286, 0
br i1 %287, label %290, label %288
288: ; preds = %282
%289 = icmp slt i32 %188, 0
br i1 %289, label %296, label %301
290: ; preds = %282
%291 = icmp sgt i32 %188, -1
br i1 %291, label %292, label %312
292: ; preds = %290
%293 = call i32 @close(i32 %188)
%294 = call i32 @snprintf(i8* %177, i32 128, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.22, i64 0, i64 0), i8* %75)
%295 = call i32 @addlogline(i8* %177, i8* %76)
br label %312
296: ; preds = %288
%297 = call i32 @stsmon_listentoport(i32 %70, i32 %180)
%298 = call i32 @snprintf(i8* %177, i32 128, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i8* %75)
%299 = call i32 @addlogline(i8* %177, i8* %76)
%300 = icmp sgt i32 %297, -1
br i1 %300, label %301, label %312
301: ; preds = %288, %296
%302 = phi i32 [ %297, %296 ], [ %188, %288 ]
%303 = call i32 @accept(i32 %302, i32* null, i32* null)
%304 = icmp slt i32 %303, 0
br i1 %304, label %312, label %305
305: ; preds = %301, %305
%306 = phi i32 [ %310, %305 ], [ %303, %301 ]
%307 = load i32, i32* @SHUT_RDWR
%308 = call i32 @shutdown(i32 %306, i32 %307)
%309 = call i32 @close(i32 %306)
%310 = call i32 @accept(i32 %302, i32* null, i32* null)
%311 = icmp slt i32 %310, 0
br i1 %311, label %312, label %305
312: ; preds = %305, %301, %290, %292, %296
%313 = phi i32 [ %297, %296 ], [ %188, %290 ], [ -1, %292 ], [ %302, %301 ], [ %302, %305 ]
br i1 %182, label %316, label %314
314: ; preds = %312
%315 = call i32 @sleep(i64 %183)
br label %316
316: ; preds = %314, %312
br i1 %185, label %319, label %317
317: ; preds = %316
%318 = call i32 @usleep(i64 %186)
br label %319
319: ; preds = %317, %316
br label %187
}