#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 _read_increased_bit(int const);
int /*<<< orphan*/ platform_delay_or_gpio_change(int const);
unsigned char _read_byte(const int delay) {
  unsigned char r = 0;
  int i;
  for (i = 7; i >= 0; i--) {
    r |= _read_increased_bit(delay) << i;
    platform_delay_or_gpio_change(delay);
  }
  return r;
}


x86 assembly (clang, -O0):
<_read_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
movl   $0x7,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     116e <_read_byte+0x4e>
mov    -0x4(%rbp),%edi
call   1040 <_read_increased_bit@plt>
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    %eax,%ecx
movzbl -0x5(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <platform_delay_or_gpio_change@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <_read_byte+0x16>
movzbl -0x5(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_read_byte>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edi,%r13d
call   1040 <_read_increased_bit@plt>
mov    %eax,%ebp
shl    $0x7,%bpl
mov    %r13d,%edi
call   1030 <platform_delay_or_gpio_change@plt>
mov    %r13d,%edi
call   1040 <_read_increased_bit@plt>
mov    %eax,%r14d
shl    $0x6,%r14b
or     %bpl,%r14b
mov    %r13d,%edi
call   1030 <platform_delay_or_gpio_change@plt>
mov    %r13d,%edi
call   1040 <_read_increased_bit@plt>
mov    %eax,%r15d
shl    $0x5,%r15b
mov    %r13d,%edi
call   1030 <platform_delay_or_gpio_change@plt>
mov    %r13d,%edi
call   1040 <_read_increased_bit@plt>
mov    %eax,%r12d
shl    $0x4,%r12b
or     %r15b,%r12b
or     %r14b,%r12b
mov    %r13d,%edi
call   1030 <platform_delay_or_gpio_change@plt>
mov    %r13d,%edi
call   1040 <_read_increased_bit@plt>
mov    %eax,%r14d
shl    $0x3,%r14b
mov    %r13d,%edi
call   1030 <platform_delay_or_gpio_change@plt>
mov    %r13d,%edi
call   1040 <_read_increased_bit@plt>
mov    %eax,%ebp
shl    $0x2,%bpl
or     %r14b,%bpl
mov    %r13d,%edi
call   1030 <platform_delay_or_gpio_change@plt>
mov    %r13d,%edi
call   1040 <_read_increased_bit@plt>
mov    %eax,%ebx
add    %bl,%bl
or     %bpl,%bl
or     %r12b,%bl
mov    %r13d,%edi
call   1030 <platform_delay_or_gpio_change@plt>
mov    %r13d,%edi
call   1040 <_read_increased_bit@plt>
mov    %eax,%ebp
or     %bl,%bpl
mov    %r13d,%edi
call   1030 <platform_delay_or_gpio_change@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define zeroext i8 @_read_byte(i32 %0) {
%2 = tail call i32 @_read_increased_bit(i32 %0)
%3 = trunc i32 %2 to i8
%4 = shl i8 %3, 7
%5 = tail call i32 @platform_delay_or_gpio_change(i32 %0)
%6 = tail call i32 @_read_increased_bit(i32 %0)
%7 = trunc i32 %6 to i8
%8 = shl i8 %7, 6
%9 = or i8 %4, %8
%10 = tail call i32 @platform_delay_or_gpio_change(i32 %0)
%11 = tail call i32 @_read_increased_bit(i32 %0)
%12 = trunc i32 %11 to i8
%13 = shl i8 %12, 5
%14 = or i8 %9, %13
%15 = tail call i32 @platform_delay_or_gpio_change(i32 %0)
%16 = tail call i32 @_read_increased_bit(i32 %0)
%17 = trunc i32 %16 to i8
%18 = shl i8 %17, 4
%19 = or i8 %14, %18
%20 = tail call i32 @platform_delay_or_gpio_change(i32 %0)
%21 = tail call i32 @_read_increased_bit(i32 %0)
%22 = trunc i32 %21 to i8
%23 = shl i8 %22, 3
%24 = or i8 %19, %23
%25 = tail call i32 @platform_delay_or_gpio_change(i32 %0)
%26 = tail call i32 @_read_increased_bit(i32 %0)
%27 = trunc i32 %26 to i8
%28 = shl i8 %27, 2
%29 = or i8 %24, %28
%30 = tail call i32 @platform_delay_or_gpio_change(i32 %0)
%31 = tail call i32 @_read_increased_bit(i32 %0)
%32 = trunc i32 %31 to i8
%33 = shl i8 %32, 1
%34 = or i8 %29, %33
%35 = tail call i32 @platform_delay_or_gpio_change(i32 %0)
%36 = tail call i32 @_read_increased_bit(i32 %0)
%37 = trunc i32 %36 to i8
%38 = or i8 %34, %37
%39 = tail call i32 @platform_delay_or_gpio_change(i32 %0)
ret i8 %38
}