#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 readBit(int /*<<< orphan*/ *, unsigned char *, unsigned char *);
int readByte(FILE *file, unsigned char *dataByte, unsigned char *dataMask) {
  int byte, i, bit;
  byte = 0;
  for (i = 0; i < 8; i++) {
    bit = readBit(file, dataByte, dataMask);
    byte = (byte << 1) | bit;
  }
  return byte;
}


x86 assembly (clang, -O0):
<readByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x8,-0x20(%rbp)
jge    116a <readByte+0x5a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <readBit@plt>
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
or     -0x24(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1132 <readByte+0x22>
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readByte>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r13
call   1030 <readBit@plt>
mov    %eax,%r12d
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <readBit@plt>
mov    %eax,%ebp
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <readBit@plt>
mov    %eax,%ebx
shl    $0x2,%r12d
add    %ebp,%ebp
or     %r12d,%ebp
or     %ebp,%ebx
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <readBit@plt>
mov    %eax,%r12d
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <readBit@plt>
mov    %eax,%ebp
shl    $0x2,%ebx
add    %r12d,%r12d
or     %r12d,%ebp
or     %ebx,%ebp
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <readBit@plt>
mov    %eax,%r12d
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <readBit@plt>
mov    %eax,%ebx
shl    $0x2,%ebp
add    %r12d,%r12d
or     %r12d,%ebx
or     %ebp,%ebx
mov    %r13,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <readBit@plt>
add    %ebx,%ebx
or     %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @readByte(i32* %0, i8* %1, i8* %2) {
%4 = tail call i32 @readBit(i32* %0, i8* %1, i8* %2)
%5 = tail call i32 @readBit(i32* %0, i8* %1, i8* %2)
%6 = tail call i32 @readBit(i32* %0, i8* %1, i8* %2)
%7 = shl i32 %4, 2
%8 = shl i32 %5, 1
%9 = or i32 %7, %8
%10 = or i32 %6, %9
%11 = tail call i32 @readBit(i32* %0, i8* %1, i8* %2)
%12 = tail call i32 @readBit(i32* %0, i8* %1, i8* %2)
%13 = shl i32 %10, 2
%14 = shl i32 %11, 1
%15 = or i32 %13, %14
%16 = or i32 %12, %15
%17 = tail call i32 @readBit(i32* %0, i8* %1, i8* %2)
%18 = tail call i32 @readBit(i32* %0, i8* %1, i8* %2)
%19 = shl i32 %16, 2
%20 = shl i32 %17, 1
%21 = or i32 %19, %20
%22 = or i32 %18, %21
%23 = tail call i32 @readBit(i32* %0, i8* %1, i8* %2)
%24 = shl i32 %22, 1
%25 = or i32 %23, %24
ret i32 %25
}