#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 strlen(char *);
int /*<<< orphan*/ strncmp(char const *, char *, int);
char tolower(char const);
extern void Unix_IsValidParallelDevice(const char *portstring, char **sername,
                                       char **parname) {
  int i = 0;
  *sername = NULL;
  *parname = NULL;
  if (portstring == NULL)
    return;
  do {
    switch (portstring[i]) {
    case ',':
      i++;
      break;
    default:
    case 0:
      return;
    case 's':
    case 'S':
    case 'p':
    case 'P':
    case 'h':
    case 'H': {
      char ch = tolower(portstring[i]);
      int j, continue_from, len;
      if (portstring[++i] == 0 || portstring[i] == ',') {
        if (ch == 's')
          *sername = "/dev/ttyS0";
        else if (ch == 'p')
          *parname = "/dev/par0";
        break;
      }
      if (portstring[i] != '=')
        return;
      for (j = ++i; portstring[j] != 0 && portstring[j] != ','; j++)
        ;
      if (portstring[j] == '0')
        continue_from = -1;
      else
        continue_from = j;
      len = (j - i);
      switch (ch) {
      case 's': {
        if (len == 1) {
          if (portstring[i] == '1')
            *sername = "/dev/ttyS0";
          else if (portstring[i] == '2')
            *sername = "/dev/ttyS1";
        } else if (len == strlen("/dev/ttyS0")) {
          if (strncmp(portstring + i, "/dev/ttyS0", strlen("/dev/ttyS0")) == 0)
            *sername = "/dev/ttyS0";
          else if (strncmp(portstring + i, "/dev/ttyS1",
                           strlen("/dev/ttyS1")) == 0)
            *sername = "/dev/ttyS1";
        }
        break;
      }
      case 'p': {
        if (len == 1) {
          if (portstring[i] == '1')
            *parname = "/dev/par0";
          else if (portstring[i] == '2')
            *parname = "/dev/par1";
        } else if (len == strlen("/dev/par0")) {
          if (strncmp(portstring + i, "/dev/par0", strlen("/dev/par0")) == 0)
            *parname = "/dev/par0";
          else if (strncmp(portstring + i, "/dev/par1", strlen("/dev/par1")) ==
                   0)
            *parname = "/dev/par1";
        }
        break;
      }
      case 'h':
        break;
      }
      if (continue_from == -1)
        return;
      i = continue_from;
      break;
    }
    }
  } while (1);
  return;
}


