#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 uint32_t;

/* Variables and functions */
int /*<<< orphan*/ delay(int);
void gpio_iic_read(unsigned char *rbyte) {
  unsigned char i;
  (*((volatile uint32_t *)0xE02000C0)) =
      ((*((volatile uint32_t *)0xE02000C0)) & 0xfffffff0) | 0x00000001;
  (*((volatile uint32_t *)0xE02000C4)) |= 1 << 0x00;
  (*((volatile uint32_t *)0xE02000C0)) =
      ((*((volatile uint32_t *)0xE02000C0)) & 0xfffffff0);
  for (i = 0; i < 8; i++) {
    (*((volatile uint32_t *)0xE02000C4)) |= 1 << 0x01;
    delay((10));
    (*rbyte) <<= 1;
    if (((*((volatile uint32_t *)0xE02000C4)) & 0x01))
      (*rbyte)++;
    (*((volatile uint32_t *)0xE02000C4)) &= ~(1 << 0x01);
    delay((10));
  }
}


x86 assembly (clang, -O0):
<gpio_iic_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xe02000c0,%eax
mov    (%rax),%ecx
and    $0xfffffff0,%ecx
or     $0x1,%ecx
mov    $0xe02000c0,%eax
mov    %ecx,(%rax)
mov    $0xe02000c4,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0xe02000c4,%eax
mov    %ecx,(%rax)
mov    $0xe02000c0,%eax
mov    (%rax),%ecx
and    $0xfffffff0,%ecx
mov    $0xe02000c0,%eax
mov    %ecx,(%rax)
movb   $0x0,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x8,%eax
jge    11d0 <gpio_iic_read+0xc0>
mov    $0xe02000c4,%eax
mov    (%rax),%ecx
or     $0x2,%ecx
mov    $0xe02000c4,%eax
mov    %ecx,(%rax)
mov    $0xa,%edi
call   1030 <delay@plt>
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
shl    $0x1,%ecx
mov    %cl,(%rax)
mov    $0xe02000c4,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     11a8 <gpio_iic_read+0x98>
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
add    $0x1,%cl
mov    %cl,(%rax)
mov    $0xe02000c4,%eax
mov    (%rax),%ecx
and    $0xfffffffd,%ecx
mov    $0xe02000c4,%eax
mov    %ecx,(%rax)
mov    $0xa,%edi
call   1030 <delay@plt>
mov    -0x9(%rbp),%al
add    $0x1,%al
mov    %al,-0x9(%rbp)
jmp    1156 <gpio_iic_read+0x46>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_iic_read>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
mov    $0xe02000c4,%r14d
mov    -0x4(%r14),%eax
and    $0xfffffff0,%eax
or     $0x1,%eax
mov    %eax,-0x4(%r14)
orl    $0x1,(%r14)
andl   $0xfffffff0,-0x4(%r14)
mov    $0x8,%bl
jmp    1153 <gpio_iic_read+0x43>
nopl   0x0(%rax)
andl   $0xfffffffd,(%r14)
mov    $0xa,%edi
call   1030 <delay@plt>
add    $0xff,%bl
je     117a <gpio_iic_read+0x6a>
orl    $0x2,(%r14)
mov    $0xa,%edi
call   1030 <delay@plt>
movzbl (%r15),%eax
add    %al,%al
mov    %al,(%r15)
testl  $0x1,(%r14)
je     1140 <gpio_iic_read+0x30>
or     $0x1,%al
mov    %al,(%r15)
jmp    1140 <gpio_iic_read+0x30>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @gpio_iic_read(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load volatile i32, i32* inttoptr (i64 3760193728 to i32*)
%5 = and i32 %4, -16
%6 = or i32 %5, 1
store volatile i32 %6, i32* inttoptr (i64 3760193728 to i32*)
%7 = load volatile i32, i32* inttoptr (i64 3760193732 to i32*)
%8 = or i32 %7, 1
store volatile i32 %8, i32* inttoptr (i64 3760193732 to i32*)
%9 = load volatile i32, i32* inttoptr (i64 3760193728 to i32*)
%10 = and i32 %9, -16
store volatile i32 %10, i32* inttoptr (i64 3760193728 to i32*)
store i8 0, i8* %3
br label %11
11: ; preds = %35, %1
%12 = load i8, i8* %3
%13 = zext i8 %12 to i32
%14 = icmp slt i32 %13, 8
br i1 %14, label %15, label %38
15: ; preds = %11
%16 = load volatile i32, i32* inttoptr (i64 3760193732 to i32*)
%17 = or i32 %16, 2
store volatile i32 %17, i32* inttoptr (i64 3760193732 to i32*)
%18 = call i32 @delay(i32 10)
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = shl i32 %21, 1
%23 = trunc i32 %22 to i8
store i8 %23, i8* %19
%24 = load volatile i32, i32* inttoptr (i64 3760193732 to i32*)
%25 = and i32 %24, 1
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %15
%28 = load i8*, i8** %2
%29 = load i8, i8* %28
%30 = add i8 %29, 1
store i8 %30, i8* %28
br label %31
31: ; preds = %27, %15
%32 = load volatile i32, i32* inttoptr (i64 3760193732 to i32*)
%33 = and i32 %32, -3
store volatile i32 %33, i32* inttoptr (i64 3760193732 to i32*)
%34 = call i32 @delay(i32 10)
br label %35
35: ; preds = %31
%36 = load i8, i8* %3
%37 = add i8 %36, 1
store i8 %37, i8* %3
br label %11
38: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @gpio_iic_read(i8* nocapture %0) {
%2 = load volatile i32, i32* inttoptr (i64 3760193728 to i32*)
%3 = and i32 %2, -16
%4 = or i32 %3, 1
store volatile i32 %4, i32* inttoptr (i64 3760193728 to i32*)
%5 = load volatile i32, i32* inttoptr (i64 3760193732 to i32*)
%6 = or i32 %5, 1
store volatile i32 %6, i32* inttoptr (i64 3760193732 to i32*)
%7 = load volatile i32, i32* inttoptr (i64 3760193728 to i32*)
%8 = and i32 %7, -16
store volatile i32 %8, i32* inttoptr (i64 3760193728 to i32*)
br label %9
9: ; preds = %1, %21
%10 = phi i8 [ 0, %1 ], [ %25, %21 ]
%11 = load volatile i32, i32* inttoptr (i64 3760193732 to i32*)
%12 = or i32 %11, 2
store volatile i32 %12, i32* inttoptr (i64 3760193732 to i32*)
%13 = tail call i32 @delay(i32 10)
%14 = load i8, i8* %0
%15 = shl i8 %14, 1
store i8 %15, i8* %0
%16 = load volatile i32, i32* inttoptr (i64 3760193732 to i32*)
%17 = and i32 %16, 1
%18 = icmp eq i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %9
%20 = or i8 %15, 1
store i8 %20, i8* %0
br label %21
21: ; preds = %19, %9
%22 = load volatile i32, i32* inttoptr (i64 3760193732 to i32*)
%23 = and i32 %22, -3
store volatile i32 %23, i32* inttoptr (i64 3760193732 to i32*)
%24 = tail call i32 @delay(i32 10)
%25 = add nuw nsw i8 %10, 1
%26 = icmp eq i8 %25, 8
br i1 %26, label %27, label %9
27: ; preds = %21
ret void
}