#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int wlReadBit(int /*<<< orphan*/ *, unsigned char *, unsigned char *);
int wlReadByte(FILE *file, unsigned char *dataByte, unsigned char *dataMask) {
  int byte, i, bit;
  byte = 0;
  for (i = 0; i < 8; i++) {
    bit = wlReadBit(file, dataByte, dataMask);
    if (bit < 0)
      return bit;
    byte = (byte << 1) | bit;
  }
  return byte;
}


x86 assembly (clang, -O0):
<wlReadByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x8,-0x28(%rbp)
jge    117f <wlReadByte+0x6f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <wlReadBit@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    1165 <wlReadByte+0x55>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1185 <wlReadByte+0x75>
mov    -0x24(%rbp),%eax
shl    $0x1,%eax
or     -0x2c(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1132 <wlReadByte+0x22>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wlReadByte>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r12
mov    %rsi,%rbp
mov    %rdi,%rbx
call   1030 <wlReadBit@plt>
mov    %eax,%r14d
test   %eax,%eax
js     1219 <wlReadByte+0x109>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1030 <wlReadBit@plt>
mov    %eax,%r15d
test   %eax,%eax
js     1211 <wlReadByte+0x101>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1030 <wlReadBit@plt>
mov    %eax,%r13d
test   %eax,%eax
js     1216 <wlReadByte+0x106>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1030 <wlReadBit@plt>
test   %eax,%eax
js     120c <wlReadByte+0xfc>
mov    %eax,0x14(%rsp)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1030 <wlReadBit@plt>
test   %eax,%eax
js     120c <wlReadByte+0xfc>
mov    %eax,0x10(%rsp)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1030 <wlReadBit@plt>
test   %eax,%eax
js     120c <wlReadByte+0xfc>
mov    %eax,0xc(%rsp)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1030 <wlReadBit@plt>
test   %eax,%eax
js     120c <wlReadByte+0xfc>
mov    %eax,0x8(%rsp)
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1030 <wlReadBit@plt>
test   %eax,%eax
js     120c <wlReadByte+0xfc>
shl    $0x2,%r14d
add    %r15d,%r15d
or     %r14d,%r15d
or     %r15d,%r13d
shl    $0x2,%r13d
mov    0x14(%rsp),%ecx
add    %ecx,%ecx
or     %r13d,%ecx
mov    0x10(%rsp),%edx
or     %ecx,%edx
shl    $0x2,%edx
mov    0xc(%rsp),%ecx
add    %ecx,%ecx
or     %edx,%ecx
mov    0x8(%rsp),%edx
or     %ecx,%edx
add    %edx,%edx
or     %edx,%eax
mov    %eax,%r14d
jmp    1219 <wlReadByte+0x109>
mov    %r15d,%r14d
jmp    1219 <wlReadByte+0x109>
mov    %r13d,%r14d
mov    %r14d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @wlReadByte(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 0, i32* %8
store i32 0, i32* %9
br label %11
11: ; preds = %28, %3
%12 = load i32, i32* %9
%13 = icmp slt i32 %12, 8
br i1 %13, label %14, label %31
14: ; preds = %11
%15 = load i32*, i32** %5
%16 = load i8*, i8** %6
%17 = load i8*, i8** %7
%18 = call i32 @wlReadBit(i32* %15, i8* %16, i8* %17)
store i32 %18, i32* %10
%19 = load i32, i32* %10
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %14
%22 = load i32, i32* %10
store i32 %22, i32* %4
br label %33
23: ; preds = %14
%24 = load i32, i32* %8
%25 = shl i32 %24, 1
%26 = load i32, i32* %10
%27 = or i32 %25, %26
store i32 %27, i32* %8
br label %28
28: ; preds = %23
%29 = load i32, i32* %9
%30 = add nsw i32 %29, 1
store i32 %30, i32* %9
br label %11
31: ; preds = %11
%32 = load i32, i32* %8
store i32 %32, i32* %4
br label %33
33: ; preds = %31, %21
%34 = load i32, i32* %4
ret i32 %34
}

LLVM IR (-O2):
define i32 @wlReadByte(i32* %0, i8* %1, i8* %2) {
%4 = tail call i32 @wlReadBit(i32* %0, i8* %1, i8* %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %42, label %6
6: ; preds = %3
%7 = tail call i32 @wlReadBit(i32* %0, i8* %1, i8* %2)
%8 = icmp slt i32 %7, 0
br i1 %8, label %42, label %9
9: ; preds = %6
%10 = tail call i32 @wlReadBit(i32* %0, i8* %1, i8* %2)
%11 = icmp slt i32 %10, 0
br i1 %11, label %42, label %12
12: ; preds = %9
%13 = tail call i32 @wlReadBit(i32* %0, i8* %1, i8* %2)
%14 = icmp slt i32 %13, 0
br i1 %14, label %42, label %15
15: ; preds = %12
%16 = tail call i32 @wlReadBit(i32* %0, i8* %1, i8* %2)
%17 = icmp slt i32 %16, 0
br i1 %17, label %42, label %18
18: ; preds = %15
%19 = tail call i32 @wlReadBit(i32* %0, i8* %1, i8* %2)
%20 = icmp slt i32 %19, 0
br i1 %20, label %42, label %21
21: ; preds = %18
%22 = tail call i32 @wlReadBit(i32* %0, i8* %1, i8* %2)
%23 = icmp slt i32 %22, 0
br i1 %23, label %42, label %24
24: ; preds = %21
%25 = tail call i32 @wlReadBit(i32* %0, i8* %1, i8* %2)
%26 = icmp slt i32 %25, 0
br i1 %26, label %42, label %27
27: ; preds = %24
%28 = shl i32 %4, 2
%29 = shl nuw i32 %7, 1
%30 = or i32 %28, %29
%31 = or i32 %10, %30
%32 = shl i32 %31, 2
%33 = shl nuw i32 %13, 1
%34 = or i32 %32, %33
%35 = or i32 %16, %34
%36 = shl i32 %35, 2
%37 = shl nuw i32 %19, 1
%38 = or i32 %36, %37
%39 = or i32 %22, %38
%40 = shl i32 %39, 1
%41 = or i32 %25, %40
br label %42
42: ; preds = %27, %24, %21, %18, %15, %12, %9, %6, %3
%43 = phi i32 [ %4, %3 ], [ %7, %6 ], [ %10, %9 ], [ %13, %12 ], [ %16, %15 ], [ %19, %18 ], [ %22, %21 ], [ %25, %24 ], [ %41, %27 ]
ret i32 %43
}