#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*/ cw_bit(int, double);
void rx02_bitpair(int bit, double mult) {
  static int accum = 0;
  static int bitcount = 0;
  if (bit == -1) {
    accum = 0;
    bitcount = 0;
  } else if (bit == -2) {
    while (bitcount) {
      bitcount--;
      cw_bit((accum & (3 << bitcount)) == 0, mult);
      cw_bit((accum & (1 << bitcount)) != 0, mult);
    }
  } else {
    accum = (accum << 1) | bit;
    bitcount++;
    if (bitcount == 5) {
      if ((accum & 0x3f) == 0x1e) {
        cw_bit(1, mult);
        cw_bit(0, mult);
        cw_bit(0, mult);
        cw_bit(0, mult);
        cw_bit(1, mult);
        cw_bit(0, mult);
        cw_bit(0, mult);
        cw_bit(0, mult);
        cw_bit(1, mult);
        cw_bit(0, mult);
        bitcount = 0;
      } else {
        cw_bit((accum & (3 << 4)) == 0, mult);
        cw_bit((accum & (1 << 4)) != 0, mult);
        bitcount--;
      }
    }
  }
}


x86 assembly (clang, -O0):
<rx02_bitpair>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    1143 <rx02_bitpair+0x33>
movl   $0x0,0x2ef8(%rip)
movl   $0x0,0x2ef2(%rip)
jmp    12fa <rx02_bitpair+0x1ea>
cmpl   $0xfffffffe,-0x4(%rbp)
jne    11d0 <rx02_bitpair+0xc0>
jmp    1152 <rx02_bitpair+0x42>
cmpl   $0x0,0x2ed7(%rip)
je     11cb <rx02_bitpair+0xbb>
mov    0x2ecb(%rip),%eax
add    $0xffffffff,%eax
mov    %eax,0x2ec2(%rip)
mov    0x2eb8(%rip),%eax
mov    0x2eb6(%rip),%ecx
mov    $0x3,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
movsd  -0x10(%rbp),%xmm0
call   1030 <cw_bit@plt>
mov    0x2e8c(%rip),%eax
mov    0x2e8a(%rip),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
movsd  -0x10(%rbp),%xmm0
call   1030 <cw_bit@plt>
jmp    1152 <rx02_bitpair+0x42>
jmp    12f5 <rx02_bitpair+0x1e5>
mov    0x2e56(%rip),%eax
shl    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,0x2e4a(%rip)
mov    0x2e48(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e3f(%rip)
cmpl   $0x5,0x2e38(%rip)
jne    12f0 <rx02_bitpair+0x1e0>
mov    0x2e28(%rip),%eax
and    $0x3f,%eax
cmp    $0x1e,%eax
jne    12a0 <rx02_bitpair+0x190>
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%edi
call   1030 <cw_bit@plt>
movsd  -0x10(%rbp),%xmm0
xor    %edi,%edi
call   1030 <cw_bit@plt>
movsd  -0x10(%rbp),%xmm0
xor    %edi,%edi
call   1030 <cw_bit@plt>
movsd  -0x10(%rbp),%xmm0
xor    %edi,%edi
call   1030 <cw_bit@plt>
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%edi
call   1030 <cw_bit@plt>
movsd  -0x10(%rbp),%xmm0
xor    %edi,%edi
call   1030 <cw_bit@plt>
movsd  -0x10(%rbp),%xmm0
xor    %edi,%edi
call   1030 <cw_bit@plt>
movsd  -0x10(%rbp),%xmm0
xor    %edi,%edi
call   1030 <cw_bit@plt>
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%edi
call   1030 <cw_bit@plt>
movsd  -0x10(%rbp),%xmm0
xor    %edi,%edi
call   1030 <cw_bit@plt>
movl   $0x0,0x2d95(%rip)
jmp    12eb <rx02_bitpair+0x1db>
mov    0x2d86(%rip),%eax
and    $0x30,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
movsd  -0x10(%rbp),%xmm0
call   1030 <cw_bit@plt>
mov    0x2d68(%rip),%eax
and    $0x10,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%edi
movsd  -0x10(%rbp),%xmm0
call   1030 <cw_bit@plt>
mov    0x2d4e(%rip),%eax
add    $0xffffffff,%eax
mov    %eax,0x2d45(%rip)
jmp    12f0 <rx02_bitpair+0x1e0>
jmp    12f5 <rx02_bitpair+0x1e5>
jmp    12fa <rx02_bitpair+0x1ea>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rx02_bitpair>:
push   %rbx
sub    $0x10,%rsp
cmp    $0xffffffff,%edi
je     1190 <rx02_bitpair+0x80>
cmp    $0xfffffffe,%edi
jne    11a1 <rx02_bitpair+0x91>
mov    0x2f07(%rip),%ecx
test   %ecx,%ecx
je     1299 <rx02_bitpair+0x189>
movsd  %xmm0,0x8(%rsp)
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%ecx
mov    0x2ee3(%rip),%eax
shr    %cl,%eax
mov    %ecx,0x2edf(%rip)
xor    %edi,%edi
test   $0x3,%al
sete   %dil
movsd  0x8(%rsp),%xmm0
call   1030 <cw_bit@plt>
mov    0x2ec2(%rip),%edi
movzbl 0x2ebf(%rip),%ecx
shr    %cl,%edi
and    $0x1,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <cw_bit@plt>
mov    0x2ea9(%rip),%ecx
test   %ecx,%ecx
jne    1140 <rx02_bitpair+0x30>
jmp    1299 <rx02_bitpair+0x189>
movl   $0x0,0x2e92(%rip)
xor    %ebx,%ebx
jmp    1293 <rx02_bitpair+0x183>
mov    0x2e85(%rip),%eax
add    %eax,%eax
or     %edi,%eax
mov    %eax,0x2e7b(%rip)
mov    0x2e79(%rip),%ecx
add    $0x1,%ecx
mov    %ecx,0x2e70(%rip)
cmp    $0x5,%ecx
jne    1299 <rx02_bitpair+0x189>
mov    %eax,%ecx
and    $0x3f,%ecx
cmp    $0x1e,%ecx
movsd  %xmm0,0x8(%rsp)
jne    1266 <rx02_bitpair+0x156>
mov    $0x1,%edi
call   1030 <cw_bit@plt>
xor    %ebx,%ebx
xor    %edi,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <cw_bit@plt>
xor    %edi,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <cw_bit@plt>
xor    %edi,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <cw_bit@plt>
mov    $0x1,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <cw_bit@plt>
xor    %edi,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <cw_bit@plt>
xor    %edi,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <cw_bit@plt>
xor    %edi,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <cw_bit@plt>
mov    $0x1,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <cw_bit@plt>
xor    %edi,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <cw_bit@plt>
jmp    1293 <rx02_bitpair+0x183>
xor    %edi,%edi
test   $0x30,%al
sete   %dil
call   1030 <cw_bit@plt>
mov    0x2db3(%rip),%edi
shr    $0x4,%edi
and    $0x1,%edi
movsd  0x8(%rsp),%xmm0
call   1030 <cw_bit@plt>
mov    0x2da0(%rip),%ebx
add    $0xffffffff,%ebx
mov    %ebx,0x2d97(%rip)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@rx02_bitpair.accum = internal global i32 0
@rx02_bitpair.bitcount = internal global i32 0
define void @rx02_bitpair(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %8
7: ; preds = %2
store i32 0, i32* @rx02_bitpair.accum
store i32 0, i32* @rx02_bitpair.bitcount
br label %87
8: ; preds = %2
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, -2
br i1 %10, label %11, label %35
11: ; preds = %8
br label %12
12: ; preds = %15, %11
%13 = load i32, i32* @rx02_bitpair.bitcount
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %34
15: ; preds = %12
%16 = load i32, i32* @rx02_bitpair.bitcount
%17 = add nsw i32 %16, -1
store i32 %17, i32* @rx02_bitpair.bitcount
%18 = load i32, i32* @rx02_bitpair.accum
%19 = load i32, i32* @rx02_bitpair.bitcount
%20 = shl i32 3, %19
%21 = and i32 %18, %20
%22 = icmp eq i32 %21, 0
%23 = zext i1 %22 to i32
%24 = load double, double* %4
%25 = call i32 @cw_bit(i32 %23, double %24)
%26 = load i32, i32* @rx02_bitpair.accum
%27 = load i32, i32* @rx02_bitpair.bitcount
%28 = shl i32 1, %27
%29 = and i32 %26, %28
%30 = icmp ne i32 %29, 0
%31 = zext i1 %30 to i32
%32 = load double, double* %4
%33 = call i32 @cw_bit(i32 %31, double %32)
br label %12
34: ; preds = %12
br label %86
35: ; preds = %8
%36 = load i32, i32* @rx02_bitpair.accum
%37 = shl i32 %36, 1
%38 = load i32, i32* %3
%39 = or i32 %37, %38
store i32 %39, i32* @rx02_bitpair.accum
%40 = load i32, i32* @rx02_bitpair.bitcount
%41 = add nsw i32 %40, 1
store i32 %41, i32* @rx02_bitpair.bitcount
%42 = load i32, i32* @rx02_bitpair.bitcount
%43 = icmp eq i32 %42, 5
br i1 %43, label %44, label %85
44: ; preds = %35
%45 = load i32, i32* @rx02_bitpair.accum
%46 = and i32 %45, 63
%47 = icmp eq i32 %46, 30
br i1 %47, label %48, label %69
48: ; preds = %44
%49 = load double, double* %4
%50 = call i32 @cw_bit(i32 1, double %49)
%51 = load double, double* %4
%52 = call i32 @cw_bit(i32 0, double %51)
%53 = load double, double* %4
%54 = call i32 @cw_bit(i32 0, double %53)
%55 = load double, double* %4
%56 = call i32 @cw_bit(i32 0, double %55)
%57 = load double, double* %4
%58 = call i32 @cw_bit(i32 1, double %57)
%59 = load double, double* %4
%60 = call i32 @cw_bit(i32 0, double %59)
%61 = load double, double* %4
%62 = call i32 @cw_bit(i32 0, double %61)
%63 = load double, double* %4
%64 = call i32 @cw_bit(i32 0, double %63)
%65 = load double, double* %4
%66 = call i32 @cw_bit(i32 1, double %65)
%67 = load double, double* %4
%68 = call i32 @cw_bit(i32 0, double %67)
store i32 0, i32* @rx02_bitpair.bitcount
br label %84
69: ; preds = %44
%70 = load i32, i32* @rx02_bitpair.accum
%71 = and i32 %70, 48
%72 = icmp eq i32 %71, 0
%73 = zext i1 %72 to i32
%74 = load double, double* %4
%75 = call i32 @cw_bit(i32 %73, double %74)
%76 = load i32, i32* @rx02_bitpair.accum
%77 = and i32 %76, 16
%78 = icmp ne i32 %77, 0
%79 = zext i1 %78 to i32
%80 = load double, double* %4
%81 = call i32 @cw_bit(i32 %79, double %80)
%82 = load i32, i32* @rx02_bitpair.bitcount
%83 = add nsw i32 %82, -1
store i32 %83, i32* @rx02_bitpair.bitcount
br label %84
84: ; preds = %69, %48
br label %85
85: ; preds = %84, %35
br label %86
86: ; preds = %85, %34
br label %87
87: ; preds = %86, %7
ret void
}

LLVM IR (-O2):
@rx02_bitpair.accum = internal unnamed_addr global i32 0
@rx02_bitpair.bitcount = internal unnamed_addr global i32 0
define void @rx02_bitpair(i32 %0, double %1) {
switch i32 %0, label %23 [
i32 -1, label %6
i32 -2, label %3
]
3: ; preds = %2
%4 = load i32, i32* @rx02_bitpair.bitcount
%5 = icmp eq i32 %4, 0
br i1 %5, label %57, label %7
6: ; preds = %2
store i32 0, i32* @rx02_bitpair.accum
br label %55
7: ; preds = %3, %7
%8 = phi i32 [ %21, %7 ], [ %4, %3 ]
%9 = add nsw i32 %8, -1
store i32 %9, i32* @rx02_bitpair.bitcount
%10 = load i32, i32* @rx02_bitpair.accum
%11 = shl i32 3, %9
%12 = and i32 %10, %11
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = tail call i32 @cw_bit(i32 %14, double %1)
%16 = load i32, i32* @rx02_bitpair.accum
%17 = load i32, i32* @rx02_bitpair.bitcount
%18 = lshr i32 %16, %17
%19 = and i32 %18, 1
%20 = tail call i32 @cw_bit(i32 %19, double %1)
%21 = load i32, i32* @rx02_bitpair.bitcount
%22 = icmp eq i32 %21, 0
br i1 %22, label %57, label %7
23: ; preds = %2
%24 = load i32, i32* @rx02_bitpair.accum
%25 = shl i32 %24, 1
%26 = or i32 %25, %0
store i32 %26, i32* @rx02_bitpair.accum
%27 = load i32, i32* @rx02_bitpair.bitcount
%28 = add nsw i32 %27, 1
store i32 %28, i32* @rx02_bitpair.bitcount
%29 = icmp eq i32 %28, 5
br i1 %29, label %30, label %57
30: ; preds = %23
%31 = and i32 %26, 63
%32 = icmp eq i32 %31, 30
br i1 %32, label %33, label %44
33: ; preds = %30
%34 = tail call i32 @cw_bit(i32 1, double %1)
%35 = tail call i32 @cw_bit(i32 0, double %1)
%36 = tail call i32 @cw_bit(i32 0, double %1)
%37 = tail call i32 @cw_bit(i32 0, double %1)
%38 = tail call i32 @cw_bit(i32 1, double %1)
%39 = tail call i32 @cw_bit(i32 0, double %1)
%40 = tail call i32 @cw_bit(i32 0, double %1)
%41 = tail call i32 @cw_bit(i32 0, double %1)
%42 = tail call i32 @cw_bit(i32 1, double %1)
%43 = tail call i32 @cw_bit(i32 0, double %1)
br label %55
44: ; preds = %30
%45 = and i32 %26, 48
%46 = icmp eq i32 %45, 0
%47 = zext i1 %46 to i32
%48 = tail call i32 @cw_bit(i32 %47, double %1)
%49 = load i32, i32* @rx02_bitpair.accum
%50 = lshr i32 %49, 4
%51 = and i32 %50, 1
%52 = tail call i32 @cw_bit(i32 %51, double %1)
%53 = load i32, i32* @rx02_bitpair.bitcount
%54 = add nsw i32 %53, -1
br label %55
55: ; preds = %6, %44, %33
%56 = phi i32 [ 0, %33 ], [ %54, %44 ], [ 0, %6 ]
store i32 %56, i32* @rx02_bitpair.bitcount
br label %57
57: ; preds = %7, %55, %3, %23
ret void
}