#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 /*<<< orphan*/ kapi_Error_pch1(int, int /*<<< orphan*/, char *, char *);
scalar_t__ strchr(char *, char);
char *strtok(char *, char *);
void ParseBypass(char *pch, char **ppchFcSrc, char **ppchPortSrc,
                 char **ppchOppSrc, char **ppchFcDest, char **ppchPortDest,
                 char **ppchOppDest, char **ppchLatency) {
  char *pchSrc, *pchDest, *pchVal;
  pchVal = (char *)strchr(pch, '=');
  if (pchVal == NULL) {
    kapi_Error_pch1(-1, 0, "Malformed bypass attribute '%s' -- '=' required",
                    pch);
    return;
  }
  *pchVal = '\0';
  *ppchLatency = pchVal + 1;
  pchDest = (char *)strchr(pch, ':');
  if (pchDest == NULL) {
    kapi_Error_pch1(-1, 0, "Malformed bypass attribute '%s' -- ':' required",
                    pch);
    return;
  }
  *pchDest = '\0';
  pchDest = pchDest + 1;
  pchSrc = pch;
  *ppchFcSrc = NULL;
  *ppchPortSrc = NULL;
  *ppchOppSrc = NULL;
  *ppchFcDest = NULL;
  *ppchPortDest = NULL;
  *ppchOppDest = NULL;
  *ppchFcSrc = strtok(pchSrc, " /");
  if (*ppchFcSrc) {
    *ppchPortSrc = strtok(NULL, " /");
    if (*ppchPortSrc) {
      *ppchOppSrc = strtok(NULL, " /");
    }
  }
  *ppchFcDest = strtok(pchDest, "/");
  if (*ppchFcDest) {
    *ppchPortDest = strtok(NULL, " /");
    if (*ppchPortDest) {
      *ppchOppDest = strtok(NULL, " /");
    }
  }
}


