#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*/ fc8300_read(void *, unsigned short, int, unsigned char *);
int /*<<< orphan*/ fc8300_write(void *, unsigned short, int, int);
int /*<<< orphan*/ msWait(int);
unsigned int vco_cal(void *handle, unsigned short devid, unsigned char offset) {
  unsigned char vco_table[4][4] = {{0xbb, 0xbb, 0xbb, 0xbb},
                                   {0xb3, 0xbb, 0xbb, 0xbb},
                                   {0x32, 0x43, 0x54, 0x65},
                                   {0x0f, 0x10, 0x21, 0x32}};
  unsigned char ib[4] = {0, 0, 0, 0};
  unsigned char i = 0;
  unsigned char j = 0;
  unsigned char read_temp = 0;
  if (offset == vco_table[3][0])
    offset = 1;
  else if (offset == vco_table[3][1])
    offset = 2;
  else if (offset == vco_table[3][2])
    offset = 3;
  for (j = offset; j < 4; j++) {
    for (i = 0; i < 4; i++)
      fc8300_write(handle, devid, (0x71 + i), vco_table[i][j]);
    fc8300_write(handle, devid, 0x5f, 0x40);
    fc8300_write(handle, devid, 0x6d, 0x0f);
    fc8300_write(handle, devid, 0x6e, 0x1f);
    fc8300_write(handle, devid, 0x6f, 0x3f);
    fc8300_write(handle, devid, 0x6a, 0x04);
    fc8300_write(handle, devid, 0x6a, 0x14);
    fc8300_write(handle, devid, 0x75, 0x30);
    for (i = 0; i < 10; i++) {
      msWait(1);
      fc8300_read(handle, devid, 0x76, &read_temp);
      if (read_temp == 0x20)
        break;
    }
    for (i = 0; i < 4; i++) {
      fc8300_write(handle, devid, 0x75, (0x34 + i));
      fc8300_read(handle, devid, 0x76, &read_temp);
      ib[i] = read_temp;
    }
    read_temp = (ib[0] == 0)   ? 0
                : (ib[1] == 0) ? 0
                : (ib[2] == 0) ? 0
                : (ib[3] == 0) ? 0
                               : 1;
    if (read_temp != 0) {
      fc8300_write(handle, devid, 0x5f, 0x00);
      return 0;
    }
  }
  fc8300_write(handle, devid, 0x6a, 0x15);
  fc8300_write(handle, devid, 0x70, 0x7f);
  return 0;
}


