#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 */
unsigned char read_Centaurus_CX9211_GPIO();
int /*<<< orphan*/ toggle_Centaurus_9211_clock();
int /*<<< orphan*/ write_Centaurus_CX9211_GPIO(int);
unsigned long read_Centaurus_CX9211_DWdata(void) {
  unsigned char ReadData;
  int count;
  unsigned long Data;
  write_Centaurus_CX9211_GPIO(0x0000);
  for (count = 0; count < 7; count++)
    toggle_Centaurus_9211_clock();
  Data = 0;
  for (count = 0; count < 32; count++) {
    ReadData = read_Centaurus_CX9211_GPIO();
    Data = Data | (((unsigned long)ReadData) << count);
  }
  return Data;
}


x86 assembly (clang, -O0):
<read_Centaurus_CX9211_DWdata>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <write_Centaurus_CX9211_GPIO@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    1165 <read_Centaurus_CX9211_DWdata+0x35>
mov    $0x0,%al
call   1050 <toggle_Centaurus_9211_clock@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <read_Centaurus_CX9211_DWdata+0x16>
movq   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    11b0 <read_Centaurus_CX9211_DWdata+0x80>
mov    $0x0,%al
call   1040 <read_Centaurus_CX9211_GPIO@plt>
mov    %al,-0x1(%rbp)
mov    -0x10(%rbp),%rax
movzbl -0x1(%rbp),%ecx
mov    %ecx,%edx
mov    -0x8(%rbp),%ecx
shl    %cl,%rdx
mov    %rdx,%rcx
or     %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1174 <read_Centaurus_CX9211_DWdata+0x44>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_Centaurus_CX9211_DWdata>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1030 <write_Centaurus_CX9211_GPIO@plt>
xor    %eax,%eax
call   1050 <toggle_Centaurus_9211_clock@plt>
xor    %eax,%eax
call   1050 <toggle_Centaurus_9211_clock@plt>
xor    %eax,%eax
call   1050 <toggle_Centaurus_9211_clock@plt>
xor    %eax,%eax
call   1050 <toggle_Centaurus_9211_clock@plt>
xor    %eax,%eax
call   1050 <toggle_Centaurus_9211_clock@plt>
xor    %eax,%eax
call   1050 <toggle_Centaurus_9211_clock@plt>
xor    %eax,%eax
call   1050 <toggle_Centaurus_9211_clock@plt>
xor    %ebx,%ebx
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <read_Centaurus_CX9211_GPIO@plt>
movzbl %al,%eax
mov    %ebx,%ecx
shl    %cl,%rax
or     %rax,%r14
add    $0x1,%rbx
cmp    $0x20,%rbx
jne    1180 <read_Centaurus_CX9211_DWdata+0x50>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @read_Centaurus_CX9211_DWdata() {
%1 = alloca i8
%2 = alloca i32
%3 = alloca i64
%4 = call i32 @write_Centaurus_CX9211_GPIO(i32 0)
store i32 0, i32* %2
br label %5
5: ; preds = %10, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 7
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = call i32 (...) @toggle_Centaurus_9211_clock()
br label %10
10: ; preds = %8
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %5
13: ; preds = %5
store i64 0, i64* %3
store i32 0, i32* %2
br label %14
14: ; preds = %26, %13
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 32
br i1 %16, label %17, label %29
17: ; preds = %14
%18 = call zeroext i8 (...) @read_Centaurus_CX9211_GPIO()
store i8 %18, i8* %1
%19 = load i64, i64* %3
%20 = load i8, i8* %1
%21 = zext i8 %20 to i64
%22 = load i32, i32* %2
%23 = zext i32 %22 to i64
%24 = shl i64 %21, %23
%25 = or i64 %19, %24
store i64 %25, i64* %3
br label %26
26: ; preds = %17
%27 = load i32, i32* %2
%28 = add nsw i32 %27, 1
store i32 %28, i32* %2
br label %14
29: ; preds = %14
%30 = load i64, i64* %3
ret i64 %30
}

LLVM IR (-O2):
define i64 @read_Centaurus_CX9211_DWdata() {
%1 = tail call i32 @write_Centaurus_CX9211_GPIO(i32 0)
%2 = tail call i32 (...) @toggle_Centaurus_9211_clock()
%3 = tail call i32 (...) @toggle_Centaurus_9211_clock()
%4 = tail call i32 (...) @toggle_Centaurus_9211_clock()
%5 = tail call i32 (...) @toggle_Centaurus_9211_clock()
%6 = tail call i32 (...) @toggle_Centaurus_9211_clock()
%7 = tail call i32 (...) @toggle_Centaurus_9211_clock()
%8 = tail call i32 (...) @toggle_Centaurus_9211_clock()
br label %9
9: ; preds = %0, %9
%10 = phi i64 [ 0, %0 ], [ %16, %9 ]
%11 = phi i64 [ 0, %0 ], [ %15, %9 ]
%12 = tail call zeroext i8 (...) @read_Centaurus_CX9211_GPIO()
%13 = zext i8 %12 to i64
%14 = shl nuw nsw i64 %13, %10
%15 = or i64 %14, %11
%16 = add nuw nsw i64 %10, 1
%17 = icmp eq i64 %16, 32
br i1 %17, label %18, label %9
18: ; preds = %9
ret i64 %15
}