#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 /*<<< orphan*/ wlWriteBit(int, int /*<<< orphan*/ *, unsigned char *,
                              unsigned char *);
int wlWriteByte(unsigned char byte, FILE *file, unsigned char *dataByte,
                unsigned char *dataMask) {
  int i, bit;
  for (i = 7; i >= 0; i--) {
    bit = (byte >> i) & 1;
    if (!wlWriteBit(bit, file, dataByte, dataMask))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<wlWriteByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x7,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jl     1186 <wlWriteByte+0x76>
movzbl -0x5(%rbp),%eax
mov    -0x24(%rbp),%ecx
sar    %cl,%eax
and    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <wlWriteBit@plt>
cmp    $0x0,%eax
jne    1173 <wlWriteByte+0x63>
movl   $0x0,-0x4(%rbp)
jmp    118d <wlWriteByte+0x7d>
jmp    1178 <wlWriteByte+0x68>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1131 <wlWriteByte+0x21>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wlWriteByte>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rsi,%rbx
mov    %edi,%ebp
shr    $0x7,%edi
call   1030 <wlWriteBit@plt>
xor    %r14d,%r14d
test   %eax,%eax
je     11f5 <wlWriteByte+0xe5>
mov    %ebp,%edi
shr    $0x6,%edi
and    $0x1,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1030 <wlWriteBit@plt>
test   %eax,%eax
je     11f5 <wlWriteByte+0xe5>
mov    %ebp,%edi
shr    $0x5,%edi
and    $0x1,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1030 <wlWriteBit@plt>
test   %eax,%eax
je     11f5 <wlWriteByte+0xe5>
mov    %ebp,%edi
shr    $0x4,%edi
and    $0x1,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1030 <wlWriteBit@plt>
test   %eax,%eax
je     11f5 <wlWriteByte+0xe5>
mov    %ebp,%edi
shr    $0x3,%edi
and    $0x1,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1030 <wlWriteBit@plt>
test   %eax,%eax
je     11f5 <wlWriteByte+0xe5>
mov    %ebp,%edi
shr    $0x2,%edi
and    $0x1,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1030 <wlWriteBit@plt>
test   %eax,%eax
je     11f5 <wlWriteByte+0xe5>
mov    %ebp,%edi
shr    %edi
and    $0x1,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1030 <wlWriteBit@plt>
test   %eax,%eax
je     11f5 <wlWriteByte+0xe5>
and    $0x1,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1030 <wlWriteBit@plt>
xor    %r14d,%r14d
test   %eax,%eax
setne  %r14b
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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