x86 assembly (clang, -O0):
<ParseBypass>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3d,%esi
call   1030 <strchr@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1191 <ParseBypass+0x61>
mov    -0x8(%rbp),%rcx
mov    $0xffffffff,%edi
xor    %esi,%esi
lea    0xe79(%rip),%rdx
call   1040 <kapi_Error_pch1@plt>
jmp    131b <ParseBypass+0x1eb>
mov    -0x48(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x48(%rbp),%rcx
add    $0x1,%rcx
mov    0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    11e0 <ParseBypass+0xb0>
mov    -0x8(%rbp),%rcx
mov    $0xffffffff,%edi
xor    %esi,%esi
lea    0xe5a(%rip),%rdx
call   1040 <kapi_Error_pch1@plt>
jmp    131b <ParseBypass+0x1eb>
mov    -0x40(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x28(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x30(%rbp),%rax
movq   $0x0,(%rax)
mov    0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x38(%rbp),%rdi
lea    0xe18(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     12ac <ParseBypass+0x17c>
xor    %eax,%eax
mov    %eax,%edi
lea    0xdf0(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     12a7 <ParseBypass+0x177>
xor    %eax,%eax
mov    %eax,%edi
lea    0xdc8(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
jmp    12ac <ParseBypass+0x17c>
mov    -0x40(%rbp),%rdi
lea    0xdaa(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
cmpq   $0x0,(%rax)
je     131b <ParseBypass+0x1eb>
xor    %eax,%eax
mov    %eax,%edi
lea    0xd81(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x30(%rbp),%rax
cmpq   $0x0,(%rax)
je     1316 <ParseBypass+0x1e6>
xor    %eax,%eax
mov    %eax,%edi
lea    0xd59(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,%rcx
mov    0x10(%rbp),%rax
mov    %rcx,(%rax)
jmp    131b <ParseBypass+0x1eb>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ParseBypass>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,%r12
mov    %rcx,%r15
mov    %rdx,%r13
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x58(%rsp),%rbp
mov    0x50(%rsp),%rax
mov    %rax,0x8(%rsp)
mov    $0x3d,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     126c <ParseBypass+0x13c>
movb   $0x0,(%rax)
add    $0x1,%rax
mov    %rax,0x0(%rbp)
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1275 <ParseBypass+0x145>
mov    %rax,%rbp
movb   $0x0,(%rax)
add    $0x1,%rbp
movq   $0x0,(%r14)
movq   $0x0,0x0(%r13)
movq   $0x0,(%r15)
movq   $0x0,(%r12)
mov    0x10(%rsp),%rax
movq   $0x0,(%rax)
mov    0x8(%rsp),%rax
movq   $0x0,(%rax)
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strtok@plt>
mov    %rax,(%r14)
test   %rax,%rax
je     1214 <ParseBypass+0xe4>
lea    0xe6d(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
mov    %rax,0x0(%r13)
test   %rax,%rax
je     1214 <ParseBypass+0xe4>
lea    0xe56(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
mov    %rax,(%r15)
lea    0xe46(%rip),%rsi
mov    %rbp,%rdi
call   1050 <strtok@plt>
mov    %rax,(%r12)
test   %rax,%rax
je     125d <ParseBypass+0x12d>
lea    0xe2d(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
mov    0x10(%rsp),%rcx
mov    %rax,(%rcx)
test   %rax,%rax
je     125d <ParseBypass+0x12d>
lea    0xe12(%rip),%rsi
xor    %edi,%edi
call   1050 <strtok@plt>
mov    0x8(%rsp),%rcx
mov    %rax,(%rcx)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd8d(%rip),%rdx
jmp    127c <ParseBypass+0x14c>
lea    0xdb4(%rip),%rdx
mov    $0xffffffff,%edi
xor    %esi,%esi
mov    %rbx,%rcx
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <kapi_Error_pch1@plt>

LLVM IR (-O0):
@.str = [48 x i8] c"Malformed bypass attribute '%s' -- '=' required\00"
@.str.1 = [48 x i8] c"Malformed bypass attribute '%s' -- ':' required\00"
@.str.2 = [3 x i8] c" /\00"
@.str.3 = [2 x i8] c"/\00"
define void @ParseBypass(i8* %0, i8** %1, i8** %2, i8** %3, i8** %4, i8** %5, i8** %6, i8** %7) {
%9 = alloca i8*
%10 = alloca i8**
%11 = alloca i8**
%12 = alloca i8**
%13 = alloca i8**
%14 = alloca i8**
%15 = alloca i8**
%16 = alloca i8**
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca i8*
store i8* %0, i8** %9
store i8** %1, i8*** %10
store i8** %2, i8*** %11
store i8** %3, i8*** %12
store i8** %4, i8*** %13
store i8** %5, i8*** %14
store i8** %6, i8*** %15
store i8** %7, i8*** %16
%20 = load i8*, i8** %9
%21 = call i64 @strchr(i8* %20, i8 signext 61)
%22 = inttoptr i64 %21 to i8*
store i8* %22, i8** %19
%23 = load i8*, i8** %19
%24 = icmp eq i8* %23, null
br i1 %24, label %25, label %28
25: ; preds = %8
%26 = load i8*, i8** %9
%27 = call i32 @kapi_Error_pch1(i32 -1, i32 0, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %26)
br label %85
28: ; preds = %8
%29 = load i8*, i8** %19
store i8 0, i8* %29
%30 = load i8*, i8** %19
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = load i8**, i8*** %16
store i8* %31, i8** %32
%33 = load i8*, i8** %9
%34 = call i64 @strchr(i8* %33, i8 signext 58)
%35 = inttoptr i64 %34 to i8*
store i8* %35, i8** %18
%36 = load i8*, i8** %18
%37 = icmp eq i8* %36, null
br i1 %37, label %38, label %41
38: ; preds = %28
%39 = load i8*, i8** %9
%40 = call i32 @kapi_Error_pch1(i32 -1, i32 0, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %39)
br label %85
41: ; preds = %28
%42 = load i8*, i8** %18
store i8 0, i8* %42
%43 = load i8*, i8** %18
%44 = getelementptr inbounds i8, i8* %43, i64 1
store i8* %44, i8** %18
%45 = load i8*, i8** %9
store i8* %45, i8** %17
%46 = load i8**, i8*** %10
store i8* null, i8** %46
%47 = load i8**, i8*** %11
store i8* null, i8** %47
%48 = load i8**, i8*** %12
store i8* null, i8** %48
%49 = load i8**, i8*** %13
store i8* null, i8** %49
%50 = load i8**, i8*** %14
store i8* null, i8** %50
%51 = load i8**, i8*** %15
store i8* null, i8** %51
%52 = load i8*, i8** %17
%53 = call i8* @strtok(i8* %52, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%54 = load i8**, i8*** %10
store i8* %53, i8** %54
%55 = load i8**, i8*** %10
%56 = load i8*, i8** %55
%57 = icmp ne i8* %56, null
br i1 %57, label %58, label %68
58: ; preds = %41
%59 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%60 = load i8**, i8*** %11
store i8* %59, i8** %60
%61 = load i8**, i8*** %11
%62 = load i8*, i8** %61
%63 = icmp ne i8* %62, null
br i1 %63, label %64, label %67
64: ; preds = %58
%65 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%66 = load i8**, i8*** %12
store i8* %65, i8** %66
br label %67
67: ; preds = %64, %58
br label %68
68: ; preds = %67, %41
%69 = load i8*, i8** %18
%70 = call i8* @strtok(i8* %69, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%71 = load i8**, i8*** %13
store i8* %70, i8** %71
%72 = load i8**, i8*** %13
%73 = load i8*, i8** %72
%74 = icmp ne i8* %73, null
br i1 %74, label %75, label %85
75: ; preds = %68
%76 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%77 = load i8**, i8*** %14
store i8* %76, i8** %77
%78 = load i8**, i8*** %14
%79 = load i8*, i8** %78
%80 = icmp ne i8* %79, null
br i1 %80, label %81, label %84
81: ; preds = %75
%82 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%83 = load i8**, i8*** %15
store i8* %82, i8** %83
br label %84
84: ; preds = %81, %75
br label %85
85: ; preds = %25, %38, %84, %68
ret void
}

LLVM IR (-O2):
@.str = [48 x i8] c"Malformed bypass attribute '%s' -- '=' required\00"
@.str.1 = [48 x i8] c"Malformed bypass attribute '%s' -- ':' required\00"
@.str.2 = [3 x i8] c" /\00"
@.str.3 = [2 x i8] c"/\00"
define void @ParseBypass(i8* %0, i8** nocapture writeonly %1, i8** nocapture writeonly %2, i8** nocapture writeonly %3, i8** nocapture writeonly %4, i8** nocapture writeonly %5, i8** nocapture writeonly %6, i8** nocapture writeonly %7) {
%9 = tail call i64 @strchr(i8* %0, i8 signext 61)
%10 = inttoptr i64 %9 to i8*
%11 = icmp eq i64 %9, 0
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = tail call i32 @kapi_Error_pch1(i32 -1, i32 0, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %38
14: ; preds = %8
store i8 0, i8* %10
%15 = getelementptr inbounds i8, i8* %10, i64 1
store i8* %15, i8** %7
%16 = tail call i64 @strchr(i8* %0, i8 signext 58)
%17 = inttoptr i64 %16 to i8*
%18 = icmp eq i64 %16, 0
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = tail call i32 @kapi_Error_pch1(i32 -1, i32 0, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %38
21: ; preds = %14
store i8 0, i8* %17
%22 = getelementptr inbounds i8, i8* %17, i64 1
store i8* null, i8** %1
store i8* null, i8** %2
store i8* null, i8** %3
store i8* null, i8** %4
store i8* null, i8** %5
store i8* null, i8** %6
%23 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i8* %23, i8** %1
%24 = icmp eq i8* %23, null
br i1 %24, label %30, label %25
25: ; preds = %21
%26 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i8* %26, i8** %2
%27 = icmp eq i8* %26, null
br i1 %27, label %30, label %28
28: ; preds = %25
%29 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i8* %29, i8** %3
br label %30
30: ; preds = %25, %28, %21
%31 = tail call i8* @strtok(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i8* %31, i8** %4
%32 = icmp eq i8* %31, null
br i1 %32, label %38, label %33
33: ; preds = %30
%34 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i8* %34, i8** %5
%35 = icmp eq i8* %34, null
br i1 %35, label %38, label %36
36: ; preds = %33
%37 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i8* %37, i8** %6
br label %38
38: ; preds = %30, %36, %33, %19, %12
ret void
}