x86 assembly (clang, -O0):
<Unix_IsValidParallelDevice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
cmpq   $0x0,-0x8(%rbp)
jne    1171 <Unix_IsValidParallelDevice+0x41>
jmp    15fe <Unix_IsValidParallelDevice+0x4ce>
jmp    1176 <Unix_IsValidParallelDevice+0x46>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    %eax,-0x30(%rbp)
test   %eax,%eax
je     121c <Unix_IsValidParallelDevice+0xec>
jmp    1192 <Unix_IsValidParallelDevice+0x62>
mov    -0x30(%rbp),%eax
sub    $0x2c,%eax
je     1209 <Unix_IsValidParallelDevice+0xd9>
jmp    11a3 <Unix_IsValidParallelDevice+0x73>
mov    -0x30(%rbp),%eax
sub    $0x48,%eax
je     1221 <Unix_IsValidParallelDevice+0xf1>
jmp    11b4 <Unix_IsValidParallelDevice+0x84>
mov    -0x30(%rbp),%eax
sub    $0x50,%eax
je     1221 <Unix_IsValidParallelDevice+0xf1>
jmp    11c5 <Unix_IsValidParallelDevice+0x95>
mov    -0x30(%rbp),%eax
sub    $0x53,%eax
je     1221 <Unix_IsValidParallelDevice+0xf1>
jmp    11d6 <Unix_IsValidParallelDevice+0xa6>
mov    -0x30(%rbp),%eax
sub    $0x68,%eax
je     1221 <Unix_IsValidParallelDevice+0xf1>
jmp    11e7 <Unix_IsValidParallelDevice+0xb7>
mov    -0x30(%rbp),%eax
sub    $0x70,%eax
je     1221 <Unix_IsValidParallelDevice+0xf1>
jmp    11f8 <Unix_IsValidParallelDevice+0xc8>
mov    -0x30(%rbp),%eax
sub    $0x73,%eax
je     1221 <Unix_IsValidParallelDevice+0xf1>
jmp    1217 <Unix_IsValidParallelDevice+0xe7>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    15e5 <Unix_IsValidParallelDevice+0x4b5>
jmp    121c <Unix_IsValidParallelDevice+0xec>
jmp    15fe <Unix_IsValidParallelDevice+0x4ce>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <tolower@plt>
mov    %al,-0x1d(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1c(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1267 <Unix_IsValidParallelDevice+0x137>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
jne    12ac <Unix_IsValidParallelDevice+0x17c>
movsbl -0x1d(%rbp),%eax
cmp    $0x73,%eax
jne    1287 <Unix_IsValidParallelDevice+0x157>
mov    -0x10(%rbp),%rax
lea    0xd81(%rip),%rcx
mov    %rcx,(%rax)
jmp    12a7 <Unix_IsValidParallelDevice+0x177>
movsbl -0x1d(%rbp),%eax
cmp    $0x70,%eax
jne    12a2 <Unix_IsValidParallelDevice+0x172>
mov    -0x18(%rbp),%rax
lea    0xd6c(%rip),%rcx
mov    %rcx,(%rax)
jmp    12a7 <Unix_IsValidParallelDevice+0x177>
jmp    15e5 <Unix_IsValidParallelDevice+0x4b5>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3d,%eax
je     12c6 <Unix_IsValidParallelDevice+0x196>
jmp    15fe <Unix_IsValidParallelDevice+0x4ce>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x31(%rbp)
je     1301 <Unix_IsValidParallelDevice+0x1d1>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
setne  %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    1311 <Unix_IsValidParallelDevice+0x1e1>
jmp    1324 <Unix_IsValidParallelDevice+0x1f4>
jmp    1316 <Unix_IsValidParallelDevice+0x1e6>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12d2 <Unix_IsValidParallelDevice+0x1a2>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jne    1345 <Unix_IsValidParallelDevice+0x215>
movl   $0xffffffff,-0x28(%rbp)
jmp    134b <Unix_IsValidParallelDevice+0x21b>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x2c(%rbp)
movsbl -0x1d(%rbp),%eax
mov    %eax,-0x38(%rbp)
sub    $0x68,%eax
je     15cb <Unix_IsValidParallelDevice+0x49b>
jmp    136b <Unix_IsValidParallelDevice+0x23b>
mov    -0x38(%rbp),%eax
sub    $0x70,%eax
je     14ac <Unix_IsValidParallelDevice+0x37c>
jmp    137c <Unix_IsValidParallelDevice+0x24c>
mov    -0x38(%rbp),%eax
sub    $0x73,%eax
jne    15d0 <Unix_IsValidParallelDevice+0x4a0>
jmp    138d <Unix_IsValidParallelDevice+0x25d>
cmpl   $0x1,-0x2c(%rbp)
jne    13ec <Unix_IsValidParallelDevice+0x2bc>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x31,%eax
jne    13bf <Unix_IsValidParallelDevice+0x28f>
mov    -0x10(%rbp),%rax
lea    0xc49(%rip),%rcx
mov    %rcx,(%rax)
jmp    13e7 <Unix_IsValidParallelDevice+0x2b7>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x32,%eax
jne    13e2 <Unix_IsValidParallelDevice+0x2b2>
mov    -0x10(%rbp),%rax
lea    0xc36(%rip),%rcx
mov    %rcx,(%rax)
jmp    13e7 <Unix_IsValidParallelDevice+0x2b7>
jmp    14a7 <Unix_IsValidParallelDevice+0x377>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
lea    0xc07(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
cmp    %ecx,%eax
jne    14a2 <Unix_IsValidParallelDevice+0x372>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
lea    0xbdf(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%edx
lea    0xbcd(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1454 <Unix_IsValidParallelDevice+0x324>
mov    -0x10(%rbp),%rax
lea    0xbb4(%rip),%rcx
mov    %rcx,(%rax)
jmp    149d <Unix_IsValidParallelDevice+0x36d>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
lea    0xbab(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x50(%rbp),%rdi
mov    %eax,%edx
lea    0xb99(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1498 <Unix_IsValidParallelDevice+0x368>
mov    -0x10(%rbp),%rax
lea    0xb80(%rip),%rcx
mov    %rcx,(%rax)
jmp    149d <Unix_IsValidParallelDevice+0x36d>
jmp    14a2 <Unix_IsValidParallelDevice+0x372>
jmp    14a7 <Unix_IsValidParallelDevice+0x377>
jmp    15d0 <Unix_IsValidParallelDevice+0x4a0>
cmpl   $0x1,-0x2c(%rbp)
jne    150b <Unix_IsValidParallelDevice+0x3db>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x31,%eax
jne    14de <Unix_IsValidParallelDevice+0x3ae>
mov    -0x18(%rbp),%rax
lea    0xb35(%rip),%rcx
mov    %rcx,(%rax)
jmp    1506 <Unix_IsValidParallelDevice+0x3d6>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x32,%eax
jne    1501 <Unix_IsValidParallelDevice+0x3d1>
mov    -0x18(%rbp),%rax
lea    0xb22(%rip),%rcx
mov    %rcx,(%rax)
jmp    1506 <Unix_IsValidParallelDevice+0x3d6>
jmp    15c6 <Unix_IsValidParallelDevice+0x496>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x54(%rbp)
lea    0xaf3(%rip),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
cmp    %ecx,%eax
jne    15c1 <Unix_IsValidParallelDevice+0x491>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x60(%rbp)
lea    0xacb(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x60(%rbp),%rdi
mov    %eax,%edx
lea    0xab9(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1573 <Unix_IsValidParallelDevice+0x443>
mov    -0x18(%rbp),%rax
lea    0xaa0(%rip),%rcx
mov    %rcx,(%rax)
jmp    15bc <Unix_IsValidParallelDevice+0x48c>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x68(%rbp)
lea    0xa97(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x68(%rbp),%rdi
mov    %eax,%edx
lea    0xa85(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    15b7 <Unix_IsValidParallelDevice+0x487>
mov    -0x18(%rbp),%rax
lea    0xa6c(%rip),%rcx
mov    %rcx,(%rax)
jmp    15bc <Unix_IsValidParallelDevice+0x48c>
jmp    15c1 <Unix_IsValidParallelDevice+0x491>
jmp    15c6 <Unix_IsValidParallelDevice+0x496>
jmp    15d0 <Unix_IsValidParallelDevice+0x4a0>
jmp    15d0 <Unix_IsValidParallelDevice+0x4a0>
cmpl   $0xffffffff,-0x28(%rbp)
jne    15df <Unix_IsValidParallelDevice+0x4af>
jmp    15fe <Unix_IsValidParallelDevice+0x4ce>
mov    -0x28(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    15ea <Unix_IsValidParallelDevice+0x4ba>
mov    $0x1,%al
test   $0x1,%al
jne    1176 <Unix_IsValidParallelDevice+0x46>
jmp    15f9 <Unix_IsValidParallelDevice+0x4c9>
jmp    15fe <Unix_IsValidParallelDevice+0x4ce>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Unix_IsValidParallelDevice>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,0x8(%rsp)
movq   $0x0,(%rsi)
mov    %rdx,0x10(%rsp)
movq   $0x0,(%rdx)
test   %rdi,%rdi
je     13ef <Unix_IsValidParallelDevice+0x2bf>
mov    %rdi,%r8
xor    %r14d,%r14d
movabs $0x90100000901,%rbp
lea    0xe95(%rip),%r15
lea    0xe83(%rip),%rsi
mov    %rdi,(%rsp)
jmp    1190 <Unix_IsValidParallelDevice+0x60>
mov    0x10(%rsp),%rax
mov    %r15,(%rax)
nopl   0x0(%rax,%rax,1)
movslq %r14d,%rbx
movsbl (%r8,%rbx,1),%edi
lea    -0x48(%rdi),%eax
cmp    $0x2b,%eax
ja     126f <Unix_IsValidParallelDevice+0x13f>
bt     %rax,%rbp
jae    126f <Unix_IsValidParallelDevice+0x13f>
mov    %rsi,%r12
call   1050 <tolower@plt>
mov    (%rsp),%r8
mov    %r12,%rsi
mov    0x1(%r8,%rbx,1),%cl
test   %cl,%cl
je     11d4 <Unix_IsValidParallelDevice+0xa4>
cmp    $0x3d,%cl
je     11f0 <Unix_IsValidParallelDevice+0xc0>
cmp    $0x2c,%cl
jne    13ef <Unix_IsValidParallelDevice+0x2bf>
add    $0x1,%rbx
mov    %ebx,%r14d
cmp    $0x70,%al
je     1183 <Unix_IsValidParallelDevice+0x53>
cmp    $0x73,%al
jne    1190 <Unix_IsValidParallelDevice+0x60>
mov    0x8(%rsp),%rax
mov    %rsi,(%rax)
jmp    1190 <Unix_IsValidParallelDevice+0x60>
nopl   (%rax)
mov    %r15,%rbx
lea    0x2(%r14),%ecx
movslq %ecx,%rcx
lea    (%r8,%rcx,1),%rbp
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl 0x0(%rbp,%r13,1),%edx
test   %dl,%dl
je     1230 <Unix_IsValidParallelDevice+0x100>
cmp    $0x2c,%dl
je     1230 <Unix_IsValidParallelDevice+0x100>
add    $0x1,%r13
jmp    1210 <Unix_IsValidParallelDevice+0xe0>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14d,%r14d
lea    (%r14,%r13,1),%r15
movsbl %al,%eax
cmp    $0x70,%eax
je     1281 <Unix_IsValidParallelDevice+0x151>
cmp    $0x73,%eax
jne    13d0 <Unix_IsValidParallelDevice+0x2a0>
cmp    $0x1,%r13d
jne    12af <Unix_IsValidParallelDevice+0x17f>
mov    (%r8,%rcx,1),%al
cmp    $0x32,%al
je     1316 <Unix_IsValidParallelDevice+0x1e6>
cmp    $0x31,%al
jne    13d0 <Unix_IsValidParallelDevice+0x2a0>
mov    0x8(%rsp),%rax
mov    %rsi,(%rax)
jmp    13d0 <Unix_IsValidParallelDevice+0x2a0>
cmp    $0x2c,%edi
jne    13ef <Unix_IsValidParallelDevice+0x2bf>
add    $0x1,%r14d
jmp    1190 <Unix_IsValidParallelDevice+0x60>
cmp    $0x1,%r13d
jne    1324 <Unix_IsValidParallelDevice+0x1f4>
mov    (%r8,%rcx,1),%al
cmp    $0x32,%al
je     1392 <Unix_IsValidParallelDevice+0x262>
cmp    $0x31,%al
mov    %r12,%rsi
jne    13d0 <Unix_IsValidParallelDevice+0x2a0>
mov    0x10(%rsp),%rax
mov    %rbx,(%rax)
jmp    13d0 <Unix_IsValidParallelDevice+0x2a0>
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    (%rsp),%r8
mov    %r12,%rsi
cmp    %r13d,%eax
jne    13d0 <Unix_IsValidParallelDevice+0x2a0>
mov    %rsi,%rdi
mov    %rsi,%r12
call   1040 <strlen@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     13a6 <Unix_IsValidParallelDevice+0x276>
lea    0xd27(%rip),%r12
mov    %r12,%rdi
call   1040 <strlen@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
lea    0xcf4(%rip),%rsi
mov    (%rsp),%r8
jne    13d0 <Unix_IsValidParallelDevice+0x2a0>
mov    0x8(%rsp),%rax
lea    0xcf3(%rip),%rcx
jmp    138d <Unix_IsValidParallelDevice+0x25d>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    (%rsp),%r8
cmp    %r13d,%eax
mov    %r12,%rsi
jne    13d0 <Unix_IsValidParallelDevice+0x2a0>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbp,%rdi
lea    0xcbd(%rip),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     13b0 <Unix_IsValidParallelDevice+0x280>
lea    0xcc0(%rip),%rdi
call   1040 <strlen@plt>
mov    %rbp,%rdi
lea    0xcb1(%rip),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
mov    %r12,%rsi
mov    (%rsp),%r8
jne    13d0 <Unix_IsValidParallelDevice+0x2a0>
mov    0x10(%rsp),%rax
lea    0xc93(%rip),%rcx
mov    %rcx,(%rax)
jmp    13d0 <Unix_IsValidParallelDevice+0x2a0>
mov    0x10(%rsp),%rax
lea    0xc82(%rip),%rcx
mov    %rcx,(%rax)
mov    %r12,%rsi
jmp    13d0 <Unix_IsValidParallelDevice+0x2a0>
mov    0x8(%rsp),%rax
mov    %r12,(%rax)
jmp    13bf <Unix_IsValidParallelDevice+0x28f>
mov    0x10(%rsp),%rax
lea    0xc4f(%rip),%rcx
mov    %rcx,(%rax)
mov    %r12,%rsi
mov    (%rsp),%r8
cs nopw 0x0(%rax,%rax,1)
cmp    $0xfffffffd,%r15d
movabs $0x90100000901,%rbp
je     13ef <Unix_IsValidParallelDevice+0x2bf>
mov    %rbx,%r15
add    %r13,%r14
add    $0x2,%r14
jmp    1190 <Unix_IsValidParallelDevice+0x60>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"/dev/ttyS0\00"
@.str.1 = [10 x i8] c"/dev/par0\00"
@.str.2 = [11 x i8] c"/dev/ttyS1\00"
@.str.3 = [10 x i8] c"/dev/par1\00"
define void @Unix_IsValidParallelDevice(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
store i32 0, i32* %7
%12 = load i8**, i8*** %5
store i8* null, i8** %12
%13 = load i8**, i8*** %6
store i8* null, i8** %13
%14 = load i8*, i8** %4
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %17
16: ; preds = %3
br label %234
17: ; preds = %3
br label %18
18: ; preds = %232, %17
%19 = load i8*, i8** %4
%20 = load i32, i32* %7
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
switch i32 %24, label %28 [
i32 44, label %25
i32 0, label %29
i32 115, label %30
i32 83, label %30
i32 112, label %30
i32 80, label %30
i32 104, label %30
i32 72, label %30
]
25: ; preds = %18
%26 = load i32, i32* %7
%27 = add nsw i32 %26, 1
store i32 %27, i32* %7
br label %231
28: ; preds = %18
br label %29
29: ; preds = %18, %28
br label %234
30: ; preds = %18, %18, %18, %18, %18, %18
%31 = load i8*, i8** %4
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = load i8, i8* %34
%36 = call signext i8 @tolower(i8 signext %35)
store i8 %36, i8* %8
%37 = load i8*, i8** %4
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %37, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 0
br i1 %44, label %53, label %45
45: ; preds = %30
%46 = load i8*, i8** %4
%47 = load i32, i32* %7
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %46, i64 %48
%50 = load i8, i8* %49
%51 = sext i8 %50 to i32
%52 = icmp eq i32 %51, 44
br i1 %52, label %53, label %67
53: ; preds = %45, %30
%54 = load i8, i8* %8
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 115
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = load i8**, i8*** %5
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %58
br label %66
59: ; preds = %53
%60 = load i8, i8* %8
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 112
br i1 %62, label %63, label %65
63: ; preds = %59
%64 = load i8**, i8*** %6
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %64
br label %65
65: ; preds = %63, %59
br label %66
66: ; preds = %65, %57
br label %231
67: ; preds = %45
%68 = load i8*, i8** %4
%69 = load i32, i32* %7
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8, i8* %68, i64 %70
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = icmp ne i32 %73, 61
br i1 %74, label %75, label %76
75: ; preds = %67
br label %234
76: ; preds = %67
%77 = load i32, i32* %7
%78 = add nsw i32 %77, 1
store i32 %78, i32* %7
store i32 %78, i32* %9
br label %79
79: ; preds = %98, %76
%80 = load i8*, i8** %4
%81 = load i32, i32* %9
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %80, i64 %82
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %95
87: ; preds = %79
%88 = load i8*, i8** %4
%89 = load i32, i32* %9
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds i8, i8* %88, i64 %90
%92 = load i8, i8* %91
%93 = sext i8 %92 to i32
%94 = icmp ne i32 %93, 44
br label %95
95: ; preds = %87, %79
%96 = phi i1 [ false, %79 ], [ %94, %87 ]
br i1 %96, label %97, label %101
97: ; preds = %95
br label %98
98: ; preds = %97
%99 = load i32, i32* %9
%100 = add nsw i32 %99, 1
store i32 %100, i32* %9
br label %79
101: ; preds = %95
%102 = load i8*, i8** %4
%103 = load i32, i32* %9
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i8, i8* %102, i64 %104
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = icmp eq i32 %107, 48
br i1 %108, label %109, label %110
109: ; preds = %101
store i32 -1, i32* %10
br label %112
110: ; preds = %101
%111 = load i32, i32* %9
store i32 %111, i32* %10
br label %112
112: ; preds = %110, %109
%113 = load i32, i32* %9
%114 = load i32, i32* %7
%115 = sub nsw i32 %113, %114
store i32 %115, i32* %11
%116 = load i8, i8* %8
%117 = sext i8 %116 to i32
switch i32 %117, label %225 [
i32 115, label %118
i32 112, label %171
i32 104, label %224
]
118: ; preds = %112
%119 = load i32, i32* %11
%120 = icmp eq i32 %119, 1
br i1 %120, label %121, label %143
121: ; preds = %118
%122 = load i8*, i8** %4
%123 = load i32, i32* %7
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i8, i8* %122, i64 %124
%126 = load i8, i8* %125
%127 = sext i8 %126 to i32
%128 = icmp eq i32 %127, 49
br i1 %128, label %129, label %131
129: ; preds = %121
%130 = load i8**, i8*** %5
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %130
br label %142
131: ; preds = %121
%132 = load i8*, i8** %4
%133 = load i32, i32* %7
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds i8, i8* %132, i64 %134
%136 = load i8, i8* %135
%137 = sext i8 %136 to i32
%138 = icmp eq i32 %137, 50
br i1 %138, label %139, label %141
139: ; preds = %131
%140 = load i8**, i8*** %5
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %140
br label %141
141: ; preds = %139, %131
br label %142
142: ; preds = %141, %129
br label %170
143: ; preds = %118
%144 = load i32, i32* %11
%145 = call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%146 = icmp eq i32 %144, %145
br i1 %146, label %147, label %169
147: ; preds = %143
%148 = load i8*, i8** %4
%149 = load i32, i32* %7
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds i8, i8* %148, i64 %150
%152 = call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%153 = call i32 @strncmp(i8* %151, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %152)
%154 = icmp eq i32 %153, 0
br i1 %154, label %155, label %157
155: ; preds = %147
%156 = load i8**, i8*** %5
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %156
br label %168
157: ; preds = %147
%158 = load i8*, i8** %4
%159 = load i32, i32* %7
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds i8, i8* %158, i64 %160
%162 = call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%163 = call i32 @strncmp(i8* %161, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %162)
%164 = icmp eq i32 %163, 0
br i1 %164, label %165, label %167
165: ; preds = %157
%166 = load i8**, i8*** %5
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %166
br label %167
167: ; preds = %165, %157
br label %168
168: ; preds = %167, %155
br label %169
169: ; preds = %168, %143
br label %170
170: ; preds = %169, %142
br label %225
171: ; preds = %112
%172 = load i32, i32* %11
%173 = icmp eq i32 %172, 1
br i1 %173, label %174, label %196
174: ; preds = %171
%175 = load i8*, i8** %4
%176 = load i32, i32* %7
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds i8, i8* %175, i64 %177
%179 = load i8, i8* %178
%180 = sext i8 %179 to i32
%181 = icmp eq i32 %180, 49
br i1 %181, label %182, label %184
182: ; preds = %174
%183 = load i8**, i8*** %6
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %183
br label %195
184: ; preds = %174
%185 = load i8*, i8** %4
%186 = load i32, i32* %7
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds i8, i8* %185, i64 %187
%189 = load i8, i8* %188
%190 = sext i8 %189 to i32
%191 = icmp eq i32 %190, 50
br i1 %191, label %192, label %194
192: ; preds = %184
%193 = load i8**, i8*** %6
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8** %193
br label %194
194: ; preds = %192, %184
br label %195
195: ; preds = %194, %182
br label %223
196: ; preds = %171
%197 = load i32, i32* %11
%198 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%199 = icmp eq i32 %197, %198
br i1 %199, label %200, label %222
200: ; preds = %196
%201 = load i8*, i8** %4
%202 = load i32, i32* %7
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds i8, i8* %201, i64 %203
%205 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%206 = call i32 @strncmp(i8* %204, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %205)
%207 = icmp eq i32 %206, 0
br i1 %207, label %208, label %210
208: ; preds = %200
%209 = load i8**, i8*** %6
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %209
br label %221
210: ; preds = %200
%211 = load i8*, i8** %4
%212 = load i32, i32* %7
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds i8, i8* %211, i64 %213
%215 = call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%216 = call i32 @strncmp(i8* %214, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %215)
%217 = icmp eq i32 %216, 0
br i1 %217, label %218, label %220
218: ; preds = %210
%219 = load i8**, i8*** %6
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8** %219
br label %220
220: ; preds = %218, %210
br label %221
221: ; preds = %220, %208
br label %222
222: ; preds = %221, %196
br label %223
223: ; preds = %222, %195
br label %225
224: ; preds = %112
br label %225
225: ; preds = %112, %224, %223, %170
%226 = load i32, i32* %10
%227 = icmp eq i32 %226, -1
br i1 %227, label %228, label %229
228: ; preds = %225
br label %234
229: ; preds = %225
%230 = load i32, i32* %10
store i32 %230, i32* %7
br label %231
231: ; preds = %229, %66, %25
br label %232
232: ; preds = %231
br i1 true, label %18, label %233
233: ; preds = %232
br label %234
234: ; preds = %233, %228, %75, %29, %16
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"/dev/ttyS0\00"
@.str.1 = [10 x i8] c"/dev/par0\00"
@.str.2 = [11 x i8] c"/dev/ttyS1\00"
@.str.3 = [10 x i8] c"/dev/par1\00"
define void @Unix_IsValidParallelDevice(i8* %0, i8** nocapture writeonly %1, i8** nocapture writeonly %2) {
store i8* null, i8** %1
store i8* null, i8** %2
%4 = icmp eq i8* %0, null
br i1 %4, label %81, label %5
5: ; preds = %3, %21
%6 = phi i32 [ %22, %21 ], [ 0, %3 ]
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
switch i32 %10, label %81 [
i32 44, label %11
i32 72, label %13
i32 115, label %13
i32 83, label %13
i32 112, label %13
i32 80, label %13
i32 104, label %13
]
11: ; preds = %5
%12 = add nsw i32 %6, 1
br label %21
13: ; preds = %5, %5, %5, %5, %5, %5
%14 = tail call signext i8 @tolower(i8 signext %9)
%15 = add nsw i32 %6, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = load i8, i8* %17
switch i8 %18, label %81 [
i8 0, label %19
i8 44, label %19
i8 61, label %24
]
19: ; preds = %13, %13
switch i8 %14, label %21 [
i8 115, label %20
i8 112, label %23
]
20: ; preds = %19
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %1
br label %21
21: ; preds = %20, %23, %19, %11, %79
%22 = phi i32 [ %34, %79 ], [ %12, %11 ], [ %15, %19 ], [ %15, %23 ], [ %15, %20 ]
br label %5
23: ; preds = %19
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %21
24: ; preds = %13
%25 = add i32 %6, 2
%26 = sext i32 %25 to i64
br label %27
27: ; preds = %31, %24
%28 = phi i64 [ %32, %31 ], [ %26, %24 ]
%29 = getelementptr inbounds i8, i8* %0, i64 %28
%30 = load i8, i8* %29
switch i8 %30, label %31 [
i8 0, label %33
i8 44, label %33
]
31: ; preds = %27
%32 = add i64 %28, 1
br label %27
33: ; preds = %27, %27
%34 = trunc i64 %28 to i32
%35 = sub nsw i32 %34, %25
%36 = sext i8 %14 to i32
switch i32 %36, label %79 [
i32 115, label %37
i32 112, label %58
]
37: ; preds = %33
%38 = icmp eq i32 %35, 1
br i1 %38, label %39, label %44
39: ; preds = %37
%40 = getelementptr inbounds i8, i8* %0, i64 %26
%41 = load i8, i8* %40
switch i8 %41, label %79 [
i8 49, label %42
i8 50, label %43
]
42: ; preds = %39
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %1
br label %79
43: ; preds = %39
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %79
44: ; preds = %37
%45 = tail call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%46 = icmp eq i32 %35, %45
br i1 %46, label %47, label %79
47: ; preds = %44
%48 = getelementptr inbounds i8, i8* %0, i64 %26
%49 = tail call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%50 = tail call i32 @strncmp(i8* %48, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %49)
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %53
52: ; preds = %47
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %1
br label %79
53: ; preds = %47
%54 = tail call i32 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%55 = tail call i32 @strncmp(i8* %48, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %54)
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %79
57: ; preds = %53
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8** %1
br label %79
58: ; preds = %33
%59 = icmp eq i32 %35, 1
br i1 %59, label %60, label %65
60: ; preds = %58
%61 = getelementptr inbounds i8, i8* %0, i64 %26
%62 = load i8, i8* %61
switch i8 %62, label %79 [
i8 49, label %63
i8 50, label %64
]
63: ; preds = %60
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %79
64: ; preds = %60
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %79
65: ; preds = %58
%66 = tail call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%67 = icmp eq i32 %35, %66
br i1 %67, label %68, label %79
68: ; preds = %65
%69 = getelementptr inbounds i8, i8* %0, i64 %26
%70 = tail call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%71 = tail call i32 @strncmp(i8* %69, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %70)
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %74
73: ; preds = %68
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %79
74: ; preds = %68
%75 = tail call i32 @strlen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%76 = tail call i32 @strncmp(i8* %69, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %75)
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %79
78: ; preds = %74
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %79
79: ; preds = %33, %44, %53, %57, %52, %42, %43, %65, %74, %78, %73, %63, %64, %39, %60
%80 = icmp eq i32 %34, -1
br i1 %80, label %81, label %21
81: ; preds = %13, %5, %79, %3
ret void
}