#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 */
struct timeval {
  int tv_usec;
  unsigned long tv_sec;
};
struct sched_param {
  int sched_priority;
};

/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ SCHED_FIFO;
int /*<<< orphan*/ TIOCMGET;
int /*<<< orphan*/ TIOCMSET;
int TIOCM_DTR;
int TIOCM_RTS;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
scalar_t__ getenv(char *);
int gettimeofday(struct timeval *, int /*<<< orphan*/ *);
scalar_t__ ioctl(int, int /*<<< orphan*/, int *);
scalar_t__ ioperm(int, int, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ outb(int, int);
int /*<<< orphan*/ printf(char *, int, int);
scalar_t__ sched_setscheduler(int /*<<< orphan*/, int /*<<< orphan*/,
                              struct sched_param *);
int sscanf(char *, char *, int *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ usleep(int);
int main(int argc, char **argv) {
  struct timeval tv, tv2;
  unsigned long sec;
  struct sched_param param;
  int port, sfd, mask, m1, diff, d2;
  char c;
  if (argc != 2) {
    fprintf(stderr, "%s: use \"%s <hex-port-or-/dev/serial>\" \n", argv[0],
            argv[0]);
    exit(1);
  }
  if (sscanf(argv[1], "%x%c", &port, &c) == 1) {
    sfd = 0;
    if (ioperm(port, 1, 1) < 0) {
      fprintf(stderr, "%s: ioperm(0x%x): %s\n", argv[0], port, strerror(errno));
      exit(1);
    }
  } else if (argv[1][0] != '/') {
    fprintf(stderr, "%s: not a hex number nor a device\"%s\"\n", argv[0],
            argv[1]);
    exit(1);
  } else {
    sfd = open(argv[1], O_RDWR);
    if (sfd < 0) {
      fprintf(stderr, "%s: %s: %s\n", argv[0], argv[1], strerror(errno));
      exit(1);
    }
    if (ioctl(sfd, TIOCMGET, &mask) < 0) {
      fprintf(stderr, "%s: %s: %s\n", argv[0], argv[1], strerror(errno));
      exit(1);
    }
    mask &= ~(TIOCM_RTS | TIOCM_DTR);
    m1 = mask | TIOCM_RTS | TIOCM_DTR;
  }
  param.sched_priority = 10;
  if (sched_setscheduler(0, SCHED_FIFO, &param) < 0) {
    fprintf(stderr, "%s: setscheduler: %s\n", argv[0], strerror(errno));
  }
  gettimeofday(&tv, NULL);
  gettimeofday(&tv2, NULL);
  gettimeofday(&tv2, NULL);
  gettimeofday(&tv2, NULL);
  gettimeofday(&tv2, NULL);
  gettimeofday(&tv2, NULL);
  gettimeofday(&tv2, NULL);
  gettimeofday(&tv2, NULL);
  gettimeofday(&tv2, NULL);
  gettimeofday(&tv2, NULL);
  gettimeofday(&tv2, NULL);
  diff = tv2.tv_usec - tv.tv_usec;
  if (diff < 0)
    diff += 1000 * 1000;
  if (getenv("VERBOSE"))
    printf("gettimeofday takes %i.%i usec\n", diff / 10, diff % 10);
  gettimeofday(&tv, NULL);
  usleep(0);
  usleep(0);
  usleep(0);
  usleep(0);
  usleep(0);
  usleep(0);
  usleep(0);
  usleep(0);
  usleep(0);
  usleep(0);
  gettimeofday(&tv2, NULL);
  d2 = diff;
  diff = tv2.tv_usec - tv.tv_usec;
  if (diff < 0)
    diff += 1000 * 1000;
  diff -= (d2 + 5) / 10;
  if (getenv("VERBOSE"))
    printf("udelay takes %i.%i usec\n", diff / 10, diff % 10);
  if (sfd)
    ioctl(sfd, TIOCMSET, &mask);
  else
    outb(0x00, port);
  gettimeofday(&tv, NULL);
  sec = tv.tv_sec;
  while (1) {
    sec++;
    while (gettimeofday(&tv, NULL), tv.tv_sec < sec)
      if (tv.tv_usec < 990 * 1000)
        usleep((1000 * 1000 - tv.tv_usec) / 2);
    if (sfd)
      ioctl(sfd, TIOCMSET, &m1);
    else
      outb(0xff, port);
    gettimeofday(&tv2, NULL);
    if (getenv("VERBOSE"))
      printf("delayed between %3i and %3i usecs\n", (int)tv.tv_usec,
             (int)tv2.tv_usec);
    usleep(50 * 1000);
    if (sfd)
      ioctl(sfd, TIOCMSET, &mask);
    else
      outb(0x00, port);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1222 <main+0x52>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
lea    0xdef(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf8(%rip),%rsi
lea    -0x44(%rbp),%rdx
lea    -0x59(%rbp),%rcx
call   10b0 <sscanf@plt>
cmp    $0x1,%eax
jne    12bc <main+0xec>
movl   $0x0,-0x48(%rbp)
mov    -0x44(%rbp),%edi
mov    $0x1,%edx
mov    %edx,%esi
call   1090 <ioperm@plt>
cmp    $0x0,%rax
jge    12b7 <main+0xe7>
mov    0x2d42(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x68(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x60(%rbp)
mov    0x2d1d(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x6c(%rbp),%edi
mov    -0x68(%rbp),%rdx
mov    -0x60(%rbp),%ecx
mov    %rax,%r8
lea    0xd88(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
jmp    1440 <main+0x270>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1300 <main+0x130>
mov    0x2cd9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xd55(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2cd9(%rip),%rax
mov    (%rax),%esi
call   10c0 <open@plt>
mov    %eax,-0x48(%rbp)
cmpl   $0x0,-0x48(%rbp)
jge    1380 <main+0x1b0>
mov    0x2c86(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x84(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x80(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x78(%rbp)
mov    0x2c58(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x84(%rbp),%edi
mov    -0x80(%rbp),%rdx
mov    -0x78(%rbp),%rcx
mov    %rax,%r8
lea    0xcfc(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x48(%rbp),%edi
mov    0x2c36(%rip),%rax
mov    (%rax),%esi
lea    -0x4c(%rbp),%rdx
call   1080 <ioctl@plt>
cmp    $0x0,%rax
jge    1408 <main+0x238>
mov    0x2c0a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x98(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x90(%rbp)
mov    0x2bd6(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0x9c(%rbp),%edi
mov    -0x98(%rbp),%rdx
mov    -0x90(%rbp),%rcx
mov    %rax,%r8
lea    0xc74(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2bc9(%rip),%rax
mov    (%rax),%eax
mov    0x2bb8(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x4c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    0x2bab(%rip),%rcx
or     (%rcx),%eax
mov    0x2b9a(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x50(%rbp)
jmp    1440 <main+0x270>
movl   $0xa,-0x40(%rbp)
mov    0x2b7a(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x40(%rbp),%rdx
call   1070 <sched_setscheduler@plt>
cmp    $0x0,%rax
jge    14ae <main+0x2de>
mov    0x2b44(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xac(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0xa8(%rbp)
mov    0x2b1f(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
mov    -0xac(%rbp),%edi
mov    -0xa8(%rbp),%rdx
mov    %rax,%rcx
lea    0xbd0(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x30(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jge    155b <main+0x38b>
mov    -0x54(%rbp),%eax
add    $0xf4240,%eax
mov    %eax,-0x54(%rbp)
lea    0xb2b(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1595 <main+0x3c5>
mov    -0x54(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x54(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
lea    0xb05(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x54(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x30(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jge    1619 <main+0x449>
mov    -0x54(%rbp),%eax
add    $0xf4240,%eax
mov    %eax,-0x54(%rbp)
mov    -0x58(%rbp),%eax
add    $0x5,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x54(%rbp)
lea    0xa55(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     166b <main+0x49b>
mov    -0x54(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x54(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
lea    0xa4e(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x0,-0x48(%rbp)
je     168f <main+0x4bf>
mov    -0x48(%rbp),%edi
mov    0x2961(%rip),%rax
mov    (%rax),%esi
lea    -0x4c(%rbp),%rdx
call   1080 <ioctl@plt>
jmp    1699 <main+0x4c9>
mov    -0x44(%rbp),%esi
xor    %edi,%edi
call   1060 <outb@plt>
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
mov    -0x18(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    16fe <main+0x52e>
cmpl   $0xf1b30,-0x20(%rbp)
jge    16f9 <main+0x529>
mov    $0xf4240,%eax
sub    -0x20(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   10f0 <usleep@plt>
jmp    16ba <main+0x4ea>
cmpl   $0x0,-0x48(%rbp)
je     1722 <main+0x552>
mov    -0x48(%rbp),%edi
mov    0x28ce(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdx
call   1080 <ioctl@plt>
jmp    172f <main+0x55f>
mov    -0x44(%rbp),%esi
mov    $0xff,%edi
call   1060 <outb@plt>
lea    -0x30(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1050 <gettimeofday@plt>
lea    0x94a(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1764 <main+0x594>
mov    -0x20(%rbp),%esi
mov    -0x30(%rbp),%edx
lea    0x96e(%rip),%rdi
call   1040 <printf@plt>
mov    $0xc350,%edi
call   10f0 <usleep@plt>
cmpl   $0x0,-0x48(%rbp)
je     1792 <main+0x5c2>
mov    -0x48(%rbp),%edi
mov    0x285e(%rip),%rax
mov    (%rax),%esi
lea    -0x4c(%rbp),%rdx
call   1080 <ioctl@plt>
jmp    179c <main+0x5cc>
mov    -0x44(%rbp),%esi
xor    %edi,%edi
call   1060 <outb@plt>
jmp    16ae <main+0x4de>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r15
cmp    $0x2,%edi
jne    15db <main+0x40b>
mov    0x8(%r15),%rdi
lea    0xe34(%rip),%rsi
lea    0x4(%rsp),%rdx
lea    0xf(%rsp),%rcx
call   10b0 <sscanf@plt>
cmp    $0x1,%eax
jne    1269 <main+0x99>
mov    0x4(%rsp),%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1090 <ioperm@plt>
xor    %ebp,%ebp
test   %rax,%rax
jns    12d5 <main+0x105>
mov    0x2d82(%rip),%rax
mov    (%rax),%ebp
mov    (%r15),%rbx
mov    0x4(%rsp),%r14d
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xde1(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %r14d,%ecx
mov    %rax,%r8
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x8(%r15),%rcx
cmpb   $0x2f,(%rcx)
jne    1634 <main+0x464>
mov    0x2d6b(%rip),%rax
mov    (%rax),%esi
mov    %rcx,%rdi
call   10c0 <open@plt>
test   %eax,%eax
js     15f3 <main+0x423>
mov    %eax,%ebp
mov    0x2d28(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebp,%edi
call   1080 <ioctl@plt>
test   %rax,%rax
js     15f3 <main+0x423>
mov    0x2d22(%rip),%rax
mov    0x2d13(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    %ecx,%eax
not    %eax
mov    0x8(%rsp),%edx
and    %edx,%eax
mov    %eax,0x8(%rsp)
or     %edx,%ecx
mov    %ecx,0x24(%rsp)
movl   $0xa,0x20(%rsp)
mov    0x2ce4(%rip),%rax
mov    (%rax),%esi
lea    0x20(%rsp),%rdx
xor    %edi,%edi
call   1070 <sched_setscheduler@plt>
test   %rax,%rax
jns    1327 <main+0x157>
mov    0x2cb2(%rip),%rax
mov    (%rax),%ebx
mov    (%r15),%r14
mov    0x2c9e(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xd5f(%rip),%rsi
mov    %ebx,%edi
mov    %r14,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   10a0 <fprintf@plt>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
lea    0x28(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    0x28(%rsp),%eax
sub    0x10(%rsp),%eax
lea    0xf4240(%rax),%r14d
test   %eax,%eax
cmovns %eax,%r14d
lea    0xcd5(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     13ed <main+0x21d>
movslq %r14d,%rdx
imul   $0x66666667,%rdx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x22,%rsi
add    %eax,%esi
lea    (%rsi,%rsi,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edx
lea    0xcad(%rip),%rdi
call   1040 <printf@plt>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
xor    %edi,%edi
call   10f0 <usleep@plt>
lea    0x28(%rsp),%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    0x28(%rsp),%eax
sub    0x10(%rsp),%eax
lea    0xf4240(%rax),%ebx
test   %eax,%eax
cmovns %eax,%ebx
lea    0xc28(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     14b7 <main+0x2e7>
add    $0x5,%r14d
movslq %r14d,%rax
imul   $0xffffffff99999999,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%ebx
movslq %ebx,%rdx
imul   $0x66666667,%rdx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x22,%rsi
add    %eax,%esi
lea    (%rsi,%rsi,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edx
lea    0xc02(%rip),%rdi
call   1040 <printf@plt>
test   %ebp,%ebp
je     14d2 <main+0x302>
mov    0x2b1e(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
mov    %ebp,%edi
call   1080 <ioctl@plt>
jmp    14dd <main+0x30d>
mov    0x4(%rsp),%esi
xor    %edi,%edi
call   1060 <outb@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    0x18(%rsp),%r13
lea    0x28(%rsp),%r14
lea    0xb90(%rip),%r15
mov    0x2adc(%rip),%r12
jmp    1520 <main+0x350>
cs nopw 0x0(%rax,%rax,1)
mov    (%r12),%esi
mov    %ebp,%edi
lea    0x8(%rsp),%rdx
call   1080 <ioctl@plt>
add    $0x1,%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
cmp    %r13,0x18(%rsp)
jae    1560 <main+0x390>
mov    0x10(%rsp),%eax
cmp    $0xf1b2f,%eax
jg     1530 <main+0x360>
mov    $0xf4240,%edi
sub    %eax,%edi
shr    %edi
call   10f0 <usleep@plt>
jmp    1530 <main+0x360>
nopl   0x0(%rax)
test   %ebp,%ebp
je     1580 <main+0x3b0>
mov    (%r12),%esi
mov    %ebp,%edi
lea    0x24(%rsp),%rdx
call   1080 <ioctl@plt>
jmp    158e <main+0x3be>
cs nopw 0x0(%rax,%rax,1)
mov    0x4(%rsp),%esi
mov    $0xff,%edi
call   1060 <outb@plt>
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <gettimeofday@plt>
mov    %r15,%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     15b9 <main+0x3e9>
mov    0x10(%rsp),%esi
mov    0x28(%rsp),%edx
lea    0xb19(%rip),%rdi
call   1040 <printf@plt>
mov    $0xc350,%edi
call   10f0 <usleep@plt>
test   %ebp,%ebp
jne    1510 <main+0x340>
mov    0x4(%rsp),%esi
xor    %edi,%edi
call   1060 <outb@plt>
jmp    1520 <main+0x350>
mov    0x29ce(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rcx
lea    0xa12(%rip),%rsi
mov    %rcx,%rdx
jmp    1647 <main+0x477>
mov    0x29b6(%rip),%rax
mov    (%rax),%ebp
mov    (%r15),%r14
mov    0x8(%r15),%rbx
mov    0x299e(%rip),%rax
mov    (%rax),%edi
call   10e0 <strerror@plt>
lea    0xa53(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
mov    %rbx,%rcx
mov    %rax,%r8
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    0x2975(%rip),%rax
mov    (%rax),%edi
mov    (%r15),%rdx
lea    0x9fd(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
%struct.sched_param = type { i32 }
@stderr = global i32 0
@.str = [41 x i8] c"%s: use \22%s <hex-port-or-/dev/serial>\22 \0A\00"
@.str.1 = [5 x i8] c"%x%c\00"
@.str.2 = [22 x i8] c"%s: ioperm(0x%x): %s\0A\00"
@errno = global i32 0
@.str.3 = [39 x i8] c"%s: not a hex number nor a device\22%s\22\0A\00"
@O_RDWR = global i32 0
@.str.4 = [12 x i8] c"%s: %s: %s\0A\00"
@TIOCMGET = global i32 0
@TIOCM_RTS = global i32 0
@TIOCM_DTR = global i32 0
@SCHED_FIFO = global i32 0
@.str.5 = [22 x i8] c"%s: setscheduler: %s\0A\00"
@.str.6 = [8 x i8] c"VERBOSE\00"
@.str.7 = [31 x i8] c"gettimeofday takes %i.%i usec\0A\00"
@.str.8 = [25 x i8] c"udelay takes %i.%i usec\0A\00"
@TIOCMSET = global i32 0
@.str.9 = [35 x i8] c"delayed between %3i and %3i usecs\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.timeval
%7 = alloca %struct.timeval
%8 = alloca i64
%9 = alloca %struct.sched_param
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 2
br i1 %18, label %19, label %29
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %23, i8* %26)
%28 = call i32 @exit(i32 1)
unreachable
29: ; preds = %2
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 1
%32 = load i8*, i8** %31
%33 = call i32 @sscanf(i8* %32, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %10, i8* %16)
%34 = icmp eq i32 %33, 1
br i1 %34, label %35, label %50
35: ; preds = %29
store i32 0, i32* %11
%36 = load i32, i32* %10
%37 = call i64 @ioperm(i32 %36, i32 1, i32 1)
%38 = icmp slt i64 %37, 0
br i1 %38, label %39, label %49
39: ; preds = %35
%40 = load i32, i32* @stderr
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 0
%43 = load i8*, i8** %42
%44 = load i32, i32* %10
%45 = load i32, i32* @errno
%46 = call i8* @strerror(i32 %45)
%47 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %43, i32 %44, i8* %46)
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %35
br label %118
50: ; preds = %29
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 1
%53 = load i8*, i8** %52
%54 = getelementptr inbounds i8, i8* %53, i64 0
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp ne i32 %56, 47
br i1 %57, label %58, label %68
58: ; preds = %50
%59 = load i32, i32* @stderr
%60 = load i8**, i8*** %5
%61 = getelementptr inbounds i8*, i8** %60, i64 0
%62 = load i8*, i8** %61
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 1
%65 = load i8*, i8** %64
%66 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %62, i8* %65)
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %50
%69 = load i8**, i8*** %5
%70 = getelementptr inbounds i8*, i8** %69, i64 1
%71 = load i8*, i8** %70
%72 = load i32, i32* @O_RDWR
%73 = call i32 @open(i8* %71, i32 %72)
store i32 %73, i32* %11
%74 = load i32, i32* %11
%75 = icmp slt i32 %74, 0
br i1 %75, label %76, label %88
76: ; preds = %68
%77 = load i32, i32* @stderr
%78 = load i8**, i8*** %5
%79 = getelementptr inbounds i8*, i8** %78, i64 0
%80 = load i8*, i8** %79
%81 = load i8**, i8*** %5
%82 = getelementptr inbounds i8*, i8** %81, i64 1
%83 = load i8*, i8** %82
%84 = load i32, i32* @errno
%85 = call i8* @strerror(i32 %84)
%86 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %77, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %80, i8* %83, i8* %85)
%87 = call i32 @exit(i32 1)
unreachable
88: ; preds = %68
%89 = load i32, i32* %11
%90 = load i32, i32* @TIOCMGET
%91 = call i64 @ioctl(i32 %89, i32 %90, i32* %12)
%92 = icmp slt i64 %91, 0
br i1 %92, label %93, label %105
93: ; preds = %88
%94 = load i32, i32* @stderr
%95 = load i8**, i8*** %5
%96 = getelementptr inbounds i8*, i8** %95, i64 0
%97 = load i8*, i8** %96
%98 = load i8**, i8*** %5
%99 = getelementptr inbounds i8*, i8** %98, i64 1
%100 = load i8*, i8** %99
%101 = load i32, i32* @errno
%102 = call i8* @strerror(i32 %101)
%103 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %97, i8* %100, i8* %102)
%104 = call i32 @exit(i32 1)
unreachable
105: ; preds = %88
%106 = load i32, i32* @TIOCM_RTS
%107 = load i32, i32* @TIOCM_DTR
%108 = or i32 %106, %107
%109 = xor i32 %108, -1
%110 = load i32, i32* %12
%111 = and i32 %110, %109
store i32 %111, i32* %12
%112 = load i32, i32* %12
%113 = load i32, i32* @TIOCM_RTS
%114 = or i32 %112, %113
%115 = load i32, i32* @TIOCM_DTR
%116 = or i32 %114, %115
store i32 %116, i32* %13
br label %117
117: ; preds = %105
br label %118
118: ; preds = %117, %49
%119 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %9, i32 0, i32 0
store i32 10, i32* %119
%120 = load i32, i32* @SCHED_FIFO
%121 = call i64 @sched_setscheduler(i32 0, i32 %120, %struct.sched_param* %9)
%122 = icmp slt i64 %121, 0
br i1 %122, label %123, label %131
123: ; preds = %118
%124 = load i32, i32* @stderr
%125 = load i8**, i8*** %5
%126 = getelementptr inbounds i8*, i8** %125, i64 0
%127 = load i8*, i8** %126
%128 = load i32, i32* @errno
%129 = call i8* @strerror(i32 %128)
%130 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %124, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %127, i8* %129)
br label %131
131: ; preds = %123, %118
%132 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%133 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%134 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%135 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%136 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%137 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%138 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%139 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%140 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%141 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%142 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%143 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%144 = load i32, i32* %143
%145 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%146 = load i32, i32* %145
%147 = sub nsw i32 %144, %146
store i32 %147, i32* %14
%148 = load i32, i32* %14
%149 = icmp slt i32 %148, 0
br i1 %149, label %150, label %153
150: ; preds = %131
%151 = load i32, i32* %14
%152 = add nsw i32 %151, 1000000
store i32 %152, i32* %14
br label %153
153: ; preds = %150, %131
%154 = call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%155 = icmp ne i64 %154, 0
br i1 %155, label %156, label %162
156: ; preds = %153
%157 = load i32, i32* %14
%158 = sdiv i32 %157, 10
%159 = load i32, i32* %14
%160 = srem i32 %159, 10
%161 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 %158, i32 %160)
br label %162
162: ; preds = %156, %153
%163 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%164 = call i32 @usleep(i32 0)
%165 = call i32 @usleep(i32 0)
%166 = call i32 @usleep(i32 0)
%167 = call i32 @usleep(i32 0)
%168 = call i32 @usleep(i32 0)
%169 = call i32 @usleep(i32 0)
%170 = call i32 @usleep(i32 0)
%171 = call i32 @usleep(i32 0)
%172 = call i32 @usleep(i32 0)
%173 = call i32 @usleep(i32 0)
%174 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%175 = load i32, i32* %14
store i32 %175, i32* %15
%176 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%177 = load i32, i32* %176
%178 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%179 = load i32, i32* %178
%180 = sub nsw i32 %177, %179
store i32 %180, i32* %14
%181 = load i32, i32* %14
%182 = icmp slt i32 %181, 0
br i1 %182, label %183, label %186
183: ; preds = %162
%184 = load i32, i32* %14
%185 = add nsw i32 %184, 1000000
store i32 %185, i32* %14
br label %186
186: ; preds = %183, %162
%187 = load i32, i32* %15
%188 = add nsw i32 %187, 5
%189 = sdiv i32 %188, 10
%190 = load i32, i32* %14
%191 = sub nsw i32 %190, %189
store i32 %191, i32* %14
%192 = call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%193 = icmp ne i64 %192, 0
br i1 %193, label %194, label %200
194: ; preds = %186
%195 = load i32, i32* %14
%196 = sdiv i32 %195, 10
%197 = load i32, i32* %14
%198 = srem i32 %197, 10
%199 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %196, i32 %198)
br label %200
200: ; preds = %194, %186
%201 = load i32, i32* %11
%202 = icmp ne i32 %201, 0
br i1 %202, label %203, label %207
203: ; preds = %200
%204 = load i32, i32* %11
%205 = load i32, i32* @TIOCMSET
%206 = call i64 @ioctl(i32 %204, i32 %205, i32* %12)
br label %210
207: ; preds = %200
%208 = load i32, i32* %10
%209 = call i32 @outb(i32 0, i32 %208)
br label %210
210: ; preds = %207, %203
%211 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%212 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%213 = load i64, i64* %212
store i64 %213, i64* %8
br label %214
214: ; preds = %210, %265
%215 = load i64, i64* %8
%216 = add i64 %215, 1
store i64 %216, i64* %8
br label %217
217: ; preds = %233, %214
%218 = call i32 @gettimeofday(%struct.timeval* %6, i32* null)
%219 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%220 = load i64, i64* %219
%221 = load i64, i64* %8
%222 = icmp ult i64 %220, %221
br i1 %222, label %223, label %234
223: ; preds = %217
%224 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%225 = load i32, i32* %224
%226 = icmp slt i32 %225, 990000
br i1 %226, label %227, label %233
227: ; preds = %223
%228 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%229 = load i32, i32* %228
%230 = sub nsw i32 1000000, %229
%231 = sdiv i32 %230, 2
%232 = call i32 @usleep(i32 %231)
br label %233
233: ; preds = %227, %223
br label %217
234: ; preds = %217
%235 = load i32, i32* %11
%236 = icmp ne i32 %235, 0
br i1 %236, label %237, label %241
237: ; preds = %234
%238 = load i32, i32* %11
%239 = load i32, i32* @TIOCMSET
%240 = call i64 @ioctl(i32 %238, i32 %239, i32* %13)
br label %244
241: ; preds = %234
%242 = load i32, i32* %10
%243 = call i32 @outb(i32 255, i32 %242)
br label %244
244: ; preds = %241, %237
%245 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%246 = call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%247 = icmp ne i64 %246, 0
br i1 %247, label %248, label %254
248: ; preds = %244
%249 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 0
%250 = load i32, i32* %249
%251 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%252 = load i32, i32* %251
%253 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0), i32 %250, i32 %252)
br label %254
254: ; preds = %248, %244
%255 = call i32 @usleep(i32 50000)
%256 = load i32, i32* %11
%257 = icmp ne i32 %256, 0
br i1 %257, label %258, label %262
258: ; preds = %254
%259 = load i32, i32* %11
%260 = load i32, i32* @TIOCMSET
%261 = call i64 @ioctl(i32 %259, i32 %260, i32* %12)
br label %265
262: ; preds = %254
%263 = load i32, i32* %10
%264 = call i32 @outb(i32 0, i32 %263)
br label %265
265: ; preds = %262, %258
br label %214
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
%struct.sched_param = type { i32 }
@stderr = global i32 0
@.str = [41 x i8] c"%s: use \22%s <hex-port-or-/dev/serial>\22 \0A\00"
@.str.1 = [5 x i8] c"%x%c\00"
@.str.2 = [22 x i8] c"%s: ioperm(0x%x): %s\0A\00"
@errno = global i32 0
@.str.3 = [39 x i8] c"%s: not a hex number nor a device\22%s\22\0A\00"
@O_RDWR = global i32 0
@.str.4 = [12 x i8] c"%s: %s: %s\0A\00"
@TIOCMGET = global i32 0
@TIOCM_RTS = global i32 0
@TIOCM_DTR = global i32 0
@SCHED_FIFO = global i32 0
@.str.5 = [22 x i8] c"%s: setscheduler: %s\0A\00"
@.str.6 = [8 x i8] c"VERBOSE\00"
@.str.7 = [31 x i8] c"gettimeofday takes %i.%i usec\0A\00"
@.str.8 = [25 x i8] c"udelay takes %i.%i usec\0A\00"
@TIOCMSET = global i32 0
@.str.9 = [35 x i8] c"delayed between %3i and %3i usecs\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = alloca %struct.sched_param
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
%10 = bitcast %struct.timeval* %3 to i8*
%11 = bitcast %struct.timeval* %4 to i8*
%12 = bitcast %struct.sched_param* %5 to i8*
%13 = bitcast i32* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = bitcast i32* %8 to i8*
%16 = icmp eq i32 %0, 2
br i1 %16, label %22, label %17
17: ; preds = %2
%18 = load i32, i32* @stderr
%19 = load i8*, i8** %1
%20 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %19, i8* %19)
%21 = tail call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = call i32 @sscanf(i8* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %6, i8* %9)
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %39
27: ; preds = %22
%28 = load i32, i32* %6
%29 = call i64 @ioperm(i32 %28, i32 1, i32 1)
%30 = icmp slt i64 %29, 0
br i1 %30, label %31, label %80
31: ; preds = %27
%32 = load i32, i32* @stderr
%33 = load i8*, i8** %1
%34 = load i32, i32* %6
%35 = load i32, i32* @errno
%36 = call i8* @strerror(i32 %35)
%37 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8* %33, i32 %34, i8* %36)
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %22
%40 = load i8*, i8** %23
%41 = load i8, i8* %40
%42 = icmp eq i8 %41, 47
br i1 %42, label %48, label %43
43: ; preds = %39
%44 = load i32, i32* @stderr
%45 = load i8*, i8** %1
%46 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i8* %45, i8* %40)
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %39
%49 = load i32, i32* @O_RDWR
%50 = call i32 @open(i8* %40, i32 %49)
%51 = icmp slt i32 %50, 0
br i1 %51, label %52, label %60
52: ; preds = %48
%53 = load i32, i32* @stderr
%54 = load i8*, i8** %1
%55 = load i8*, i8** %23
%56 = load i32, i32* @errno
%57 = call i8* @strerror(i32 %56)
%58 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %53, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %54, i8* %55, i8* %57)
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %48
%61 = load i32, i32* @TIOCMGET
%62 = call i64 @ioctl(i32 %50, i32 %61, i32* %7)
%63 = icmp slt i64 %62, 0
br i1 %63, label %64, label %72
64: ; preds = %60
%65 = load i32, i32* @stderr
%66 = load i8*, i8** %1
%67 = load i8*, i8** %23
%68 = load i32, i32* @errno
%69 = call i8* @strerror(i32 %68)
%70 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i8* %66, i8* %67, i8* %69)
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %60
%73 = load i32, i32* @TIOCM_RTS
%74 = load i32, i32* @TIOCM_DTR
%75 = or i32 %74, %73
%76 = xor i32 %75, -1
%77 = load i32, i32* %7
%78 = and i32 %77, %76
store i32 %78, i32* %7
%79 = or i32 %75, %77
store i32 %79, i32* %8
br label %80
80: ; preds = %27, %72
%81 = phi i32 [ 0, %27 ], [ %50, %72 ]
%82 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %5, i64 0, i32 0
store i32 10, i32* %82
%83 = load i32, i32* @SCHED_FIFO
%84 = call i64 @sched_setscheduler(i32 0, i32 %83, %struct.sched_param* %5)
%85 = icmp slt i64 %84, 0
br i1 %85, label %86, label %92
86: ; preds = %80
%87 = load i32, i32* @stderr
%88 = load i8*, i8** %1
%89 = load i32, i32* @errno
%90 = call i8* @strerror(i32 %89)
%91 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* %88, i8* %90)
br label %92
92: ; preds = %86, %80
%93 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%94 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%95 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%96 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%97 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%98 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%99 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%100 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%101 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%102 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%103 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%104 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%105 = load i32, i32* %104
%106 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
%107 = load i32, i32* %106
%108 = sub nsw i32 %105, %107
%109 = icmp slt i32 %108, 0
%110 = add nsw i32 %108, 1000000
%111 = select i1 %109, i32 %110, i32 %108
%112 = call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%113 = icmp eq i64 %112, 0
br i1 %113, label %118, label %114
114: ; preds = %92
%115 = sdiv i32 %111, 10
%116 = srem i32 %111, 10
%117 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 %115, i32 %116)
br label %118
118: ; preds = %114, %92
%119 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%120 = call i32 @usleep(i32 0)
%121 = call i32 @usleep(i32 0)
%122 = call i32 @usleep(i32 0)
%123 = call i32 @usleep(i32 0)
%124 = call i32 @usleep(i32 0)
%125 = call i32 @usleep(i32 0)
%126 = call i32 @usleep(i32 0)
%127 = call i32 @usleep(i32 0)
%128 = call i32 @usleep(i32 0)
%129 = call i32 @usleep(i32 0)
%130 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%131 = load i32, i32* %104
%132 = load i32, i32* %106
%133 = sub nsw i32 %131, %132
%134 = icmp slt i32 %133, 0
%135 = add nsw i32 %133, 1000000
%136 = select i1 %134, i32 %135, i32 %133
%137 = add nsw i32 %111, 5
%138 = sdiv i32 %137, -10
%139 = add i32 %136, %138
%140 = call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%141 = icmp eq i64 %140, 0
br i1 %141, label %146, label %142
142: ; preds = %118
%143 = sdiv i32 %139, 10
%144 = srem i32 %139, 10
%145 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %143, i32 %144)
br label %146
146: ; preds = %142, %118
%147 = icmp eq i32 %81, 0
br i1 %147, label %151, label %148
148: ; preds = %146
%149 = load i32, i32* @TIOCMSET
%150 = call i64 @ioctl(i32 %81, i32 %149, i32* %7)
br label %154
151: ; preds = %146
%152 = load i32, i32* %6
%153 = call i32 @outb(i32 0, i32 %152)
br label %154
154: ; preds = %151, %148
%155 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%156 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
%157 = load i64, i64* %156
br label %158
158: ; preds = %198, %154
%159 = phi i64 [ %157, %154 ], [ %160, %198 ]
%160 = add i64 %159, 1
%161 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%162 = load i64, i64* %156
%163 = icmp ult i64 %162, %160
br i1 %163, label %164, label %175
164: ; preds = %158, %171
%165 = load i32, i32* %106
%166 = icmp slt i32 %165, 990000
br i1 %166, label %167, label %171
167: ; preds = %164
%168 = sub nsw i32 1000000, %165
%169 = lshr i32 %168, 1
%170 = call i32 @usleep(i32 %169)
br label %171
171: ; preds = %167, %164
%172 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%173 = load i64, i64* %156
%174 = icmp ult i64 %173, %160
br i1 %174, label %164, label %175
175: ; preds = %171, %158
br i1 %147, label %179, label %176
176: ; preds = %175
%177 = load i32, i32* @TIOCMSET
%178 = call i64 @ioctl(i32 %81, i32 %177, i32* %8)
br label %182
179: ; preds = %175
%180 = load i32, i32* %6
%181 = call i32 @outb(i32 255, i32 %180)
br label %182
182: ; preds = %179, %176
%183 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%184 = call i64 @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%185 = icmp eq i64 %184, 0
br i1 %185, label %190, label %186
186: ; preds = %182
%187 = load i32, i32* %106
%188 = load i32, i32* %104
%189 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0), i32 %187, i32 %188)
br label %190
190: ; preds = %186, %182
%191 = call i32 @usleep(i32 50000)
br i1 %147, label %195, label %192
192: ; preds = %190
%193 = load i32, i32* @TIOCMSET
%194 = call i64 @ioctl(i32 %81, i32 %193, i32* %7)
br label %198
195: ; preds = %190
%196 = load i32, i32* %6
%197 = call i32 @outb(i32 0, i32 %196)
br label %198
198: ; preds = %195, %192
br label %158
}