#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*/ delay(int);
int read_bit_B20();
int read_byte_B20(void) {
  int i, j = 0;
  char temp;
  char temp2;
  int temp3;
  char c;
  for (i = 0; i < 8; i++) {
    j = read_bit_B20();
    temp = (j << 7) | (temp >> 1);
    delay(216);
  }
  return temp;
}


x86 assembly (clang, -O0):
<read_byte_B20>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jge    1174 <read_byte_B20+0x54>
mov    $0x0,%al
call   1040 <read_bit_B20@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x7,%eax
movsbl -0x9(%rbp),%ecx
sar    $0x1,%ecx
or     %ecx,%eax
mov    %al,-0x9(%rbp)
mov    $0xd8,%edi
call   1030 <delay@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1136 <read_byte_B20+0x16>
movsbl -0x9(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_byte_B20>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <read_bit_B20@plt>
mov    %eax,%ebp
mov    $0xd8,%edi
call   1030 <delay@plt>
shl    $0x1f,%ebp
xor    %eax,%eax
call   1040 <read_bit_B20@plt>
mov    %eax,%ebx
mov    $0xd8,%edi
call   1030 <delay@plt>
shl    $0x1f,%ebx
sar    $0x19,%ebp
sar    $0x18,%ebx
or     %ebp,%ebx
xor    %eax,%eax
call   1040 <read_bit_B20@plt>
mov    %eax,%ebp
mov    $0xd8,%edi
call   1030 <delay@plt>
shl    $0x1f,%ebp
shl    $0x17,%ebx
or     %ebp,%ebx
xor    %eax,%eax
call   1040 <read_bit_B20@plt>
mov    %eax,%ebp
mov    $0xd8,%edi
call   1030 <delay@plt>
shl    $0x1f,%ebp
sar    $0x19,%ebx
sar    $0x18,%ebp
or     %ebx,%ebp
xor    %eax,%eax
call   1040 <read_bit_B20@plt>
mov    %eax,%ebx
mov    $0xd8,%edi
call   1030 <delay@plt>
shl    $0x1f,%ebx
shl    $0x17,%ebp
or     %ebx,%ebp
xor    %eax,%eax
call   1040 <read_bit_B20@plt>
mov    %eax,%ebx
mov    $0xd8,%edi
call   1030 <delay@plt>
shl    $0x1f,%ebx
sar    $0x19,%ebp
sar    $0x18,%ebx
or     %ebp,%ebx
xor    %eax,%eax
call   1040 <read_bit_B20@plt>
mov    %eax,%ebp
mov    $0xd8,%edi
call   1030 <delay@plt>
shl    $0x1f,%ebp
shl    $0x17,%ebx
or     %ebp,%ebx
xor    %eax,%eax
call   1040 <read_bit_B20@plt>
mov    %eax,%ebp
mov    $0xd8,%edi
call   1030 <delay@plt>
shl    $0x1f,%ebp
sar    $0x19,%ebx
sar    $0x18,%ebp
or     %ebx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @read_byte_B20() {
%1 = tail call i32 (...) @read_bit_B20()
%2 = tail call i32 @delay(i32 216)
%3 = shl i32 %1, 31
%4 = tail call i32 (...) @read_bit_B20()
%5 = tail call i32 @delay(i32 216)
%6 = shl i32 %4, 31
%7 = ashr exact i32 %3, 25
%8 = ashr exact i32 %6, 24
%9 = or i32 %7, %8
%10 = tail call i32 (...) @read_bit_B20()
%11 = tail call i32 @delay(i32 216)
%12 = shl i32 %10, 31
%13 = shl nsw i32 %9, 23
%14 = or i32 %12, %13
%15 = tail call i32 (...) @read_bit_B20()
%16 = tail call i32 @delay(i32 216)
%17 = shl i32 %15, 31
%18 = ashr exact i32 %14, 25
%19 = ashr exact i32 %17, 24
%20 = or i32 %18, %19
%21 = tail call i32 (...) @read_bit_B20()
%22 = tail call i32 @delay(i32 216)
%23 = shl i32 %21, 31
%24 = shl nsw i32 %20, 23
%25 = or i32 %23, %24
%26 = tail call i32 (...) @read_bit_B20()
%27 = tail call i32 @delay(i32 216)
%28 = shl i32 %26, 31
%29 = ashr i32 %25, 25
%30 = ashr exact i32 %28, 24
%31 = or i32 %29, %30
%32 = tail call i32 (...) @read_bit_B20()
%33 = tail call i32 @delay(i32 216)
%34 = shl i32 %32, 31
%35 = shl nsw i32 %31, 23
%36 = or i32 %34, %35
%37 = tail call i32 (...) @read_bit_B20()
%38 = tail call i32 @delay(i32 216)
%39 = shl i32 %37, 31
%40 = ashr i32 %36, 25
%41 = ashr exact i32 %39, 24
%42 = or i32 %40, %41
ret i32 %42
}