#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 */

/* Variables and functions */
int O_NOCTTY;
int O_NONBLOCK;
int O_RDWR;
int /*<<< orphan*/ TCIOFLUSH;
int /*<<< orphan*/ TIOCMBIC;
int /*<<< orphan*/ TIOCMBIS;
int /*<<< orphan*/ TIOCMGET;
int TIOCM_CD;
int TIOCM_DSR;
int TIOCM_DTR;
int TIOCM_RTS;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, int *);
int open(char *, int);
int /*<<< orphan*/ port_init(int, char *, char, char, char);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ tcflush(int, int /*<<< orphan*/);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char **argv) {
  char c;
  int portfdMaster;
  int portfdSlave;
  int MasterHandShake = 0;
  int SlaveHandShake = 0;
  int i = 0;
  int j = 0;
  bool master = true;
  portfdMaster = open(argv[1], O_RDWR | O_NONBLOCK | O_NOCTTY);
  portfdSlave = open(argv[2], O_RDWR | O_NONBLOCK | O_NOCTTY);
  port_init(portfdMaster, argv[3], argv[4][0], argv[4][1], argv[4][2]);
  port_init(portfdSlave, argv[3], argv[4][0], argv[4][1], argv[4][2]);
  tcflush(portfdMaster, TCIOFLUSH);
  tcflush(portfdSlave, TCIOFLUSH);
  printf("Master\n");
  while (true) {
    ioctl(portfdMaster, TIOCMGET, &i);
    if ((i & (TIOCM_DSR | TIOCM_CD)) !=
        (MasterHandShake & (TIOCM_DSR | TIOCM_CD))) {
      if (!master) {
        master = true;
        printf("\nT ");
      }
      if ((i & TIOCM_DSR) != (MasterHandShake & TIOCM_DSR)) {
        j = TIOCM_DTR;
        if (i & TIOCM_DSR) {
          ioctl(portfdSlave, TIOCMBIS, &j);
        } else {
          ioctl(portfdSlave, TIOCMBIC, &j);
        }
        fflush(stdout);
      }
      if ((i & TIOCM_CD) != (MasterHandShake & TIOCM_CD)) {
        j = TIOCM_RTS;
        if (i & TIOCM_CD) {
          ioctl(portfdSlave, TIOCMBIS, &j);
        } else {
          ioctl(portfdSlave, TIOCMBIC, &j);
        }
        fflush(stdout);
      }
      MasterHandShake = i;
    }
    if (1 == read(portfdMaster, &c, 1)) {
      if (!master) {
        master = true;
        printf("\nT ");
      }
      write(portfdSlave, &c, 1);
      printf("0x%02hhX ", c);
      fflush(stdout);
    }
    ioctl(portfdSlave, TIOCMGET, &i);
    if ((i & (TIOCM_DSR | TIOCM_CD)) !=
        (SlaveHandShake & (TIOCM_DSR | TIOCM_CD))) {
      if (master) {
        master = false;
        printf("\tR ");
      }
      if ((i & TIOCM_DSR) != (SlaveHandShake & TIOCM_DSR)) {
        j = TIOCM_DTR;
        if (i & TIOCM_DSR) {
          ioctl(portfdMaster, TIOCMBIS, &j);
        } else {
          ioctl(portfdMaster, TIOCMBIC, &j);
        }
        fflush(stdout);
      }
      if ((i & TIOCM_CD) != (SlaveHandShake & TIOCM_CD)) {
        j = TIOCM_RTS;
        if (i & TIOCM_CD) {
          ioctl(portfdMaster, TIOCMBIS, &j);
        } else {
          ioctl(portfdMaster, TIOCMBIC, &j);
        }
        fflush(stdout);
      }
      SlaveHandShake = i;
    }
    if (1 == read(portfdSlave, &c, 1)) {
      if (master) {
        master = false;
        printf("\tR ");
      }
      write(portfdMaster, &c, 1);
      printf("0x%02hhX ", c);
      fflush(stdout);
    }
  }
  close(portfdMaster);
  close(portfdSlave);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x1,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e20(%rip),%rax
mov    (%rax),%esi
mov    0x2e0f(%rip),%rax
or     (%rax),%esi
mov    0x2dce(%rip),%rax
or     (%rax),%esi
call   10a0 <open@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x2df5(%rip),%rax
mov    (%rax),%esi
mov    0x2de4(%rip),%rax
or     (%rax),%esi
mov    0x2da3(%rip),%rax
or     (%rax),%esi
call   10a0 <open@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movsbl %dl,%edx
movsbl %cl,%ecx
movsbl 0x2(%rax),%r8d
call   1090 <port_init@plt>
mov    -0x1c(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
mov    0x1(%rax),%cl
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movsbl %dl,%edx
movsbl %cl,%ecx
movsbl 0x2(%rax),%r8d
call   1090 <port_init@plt>
mov    -0x18(%rbp),%edi
mov    0x2d0f(%rip),%rax
mov    (%rax),%esi
call   1040 <tcflush@plt>
mov    -0x1c(%rbp),%edi
mov    0x2cfe(%rip),%rax
mov    (%rax),%esi
call   1040 <tcflush@plt>
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%edi
mov    0x2d07(%rip),%rax
mov    (%rax),%esi
lea    -0x28(%rbp),%rdx
call   1060 <ioctl@plt>
mov    -0x28(%rbp),%eax
mov    0x2d0a(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2cb1(%rip),%rdx
or     (%rdx),%ecx
and    %ecx,%eax
mov    -0x20(%rbp),%ecx
mov    0x2cf3(%rip),%rdx
mov    (%rdx),%edx
mov    0x2c9a(%rip),%rsi
or     (%rsi),%edx
and    %edx,%ecx
cmp    %ecx,%eax
je     141b <main+0x29b>
cmpl   $0x0,-0x30(%rbp)
jne    1319 <main+0x199>
movl   $0x1,-0x30(%rbp)
lea    0xcf6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%eax
mov    0x2cb5(%rip),%rcx
and    (%rcx),%eax
mov    -0x20(%rbp),%ecx
mov    0x2ca9(%rip),%rdx
and    (%rdx),%ecx
cmp    %ecx,%eax
je     1397 <main+0x217>
mov    0x2c88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
mov    0x2c89(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1374 <main+0x1f4>
mov    -0x1c(%rbp),%edi
mov    0x2c4c(%rip),%rax
mov    (%rax),%esi
lea    -0x2c(%rbp),%rdx
call   1060 <ioctl@plt>
jmp    1389 <main+0x209>
mov    -0x1c(%rbp),%edi
mov    0x2c22(%rip),%rax
mov    (%rax),%esi
lea    -0x2c(%rbp),%rdx
call   1060 <ioctl@plt>
mov    0x2c00(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0x28(%rbp),%eax
mov    0x2be7(%rip),%rcx
and    (%rcx),%eax
mov    -0x20(%rbp),%ecx
mov    0x2bdb(%rip),%rdx
and    (%rdx),%ecx
cmp    %ecx,%eax
je     1415 <main+0x295>
mov    0x2c12(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
mov    0x2bbb(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13f2 <main+0x272>
mov    -0x1c(%rbp),%edi
mov    0x2bce(%rip),%rax
mov    (%rax),%esi
lea    -0x2c(%rbp),%rdx
call   1060 <ioctl@plt>
jmp    1407 <main+0x287>
mov    -0x1c(%rbp),%edi
mov    0x2ba4(%rip),%rax
mov    (%rax),%esi
lea    -0x2c(%rbp),%rdx
call   1060 <ioctl@plt>
mov    0x2b82(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x11(%rbp),%rsi
mov    $0x1,%edx
call   1070 <read@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    148b <main+0x30b>
cmpl   $0x0,-0x30(%rbp)
jne    145a <main+0x2da>
movl   $0x1,-0x30(%rbp)
lea    0xbb5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%edi
lea    -0x11(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
movsbl -0x11(%rbp),%esi
lea    0xb96(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2b0c(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0x1c(%rbp),%edi
mov    0x2b2b(%rip),%rax
mov    (%rax),%esi
lea    -0x28(%rbp),%rdx
call   1060 <ioctl@plt>
mov    -0x28(%rbp),%eax
mov    0x2b2e(%rip),%rcx
mov    (%rcx),%ecx
mov    0x2ad5(%rip),%rdx
or     (%rdx),%ecx
and    %ecx,%eax
mov    -0x24(%rbp),%ecx
mov    0x2b17(%rip),%rdx
mov    (%rdx),%edx
mov    0x2abe(%rip),%rsi
or     (%rsi),%edx
and    %edx,%ecx
cmp    %ecx,%eax
je     15f7 <main+0x477>
cmpl   $0x0,-0x30(%rbp)
je     14f5 <main+0x375>
movl   $0x0,-0x30(%rbp)
lea    0xb28(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x28(%rbp),%eax
mov    0x2ad9(%rip),%rcx
and    (%rcx),%eax
mov    -0x24(%rbp),%ecx
mov    0x2acd(%rip),%rdx
and    (%rdx),%ecx
cmp    %ecx,%eax
je     1573 <main+0x3f3>
mov    0x2aac(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
mov    0x2aad(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1550 <main+0x3d0>
mov    -0x18(%rbp),%edi
mov    0x2a70(%rip),%rax
mov    (%rax),%esi
lea    -0x2c(%rbp),%rdx
call   1060 <ioctl@plt>
jmp    1565 <main+0x3e5>
mov    -0x18(%rbp),%edi
mov    0x2a46(%rip),%rax
mov    (%rax),%esi
lea    -0x2c(%rbp),%rdx
call   1060 <ioctl@plt>
mov    0x2a24(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0x28(%rbp),%eax
mov    0x2a0b(%rip),%rcx
and    (%rcx),%eax
mov    -0x24(%rbp),%ecx
mov    0x29ff(%rip),%rdx
and    (%rdx),%ecx
cmp    %ecx,%eax
je     15f1 <main+0x471>
mov    0x2a36(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%eax
mov    0x29df(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     15ce <main+0x44e>
mov    -0x18(%rbp),%edi
mov    0x29f2(%rip),%rax
mov    (%rax),%esi
lea    -0x2c(%rbp),%rdx
call   1060 <ioctl@plt>
jmp    15e3 <main+0x463>
mov    -0x18(%rbp),%edi
mov    0x29c8(%rip),%rax
mov    (%rax),%esi
lea    -0x2c(%rbp),%rdx
call   1060 <ioctl@plt>
mov    0x29a6(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x11(%rbp),%rsi
mov    $0x1,%edx
call   1070 <read@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    1667 <main+0x4e7>
cmpl   $0x0,-0x30(%rbp)
je     1636 <main+0x4b6>
movl   $0x0,-0x30(%rbp)
lea    0x9e7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%edi
lea    -0x11(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
movsbl -0x11(%rbp),%esi
lea    0x9ba(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2930(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
jmp    12af <main+0x12f>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
movl   $0x0,0x8(%rsp)
movl   $0x0,0xc(%rsp)
mov    0x2e30(%rip),%r15
mov    0x2e21(%rip),%r12
mov    (%r12),%esi
or     (%r15),%esi
mov    0x8(%r14),%rdi
mov    0x2dd7(%rip),%rbx
or     (%rbx),%esi
call   10b0 <open@plt>
mov    %eax,%ebp
mov    0x10(%r14),%rdi
mov    (%r12),%esi
or     (%r15),%esi
or     (%rbx),%esi
call   10b0 <open@plt>
mov    %eax,%r13d
mov    0x18(%r14),%rsi
mov    0x20(%r14),%rax
movsbl (%rax),%edx
movsbl 0x1(%rax),%ecx
movsbl 0x2(%rax),%r8d
mov    %ebp,%edi
call   10a0 <port_init@plt>
mov    0x18(%r14),%rsi
mov    0x20(%r14),%rax
movsbl (%rax),%edx
movsbl 0x1(%rax),%ecx
movsbl 0x2(%rax),%r8d
mov    %r13d,%edi
call   10a0 <port_init@plt>
mov    0x2d6b(%rip),%rbx
mov    (%rbx),%esi
mov    %ebp,%edi
call   1050 <tcflush@plt>
mov    (%rbx),%esi
mov    %r13d,%edi
call   1050 <tcflush@plt>
lea    0xdcb(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r15d
mov    0x2d67(%rip),%rbx
xor    %r14d,%r14d
movl   $0x0,0x14(%rsp)
mov    %ebp,0x10(%rsp)
jmp    12a0 <main+0x110>
mov    %ebp,%edi
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1040 <write@plt>
movsbl 0x7(%rsp),%esi
xor    %r15d,%r15d
lea    0xd7a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2cf8(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
nop
mov    %rbx,%r12
mov    (%rbx),%esi
mov    %ebp,%edi
lea    0x8(%rsp),%rdx
call   1070 <ioctl@plt>
mov    0x8(%rsp),%ebx
mov    0x2d1c(%rip),%rax
mov    (%rax),%ecx
mov    0x2cc3(%rip),%rax
mov    (%rax),%edx
or     %ecx,%edx
mov    %ebx,%eax
xor    %r14d,%eax
test   %eax,%edx
je     12e0 <main+0x150>
test   %r15d,%r15d
je     1320 <main+0x190>
test   %ecx,%eax
jne    1344 <main+0x1b4>
jmp    138a <main+0x1fa>
mov    %ebp,%edi
lea    0x7(%rsp),%rbp
mov    %rbp,%rsi
mov    $0x1,%edx
call   1080 <read@plt>
cmp    $0x1,%eax
jne    1435 <main+0x2a5>
test   %r15d,%r15d
mov    %r12,%rbx
jne    13fc <main+0x26c>
lea    0xcf0(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13fc <main+0x26c>
nopl   0x0(%rax)
lea    0xcd9(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%ebx
mov    0x2c9f(%rip),%rax
mov    (%rax),%ecx
mov    %ebx,%eax
xor    %r14d,%eax
test   %ecx,%eax
je     138a <main+0x1fa>
mov    0x2c7d(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2c58(%rip),%rax
test   %ebx,%ecx
jne    1363 <main+0x1d3>
mov    0x2c3d(%rip),%rax
mov    (%rax),%esi
mov    %r13d,%edi
lea    0xc(%rsp),%rdx
call   1070 <ioctl@plt>
mov    0x2c17(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    0x8(%rsp),%ebx
xor    %ebx,%r14d
mov    %r14d,%eax
mov    0x2bf7(%rip),%rcx
mov    (%rcx),%ecx
test   %ecx,%eax
je     13d7 <main+0x247>
mov    0x2c32(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2c05(%rip),%rax
test   %ebx,%ecx
jne    13b6 <main+0x226>
mov    0x2bea(%rip),%rax
mov    (%rax),%esi
mov    %r13d,%edi
lea    0xc(%rsp),%rdx
call   1070 <ioctl@plt>
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    0x8(%rsp),%ebx
mov    $0x1,%r15d
mov    %ebp,%edi
lea    0x7(%rsp),%rbp
mov    %rbp,%rsi
mov    $0x1,%edx
call   1080 <read@plt>
mov    %ebx,%r14d
cmp    $0x1,%eax
mov    %r12,%rbx
jne    1440 <main+0x2b0>
mov    $0x1,%r15d
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0x1,%edx
call   1040 <write@plt>
movsbl 0x7(%rsp),%esi
lea    0xbe6(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2b64(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
jmp    1440 <main+0x2b0>
mov    %r12,%rbx
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%esi
mov    %r13d,%edi
lea    0x8(%rsp),%rdx
call   1070 <ioctl@plt>
mov    0x8(%rsp),%r12d
mov    0x2b7d(%rip),%rax
mov    (%rax),%ecx
mov    0x2b24(%rip),%rax
mov    (%rax),%edx
or     %ecx,%edx
mov    %r12d,%eax
xor    0x14(%rsp),%eax
test   %eax,%edx
jne    14ac <main+0x31c>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0x1,%edx
call   1080 <read@plt>
cmp    $0x1,%eax
mov    0x10(%rsp),%ebp
jne    12a0 <main+0x110>
test   %r15d,%r15d
je     126a <main+0xda>
lea    0xb6e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    126a <main+0xda>
test   %r15d,%r15d
je     14d4 <main+0x344>
lea    0xb56(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x8(%rsp),%r12d
mov    0x2b0d(%rip),%rax
mov    (%rax),%ecx
mov    %r12d,%eax
xor    0x14(%rsp),%eax
test   %ecx,%eax
je     1522 <main+0x392>
mov    0x2ae9(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2ac4(%rip),%rax
test   %r12d,%ecx
jne    14f8 <main+0x368>
mov    0x2aa8(%rip),%rax
mov    (%rax),%esi
mov    0x10(%rsp),%edi
lea    0xc(%rsp),%rdx
call   1070 <ioctl@plt>
mov    0x2a81(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    0x8(%rsp),%r12d
mov    0x14(%rsp),%eax
xor    %r12d,%eax
mov    0x2a5f(%rip),%rcx
mov    (%rcx),%ecx
test   %ecx,%eax
je     1572 <main+0x3e2>
mov    0x2a9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    0x2a6d(%rip),%rax
test   %r12d,%ecx
jne    154f <main+0x3bf>
mov    0x2a51(%rip),%rax
mov    (%rax),%esi
mov    0x10(%rsp),%edi
lea    0xc(%rsp),%rdx
call   1070 <ioctl@plt>
mov    0x2a2a(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
mov    0x8(%rsp),%r12d
mov    %r13d,%edi
mov    %rbp,%rsi
mov    $0x1,%edx
call   1080 <read@plt>
xor    %r15d,%r15d
mov    %r12d,0x14(%rsp)
cmp    $0x1,%eax
mov    0x10(%rsp),%ebp
jne    12a0 <main+0x110>
jmp    126a <main+0xda>

LLVM IR (-O0):
@O_RDWR = global i32 0
@O_NONBLOCK = global i32 0
@O_NOCTTY = global i32 0
@TCIOFLUSH = global i32 0
@.str = [8 x i8] c"Master\0A\00"
@TIOCMGET = global i32 0
@TIOCM_DSR = global i32 0
@TIOCM_CD = global i32 0
@.str.1 = [4 x i8] c"\0AT \00"
@TIOCM_DTR = global i32 0
@TIOCMBIS = global i32 0
@TIOCMBIC = global i32 0
@stdout = global i32 0
@TIOCM_RTS = global i32 0
@.str.2 = [10 x i8] c"0x%02hhX \00"
@.str.3 = [4 x i8] c"\09R \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
store i32 1, i32* %13
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = load i32, i32* @O_RDWR
%18 = load i32, i32* @O_NONBLOCK
%19 = or i32 %17, %18
%20 = load i32, i32* @O_NOCTTY
%21 = or i32 %19, %20
%22 = call i32 @open(i8* %16, i32 %21)
store i32 %22, i32* %7
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 2
%25 = load i8*, i8** %24
%26 = load i32, i32* @O_RDWR
%27 = load i32, i32* @O_NONBLOCK
%28 = or i32 %26, %27
%29 = load i32, i32* @O_NOCTTY
%30 = or i32 %28, %29
%31 = call i32 @open(i8* %25, i32 %30)
store i32 %31, i32* %8
%32 = load i32, i32* %7
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 3
%35 = load i8*, i8** %34
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 4
%38 = load i8*, i8** %37
%39 = getelementptr inbounds i8, i8* %38, i64 0
%40 = load i8, i8* %39
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 4
%43 = load i8*, i8** %42
%44 = getelementptr inbounds i8, i8* %43, i64 1
%45 = load i8, i8* %44
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 4
%48 = load i8*, i8** %47
%49 = getelementptr inbounds i8, i8* %48, i64 2
%50 = load i8, i8* %49
%51 = call i32 @port_init(i32 %32, i8* %35, i8 signext %40, i8 signext %45, i8 signext %50)
%52 = load i32, i32* %8
%53 = load i8**, i8*** %5
%54 = getelementptr inbounds i8*, i8** %53, i64 3
%55 = load i8*, i8** %54
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 4
%58 = load i8*, i8** %57
%59 = getelementptr inbounds i8, i8* %58, i64 0
%60 = load i8, i8* %59
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 4
%63 = load i8*, i8** %62
%64 = getelementptr inbounds i8, i8* %63, i64 1
%65 = load i8, i8* %64
%66 = load i8**, i8*** %5
%67 = getelementptr inbounds i8*, i8** %66, i64 4
%68 = load i8*, i8** %67
%69 = getelementptr inbounds i8, i8* %68, i64 2
%70 = load i8, i8* %69
%71 = call i32 @port_init(i32 %52, i8* %55, i8 signext %60, i8 signext %65, i8 signext %70)
%72 = load i32, i32* %7
%73 = load i32, i32* @TCIOFLUSH
%74 = call i32 @tcflush(i32 %72, i32 %73)
%75 = load i32, i32* %8
%76 = load i32, i32* @TCIOFLUSH
%77 = call i32 @tcflush(i32 %75, i32 %76)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %79
79: ; preds = %2, %257
%80 = load i32, i32* %7
%81 = load i32, i32* @TIOCMGET
%82 = call i32 @ioctl(i32 %80, i32 %81, i32* %11)
%83 = load i32, i32* %11
%84 = load i32, i32* @TIOCM_DSR
%85 = load i32, i32* @TIOCM_CD
%86 = or i32 %84, %85
%87 = and i32 %83, %86
%88 = load i32, i32* %9
%89 = load i32, i32* @TIOCM_DSR
%90 = load i32, i32* @TIOCM_CD
%91 = or i32 %89, %90
%92 = and i32 %88, %91
%93 = icmp ne i32 %87, %92
br i1 %93, label %94, label %151
94: ; preds = %79
%95 = load i32, i32* %13
%96 = icmp ne i32 %95, 0
br i1 %96, label %99, label %97
97: ; preds = %94
store i32 1, i32* %13
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %99
99: ; preds = %97, %94
%100 = load i32, i32* %11
%101 = load i32, i32* @TIOCM_DSR
%102 = and i32 %100, %101
%103 = load i32, i32* %9
%104 = load i32, i32* @TIOCM_DSR
%105 = and i32 %103, %104
%106 = icmp ne i32 %102, %105
br i1 %106, label %107, label %124
107: ; preds = %99
%108 = load i32, i32* @TIOCM_DTR
store i32 %108, i32* %12
%109 = load i32, i32* %11
%110 = load i32, i32* @TIOCM_DSR
%111 = and i32 %109, %110
%112 = icmp ne i32 %111, 0
br i1 %112, label %113, label %117
113: ; preds = %107
%114 = load i32, i32* %8
%115 = load i32, i32* @TIOCMBIS
%116 = call i32 @ioctl(i32 %114, i32 %115, i32* %12)
br label %121
117: ; preds = %107
%118 = load i32, i32* %8
%119 = load i32, i32* @TIOCMBIC
%120 = call i32 @ioctl(i32 %118, i32 %119, i32* %12)
br label %121
121: ; preds = %117, %113
%122 = load i32, i32* @stdout
%123 = call i32 @fflush(i32 %122)
br label %124
124: ; preds = %121, %99
%125 = load i32, i32* %11
%126 = load i32, i32* @TIOCM_CD
%127 = and i32 %125, %126
%128 = load i32, i32* %9
%129 = load i32, i32* @TIOCM_CD
%130 = and i32 %128, %129
%131 = icmp ne i32 %127, %130
br i1 %131, label %132, label %149
132: ; preds = %124
%133 = load i32, i32* @TIOCM_RTS
store i32 %133, i32* %12
%134 = load i32, i32* %11
%135 = load i32, i32* @TIOCM_CD
%136 = and i32 %134, %135
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %142
138: ; preds = %132
%139 = load i32, i32* %8
%140 = load i32, i32* @TIOCMBIS
%141 = call i32 @ioctl(i32 %139, i32 %140, i32* %12)
br label %146
142: ; preds = %132
%143 = load i32, i32* %8
%144 = load i32, i32* @TIOCMBIC
%145 = call i32 @ioctl(i32 %143, i32 %144, i32* %12)
br label %146
146: ; preds = %142, %138
%147 = load i32, i32* @stdout
%148 = call i32 @fflush(i32 %147)
br label %149
149: ; preds = %146, %124
%150 = load i32, i32* %11
store i32 %150, i32* %9
br label %151
151: ; preds = %149, %79
%152 = load i32, i32* %7
%153 = call i32 @read(i32 %152, i8* %6, i32 1)
%154 = icmp eq i32 1, %153
br i1 %154, label %155, label %168
155: ; preds = %151
%156 = load i32, i32* %13
%157 = icmp ne i32 %156, 0
br i1 %157, label %160, label %158
158: ; preds = %155
store i32 1, i32* %13
%159 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %160
160: ; preds = %158, %155
%161 = load i32, i32* %8
%162 = call i32 @write(i32 %161, i8* %6, i32 1)
%163 = load i8, i8* %6
%164 = sext i8 %163 to i32
%165 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %164)
%166 = load i32, i32* @stdout
%167 = call i32 @fflush(i32 %166)
br label %168
168: ; preds = %160, %151
%169 = load i32, i32* %8
%170 = load i32, i32* @TIOCMGET
%171 = call i32 @ioctl(i32 %169, i32 %170, i32* %11)
%172 = load i32, i32* %11
%173 = load i32, i32* @TIOCM_DSR
%174 = load i32, i32* @TIOCM_CD
%175 = or i32 %173, %174
%176 = and i32 %172, %175
%177 = load i32, i32* %10
%178 = load i32, i32* @TIOCM_DSR
%179 = load i32, i32* @TIOCM_CD
%180 = or i32 %178, %179
%181 = and i32 %177, %180
%182 = icmp ne i32 %176, %181
br i1 %182, label %183, label %240
183: ; preds = %168
%184 = load i32, i32* %13
%185 = icmp ne i32 %184, 0
br i1 %185, label %186, label %188
186: ; preds = %183
store i32 0, i32* %13
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %188
188: ; preds = %186, %183
%189 = load i32, i32* %11
%190 = load i32, i32* @TIOCM_DSR
%191 = and i32 %189, %190
%192 = load i32, i32* %10
%193 = load i32, i32* @TIOCM_DSR
%194 = and i32 %192, %193
%195 = icmp ne i32 %191, %194
br i1 %195, label %196, label %213
196: ; preds = %188
%197 = load i32, i32* @TIOCM_DTR
store i32 %197, i32* %12
%198 = load i32, i32* %11
%199 = load i32, i32* @TIOCM_DSR
%200 = and i32 %198, %199
%201 = icmp ne i32 %200, 0
br i1 %201, label %202, label %206
202: ; preds = %196
%203 = load i32, i32* %7
%204 = load i32, i32* @TIOCMBIS
%205 = call i32 @ioctl(i32 %203, i32 %204, i32* %12)
br label %210
206: ; preds = %196
%207 = load i32, i32* %7
%208 = load i32, i32* @TIOCMBIC
%209 = call i32 @ioctl(i32 %207, i32 %208, i32* %12)
br label %210
210: ; preds = %206, %202
%211 = load i32, i32* @stdout
%212 = call i32 @fflush(i32 %211)
br label %213
213: ; preds = %210, %188
%214 = load i32, i32* %11
%215 = load i32, i32* @TIOCM_CD
%216 = and i32 %214, %215
%217 = load i32, i32* %10
%218 = load i32, i32* @TIOCM_CD
%219 = and i32 %217, %218
%220 = icmp ne i32 %216, %219
br i1 %220, label %221, label %238
221: ; preds = %213
%222 = load i32, i32* @TIOCM_RTS
store i32 %222, i32* %12
%223 = load i32, i32* %11
%224 = load i32, i32* @TIOCM_CD
%225 = and i32 %223, %224
%226 = icmp ne i32 %225, 0
br i1 %226, label %227, label %231
227: ; preds = %221
%228 = load i32, i32* %7
%229 = load i32, i32* @TIOCMBIS
%230 = call i32 @ioctl(i32 %228, i32 %229, i32* %12)
br label %235
231: ; preds = %221
%232 = load i32, i32* %7
%233 = load i32, i32* @TIOCMBIC
%234 = call i32 @ioctl(i32 %232, i32 %233, i32* %12)
br label %235
235: ; preds = %231, %227
%236 = load i32, i32* @stdout
%237 = call i32 @fflush(i32 %236)
br label %238
238: ; preds = %235, %213
%239 = load i32, i32* %11
store i32 %239, i32* %10
br label %240
240: ; preds = %238, %168
%241 = load i32, i32* %8
%242 = call i32 @read(i32 %241, i8* %6, i32 1)
%243 = icmp eq i32 1, %242
br i1 %243, label %244, label %257
244: ; preds = %240
%245 = load i32, i32* %13
%246 = icmp ne i32 %245, 0
br i1 %246, label %247, label %249
247: ; preds = %244
store i32 0, i32* %13
%248 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %249
249: ; preds = %247, %244
%250 = load i32, i32* %7
%251 = call i32 @write(i32 %250, i8* %6, i32 1)
%252 = load i8, i8* %6
%253 = sext i8 %252 to i32
%254 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %253)
%255 = load i32, i32* @stdout
%256 = call i32 @fflush(i32 %255)
br label %257
257: ; preds = %249, %240
br label %79
}

LLVM IR (-O2):
@O_RDWR = global i32 0
@O_NONBLOCK = global i32 0
@O_NOCTTY = global i32 0
@TCIOFLUSH = global i32 0
@TIOCMGET = global i32 0
@TIOCM_DSR = global i32 0
@TIOCM_CD = global i32 0
@.str.1 = [4 x i8] c"\0AT \00"
@TIOCM_DTR = global i32 0
@TIOCMBIS = global i32 0
@TIOCMBIC = global i32 0
@stdout = global i32 0
@TIOCM_RTS = global i32 0
@.str.2 = [10 x i8] c"0x%02hhX \00"
@.str.3 = [4 x i8] c"\09R \00"
@str = [7 x i8] c"Master\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%7 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = load i32, i32* @O_RDWR
%11 = load i32, i32* @O_NONBLOCK
%12 = or i32 %11, %10
%13 = load i32, i32* @O_NOCTTY
%14 = or i32 %12, %13
%15 = tail call i32 @open(i8* %9, i32 %14)
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = load i32, i32* @O_RDWR
%19 = load i32, i32* @O_NONBLOCK
%20 = or i32 %19, %18
%21 = load i32, i32* @O_NOCTTY
%22 = or i32 %20, %21
%23 = tail call i32 @open(i8* %17, i32 %22)
%24 = getelementptr inbounds i8*, i8** %1, i64 3
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8*, i8** %1, i64 4
%27 = load i8*, i8** %26
%28 = load i8, i8* %27
%29 = getelementptr inbounds i8, i8* %27, i64 1
%30 = load i8, i8* %29
%31 = getelementptr inbounds i8, i8* %27, i64 2
%32 = load i8, i8* %31
%33 = tail call i32 @port_init(i32 %15, i8* %25, i8 signext %28, i8 signext %30, i8 signext %32)
%34 = load i8*, i8** %24
%35 = load i8*, i8** %26
%36 = load i8, i8* %35
%37 = getelementptr inbounds i8, i8* %35, i64 1
%38 = load i8, i8* %37
%39 = getelementptr inbounds i8, i8* %35, i64 2
%40 = load i8, i8* %39
%41 = tail call i32 @port_init(i32 %23, i8* %34, i8 signext %36, i8 signext %38, i8 signext %40)
%42 = load i32, i32* @TCIOFLUSH
%43 = tail call i32 @tcflush(i32 %15, i32 %42)
%44 = load i32, i32* @TCIOFLUSH
%45 = tail call i32 @tcflush(i32 %23, i32 %44)
%46 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %47
47: ; preds = %185, %2
%48 = phi i32 [ 0, %2 ], [ %125, %185 ]
%49 = phi i32 [ 0, %2 ], [ %186, %185 ]
%50 = phi i32 [ 1, %2 ], [ 0, %185 ]
br label %51
51: ; preds = %47, %178
%52 = phi i32 [ %125, %178 ], [ %48, %47 ]
%53 = phi i32 [ %126, %178 ], [ %50, %47 ]
%54 = load i32, i32* @TIOCMGET
%55 = call i32 @ioctl(i32 %15, i32 %54, i32* %4)
%56 = load i32, i32* %4
%57 = load i32, i32* @TIOCM_DSR
%58 = load i32, i32* @TIOCM_CD
%59 = or i32 %58, %57
%60 = xor i32 %56, %52
%61 = and i32 %59, %60
%62 = icmp eq i32 %61, 0
br i1 %62, label %105, label %63
63: ; preds = %51
%64 = icmp eq i32 %53, 0
br i1 %64, label %65, label %70
65: ; preds = %63
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%67 = load i32, i32* %4
%68 = load i32, i32* @TIOCM_DSR
%69 = xor i32 %67, %52
br label %70
70: ; preds = %65, %63
%71 = phi i32 [ %69, %65 ], [ %60, %63 ]
%72 = phi i32 [ %68, %65 ], [ %57, %63 ]
%73 = phi i32 [ %67, %65 ], [ %56, %63 ]
%74 = and i32 %71, %72
%75 = icmp eq i32 %74, 0
br i1 %75, label %88, label %76
76: ; preds = %70
%77 = load i32, i32* @TIOCM_DTR
store i32 %77, i32* %5
%78 = and i32 %72, %73
%79 = icmp eq i32 %78, 0
%80 = load i32, i32* @TIOCMBIC
%81 = load i32, i32* @TIOCMBIS
%82 = select i1 %79, i32 %80, i32 %81
%83 = call i32 @ioctl(i32 %23, i32 %82, i32* %5)
%84 = load i32, i32* @stdout
%85 = call i32 @fflush(i32 %84)
%86 = load i32, i32* %4
%87 = xor i32 %86, %52
br label %88
88: ; preds = %76, %70
%89 = phi i32 [ %87, %76 ], [ %71, %70 ]
%90 = phi i32 [ %86, %76 ], [ %73, %70 ]
%91 = load i32, i32* @TIOCM_CD
%92 = and i32 %89, %91
%93 = icmp eq i32 %92, 0
br i1 %93, label %108, label %94
94: ; preds = %88
%95 = load i32, i32* @TIOCM_RTS
store i32 %95, i32* %5
%96 = and i32 %91, %90
%97 = icmp eq i32 %96, 0
%98 = load i32, i32* @TIOCMBIC
%99 = load i32, i32* @TIOCMBIS
%100 = select i1 %97, i32 %98, i32 %99
%101 = call i32 @ioctl(i32 %23, i32 %100, i32* %5)
%102 = load i32, i32* @stdout
%103 = call i32 @fflush(i32 %102)
%104 = load i32, i32* %4
br label %108
105: ; preds = %51
%106 = call i32 @read(i32 %15, i8* %3, i32 1)
%107 = icmp eq i32 %106, 1
br i1 %107, label %112, label %124
108: ; preds = %88, %94
%109 = phi i32 [ %90, %88 ], [ %104, %94 ]
%110 = call i32 @read(i32 %15, i8* %3, i32 1)
%111 = icmp eq i32 %110, 1
br i1 %111, label %116, label %124
112: ; preds = %105
%113 = icmp eq i32 %53, 0
br i1 %113, label %114, label %116
114: ; preds = %112
%115 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %116
116: ; preds = %108, %114, %112
%117 = phi i32 [ %52, %114 ], [ %52, %112 ], [ %109, %108 ]
%118 = call i32 @write(i32 %23, i8* %3, i32 1)
%119 = load i8, i8* %3
%120 = sext i8 %119 to i32
%121 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %120)
%122 = load i32, i32* @stdout
%123 = call i32 @fflush(i32 %122)
br label %124
124: ; preds = %108, %116, %105
%125 = phi i32 [ %117, %116 ], [ %52, %105 ], [ %109, %108 ]
%126 = phi i32 [ 1, %116 ], [ %53, %105 ], [ 1, %108 ]
%127 = load i32, i32* @TIOCMGET
%128 = call i32 @ioctl(i32 %23, i32 %127, i32* %4)
%129 = load i32, i32* %4
%130 = load i32, i32* @TIOCM_DSR
%131 = load i32, i32* @TIOCM_CD
%132 = or i32 %131, %130
%133 = xor i32 %129, %49
%134 = and i32 %132, %133
%135 = icmp eq i32 %134, 0
br i1 %135, label %178, label %136
136: ; preds = %124
%137 = icmp eq i32 %126, 0
br i1 %137, label %143, label %138
138: ; preds = %136
%139 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%140 = load i32, i32* %4
%141 = load i32, i32* @TIOCM_DSR
%142 = xor i32 %140, %49
br label %143
143: ; preds = %138, %136
%144 = phi i32 [ %142, %138 ], [ %133, %136 ]
%145 = phi i32 [ %141, %138 ], [ %130, %136 ]
%146 = phi i32 [ %140, %138 ], [ %129, %136 ]
%147 = and i32 %144, %145
%148 = icmp eq i32 %147, 0
br i1 %148, label %161, label %149
149: ; preds = %143
%150 = load i32, i32* @TIOCM_DTR
store i32 %150, i32* %5
%151 = and i32 %145, %146
%152 = icmp eq i32 %151, 0
%153 = load i32, i32* @TIOCMBIC
%154 = load i32, i32* @TIOCMBIS
%155 = select i1 %152, i32 %153, i32 %154
%156 = call i32 @ioctl(i32 %15, i32 %155, i32* %5)
%157 = load i32, i32* @stdout
%158 = call i32 @fflush(i32 %157)
%159 = load i32, i32* %4
%160 = xor i32 %159, %49
br label %161
161: ; preds = %149, %143
%162 = phi i32 [ %160, %149 ], [ %144, %143 ]
%163 = phi i32 [ %159, %149 ], [ %146, %143 ]
%164 = load i32, i32* @TIOCM_CD
%165 = and i32 %162, %164
%166 = icmp eq i32 %165, 0
br i1 %166, label %181, label %167
167: ; preds = %161
%168 = load i32, i32* @TIOCM_RTS
store i32 %168, i32* %5
%169 = and i32 %164, %163
%170 = icmp eq i32 %169, 0
%171 = load i32, i32* @TIOCMBIC
%172 = load i32, i32* @TIOCMBIS
%173 = select i1 %170, i32 %171, i32 %172
%174 = call i32 @ioctl(i32 %15, i32 %173, i32* %5)
%175 = load i32, i32* @stdout
%176 = call i32 @fflush(i32 %175)
%177 = load i32, i32* %4
br label %181
178: ; preds = %124
%179 = call i32 @read(i32 %23, i8* %3, i32 1)
%180 = icmp eq i32 %179, 1
br i1 %180, label %187, label %51
181: ; preds = %161, %167
%182 = phi i32 [ %163, %161 ], [ %177, %167 ]
%183 = call i32 @read(i32 %23, i8* %3, i32 1)
%184 = icmp eq i32 %183, 1
br i1 %184, label %191, label %185
185: ; preds = %181, %191
%186 = phi i32 [ %192, %191 ], [ %182, %181 ]
br label %47
187: ; preds = %178
%188 = icmp eq i32 %126, 0
br i1 %188, label %191, label %189
189: ; preds = %187
%190 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %191
191: ; preds = %181, %189, %187
%192 = phi i32 [ %49, %189 ], [ %49, %187 ], [ %182, %181 ]
%193 = call i32 @write(i32 %15, i8* %3, i32 1)
%194 = load i8, i8* %3
%195 = sext i8 %194 to i32
%196 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %195)
%197 = load i32, i32* @stdout
%198 = call i32 @fflush(i32 %197)
br label %185
}