#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 termios {
  int c_cflag;
  int *c_cc;
  int c_iflag;
  int /*<<< orphan*/ c_oflag;
};

/* Variables and functions */
int /*<<< orphan*/ B115200;
int CLOCAL;
int CREAD;
int CRTSCTS;
int CS8;
int CSIZE;
int CSTOPB;
int ECHO;
int ECHOE;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int ICANON;
int ISIG;
int IXANY;
int IXOFF;
int IXON;
int /*<<< orphan*/ OPOST;
int O_NOCTTY;
int O_RDWR;
int PARENB;
int /*<<< orphan*/ TCIFLUSH;
int /*<<< orphan*/ TCSANOW;
int TIOCM_CTS;
int TIOCM_RTS;
size_t VMIN;
size_t VTIME;
int /*<<< orphan*/ cfsetispeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ cfsetospeed(struct termios *, int /*<<< orphan*/);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ getCTS(int);
int /*<<< orphan*/ memset(char **, char, int);
int open(char *, int);
unsigned long printTime(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ tcflush(int, int /*<<< orphan*/);
int /*<<< orphan*/ tcgetattr(int, struct termios *);
int tcsetattr(int, int /*<<< orphan*/, struct termios *);
int /*<<< orphan*/ usleep(int);
int main(int argc, char *argv[]) {
  char ttydev1[] = "/dev/ttyUSB0";
  char ttydev2[] = "/dev/ttyUSB1";
  int fd1, fd2;
  int i;
  for (i = 0; i < argc; i++) {
    printf("Argument %d: %s\n", i, argv[i]);
  }
  switch (argc) {
  case 1:
    break;
  case 2:
    strcpy(ttydev1, argv[1]);
    strcpy(ttydev2, "");
    break;
  case 3:
    strcpy(ttydev1, argv[1]);
    strcpy(ttydev2, argv[2]);
    break;
  default:
    printf("invalid number of arguments. Exit.\n");
    return EXIT_FAILURE;
    break;
  }
  if (strlen(ttydev1) > 4) {
    printf("Using TTY device: %s\n", ttydev1);
  }
  fd1 = open(ttydev1, O_RDWR | O_NOCTTY);
  if (fd1 == 1) {
    fprintf(stderr, "Error in opening %s\n", ttydev1);
    return EXIT_FAILURE;
  } else {
    printf("%s opened successfully\n", ttydev1);
  }
  struct termios SerialPortSettings1;
  tcgetattr(fd1, &SerialPortSettings1);
  cfsetispeed(&SerialPortSettings1, B115200);
  cfsetospeed(&SerialPortSettings1, B115200);
  SerialPortSettings1.c_cflag &= ~PARENB;
  SerialPortSettings1.c_cflag &= ~CSTOPB;
  SerialPortSettings1.c_cflag &= ~CSIZE;
  SerialPortSettings1.c_cflag |= CS8;
  SerialPortSettings1.c_cflag &= ~CRTSCTS;
  SerialPortSettings1.c_cflag |= CREAD | CLOCAL;
  SerialPortSettings1.c_cc[VMIN] = 24;
  SerialPortSettings1.c_cc[VTIME] = 0;
  SerialPortSettings1.c_iflag &= ~(IXON | IXOFF | IXANY);
  SerialPortSettings1.c_iflag &= ~(ICANON | ECHO | ECHOE | ISIG);
  SerialPortSettings1.c_oflag &= ~OPOST;
  tcflush(fd1, TCIFLUSH);
  int result;
  if ((result = tcsetattr(fd1, TCSANOW, &SerialPortSettings1)) != 0) {
    fprintf(stderr, "ERROR %d in Setting attributes\n", result);
    return EXIT_FAILURE;
  } else {
    printf("  BaudRate = 115200 \n  StopBits = 1 \n  Parity   = none\n  "
           "FlowCtrl = none\n");
  }
  int RTS_flag, CTS_flag;
  RTS_flag = TIOCM_RTS;
  CTS_flag = TIOCM_CTS;
  unsigned int position = 0x000000;
  unsigned int speed = 0x0000;
  char parsed_pos[] = "000000";
  char parsed_spd[] = "0000\0";
  char response[256];
  memset(&response, '\0', sizeof response);
  unsigned long start, stop, diff;
  for (i = 0; i < 100; i++) {
    int spot = 0;
    char read_buf = '\0';
    int byte_read = 0;
    printTime(1);
    while (getCTS(fd1)) {
      usleep(1);
    }
    start = printTime(2);
    printTime(3);
    while (!getCTS(fd1)) {
      usleep(1);
    }
    stop = printTime(4);
    if (start > stop) {
      diff = 1000000 - start + stop;
    } else {
      diff = stop - start;
    }
    printf("Delay in microseconds: %lu, from start %lu until stop %lu\n", diff,
           start, stop);
  }
  close(fd1);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xdf0(%rip),%rax
mov    %rax,-0x1d(%rbp)
mov    0xdee(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xde9(%rip),%al
mov    %al,-0x11(%rbp)
mov    0xde0(%rip),%rax
mov    %rax,-0x2a(%rbp)
mov    0xdde(%rip),%eax
mov    %eax,-0x22(%rbp)
mov    0xdd9(%rip),%al
mov    %al,-0x1e(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1281 <main+0x91>
mov    -0x38(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x38(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    124a <main+0x5a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x1a8(%rbp)
sub    $0x1,%eax
je     12c0 <main+0xd0>
jmp    1298 <main+0xa8>
mov    -0x1a8(%rbp),%eax
sub    $0x2,%eax
je     12c5 <main+0xd5>
jmp    12ac <main+0xbc>
mov    -0x1a8(%rbp),%eax
sub    $0x3,%eax
je     12eb <main+0xfb>
jmp    1312 <main+0x122>
jmp    1331 <main+0x141>
lea    -0x1d(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x2a(%rbp),%rdi
lea    0xd6d(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1331 <main+0x141>
lea    -0x1d(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x2a(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
jmp    1331 <main+0x141>
lea    0xd12(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2c29(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    16f9 <main+0x509>
lea    -0x1d(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x4,%eax
jle    1355 <main+0x165>
lea    -0x1d(%rbp),%rsi
lea    0xd01(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x1d(%rbp),%rdi
mov    0x2c88(%rip),%rax
mov    (%rax),%esi
mov    0x2bf7(%rip),%rax
or     (%rax),%esi
call   10f0 <open@plt>
mov    %eax,-0x30(%rbp)
cmpl   $0x1,-0x30(%rbp)
jne    13a9 <main+0x1b9>
mov    0x2bd4(%rip),%rax
mov    (%rax),%edi
lea    -0x1d(%rbp),%rdx
lea    0xcd4(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2bb1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    16f9 <main+0x509>
lea    -0x1d(%rbp),%rsi
lea    0xcc6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x30(%rbp),%edi
lea    -0x50(%rbp),%rsi
call   10d0 <tcgetattr@plt>
mov    0x2b72(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdi
call   1100 <cfsetispeed@plt>
mov    0x2b60(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdi
call   1040 <cfsetospeed@plt>
mov    0x2bd6(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x50(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    0x2b0c(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x50(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    0x2b6a(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x50(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    0x2b68(%rip),%rax
mov    (%rax),%eax
or     -0x50(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    0x2ae1(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x50(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    0x2b4f(%rip),%rax
mov    (%rax),%eax
mov    0x2ab6(%rip),%rcx
or     (%rcx),%eax
or     -0x50(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x48(%rbp),%rax
mov    0x2b23(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x18,(%rax,%rcx,4)
mov    -0x48(%rbp),%rax
mov    0x2abe(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2b45(%rip),%rax
mov    (%rax),%eax
mov    0x2b4c(%rip),%rcx
or     (%rcx),%eax
mov    0x2ad3(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x40(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    0x2a79(%rip),%rax
mov    (%rax),%eax
mov    0x2af8(%rip),%rcx
or     (%rcx),%eax
mov    0x2ae7(%rip),%rcx
or     (%rcx),%eax
mov    0x2ad6(%rip),%rcx
or     (%rcx),%eax
xor    $0xffffffff,%eax
and    -0x40(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    0x2afc(%rip),%rax
mov    (%rax),%eax
xor    $0xffffffff,%eax
and    -0x3c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x30(%rbp),%edi
mov    0x2a77(%rip),%rax
mov    (%rax),%esi
call   1060 <tcflush@plt>
mov    -0x30(%rbp),%edi
mov    0x2abe(%rip),%rax
mov    (%rax),%esi
lea    -0x50(%rbp),%rdx
call   10e0 <tcsetattr@plt>
mov    %eax,-0x54(%rbp)
cmp    $0x0,%eax
je     1544 <main+0x354>
mov    0x2a38(%rip),%rax
mov    (%rax),%edi
mov    -0x54(%rbp),%edx
lea    0xb66(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    0x2a16(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    16f9 <main+0x509>
lea    0xb67(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2a5f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
mov    0x29cb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
movl   $0x0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
mov    0xb7e(%rip),%eax
mov    %eax,-0x6b(%rbp)
mov    0xb78(%rip),%ax
mov    %ax,-0x67(%rbp)
mov    0xb70(%rip),%al
mov    %al,-0x65(%rbp)
mov    0xba3(%rip),%eax
mov    %eax,-0x71(%rbp)
mov    0xb9d(%rip),%ax
mov    %ax,-0x6d(%rbp)
lea    -0x180(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1080 <memset@plt>
movl   $0x0,-0x38(%rbp)
cmpl   $0x64,-0x38(%rbp)
jge    16e5 <main+0x4f5>
movl   $0x0,-0x19c(%rbp)
movb   $0x0,-0x19d(%rbp)
movl   $0x0,-0x1a4(%rbp)
mov    $0x1,%edi
call   10c0 <printTime@plt>
mov    -0x30(%rbp),%edi
call   10b0 <getCTS@plt>
cmp    $0x0,%rax
je     1613 <main+0x423>
mov    $0x1,%edi
call   1110 <usleep@plt>
jmp    15f2 <main+0x402>
mov    $0x2,%edi
call   10c0 <printTime@plt>
mov    %rax,-0x188(%rbp)
mov    $0x3,%edi
call   10c0 <printTime@plt>
mov    -0x30(%rbp),%edi
call   10b0 <getCTS@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    164c <main+0x45c>
jmp    165b <main+0x46b>
mov    $0x1,%edi
call   1110 <usleep@plt>
jmp    162e <main+0x43e>
mov    $0x4,%edi
call   10c0 <printTime@plt>
mov    %rax,-0x190(%rbp)
mov    -0x188(%rbp),%rax
cmp    -0x190(%rbp),%rax
jbe    169f <main+0x4af>
mov    $0xf4240,%eax
sub    -0x188(%rbp),%rax
add    -0x190(%rbp),%rax
mov    %rax,-0x198(%rbp)
jmp    16b4 <main+0x4c4>
mov    -0x190(%rbp),%rax
sub    -0x188(%rbp),%rax
mov    %rax,-0x198(%rbp)
mov    -0x198(%rbp),%rsi
mov    -0x188(%rbp),%rdx
mov    -0x190(%rbp),%rcx
lea    0xa33(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    15c3 <main+0x3d3>
mov    -0x30(%rbp),%edi
call   1090 <close@plt>
mov    0x2854(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x140,%rsp
mov    %rsi,%r12
mov    %edi,%r14d
movabs $0x30425355797474,%rax
mov    %rax,0xd(%rsp)
movabs $0x7974742f7665642f,%rax
74 74 79
mov    %rax,0x8(%rsp)
movabs $0x31425355797474,%rcx
mov    %rcx,0x35(%rsp)
mov    %rax,0x30(%rsp)
test   %edi,%edi
jle    1279 <main+0x79>
mov    %r14d,%ebx
lea    0xdc5(%rip),%r15
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%r12,%rbp,8),%rdx
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1080 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1260 <main+0x60>
cmp    $0x1,%r14d
je     12c5 <main+0xc5>
cmp    $0x3,%r14d
je     12a7 <main+0xa7>
cmp    $0x2,%r14d
jne    1487 <main+0x287>
mov    0x8(%r12),%rsi
lea    0x8(%rsp),%rdi
call   1030 <strcpy@plt>
lea    0xd85(%rip),%rsi
jmp    12bb <main+0xbb>
mov    0x8(%r12),%rsi
lea    0x8(%rsp),%rdi
call   1030 <strcpy@plt>
mov    0x10(%r12),%rsi
lea    0x30(%rsp),%rdi
call   1030 <strcpy@plt>
lea    0x8(%rsp),%rdi
call   1060 <strlen@plt>
cmp    $0x5,%eax
jl     12e7 <main+0xe7>
lea    0xd50(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x2cfa(%rip),%rax
mov    0x2c73(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    0x8(%rsp),%rdi
call   1100 <open@plt>
cmp    $0x1,%eax
jne    1330 <main+0x130>
mov    0x2c51(%rip),%rax
mov    (%rax),%edi
lea    0xd29(%rip),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x2c2d(%rip),%rax
jmp    158a <main+0x38a>
mov    %eax,%ebx
lea    0xd1d(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x18(%rsp),%r14
mov    %ebx,%edi
mov    %r14,%rsi
call   10e0 <tcgetattr@plt>
mov    0x2bed(%rip),%rbp
mov    0x0(%rbp),%esi
mov    %r14,%rdi
call   1110 <cfsetispeed@plt>
mov    0x0(%rbp),%esi
mov    %r14,%rdi
call   1050 <cfsetospeed@plt>
mov    0x2c50(%rip),%rax
mov    (%rax),%eax
mov    0x2b9f(%rip),%rcx
or     (%rcx),%eax
mov    0x2bfe(%rip),%rcx
or     (%rcx),%eax
not    %eax
and    0x18(%rsp),%eax
mov    0x2bff(%rip),%rcx
or     (%rcx),%eax
mov    0x2b86(%rip),%rcx
mov    (%rcx),%ecx
not    %ecx
and    %eax,%ecx
mov    0x2bf1(%rip),%rax
or     (%rax),%ecx
mov    0x2b60(%rip),%rax
or     (%rax),%ecx
mov    %ecx,0x18(%rsp)
mov    0x20(%rsp),%rax
mov    0x2bc6(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x18,(%rax,%rcx,4)
mov    0x2b65(%rip),%rcx
mov    (%rcx),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    0x2be4(%rip),%rax
mov    0x2bed(%rip),%rcx
mov    (%rcx),%ecx
or     (%rax),%ecx
mov    0x2b7a(%rip),%rax
or     (%rax),%ecx
mov    0x2b31(%rip),%rax
mov    0x2baa(%rip),%rdx
mov    (%rdx),%edx
or     (%rax),%edx
mov    0x2b97(%rip),%rax
or     (%rax),%edx
mov    0x2b86(%rip),%rax
or     (%rax),%edx
or     %ecx,%edx
not    %edx
and    %edx,0x28(%rsp)
mov    0x2ba5(%rip),%rax
mov    (%rax),%eax
not    %eax
and    %eax,0x2c(%rsp)
mov    0x2b2e(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1070 <tcflush@plt>
mov    0x2b6e(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
mov    %r14,%rdx
call   10f0 <tcsetattr@plt>
test   %eax,%eax
je     149f <main+0x29f>
mov    0x2af7(%rip),%rcx
mov    (%rcx),%edi
lea    0xbfc(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x2ad6(%rip),%rax
jmp    158a <main+0x38a>
lea    0xc84(%rip),%rdi
call   1040 <puts@plt>
mov    0x2abe(%rip),%rax
jmp    158a <main+0x38a>
lea    0xc23(%rip),%rdi
call   1040 <puts@plt>
lea    0x40(%rsp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   1090 <memset@plt>
lea    0xbcb(%rip),%r14
xor    %ebp,%ebp
jmp    1509 <main+0x309>
nopw   0x0(%rax,%rax,1)
mov    $0x4,%edi
call   10d0 <printTime@plt>
mov    %rax,%rcx
sub    %r15,%rcx
add    $0xf4240,%rcx
mov    %rax,%rsi
sub    %r15,%rsi
cmovb  %rcx,%rsi
mov    %r14,%rdi
mov    %r15,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1080 <printf@plt>
add    $0x1,%ebp
cmp    $0x64,%ebp
je     157c <main+0x37c>
mov    $0x1,%edi
call   10d0 <printTime@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   10c0 <getCTS@plt>
test   %rax,%rax
je     1540 <main+0x340>
mov    $0x1,%edi
call   1120 <usleep@plt>
jmp    1520 <main+0x320>
nopl   0x0(%rax,%rax,1)
mov    $0x2,%edi
call   10d0 <printTime@plt>
mov    %rax,%r15
mov    $0x3,%edi
call   10d0 <printTime@plt>
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   10c0 <getCTS@plt>
test   %rax,%rax
jne    14d0 <main+0x2d0>
mov    $0x1,%edi
call   1120 <usleep@plt>
jmp    1560 <main+0x360>
mov    %ebx,%edi
call   10a0 <close@plt>
mov    0x29c6(%rip),%rax
mov    (%rax),%eax
add    $0x140,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.termios = type { i32, i32*, i32, i32 }
@__const.main.ttydev1 = [13 x i8] c"/dev/ttyUSB0\00"
@__const.main.ttydev2 = [13 x i8] c"/dev/ttyUSB1\00"
@.str = [17 x i8] c"Argument %d: %s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [36 x i8] c"invalid number of arguments. Exit.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [22 x i8] c"Using TTY device: %s\0A\00"
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@stderr = global i32 0
@.str.4 = [21 x i8] c"Error in opening %s\0A\00"
@.str.5 = [24 x i8] c"%s opened successfully\0A\00"
@B115200 = global i32 0
@PARENB = global i32 0
@CSTOPB = global i32 0
@CSIZE = global i32 0
@CS8 = global i32 0
@CRTSCTS = global i32 0
@CREAD = global i32 0
@CLOCAL = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@IXON = global i32 0
@IXOFF = global i32 0
@IXANY = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@ECHOE = global i32 0
@ISIG = global i32 0
@OPOST = global i32 0
@TCIFLUSH = global i32 0
@TCSANOW = global i32 0
@.str.6 = [32 x i8] c"ERROR %d in Setting attributes\0A\00"
@.str.7 = [74 x i8] c" BaudRate = 115200 \0A StopBits = 1 \0A Parity = none\0A FlowCtrl = none\0A\00"
@TIOCM_RTS = global i32 0
@TIOCM_CTS = global i32 0
@__const.main.parsed_pos = [7 x i8] c"000000\00"
@__const.main.parsed_spd = [6 x i8] c"0000\00\00"
@.str.8 = [59 x i8] c"Delay in microseconds: %lu, from start %lu until stop %lu\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [13 x i8]
%7 = alloca [13 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.termios
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [7 x i8]
%18 = alloca [6 x i8]
%19 = alloca [256 x i8]
%20 = alloca i64
%21 = alloca i64
%22 = alloca i64
%23 = alloca i32
%24 = alloca i8
%25 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%26 = bitcast [13 x i8]* %6 to i8*
%27 = bitcast [13 x i8]* %7 to i8*
store i32 0, i32* %10
br label %28
28: ; preds = %40, %2
%29 = load i32, i32* %10
%30 = load i32, i32* %4
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %43
32: ; preds = %28
%33 = load i32, i32* %10
%34 = load i8**, i8*** %5
%35 = load i32, i32* %10
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %33, i8* %38)
br label %40
40: ; preds = %32
%41 = load i32, i32* %10
%42 = add nsw i32 %41, 1
store i32 %42, i32* %10
br label %28
43: ; preds = %28
%44 = load i32, i32* %4
switch i32 %44, label %65 [
i32 1, label %45
i32 2, label %46
i32 3, label %54
]
45: ; preds = %43
br label %68
46: ; preds = %43
%47 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%48 = load i8**, i8*** %5
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i32 @strcpy(i8* %47, i8* %50)
%52 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 0
%53 = call i32 @strcpy(i8* %52, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
br label %68
54: ; preds = %43
%55 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%56 = load i8**, i8*** %5
%57 = getelementptr inbounds i8*, i8** %56, i64 1
%58 = load i8*, i8** %57
%59 = call i32 @strcpy(i8* %55, i8* %58)
%60 = getelementptr inbounds [13 x i8], [13 x i8]* %7, i64 0, i64 0
%61 = load i8**, i8*** %5
%62 = getelementptr inbounds i8*, i8** %61, i64 2
%63 = load i8*, i8** %62
%64 = call i32 @strcpy(i8* %60, i8* %63)
br label %68
65: ; preds = %43
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%67 = load i32, i32* @EXIT_FAILURE
store i32 %67, i32* %3
br label %229
68: ; preds = %54, %46, %45
%69 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%70 = call i32 @strlen(i8* %69)
%71 = icmp sgt i32 %70, 4
br i1 %71, label %72, label %75
72: ; preds = %68
%73 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %73)
br label %75
75: ; preds = %72, %68
%76 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%77 = load i32, i32* @O_RDWR
%78 = load i32, i32* @O_NOCTTY
%79 = or i32 %77, %78
%80 = call i32 @open(i8* %76, i32 %79)
store i32 %80, i32* %8
%81 = load i32, i32* %8
%82 = icmp eq i32 %81, 1
br i1 %82, label %83, label %88
83: ; preds = %75
%84 = load i32, i32* @stderr
%85 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%86 = call i32 (i32, i8*, ...) @fprintf(i32 %84, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %85)
%87 = load i32, i32* @EXIT_FAILURE
store i32 %87, i32* %3
br label %229
88: ; preds = %75
%89 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %89)
br label %91
91: ; preds = %88
%92 = load i32, i32* %8
%93 = call i32 @tcgetattr(i32 %92, %struct.termios* %11)
%94 = load i32, i32* @B115200
%95 = call i32 @cfsetispeed(%struct.termios* %11, i32 %94)
%96 = load i32, i32* @B115200
%97 = call i32 @cfsetospeed(%struct.termios* %11, i32 %96)
%98 = load i32, i32* @PARENB
%99 = xor i32 %98, -1
%100 = getelementptr inbounds %struct.termios, %struct.termios* %11, i32 0, i32 0
%101 = load i32, i32* %100
%102 = and i32 %101, %99
store i32 %102, i32* %100
%103 = load i32, i32* @CSTOPB
%104 = xor i32 %103, -1
%105 = getelementptr inbounds %struct.termios, %struct.termios* %11, i32 0, i32 0
%106 = load i32, i32* %105
%107 = and i32 %106, %104
store i32 %107, i32* %105
%108 = load i32, i32* @CSIZE
%109 = xor i32 %108, -1
%110 = getelementptr inbounds %struct.termios, %struct.termios* %11, i32 0, i32 0
%111 = load i32, i32* %110
%112 = and i32 %111, %109
store i32 %112, i32* %110
%113 = load i32, i32* @CS8
%114 = getelementptr inbounds %struct.termios, %struct.termios* %11, i32 0, i32 0
%115 = load i32, i32* %114
%116 = or i32 %115, %113
store i32 %116, i32* %114
%117 = load i32, i32* @CRTSCTS
%118 = xor i32 %117, -1
%119 = getelementptr inbounds %struct.termios, %struct.termios* %11, i32 0, i32 0
%120 = load i32, i32* %119
%121 = and i32 %120, %118
store i32 %121, i32* %119
%122 = load i32, i32* @CREAD
%123 = load i32, i32* @CLOCAL
%124 = or i32 %122, %123
%125 = getelementptr inbounds %struct.termios, %struct.termios* %11, i32 0, i32 0
%126 = load i32, i32* %125
%127 = or i32 %126, %124
store i32 %127, i32* %125
%128 = getelementptr inbounds %struct.termios, %struct.termios* %11, i32 0, i32 1
%129 = load i32*, i32** %128
%130 = load i64, i64* @VMIN
%131 = getelementptr inbounds i32, i32* %129, i64 %130
store i32 24, i32* %131
%132 = getelementptr inbounds %struct.termios, %struct.termios* %11, i32 0, i32 1
%133 = load i32*, i32** %132
%134 = load i64, i64* @VTIME
%135 = getelementptr inbounds i32, i32* %133, i64 %134
store i32 0, i32* %135
%136 = load i32, i32* @IXON
%137 = load i32, i32* @IXOFF
%138 = or i32 %136, %137
%139 = load i32, i32* @IXANY
%140 = or i32 %138, %139
%141 = xor i32 %140, -1
%142 = getelementptr inbounds %struct.termios, %struct.termios* %11, i32 0, i32 2
%143 = load i32, i32* %142
%144 = and i32 %143, %141
store i32 %144, i32* %142
%145 = load i32, i32* @ICANON
%146 = load i32, i32* @ECHO
%147 = or i32 %145, %146
%148 = load i32, i32* @ECHOE
%149 = or i32 %147, %148
%150 = load i32, i32* @ISIG
%151 = or i32 %149, %150
%152 = xor i32 %151, -1
%153 = getelementptr inbounds %struct.termios, %struct.termios* %11, i32 0, i32 2
%154 = load i32, i32* %153
%155 = and i32 %154, %152
store i32 %155, i32* %153
%156 = load i32, i32* @OPOST
%157 = xor i32 %156, -1
%158 = getelementptr inbounds %struct.termios, %struct.termios* %11, i32 0, i32 3
%159 = load i32, i32* %158
%160 = and i32 %159, %157
store i32 %160, i32* %158
%161 = load i32, i32* %8
%162 = load i32, i32* @TCIFLUSH
%163 = call i32 @tcflush(i32 %161, i32 %162)
%164 = load i32, i32* %8
%165 = load i32, i32* @TCSANOW
%166 = call i32 @tcsetattr(i32 %164, i32 %165, %struct.termios* %11)
store i32 %166, i32* %12
%167 = icmp ne i32 %166, 0
br i1 %167, label %168, label %173
168: ; preds = %91
%169 = load i32, i32* @stderr
%170 = load i32, i32* %12
%171 = call i32 (i32, i8*, ...) @fprintf(i32 %169, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i32 %170)
%172 = load i32, i32* @EXIT_FAILURE
store i32 %172, i32* %3
br label %229
173: ; preds = %91
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.7, i64 0, i64 0))
br label %175
175: ; preds = %173
%176 = load i32, i32* @TIOCM_RTS
store i32 %176, i32* %13
%177 = load i32, i32* @TIOCM_CTS
store i32 %177, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
%178 = bitcast [7 x i8]* %17 to i8*
%179 = bitcast [6 x i8]* %18 to i8*
%180 = bitcast [256 x i8]* %19 to i8**
%181 = call i32 @memset(i8** %180, i8 signext 0, i32 256)
store i32 0, i32* %10
br label %182
182: ; preds = %222, %175
%183 = load i32, i32* %10
%184 = icmp slt i32 %183, 100
br i1 %184, label %185, label %225
185: ; preds = %182
store i32 0, i32* %23
store i8 0, i8* %24
store i32 0, i32* %25
%186 = call i64 @printTime(i32 1)
br label %187
187: ; preds = %191, %185
%188 = load i32, i32* %8
%189 = call i64 @getCTS(i32 %188)
%190 = icmp ne i64 %189, 0
br i1 %190, label %191, label %193
191: ; preds = %187
%192 = call i32 @usleep(i32 1)
br label %187
193: ; preds = %187
%194 = call i64 @printTime(i32 2)
store i64 %194, i64* %20
%195 = call i64 @printTime(i32 3)
br label %196
196: ; preds = %201, %193
%197 = load i32, i32* %8
%198 = call i64 @getCTS(i32 %197)
%199 = icmp ne i64 %198, 0
%200 = xor i1 %199, true
br i1 %200, label %201, label %203
201: ; preds = %196
%202 = call i32 @usleep(i32 1)
br label %196
203: ; preds = %196
%204 = call i64 @printTime(i32 4)
store i64 %204, i64* %21
%205 = load i64, i64* %20
%206 = load i64, i64* %21
%207 = icmp ugt i64 %205, %206
br i1 %207, label %208, label %213
208: ; preds = %203
%209 = load i64, i64* %20
%210 = sub i64 1000000, %209
%211 = load i64, i64* %21
%212 = add i64 %210, %211
store i64 %212, i64* %22
br label %217
213: ; preds = %203
%214 = load i64, i64* %21
%215 = load i64, i64* %20
%216 = sub i64 %214, %215
store i64 %216, i64* %22
br label %217
217: ; preds = %213, %208
%218 = load i64, i64* %22
%219 = load i64, i64* %20
%220 = load i64, i64* %21
%221 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.8, i64 0, i64 0), i64 %218, i64 %219, i64 %220)
br label %222
222: ; preds = %217
%223 = load i32, i32* %10
%224 = add nsw i32 %223, 1
store i32 %224, i32* %10
br label %182
225: ; preds = %182
%226 = load i32, i32* %8
%227 = call i32 @close(i32 %226)
%228 = load i32, i32* @EXIT_SUCCESS
store i32 %228, i32* %3
br label %229
229: ; preds = %225, %168, %83, %65
%230 = load i32, i32* %3
ret i32 %230
}

LLVM IR (-O2):
%struct.termios = type { i32, i32*, i32, i32 }
@__const.main.ttydev1 = [13 x i8] c"/dev/ttyUSB0\00"
@__const.main.ttydev2 = [13 x i8] c"/dev/ttyUSB1\00"
@.str = [17 x i8] c"Argument %d: %s\0A\00"
@.str.1 = [1 x i8] zeroinitializer
@EXIT_FAILURE = global i32 0
@.str.3 = [22 x i8] c"Using TTY device: %s\0A\00"
@O_RDWR = global i32 0
@O_NOCTTY = global i32 0
@stderr = global i32 0
@.str.4 = [21 x i8] c"Error in opening %s\0A\00"
@.str.5 = [24 x i8] c"%s opened successfully\0A\00"
@B115200 = global i32 0
@PARENB = global i32 0
@CSTOPB = global i32 0
@CSIZE = global i32 0
@CS8 = global i32 0
@CRTSCTS = global i32 0
@CREAD = global i32 0
@CLOCAL = global i32 0
@VMIN = global i64 0
@VTIME = global i64 0
@IXON = global i32 0
@IXOFF = global i32 0
@IXANY = global i32 0
@ICANON = global i32 0
@ECHO = global i32 0
@ECHOE = global i32 0
@ISIG = global i32 0
@OPOST = global i32 0
@TCIFLUSH = global i32 0
@TCSANOW = global i32 0
@.str.6 = [32 x i8] c"ERROR %d in Setting attributes\0A\00"
@TIOCM_RTS = global i32 0
@TIOCM_CTS = global i32 0
@.str.8 = [59 x i8] c"Delay in microseconds: %lu, from start %lu until stop %lu\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [73 x i8] c" BaudRate = 115200 \0A StopBits = 1 \0A Parity = none\0A FlowCtrl = none\00"
@str.9 = [35 x i8] c"invalid number of arguments. Exit.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [13 x i8]
%4 = alloca [13 x i8]
%5 = alloca %struct.termios
%6 = alloca [256 x i8]
%7 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 0
%9 = icmp sgt i32 %0, 0
br i1 %9, label %10, label %20
10: ; preds = %2
%11 = zext i32 %0 to i64
br label %12
12: ; preds = %10, %12
%13 = phi i64 [ 0, %10 ], [ %18, %12 ]
%14 = getelementptr inbounds i8*, i8** %1, i64 %13
%15 = load i8*, i8** %14
%16 = trunc i64 %13 to i32
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %16, i8* %15)
%18 = add nuw nsw i64 %13, 1
%19 = icmp eq i64 %18, %11
br i1 %19, label %20, label %12
20: ; preds = %12, %2
switch i32 %0, label %31 [
i32 1, label %37
i32 2, label %21
i32 3, label %25
]
21: ; preds = %20
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @strcpy(i8* %7, i8* %23)
br label %34
25: ; preds = %20
%26 = getelementptr inbounds i8*, i8** %1, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @strcpy(i8* %7, i8* %27)
%29 = getelementptr inbounds i8*, i8** %1, i64 2
%30 = load i8*, i8** %29
br label %34
31: ; preds = %20
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.9, i64 0, i64 0))
%33 = load i32, i32* @EXIT_FAILURE
br label %152
34: ; preds = %21, %25
%35 = phi i8* [ %30, %25 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %21 ]
%36 = call i32 @strcpy(i8* %8, i8* %35)
br label %37
37: ; preds = %34, %20
%38 = call i32 @strlen(i8* %7)
%39 = icmp sgt i32 %38, 4
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8* %7)
br label %42
42: ; preds = %40, %37
%43 = load i32, i32* @O_RDWR
%44 = load i32, i32* @O_NOCTTY
%45 = or i32 %44, %43
%46 = call i32 @open(i8* %7, i32 %45)
%47 = icmp eq i32 %46, 1
br i1 %47, label %48, label %52
48: ; preds = %42
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%51 = load i32, i32* @EXIT_FAILURE
br label %152
52: ; preds = %42
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), i8* %7)
%54 = bitcast %struct.termios* %5 to i8*
%55 = call i32 @tcgetattr(i32 %46, %struct.termios* %5)
%56 = load i32, i32* @B115200
%57 = call i32 @cfsetispeed(%struct.termios* %5, i32 %56)
%58 = load i32, i32* @B115200
%59 = call i32 @cfsetospeed(%struct.termios* %5, i32 %58)
%60 = load i32, i32* @PARENB
%61 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 0
%62 = load i32, i32* %61
%63 = load i32, i32* @CSTOPB
%64 = or i32 %60, %63
%65 = load i32, i32* @CSIZE
%66 = or i32 %64, %65
%67 = xor i32 %66, -1
%68 = and i32 %62, %67
%69 = load i32, i32* @CS8
%70 = or i32 %69, %68
%71 = load i32, i32* @CRTSCTS
%72 = xor i32 %71, -1
%73 = and i32 %70, %72
%74 = load i32, i32* @CREAD
%75 = load i32, i32* @CLOCAL
%76 = or i32 %74, %73
%77 = or i32 %76, %75
store i32 %77, i32* %61
%78 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 1
%79 = load i32*, i32** %78
%80 = load i64, i64* @VMIN
%81 = getelementptr inbounds i32, i32* %79, i64 %80
store i32 24, i32* %81
%82 = load i64, i64* @VTIME
%83 = getelementptr inbounds i32, i32* %79, i64 %82
store i32 0, i32* %83
%84 = load i32, i32* @IXON
%85 = load i32, i32* @IXOFF
%86 = or i32 %85, %84
%87 = load i32, i32* @IXANY
%88 = or i32 %86, %87
%89 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 2
%90 = load i32, i32* %89
%91 = load i32, i32* @ICANON
%92 = load i32, i32* @ECHO
%93 = or i32 %92, %91
%94 = load i32, i32* @ECHOE
%95 = or i32 %93, %94
%96 = load i32, i32* @ISIG
%97 = or i32 %95, %96
%98 = or i32 %88, %97
%99 = xor i32 %98, -1
%100 = and i32 %90, %99
store i32 %100, i32* %89
%101 = load i32, i32* @OPOST
%102 = xor i32 %101, -1
%103 = getelementptr inbounds %struct.termios, %struct.termios* %5, i64 0, i32 3
%104 = load i32, i32* %103
%105 = and i32 %104, %102
store i32 %105, i32* %103
%106 = load i32, i32* @TCIFLUSH
%107 = call i32 @tcflush(i32 %46, i32 %106)
%108 = load i32, i32* @TCSANOW
%109 = call i32 @tcsetattr(i32 %46, i32 %108, %struct.termios* %5)
%110 = icmp eq i32 %109, 0
br i1 %110, label %115, label %111
111: ; preds = %52
%112 = load i32, i32* @stderr
%113 = call i32 (i32, i8*, ...) @fprintf(i32 %112, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i32 %109)
%114 = load i32, i32* @EXIT_FAILURE
br label %150
115: ; preds = %52
%116 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str, i64 0, i64 0))
%117 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%118 = bitcast [256 x i8]* %6 to i8**
%119 = call i32 @memset(i8** %118, i8 signext 0, i32 256)
br label %120
120: ; preds = %115, %138
%121 = phi i32 [ 0, %115 ], [ %145, %138 ]
%122 = call i64 @printTime(i32 1)
%123 = call i64 @getCTS(i32 %46)
%124 = icmp eq i64 %123, 0
br i1 %124, label %129, label %125
125: ; preds = %120, %125
%126 = call i32 @usleep(i32 1)
%127 = call i64 @getCTS(i32 %46)
%128 = icmp eq i64 %127, 0
br i1 %128, label %129, label %125
129: ; preds = %125, %120
%130 = call i64 @printTime(i32 2)
%131 = call i64 @printTime(i32 3)
%132 = call i64 @getCTS(i32 %46)
%133 = icmp eq i64 %132, 0
br i1 %133, label %134, label %138
134: ; preds = %129, %134
%135 = call i32 @usleep(i32 1)
%136 = call i64 @getCTS(i32 %46)
%137 = icmp eq i64 %136, 0
br i1 %137, label %134, label %138
138: ; preds = %134, %129
%139 = call i64 @printTime(i32 4)
%140 = icmp ult i64 %139, %130
%141 = select i1 %140, i64 1000000, i64 0
%142 = sub i64 %139, %130
%143 = add i64 %142, %141
%144 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.8, i64 0, i64 0), i64 %143, i64 %130, i64 %139)
%145 = add nuw nsw i32 %121, 1
%146 = icmp eq i32 %145, 100
br i1 %146, label %147, label %120
147: ; preds = %138
%148 = call i32 @close(i32 %46)
%149 = load i32, i32* @EXIT_SUCCESS
br label %150
150: ; preds = %147, %111
%151 = phi i32 [ %114, %111 ], [ %149, %147 ]
br label %152
152: ; preds = %150, %48, %31
%153 = phi i32 [ %33, %31 ], [ %51, %48 ], [ %151, %150 ]
ret i32 %153
}