#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*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
int expectedmsgrcd(unsigned int *rmsg, unsigned long type, int tos) {
  char type_ok = 0, acBuf[4];
  char tos_ok = 0;
  int r = 0;
  memset(acBuf, 0, 4);
  switch (tos) {
  case 0xE0:
  case 0xD0:
  case 0xC0:
  case 0xB8:
    if (rmsg[1] == 0xE0 || rmsg[1] == 0xD0 || rmsg[1] == 0xC0 ||
        rmsg[1] == 0xB8) {
      tos_ok = 1;
    }
    break;
  case 0xA0:
  case 0x80:
  case 0x88:
    if (rmsg[1] == 0xA0 || rmsg[1] == 0x80 || rmsg[1] == 0x88) {
      tos_ok = 1;
    }
    break;
  case 0x00:
  case 0x60:
    if (rmsg[1] == 0x00 || rmsg[1] == 0x60) {
      tos_ok = 1;
    }
    break;
  case 0x20:
  case 0x40:
    if (rmsg[1] == 0x20 || rmsg[1] == 0x40) {
      tos_ok = 1;
    }
    break;
  default:
    printf("\nexpectedmsgrcd not know tos=0x%x\n", tos);
  }
  if (tos_ok == 0) {
    switch (rmsg[1]) {
    case 0xE0:
    case 0xD0:
    case 0xC0:
    case 0xB8:
      strcat(acBuf, "VO");
      break;
    case 0xA0:
    case 0x80:
    case 0x88:
      strcat(acBuf, "VI");
      break;
    case 0x00:
    case 0x60:
      strcat(acBuf, "BE");
      break;
    case 0x20:
    case 0x40:
      strcat(acBuf, "BK");
      break;
    default:
      printf("\nexpectedmsgrcd check unexpected TOS:not know rmsg[1]=0x%x\n",
             rmsg[1]);
    }
  }
  type_ok = ((rmsg[10] == type) ? 1 : 0);
  r = (type_ok && tos_ok);
  if (!r) {
    printf("\nexpectedmsgrcd no match: rmsg[10] %u expect type %lu rmsg[1] as "
           "tos 0x%x expect tos 0x%x\n",
           rmsg[10], type, rmsg[1], tos);
    printf("expectedmsgrcd::rcv %s as repeate pkt for previous state\n", acBuf);
  }
  return r;
}


