#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*/ Draco9210ClearDataOut();
int /*<<< orphan*/ Draco9210SetCS();
int /*<<< orphan*/ Draco9210SetDataOut();
int /*<<< orphan*/ Draco9210ToggleClock();
int /*<<< orphan*/ DracoReadData(unsigned char *);
int /*<<< orphan*/ DracoWriteData(unsigned char);
unsigned char Draco9210ReadReg(unsigned char index) {
  unsigned char data;
  Draco9210SetCS();
  Draco9210ToggleClock();
  Draco9210SetDataOut();
  Draco9210ToggleClock();
  Draco9210ClearDataOut();
  Draco9210ToggleClock();
  Draco9210ClearDataOut();
  Draco9210ToggleClock();
  Draco9210ClearDataOut();
  Draco9210ToggleClock();
  DracoWriteData(index);
  DracoReadData(&data);
  return (data);
}


x86 assembly (clang, -O0):
<Draco9210ReadReg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1050 <Draco9210SetCS@plt>
mov    $0x0,%al
call   1060 <Draco9210ToggleClock@plt>
mov    $0x0,%al
call   1030 <Draco9210SetDataOut@plt>
mov    $0x0,%al
call   1060 <Draco9210ToggleClock@plt>
mov    $0x0,%al
call   1070 <Draco9210ClearDataOut@plt>
mov    $0x0,%al
call   1060 <Draco9210ToggleClock@plt>
mov    $0x0,%al
call   1070 <Draco9210ClearDataOut@plt>
mov    $0x0,%al
call   1060 <Draco9210ToggleClock@plt>
mov    $0x0,%al
call   1070 <Draco9210ClearDataOut@plt>
mov    $0x0,%al
call   1060 <Draco9210ToggleClock@plt>
movzbl -0x1(%rbp),%edi
call   1080 <DracoWriteData@plt>
lea    -0x2(%rbp),%rdi
call   1040 <DracoReadData@plt>
movzbl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Draco9210ReadReg>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <Draco9210SetCS@plt>
xor    %eax,%eax
call   1060 <Draco9210ToggleClock@plt>
xor    %eax,%eax
call   1030 <Draco9210SetDataOut@plt>
xor    %eax,%eax
call   1060 <Draco9210ToggleClock@plt>
xor    %eax,%eax
call   1070 <Draco9210ClearDataOut@plt>
xor    %eax,%eax
call   1060 <Draco9210ToggleClock@plt>
xor    %eax,%eax
call   1070 <Draco9210ClearDataOut@plt>
xor    %eax,%eax
call   1060 <Draco9210ToggleClock@plt>
xor    %eax,%eax
call   1070 <Draco9210ClearDataOut@plt>
xor    %eax,%eax
call   1060 <Draco9210ToggleClock@plt>
mov    %ebx,%edi
call   1080 <DracoWriteData@plt>
lea    0xf(%rsp),%rdi
call   1040 <DracoReadData@plt>
mov    0xf(%rsp),%al
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @Draco9210ReadReg(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %2
%4 = call i32 (...) @Draco9210SetCS()
%5 = call i32 (...) @Draco9210ToggleClock()
%6 = call i32 (...) @Draco9210SetDataOut()
%7 = call i32 (...) @Draco9210ToggleClock()
%8 = call i32 (...) @Draco9210ClearDataOut()
%9 = call i32 (...) @Draco9210ToggleClock()
%10 = call i32 (...) @Draco9210ClearDataOut()
%11 = call i32 (...) @Draco9210ToggleClock()
%12 = call i32 (...) @Draco9210ClearDataOut()
%13 = call i32 (...) @Draco9210ToggleClock()
%14 = load i8, i8* %2
%15 = call i32 @DracoWriteData(i8 zeroext %14)
%16 = call i32 @DracoReadData(i8* %3)
%17 = load i8, i8* %3
ret i8 %17
}

LLVM IR (-O2):
define zeroext i8 @Draco9210ReadReg(i8 zeroext %0) {
%2 = alloca i8
%3 = tail call i32 (...) @Draco9210SetCS()
%4 = tail call i32 (...) @Draco9210ToggleClock()
%5 = tail call i32 (...) @Draco9210SetDataOut()
%6 = tail call i32 (...) @Draco9210ToggleClock()
%7 = tail call i32 (...) @Draco9210ClearDataOut()
%8 = tail call i32 (...) @Draco9210ToggleClock()
%9 = tail call i32 (...) @Draco9210ClearDataOut()
%10 = tail call i32 (...) @Draco9210ToggleClock()
%11 = tail call i32 (...) @Draco9210ClearDataOut()
%12 = tail call i32 (...) @Draco9210ToggleClock()
%13 = tail call i32 @DracoWriteData(i8 zeroext %0)
%14 = call i32 @DracoReadData(i8* %2)
%15 = load i8, i8* %2
ret i8 %15
}