x86 assembly (clang, -O0):
<vco_cal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %dl,%al
mov    %si,%cx
mov    %rdi,-0x10(%rbp)
mov    %cx,-0x12(%rbp)
mov    %al,-0x13(%rbp)
mov    0xea1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xe9e(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x34(%rbp),%rdi
xor    %esi,%esi
mov    $0x4,%edx
call   1030 <memset@plt>
movb   $0x0,-0x35(%rbp)
movb   $0x0,-0x36(%rbp)
movb   $0x0,-0x37(%rbp)
movzbl -0x13(%rbp),%eax
movzbl -0x24(%rbp),%ecx
cmp    %ecx,%eax
jne    11a3 <vco_cal+0x63>
movb   $0x1,-0x13(%rbp)
jmp    11da <vco_cal+0x9a>
movzbl -0x13(%rbp),%eax
movzbl -0x23(%rbp),%ecx
cmp    %ecx,%eax
jne    11bc <vco_cal+0x7c>
movb   $0x2,-0x13(%rbp)
jmp    11d5 <vco_cal+0x95>
movzbl -0x13(%rbp),%eax
movzbl -0x22(%rbp),%ecx
cmp    %ecx,%eax
jne    11d0 <vco_cal+0x90>
movb   $0x3,-0x13(%rbp)
jmp    11d5 <vco_cal+0x95>
jmp    11da <vco_cal+0x9a>
mov    -0x13(%rbp),%al
mov    %al,-0x36(%rbp)
movzbl -0x36(%rbp),%eax
cmp    $0x4,%eax
jge    1436 <vco_cal+0x2f6>
movb   $0x0,-0x35(%rbp)
movzbl -0x35(%rbp),%eax
cmp    $0x4,%eax
jge    123b <vco_cal+0xfb>
mov    -0x10(%rbp),%rdi
mov    -0x12(%rbp),%ax
movzbl -0x35(%rbp),%edx
add    $0x71,%edx
movzbl -0x35(%rbp),%ecx
mov    %ecx,%esi
lea    -0x30(%rbp),%rcx
shl    $0x2,%rsi
add    %rsi,%rcx
movzbl -0x36(%rbp),%esi
movzbl (%rcx,%rsi,1),%ecx
movzwl %ax,%esi
call   1060 <fc8300_write@plt>
mov    -0x35(%rbp),%al
add    $0x1,%al
mov    %al,-0x35(%rbp)
jmp    11f1 <vco_cal+0xb1>
mov    -0x10(%rbp),%rdi
mov    $0x5f,%edx
mov    $0x40,%ecx
movzwl -0x12(%rbp),%esi
call   1060 <fc8300_write@plt>
mov    -0x10(%rbp),%rdi
mov    $0x6d,%edx
mov    $0xf,%ecx
movzwl -0x12(%rbp),%esi
call   1060 <fc8300_write@plt>
mov    -0x10(%rbp),%rdi
mov    $0x6e,%edx
mov    $0x1f,%ecx
movzwl -0x12(%rbp),%esi
call   1060 <fc8300_write@plt>
mov    -0x10(%rbp),%rdi
mov    $0x6f,%edx
mov    $0x3f,%ecx
movzwl -0x12(%rbp),%esi
call   1060 <fc8300_write@plt>
mov    -0x10(%rbp),%rdi
mov    $0x6a,%edx
mov    $0x4,%ecx
movzwl -0x12(%rbp),%esi
call   1060 <fc8300_write@plt>
mov    -0x10(%rbp),%rdi
mov    $0x6a,%edx
mov    $0x14,%ecx
movzwl -0x12(%rbp),%esi
call   1060 <fc8300_write@plt>
mov    -0x10(%rbp),%rdi
mov    $0x75,%edx
mov    $0x30,%ecx
movzwl -0x12(%rbp),%esi
call   1060 <fc8300_write@plt>
movb   $0x0,-0x35(%rbp)
movzbl -0x35(%rbp),%eax
cmp    $0xa,%eax
jge    1331 <vco_cal+0x1f1>
mov    $0x1,%edi
call   1050 <msWait@plt>
mov    -0x10(%rbp),%rdi
mov    $0x76,%edx
lea    -0x37(%rbp),%rcx
movzwl -0x12(%rbp),%esi
call   1040 <fc8300_read@plt>
movzbl -0x37(%rbp),%eax
cmp    $0x20,%eax
jne    131f <vco_cal+0x1df>
jmp    1331 <vco_cal+0x1f1>
jmp    1324 <vco_cal+0x1e4>
mov    -0x35(%rbp),%al
add    $0x1,%al
mov    %al,-0x35(%rbp)
jmp    12e0 <vco_cal+0x1a0>
movb   $0x0,-0x35(%rbp)
movzbl -0x35(%rbp),%eax
cmp    $0x4,%eax
jge    138c <vco_cal+0x24c>
mov    -0x10(%rbp),%rdi
mov    -0x12(%rbp),%ax
movzbl -0x35(%rbp),%ecx
add    $0x34,%ecx
mov    $0x75,%edx
movzwl %ax,%esi
call   1060 <fc8300_write@plt>
mov    -0x10(%rbp),%rdi
mov    $0x76,%edx
lea    -0x37(%rbp),%rcx
movzwl -0x12(%rbp),%esi
call   1040 <fc8300_read@plt>
mov    -0x37(%rbp),%cl
movzbl -0x35(%rbp),%eax
mov    %cl,-0x34(%rbp,%rax,1)
mov    -0x35(%rbp),%al
add    $0x1,%al
mov    %al,-0x35(%rbp)
jmp    1335 <vco_cal+0x1f5>
movzbl -0x34(%rbp),%eax
cmp    $0x0,%eax
jne    13a3 <vco_cal+0x263>
xor    %eax,%eax
mov    %eax,-0x3c(%rbp)
jmp    13f1 <vco_cal+0x2b1>
movzbl -0x33(%rbp),%eax
cmp    $0x0,%eax
jne    13ba <vco_cal+0x27a>
xor    %eax,%eax
mov    %eax,-0x40(%rbp)
jmp    13eb <vco_cal+0x2ab>
movzbl -0x32(%rbp),%eax
cmp    $0x0,%eax
jne    13d1 <vco_cal+0x291>
xor    %eax,%eax
mov    %eax,-0x44(%rbp)
jmp    13e5 <vco_cal+0x2a5>
movzbl -0x31(%rbp),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %eax,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %al,-0x37(%rbp)
movzbl -0x37(%rbp),%eax
cmp    $0x0,%eax
je     1424 <vco_cal+0x2e4>
mov    -0x10(%rbp),%rdi
mov    $0x5f,%edx
xor    %ecx,%ecx
movzwl -0x12(%rbp),%esi
call   1060 <fc8300_write@plt>
movl   $0x0,-0x4(%rbp)
jmp    146b <vco_cal+0x32b>
jmp    1429 <vco_cal+0x2e9>
mov    -0x36(%rbp),%al
add    $0x1,%al
mov    %al,-0x36(%rbp)
jmp    11e0 <vco_cal+0xa0>
mov    -0x10(%rbp),%rdi
mov    $0x6a,%edx
mov    $0x15,%ecx
movzwl -0x12(%rbp),%esi
call   1060 <fc8300_write@plt>
mov    -0x10(%rbp),%rdi
mov    $0x70,%edx
mov    $0x7f,%ecx
movzwl -0x12(%rbp),%esi
call   1060 <fc8300_write@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vco_cal>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
movb   $0x0,0x6(%rsp)
movzwl %si,%ebp
cmp    $0xf,%dl
je     1159 <vco_cal+0x29>
cmp    $0x21,%dl
je     115d <vco_cal+0x2d>
cmp    $0x10,%dl
jne    1161 <vco_cal+0x31>
mov    $0x2,%dl
jmp    116a <vco_cal+0x3a>
mov    $0x1,%dl
jmp    116a <vco_cal+0x3a>
mov    $0x3,%dl
jmp    116a <vco_cal+0x3a>
cmp    $0x4,%dl
jae    1378 <vco_cal+0x248>
movzbl %dl,%r15d
lea    0x6(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xe79(%rip),%rbx
movzbl (%r15,%rbx,1),%ecx
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x71,%edx
call   1050 <fc8300_write@plt>
movzbl 0x4(%r15,%rbx,1),%ecx
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x72,%edx
call   1050 <fc8300_write@plt>
movzbl 0x8(%r15,%rbx,1),%ecx
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x73,%edx
call   1050 <fc8300_write@plt>
movzbl 0xc(%r15,%rbx,1),%ecx
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x74,%edx
call   1050 <fc8300_write@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x5f,%edx
mov    $0x40,%ecx
call   1050 <fc8300_write@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x6d,%edx
mov    $0xf,%ecx
call   1050 <fc8300_write@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x6e,%edx
mov    $0x1f,%ecx
call   1050 <fc8300_write@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x6f,%edx
mov    $0x3f,%ecx
call   1050 <fc8300_write@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x6a,%edx
mov    $0x4,%ecx
call   1050 <fc8300_write@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x6a,%edx
mov    $0x14,%ecx
call   1050 <fc8300_write@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x75,%edx
mov    $0x30,%ecx
call   1050 <fc8300_write@plt>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1040 <msWait@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x76,%edx
mov    %r14,%rcx
call   1030 <fc8300_read@plt>
cmpb   $0x20,0x6(%rsp)
je     129d <vco_cal+0x16d>
lea    0x1(%rbx),%eax
cmp    $0x9,%bl
mov    %eax,%ebx
jb     1270 <vco_cal+0x140>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x75,%edx
mov    $0x34,%ecx
call   1050 <fc8300_write@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x76,%edx
mov    %r14,%rcx
call   1030 <fc8300_read@plt>
cmpb   $0x0,0x6(%rsp)
setne  0x7(%rsp)
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x75,%edx
mov    $0x35,%ecx
call   1050 <fc8300_write@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x76,%edx
mov    %r14,%rcx
call   1030 <fc8300_read@plt>
cmpb   $0x0,0x6(%rsp)
setne  %r12b
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x75,%edx
mov    $0x36,%ecx
call   1050 <fc8300_write@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x76,%edx
mov    %r14,%rcx
call   1030 <fc8300_read@plt>
cmpb   $0x0,0x6(%rsp)
setne  %bl
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x75,%edx
mov    $0x37,%ecx
call   1050 <fc8300_write@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x76,%edx
mov    %r14,%rcx
call   1030 <fc8300_read@plt>
and    0x7(%rsp),%r12b
cmpb   $0x0,0x6(%rsp)
setne  %al
and    %bl,%al
and    %r12b,%al
mov    %al,0x6(%rsp)
cmp    $0x1,%al
je     139d <vco_cal+0x26d>
add    $0x1,%r15
cmp    $0x4,%r15
jne    1180 <vco_cal+0x50>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x6a,%edx
mov    $0x15,%ecx
call   1050 <fc8300_write@plt>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x70,%edx
mov    $0x7f,%ecx
jmp    13a9 <vco_cal+0x279>
mov    %r13,%rdi
mov    %ebp,%esi
mov    $0x5f,%edx
xor    %ecx,%ecx
call   1050 <fc8300_write@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.vco_cal.vco_table = [4 x [4 x i8]] [[4 x i8] c"\BB\BB\BB\BB", [4 x i8] c"\B3\BB\BB\BB", [4 x i8] c"2CTe", [4 x i8] c"\0F\10!2"]
define i32 @vco_cal(i8* %0, i16 zeroext %1, i8 zeroext %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i16
%7 = alloca i8
%8 = alloca [4 x [4 x i8]]
%9 = alloca [4 x i8]
%10 = alloca i8
%11 = alloca i8
%12 = alloca i8
store i8* %0, i8** %5
store i16 %1, i16* %6
store i8 %2, i8* %7
%13 = bitcast [4 x [4 x i8]]* %8 to i8*
%14 = bitcast [4 x i8]* %9 to i8*
store i8 0, i8* %10
store i8 0, i8* %11
store i8 0, i8* %12
%15 = load i8, i8* %7
%16 = zext i8 %15 to i32
%17 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* %8, i64 0, i64 3
%18 = getelementptr inbounds [4 x i8], [4 x i8]* %17, i64 0, i64 0
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = icmp eq i32 %16, %20
br i1 %21, label %22, label %23
22: ; preds = %3
store i8 1, i8* %7
br label %43
23: ; preds = %3
%24 = load i8, i8* %7
%25 = zext i8 %24 to i32
%26 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* %8, i64 0, i64 3
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %26, i64 0, i64 1
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
%30 = icmp eq i32 %25, %29
br i1 %30, label %31, label %32
31: ; preds = %23
store i8 2, i8* %7
br label %42
32: ; preds = %23
%33 = load i8, i8* %7
%34 = zext i8 %33 to i32
%35 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* %8, i64 0, i64 3
%36 = getelementptr inbounds [4 x i8], [4 x i8]* %35, i64 0, i64 2
%37 = load i8, i8* %36
%38 = zext i8 %37 to i32
%39 = icmp eq i32 %34, %38
br i1 %39, label %40, label %41
40: ; preds = %32
store i8 3, i8* %7
br label %41
41: ; preds = %40, %32
br label %42
42: ; preds = %41, %31
br label %43
43: ; preds = %42, %22
%44 = load i8, i8* %7
store i8 %44, i8* %11
br label %45
45: ; preds = %173, %43
%46 = load i8, i8* %11
%47 = zext i8 %46 to i32
%48 = icmp slt i32 %47, 4
br i1 %48, label %49, label %176
49: ; preds = %45
store i8 0, i8* %10
br label %50
50: ; preds = %69, %49
%51 = load i8, i8* %10
%52 = zext i8 %51 to i32
%53 = icmp slt i32 %52, 4
br i1 %53, label %54, label %72
54: ; preds = %50
%55 = load i8*, i8** %5
%56 = load i16, i16* %6
%57 = load i8, i8* %10
%58 = zext i8 %57 to i32
%59 = add nsw i32 113, %58
%60 = load i8, i8* %10
%61 = zext i8 %60 to i64
%62 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* %8, i64 0, i64 %61
%63 = load i8, i8* %11
%64 = zext i8 %63 to i64
%65 = getelementptr inbounds [4 x i8], [4 x i8]* %62, i64 0, i64 %64
%66 = load i8, i8* %65
%67 = zext i8 %66 to i32
%68 = call i32 @fc8300_write(i8* %55, i16 zeroext %56, i32 %59, i32 %67)
br label %69
69: ; preds = %54
%70 = load i8, i8* %10
%71 = add i8 %70, 1
store i8 %71, i8* %10
br label %50
72: ; preds = %50
%73 = load i8*, i8** %5
%74 = load i16, i16* %6
%75 = call i32 @fc8300_write(i8* %73, i16 zeroext %74, i32 95, i32 64)
%76 = load i8*, i8** %5
%77 = load i16, i16* %6
%78 = call i32 @fc8300_write(i8* %76, i16 zeroext %77, i32 109, i32 15)
%79 = load i8*, i8** %5
%80 = load i16, i16* %6
%81 = call i32 @fc8300_write(i8* %79, i16 zeroext %80, i32 110, i32 31)
%82 = load i8*, i8** %5
%83 = load i16, i16* %6
%84 = call i32 @fc8300_write(i8* %82, i16 zeroext %83, i32 111, i32 63)
%85 = load i8*, i8** %5
%86 = load i16, i16* %6
%87 = call i32 @fc8300_write(i8* %85, i16 zeroext %86, i32 106, i32 4)
%88 = load i8*, i8** %5
%89 = load i16, i16* %6
%90 = call i32 @fc8300_write(i8* %88, i16 zeroext %89, i32 106, i32 20)
%91 = load i8*, i8** %5
%92 = load i16, i16* %6
%93 = call i32 @fc8300_write(i8* %91, i16 zeroext %92, i32 117, i32 48)
store i8 0, i8* %10
br label %94
94: ; preds = %108, %72
%95 = load i8, i8* %10
%96 = zext i8 %95 to i32
%97 = icmp slt i32 %96, 10
br i1 %97, label %98, label %111
98: ; preds = %94
%99 = call i32 @msWait(i32 1)
%100 = load i8*, i8** %5
%101 = load i16, i16* %6
%102 = call i32 @fc8300_read(i8* %100, i16 zeroext %101, i32 118, i8* %12)
%103 = load i8, i8* %12
%104 = zext i8 %103 to i32
%105 = icmp eq i32 %104, 32
br i1 %105, label %106, label %107
106: ; preds = %98
br label %111
107: ; preds = %98
br label %108
108: ; preds = %107
%109 = load i8, i8* %10
%110 = add i8 %109, 1
store i8 %110, i8* %10
br label %94
111: ; preds = %106, %94
store i8 0, i8* %10
br label %112
112: ; preds = %130, %111
%113 = load i8, i8* %10
%114 = zext i8 %113 to i32
%115 = icmp slt i32 %114, 4
br i1 %115, label %116, label %133
116: ; preds = %112
%117 = load i8*, i8** %5
%118 = load i16, i16* %6
%119 = load i8, i8* %10
%120 = zext i8 %119 to i32
%121 = add nsw i32 52, %120
%122 = call i32 @fc8300_write(i8* %117, i16 zeroext %118, i32 117, i32 %121)
%123 = load i8*, i8** %5
%124 = load i16, i16* %6
%125 = call i32 @fc8300_read(i8* %123, i16 zeroext %124, i32 118, i8* %12)
%126 = load i8, i8* %12
%127 = load i8, i8* %10
%128 = zext i8 %127 to i64
%129 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 %128
store i8 %126, i8* %129
br label %130
130: ; preds = %116
%131 = load i8, i8* %10
%132 = add i8 %131, 1
store i8 %132, i8* %10
br label %112
133: ; preds = %112
%134 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%135 = load i8, i8* %134
%136 = zext i8 %135 to i32
%137 = icmp eq i32 %136, 0
br i1 %137, label %138, label %139
138: ; preds = %133
br label %162
139: ; preds = %133
%140 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 1
%141 = load i8, i8* %140
%142 = zext i8 %141 to i32
%143 = icmp eq i32 %142, 0
br i1 %143, label %144, label %145
144: ; preds = %139
br label %160
145: ; preds = %139
%146 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 2
%147 = load i8, i8* %146
%148 = zext i8 %147 to i32
%149 = icmp eq i32 %148, 0
br i1 %149, label %150, label %151
150: ; preds = %145
br label %158
151: ; preds = %145
%152 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 3
%153 = load i8, i8* %152
%154 = zext i8 %153 to i32
%155 = icmp eq i32 %154, 0
%156 = zext i1 %155 to i64
%157 = select i1 %155, i32 0, i32 1
br label %158
158: ; preds = %151, %150
%159 = phi i32 [ 0, %150 ], [ %157, %151 ]
br label %160
160: ; preds = %158, %144
%161 = phi i32 [ 0, %144 ], [ %159, %158 ]
br label %162
162: ; preds = %160, %138
%163 = phi i32 [ 0, %138 ], [ %161, %160 ]
%164 = trunc i32 %163 to i8
store i8 %164, i8* %12
%165 = load i8, i8* %12
%166 = zext i8 %165 to i32
%167 = icmp ne i32 %166, 0
br i1 %167, label %168, label %172
168: ; preds = %162
%169 = load i8*, i8** %5
%170 = load i16, i16* %6
%171 = call i32 @fc8300_write(i8* %169, i16 zeroext %170, i32 95, i32 0)
store i32 0, i32* %4
br label %183
172: ; preds = %162
br label %173
173: ; preds = %172
%174 = load i8, i8* %11
%175 = add i8 %174, 1
store i8 %175, i8* %11
br label %45
176: ; preds = %45
%177 = load i8*, i8** %5
%178 = load i16, i16* %6
%179 = call i32 @fc8300_write(i8* %177, i16 zeroext %178, i32 106, i32 21)
%180 = load i8*, i8** %5
%181 = load i16, i16* %6
%182 = call i32 @fc8300_write(i8* %180, i16 zeroext %181, i32 112, i32 127)
store i32 0, i32* %4
br label %183
183: ; preds = %176, %168
%184 = load i32, i32* %4
ret i32 %184
}

LLVM IR (-O2):
@__const.vco_cal.vco_table = [4 x [4 x i8]] [[4 x i8] c"\BB\BB\BB\BB", [4 x i8] c"\B3\BB\BB\BB", [4 x i8] c"2CTe", [4 x i8] c"\0F\10!2"]
define i32 @vco_cal(i8* %0, i16 zeroext %1, i8 zeroext %2) {
%4 = alloca i8
store i8 0, i8* %4
switch i8 %2, label %6 [
i8 15, label %9
i8 16, label %5
i8 33, label %8
]
5: ; preds = %3
br label %9
6: ; preds = %3
%7 = icmp ult i8 %2, 4
br i1 %7, label %9, label %72
8: ; preds = %3
br label %9
9: ; preds = %3, %8, %5, %6
%10 = phi i8 [ %2, %6 ], [ 1, %3 ], [ 2, %5 ], [ 3, %8 ]
%11 = zext i8 %10 to i64
br label %14
12: ; preds = %48
%13 = icmp eq i64 %69, 4
br i1 %13, label %72, label %14
14: ; preds = %9, %12
%15 = phi i64 [ %11, %9 ], [ %69, %12 ]
%16 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* @__const.vco_cal.vco_table, i64 0, i64 0, i64 %15
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 113, i32 %18)
%20 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* @__const.vco_cal.vco_table, i64 0, i64 1, i64 %15
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 114, i32 %22)
%24 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* @__const.vco_cal.vco_table, i64 0, i64 2, i64 %15
%25 = load i8, i8* %24
%26 = zext i8 %25 to i32
%27 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 115, i32 %26)
%28 = getelementptr inbounds [4 x [4 x i8]], [4 x [4 x i8]]* @__const.vco_cal.vco_table, i64 0, i64 3, i64 %15
%29 = load i8, i8* %28
%30 = zext i8 %29 to i32
%31 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 116, i32 %30)
%32 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 95, i32 64)
%33 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 109, i32 15)
%34 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 110, i32 31)
%35 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 111, i32 63)
%36 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 106, i32 4)
%37 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 106, i32 20)
%38 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 117, i32 48)
br label %39
39: ; preds = %39, %14
%40 = phi i8 [ 0, %14 ], [ %45, %39 ]
%41 = call i32 @msWait(i32 1)
%42 = call i32 @fc8300_read(i8* %0, i16 zeroext %1, i32 118, i8* %4)
%43 = load i8, i8* %4
%44 = icmp ne i8 %43, 32
%45 = add nuw nsw i8 %40, 1
%46 = icmp ult i8 %40, 9
%47 = select i1 %44, i1 %46, i1 false
br i1 %47, label %39, label %48
48: ; preds = %39
%49 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 117, i32 52)
%50 = call i32 @fc8300_read(i8* %0, i16 zeroext %1, i32 118, i8* %4)
%51 = load i8, i8* %4
%52 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 117, i32 53)
%53 = call i32 @fc8300_read(i8* %0, i16 zeroext %1, i32 118, i8* %4)
%54 = load i8, i8* %4
%55 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 117, i32 54)
%56 = call i32 @fc8300_read(i8* %0, i16 zeroext %1, i32 118, i8* %4)
%57 = load i8, i8* %4
%58 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 117, i32 55)
%59 = call i32 @fc8300_read(i8* %0, i16 zeroext %1, i32 118, i8* %4)
%60 = load i8, i8* %4
%61 = icmp ne i8 %51, 0
%62 = icmp ne i8 %54, 0
%63 = select i1 %61, i1 %62, i1 false
%64 = icmp ne i8 %57, 0
%65 = select i1 %63, i1 %64, i1 false
%66 = icmp ne i8 %60, 0
%67 = select i1 %65, i1 %66, i1 false
%68 = zext i1 %67 to i8
store i8 %68, i8* %4
%69 = add nuw nsw i64 %15, 1
br i1 %67, label %70, label %12
70: ; preds = %48
%71 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 95, i32 0)
br label %75
72: ; preds = %12, %6
%73 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 106, i32 21)
%74 = call i32 @fc8300_write(i8* %0, i16 zeroext %1, i32 112, i32 127)
br label %75
75: ; preds = %72, %70
ret i32 0
}