x86 assembly (clang, -O0):
<expectedmsgrcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movb   $0x0,-0x15(%rbp)
movb   $0x0,-0x1a(%rbp)
movl   $0x0,-0x20(%rbp)
lea    -0x19(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
test   %eax,%eax
je     12b6 <expectedmsgrcd+0x186>
jmp    1175 <expectedmsgrcd+0x45>
mov    -0x24(%rbp),%eax
sub    $0x20,%eax
je     12db <expectedmsgrcd+0x1ab>
jmp    1186 <expectedmsgrcd+0x56>
mov    -0x24(%rbp),%eax
sub    $0x40,%eax
je     12db <expectedmsgrcd+0x1ab>
jmp    1197 <expectedmsgrcd+0x67>
mov    -0x24(%rbp),%eax
sub    $0x60,%eax
je     12b6 <expectedmsgrcd+0x186>
jmp    11a8 <expectedmsgrcd+0x78>
mov    -0x24(%rbp),%eax
sub    $0x80,%eax
je     127a <expectedmsgrcd+0x14a>
jmp    11bb <expectedmsgrcd+0x8b>
mov    -0x24(%rbp),%eax
sub    $0x88,%eax
je     127a <expectedmsgrcd+0x14a>
jmp    11ce <expectedmsgrcd+0x9e>
mov    -0x24(%rbp),%eax
sub    $0xa0,%eax
je     127a <expectedmsgrcd+0x14a>
jmp    11e1 <expectedmsgrcd+0xb1>
mov    -0x24(%rbp),%eax
sub    $0xb8,%eax
je     122d <expectedmsgrcd+0xfd>
jmp    11f4 <expectedmsgrcd+0xc4>
mov    -0x24(%rbp),%eax
sub    $0xc0,%eax
je     122d <expectedmsgrcd+0xfd>
jmp    1207 <expectedmsgrcd+0xd7>
mov    -0x24(%rbp),%eax
sub    $0xd0,%eax
je     122d <expectedmsgrcd+0xfd>
jmp    121a <expectedmsgrcd+0xea>
mov    -0x24(%rbp),%eax
sub    $0xe0,%eax
jne    1300 <expectedmsgrcd+0x1d0>
jmp    122d <expectedmsgrcd+0xfd>
mov    -0x8(%rbp),%rax
cmpl   $0xe0,0x4(%rax)
je     1271 <expectedmsgrcd+0x141>
mov    -0x8(%rbp),%rax
cmpl   $0xd0,0x4(%rax)
je     1271 <expectedmsgrcd+0x141>
mov    -0x8(%rbp),%rax
cmpl   $0xc0,0x4(%rax)
je     1271 <expectedmsgrcd+0x141>
mov    -0x8(%rbp),%rax
cmpl   $0xb8,0x4(%rax)
jne    1275 <expectedmsgrcd+0x145>
movb   $0x1,-0x1a(%rbp)
jmp    1311 <expectedmsgrcd+0x1e1>
mov    -0x8(%rbp),%rax
cmpl   $0xa0,0x4(%rax)
je     12ad <expectedmsgrcd+0x17d>
mov    -0x8(%rbp),%rax
cmpl   $0x80,0x4(%rax)
je     12ad <expectedmsgrcd+0x17d>
mov    -0x8(%rbp),%rax
cmpl   $0x88,0x4(%rax)
jne    12b1 <expectedmsgrcd+0x181>
movb   $0x1,-0x1a(%rbp)
jmp    1311 <expectedmsgrcd+0x1e1>
mov    -0x8(%rbp),%rax
cmpl   $0x0,0x4(%rax)
je     12d2 <expectedmsgrcd+0x1a2>
mov    -0x8(%rbp),%rax
cmpl   $0x60,0x4(%rax)
jne    12d6 <expectedmsgrcd+0x1a6>
movb   $0x1,-0x1a(%rbp)
jmp    1311 <expectedmsgrcd+0x1e1>
mov    -0x8(%rbp),%rax
cmpl   $0x20,0x4(%rax)
je     12f7 <expectedmsgrcd+0x1c7>
mov    -0x8(%rbp),%rax
cmpl   $0x40,0x4(%rax)
jne    12fb <expectedmsgrcd+0x1cb>
movb   $0x1,-0x1a(%rbp)
jmp    1311 <expectedmsgrcd+0x1e1>
mov    -0x14(%rbp),%esi
lea    0xcf6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x1a(%rbp),%eax
cmp    $0x0,%eax
jne    145b <expectedmsgrcd+0x32b>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x28(%rbp)
test   %eax,%eax
je     1417 <expectedmsgrcd+0x2e7>
jmp    1335 <expectedmsgrcd+0x205>
mov    -0x28(%rbp),%eax
sub    $0x20,%eax
je     142c <expectedmsgrcd+0x2fc>
jmp    1346 <expectedmsgrcd+0x216>
mov    -0x28(%rbp),%eax
sub    $0x40,%eax
je     142c <expectedmsgrcd+0x2fc>
jmp    1357 <expectedmsgrcd+0x227>
mov    -0x28(%rbp),%eax
sub    $0x60,%eax
je     1417 <expectedmsgrcd+0x2e7>
jmp    1368 <expectedmsgrcd+0x238>
mov    -0x28(%rbp),%eax
sub    $0x80,%eax
je     1402 <expectedmsgrcd+0x2d2>
jmp    137b <expectedmsgrcd+0x24b>
mov    -0x28(%rbp),%eax
sub    $0x88,%eax
je     1402 <expectedmsgrcd+0x2d2>
jmp    138e <expectedmsgrcd+0x25e>
mov    -0x28(%rbp),%eax
sub    $0xa0,%eax
je     1402 <expectedmsgrcd+0x2d2>
jmp    13a1 <expectedmsgrcd+0x271>
mov    -0x28(%rbp),%eax
sub    $0xb8,%eax
je     13ed <expectedmsgrcd+0x2bd>
jmp    13b4 <expectedmsgrcd+0x284>
mov    -0x28(%rbp),%eax
sub    $0xc0,%eax
je     13ed <expectedmsgrcd+0x2bd>
jmp    13c7 <expectedmsgrcd+0x297>
mov    -0x28(%rbp),%eax
sub    $0xd0,%eax
je     13ed <expectedmsgrcd+0x2bd>
jmp    13da <expectedmsgrcd+0x2aa>
mov    -0x28(%rbp),%eax
sub    $0xe0,%eax
jne    1441 <expectedmsgrcd+0x311>
jmp    13ed <expectedmsgrcd+0x2bd>
lea    -0x19(%rbp),%rdi
lea    0xc2b(%rip),%rsi
call   1050 <strcat@plt>
jmp    1456 <expectedmsgrcd+0x326>
lea    -0x19(%rbp),%rdi
lea    0xc19(%rip),%rsi
call   1050 <strcat@plt>
jmp    1456 <expectedmsgrcd+0x326>
lea    -0x19(%rbp),%rdi
lea    0xc07(%rip),%rsi
call   1050 <strcat@plt>
jmp    1456 <expectedmsgrcd+0x326>
lea    -0x19(%rbp),%rdi
lea    0xbf5(%rip),%rsi
call   1050 <strcat@plt>
jmp    1456 <expectedmsgrcd+0x326>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xbe0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    145b <expectedmsgrcd+0x32b>
mov    -0x8(%rbp),%rax
mov    0x28(%rax),%eax
mov    %eax,%edx
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %rsi,%rdx
cmove  %ecx,%eax
mov    %al,-0x15(%rbp)
movsbl -0x15(%rbp),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x29(%rbp)
je     1497 <expectedmsgrcd+0x367>
movsbl -0x1a(%rbp),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jne    14e2 <expectedmsgrcd+0x3b2>
mov    -0x8(%rbp),%rax
mov    0x28(%rax),%esi
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x14(%rbp),%r8d
lea    0xba2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x19(%rbp),%rsi
lea    0xbeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expectedmsgrcd>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x4(%rsp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1040 <memset@plt>
cmp    $0x87,%ebx
jle    117d <expectedmsgrcd+0x4d>
cmp    $0xbf,%ebx
jg     11c2 <expectedmsgrcd+0x92>
cmp    $0x88,%ebx
je     11a4 <expectedmsgrcd+0x74>
cmp    $0xa0,%ebx
je     11a4 <expectedmsgrcd+0x74>
cmp    $0xb8,%ebx
je     11e5 <expectedmsgrcd+0xb5>
jmp    129f <expectedmsgrcd+0x16f>
cmp    $0x3f,%ebx
jle    1218 <expectedmsgrcd+0xe8>
cmp    $0x40,%ebx
je     1221 <expectedmsgrcd+0xf1>
cmp    $0x60,%ebx
je     1264 <expectedmsgrcd+0x134>
cmp    $0x80,%ebx
jne    129f <expectedmsgrcd+0x16f>
mov    0x4(%r15),%ecx
lea    -0x80(%rcx),%eax
cmp    $0x20,%eax
ja     122f <expectedmsgrcd+0xff>
movabs $0x100000101,%rdx
bt     %rax,%rdx
jb     1201 <expectedmsgrcd+0xd1>
jmp    122f <expectedmsgrcd+0xff>
lea    -0xc0(%rbx),%eax
cmp    $0x20,%eax
ja     129f <expectedmsgrcd+0x16f>
movabs $0x100010001,%rcx
bt     %rax,%rcx
jae    129f <expectedmsgrcd+0x16f>
mov    0x4(%r15),%ecx
lea    -0xb8(%rcx),%eax
rol    $0x1d,%eax
cmp    $0x5,%eax
ja     122f <expectedmsgrcd+0xff>
mov    $0x2b,%edx
bt     %eax,%edx
jae    122f <expectedmsgrcd+0xff>
mov    0x28(%r15),%esi
mov    $0x1,%ebp
cmp    %r14,%rsi
jne    1306 <expectedmsgrcd+0x1d6>
jmp    132f <expectedmsgrcd+0x1ff>
test   %ebx,%ebx
je     1264 <expectedmsgrcd+0x134>
cmp    $0x20,%ebx
jne    129f <expectedmsgrcd+0x16f>
mov    0x4(%r15),%ecx
cmp    $0x20,%ecx
je     1201 <expectedmsgrcd+0xd1>
cmp    $0x40,%ecx
je     1201 <expectedmsgrcd+0xd1>
cmp    $0x87,%ecx
jle    12bb <expectedmsgrcd+0x18b>
cmp    $0xbf,%ecx
jg     1273 <expectedmsgrcd+0x143>
cmp    $0x88,%ecx
je     12d2 <expectedmsgrcd+0x1a2>
cmp    $0xa0,%ecx
je     12d2 <expectedmsgrcd+0x1a2>
cmp    $0xb8,%ecx
je     1296 <expectedmsgrcd+0x166>
jmp    133c <expectedmsgrcd+0x20c>
mov    0x4(%r15),%ecx
test   %ecx,%ecx
je     1201 <expectedmsgrcd+0xd1>
cmp    $0x60,%ecx
je     1201 <expectedmsgrcd+0xd1>
jmp    122f <expectedmsgrcd+0xff>
lea    -0xc0(%rcx),%eax
cmp    $0x20,%eax
ja     133c <expectedmsgrcd+0x20c>
movabs $0x100010001,%rdx
bt     %rax,%rdx
jae    133c <expectedmsgrcd+0x20c>
lea    0xd86(%rip),%rsi
jmp    12f4 <expectedmsgrcd+0x1c4>
lea    0xd5a(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x4(%r15),%ecx
cmp    $0x87,%ecx
jg     123b <expectedmsgrcd+0x10b>
cmp    $0x3f,%ecx
jle    12db <expectedmsgrcd+0x1ab>
cmp    $0x40,%ecx
je     12e4 <expectedmsgrcd+0x1b4>
cmp    $0x60,%ecx
je     12ed <expectedmsgrcd+0x1bd>
cmp    $0x80,%ecx
jne    133c <expectedmsgrcd+0x20c>
lea    0xd4d(%rip),%rsi
jmp    12f4 <expectedmsgrcd+0x1c4>
test   %ecx,%ecx
je     12ed <expectedmsgrcd+0x1bd>
cmp    $0x20,%ecx
jne    133c <expectedmsgrcd+0x20c>
lea    0xd41(%rip),%rsi
jmp    12f4 <expectedmsgrcd+0x1c4>
lea    0xd35(%rip),%rsi
lea    0x4(%rsp),%rdi
call   1050 <strcat@plt>
mov    0x4(%r15),%ecx
mov    0x28(%r15),%esi
lea    0xd5e(%rip),%rdi
xor    %ebp,%ebp
mov    %r14,%rdx
mov    %ebx,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xda3(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcec(%rip),%rdi
mov    %ecx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    12fe <expectedmsgrcd+0x1ce>

LLVM IR (-O0):
@.str = [35 x i8] c"\0Aexpectedmsgrcd not know tos=0x%x\0A\00"
@.str.1 = [3 x i8] c"VO\00"
@.str.2 = [3 x i8] c"VI\00"
@.str.3 = [3 x i8] c"BE\00"
@.str.4 = [3 x i8] c"BK\00"
@.str.5 = [60 x i8] c"\0Aexpectedmsgrcd check unexpected TOS:not know rmsg[1]=0x%x\0A\00"
@.str.6 = [91 x i8] c"\0Aexpectedmsgrcd no match: rmsg[10] %u expect type %lu rmsg[1] as tos 0x%x expect tos 0x%x\0A\00"
@.str.7 = [58 x i8] c"expectedmsgrcd::rcv %s as repeate pkt for previous state\0A\00"
define i32 @expectedmsgrcd(i32* %0, i64 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i64
%6 = alloca i32
%7 = alloca i8
%8 = alloca [4 x i8]
%9 = alloca i8
%10 = alloca i32
store i32* %0, i32** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
store i8 0, i8* %7
store i8 0, i8* %9
store i32 0, i32* %10
%11 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%12 = call i32 @memset(i8* %11, i32 0, i32 4)
%13 = load i32, i32* %6
switch i32 %13, label %77 [
i32 224, label %14
i32 208, label %14
i32 192, label %14
i32 184, label %14
i32 160, label %36
i32 128, label %36
i32 136, label %36
i32 0, label %53
i32 96, label %53
i32 32, label %65
i32 64, label %65
]
14: ; preds = %3, %3, %3, %3
%15 = load i32*, i32** %4
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = load i32, i32* %16
%18 = icmp eq i32 %17, 224
br i1 %18, label %34, label %19
19: ; preds = %14
%20 = load i32*, i32** %4
%21 = getelementptr inbounds i32, i32* %20, i64 1
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 208
br i1 %23, label %34, label %24
24: ; preds = %19
%25 = load i32*, i32** %4
%26 = getelementptr inbounds i32, i32* %25, i64 1
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 192
br i1 %28, label %34, label %29
29: ; preds = %24
%30 = load i32*, i32** %4
%31 = getelementptr inbounds i32, i32* %30, i64 1
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 184
br i1 %33, label %34, label %35
34: ; preds = %29, %24, %19, %14
store i8 1, i8* %9
br label %35
35: ; preds = %34, %29
br label %80
36: ; preds = %3, %3, %3
%37 = load i32*, i32** %4
%38 = getelementptr inbounds i32, i32* %37, i64 1
%39 = load i32, i32* %38
%40 = icmp eq i32 %39, 160
br i1 %40, label %51, label %41
41: ; preds = %36
%42 = load i32*, i32** %4
%43 = getelementptr inbounds i32, i32* %42, i64 1
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, 128
br i1 %45, label %51, label %46
46: ; preds = %41
%47 = load i32*, i32** %4
%48 = getelementptr inbounds i32, i32* %47, i64 1
%49 = load i32, i32* %48
%50 = icmp eq i32 %49, 136
br i1 %50, label %51, label %52
51: ; preds = %46, %41, %36
store i8 1, i8* %9
br label %52
52: ; preds = %51, %46
br label %80
53: ; preds = %3, %3
%54 = load i32*, i32** %4
%55 = getelementptr inbounds i32, i32* %54, i64 1
%56 = load i32, i32* %55
%57 = icmp eq i32 %56, 0
br i1 %57, label %63, label %58
58: ; preds = %53
%59 = load i32*, i32** %4
%60 = getelementptr inbounds i32, i32* %59, i64 1
%61 = load i32, i32* %60
%62 = icmp eq i32 %61, 96
br i1 %62, label %63, label %64
63: ; preds = %58, %53
store i8 1, i8* %9
br label %64
64: ; preds = %63, %58
br label %80
65: ; preds = %3, %3
%66 = load i32*, i32** %4
%67 = getelementptr inbounds i32, i32* %66, i64 1
%68 = load i32, i32* %67
%69 = icmp eq i32 %68, 32
br i1 %69, label %75, label %70
70: ; preds = %65
%71 = load i32*, i32** %4
%72 = getelementptr inbounds i32, i32* %71, i64 1
%73 = load i32, i32* %72
%74 = icmp eq i32 %73, 64
br i1 %74, label %75, label %76
75: ; preds = %70, %65
store i8 1, i8* %9
br label %76
76: ; preds = %75, %70
br label %80
77: ; preds = %3
%78 = load i32, i32* %6
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %78)
br label %80
80: ; preds = %77, %76, %64, %52, %35
%81 = load i8, i8* %9
%82 = sext i8 %81 to i32
%83 = icmp eq i32 %82, 0
br i1 %83, label %84, label %106
84: ; preds = %80
%85 = load i32*, i32** %4
%86 = getelementptr inbounds i32, i32* %85, i64 1
%87 = load i32, i32* %86
switch i32 %87, label %100 [
i32 224, label %88
i32 208, label %88
i32 192, label %88
i32 184, label %88
i32 160, label %91
i32 128, label %91
i32 136, label %91
i32 0, label %94
i32 96, label %94
i32 32, label %97
i32 64, label %97
]
88: ; preds = %84, %84, %84, %84
%89 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%90 = call i32 @strcat(i8* %89, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %105
91: ; preds = %84, %84, %84
%92 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%93 = call i32 @strcat(i8* %92, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %105
94: ; preds = %84, %84
%95 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%96 = call i32 @strcat(i8* %95, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %105
97: ; preds = %84, %84
%98 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%99 = call i32 @strcat(i8* %98, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %105
100: ; preds = %84
%101 = load i32*, i32** %4
%102 = getelementptr inbounds i32, i32* %101, i64 1
%103 = load i32, i32* %102
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0), i32 %103)
br label %105
105: ; preds = %100, %97, %94, %91, %88
br label %106
106: ; preds = %105, %80
%107 = load i32*, i32** %4
%108 = getelementptr inbounds i32, i32* %107, i64 10
%109 = load i32, i32* %108
%110 = zext i32 %109 to i64
%111 = load i64, i64* %5
%112 = icmp eq i64 %110, %111
%113 = zext i1 %112 to i64
%114 = select i1 %112, i32 1, i32 0
%115 = trunc i32 %114 to i8
store i8 %115, i8* %7
%116 = load i8, i8* %7
%117 = sext i8 %116 to i32
%118 = icmp ne i32 %117, 0
br i1 %118, label %119, label %123
119: ; preds = %106
%120 = load i8, i8* %9
%121 = sext i8 %120 to i32
%122 = icmp ne i32 %121, 0
br label %123
123: ; preds = %119, %106
%124 = phi i1 [ false, %106 ], [ %122, %119 ]
%125 = zext i1 %124 to i32
store i32 %125, i32* %10
%126 = load i32, i32* %10
%127 = icmp ne i32 %126, 0
br i1 %127, label %140, label %128
128: ; preds = %123
%129 = load i32*, i32** %4
%130 = getelementptr inbounds i32, i32* %129, i64 10
%131 = load i32, i32* %130
%132 = load i64, i64* %5
%133 = load i32*, i32** %4
%134 = getelementptr inbounds i32, i32* %133, i64 1
%135 = load i32, i32* %134
%136 = load i32, i32* %6
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([91 x i8], [91 x i8]* @.str.6, i64 0, i64 0), i32 %131, i64 %132, i32 %135, i32 %136)
%138 = getelementptr inbounds [4 x i8], [4 x i8]* %8, i64 0, i64 0
%139 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.7, i64 0, i64 0), i8* %138)
br label %140
140: ; preds = %128, %123
%141 = load i32, i32* %10
ret i32 %141
}

LLVM IR (-O2):
@.str = [35 x i8] c"\0Aexpectedmsgrcd not know tos=0x%x\0A\00"
@.str.1 = [3 x i8] c"VO\00"
@.str.2 = [3 x i8] c"VI\00"
@.str.3 = [3 x i8] c"BE\00"
@.str.4 = [3 x i8] c"BK\00"
@.str.5 = [60 x i8] c"\0Aexpectedmsgrcd check unexpected TOS:not know rmsg[1]=0x%x\0A\00"
@.str.6 = [91 x i8] c"\0Aexpectedmsgrcd no match: rmsg[10] %u expect type %lu rmsg[1] as tos 0x%x expect tos 0x%x\0A\00"
@.str.7 = [58 x i8] c"expectedmsgrcd::rcv %s as repeate pkt for previous state\0A\00"
define i32 @expectedmsgrcd(i32* nocapture %0, i64 %1, i32 %2) {
%4 = alloca [4 x i8]
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %4, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 4)
switch i32 %2, label %21 [
i32 224, label %7
i32 208, label %7
i32 192, label %7
i32 184, label %7
i32 160, label %12
i32 128, label %12
i32 136, label %12
i32 0, label %15
i32 96, label %15
i32 32, label %18
i32 64, label %18
]
7: ; preds = %3, %3, %3, %3
%8 = getelementptr inbounds i32, i32* %0, i64 1
%9 = load i32, i32* %8
%10 = add i32 %9, -184
%11 = call i32 @llvm.fshl.i32(i32 %10, i32 %10, i32 29)
switch i32 %11, label %25 [
i32 5, label %42
i32 3, label %42
i32 1, label %42
i32 0, label %42
]
12: ; preds = %3, %3, %3
%13 = getelementptr inbounds i32, i32* %0, i64 1
%14 = load i32, i32* %13
switch i32 %14, label %25 [
i32 160, label %42
i32 128, label %42
i32 136, label %42
]
15: ; preds = %3, %3
%16 = getelementptr inbounds i32, i32* %0, i64 1
%17 = load i32, i32* %16
switch i32 %17, label %25 [
i32 0, label %42
i32 96, label %42
]
18: ; preds = %3, %3
%19 = getelementptr inbounds i32, i32* %0, i64 1
%20 = load i32, i32* %19
switch i32 %20, label %25 [
i32 32, label %42
i32 64, label %42
]
21: ; preds = %3
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %2)
%23 = getelementptr inbounds i32, i32* %0, i64 1
%24 = load i32, i32* %23
br label %25
25: ; preds = %21, %7, %12, %15, %18
%26 = phi i32 [ %24, %21 ], [ %9, %7 ], [ %14, %12 ], [ %17, %15 ], [ %20, %18 ]
%27 = getelementptr inbounds i32, i32* %0, i64 1
switch i32 %26, label %36 [
i32 224, label %28
i32 208, label %28
i32 192, label %28
i32 184, label %28
i32 160, label %30
i32 128, label %30
i32 136, label %30
i32 0, label %32
i32 96, label %32
i32 32, label %34
i32 64, label %34
]
28: ; preds = %25, %25, %25, %25
%29 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %38
30: ; preds = %25, %25, %25
%31 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %38
32: ; preds = %25, %25
%33 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %38
34: ; preds = %25, %25
%35 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %38
36: ; preds = %25
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.5, i64 0, i64 0), i32 %26)
br label %38
38: ; preds = %28, %30, %32, %34, %36
%39 = getelementptr inbounds i32, i32* %0, i64 10
%40 = load i32, i32* %39
%41 = load i32, i32* %27
br label %48
42: ; preds = %18, %18, %15, %15, %12, %12, %12, %7, %7, %7, %7
%43 = phi i32 [ %20, %18 ], [ %20, %18 ], [ %17, %15 ], [ %17, %15 ], [ %14, %12 ], [ %14, %12 ], [ %14, %12 ], [ %9, %7 ], [ %9, %7 ], [ %9, %7 ], [ %9, %7 ]
%44 = getelementptr inbounds i32, i32* %0, i64 10
%45 = load i32, i32* %44
%46 = zext i32 %45 to i64
%47 = icmp eq i64 %46, %1
br i1 %47, label %53, label %48
48: ; preds = %38, %42
%49 = phi i32 [ %41, %38 ], [ %43, %42 ]
%50 = phi i32 [ %40, %38 ], [ %45, %42 ]
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([91 x i8], [91 x i8]* @.str.6, i64 0, i64 0), i32 %50, i64 %1, i32 %49, i32 %2)
%52 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.7, i64 0, i64 0), i8* %5)
br label %53
53: ; preds = %48, %42
%54 = phi i32 [ 0, %48 ], [ 1, %42 ]
ret i32 %54
}