#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*/ bbm_byte_read(void *, int, int, unsigned char *);
int /*<<< orphan*/ bbm_byte_write(void *, int, int, unsigned char);
int /*<<< orphan*/ fc8300_data(void *, int, unsigned char);
void fc8300_isr(void *handle) {
  unsigned char buf_int_status = 0;
  bbm_byte_read(handle, 0x5800, 0x8000, &buf_int_status);
  if (buf_int_status) {
    bbm_byte_write(handle, 0x5800, 0x8000, buf_int_status);
    fc8300_data(handle, 0x5800, buf_int_status);
  }
  buf_int_status = 0;
  bbm_byte_read(handle, 0x5800, 0x8000, &buf_int_status);
  if (buf_int_status) {
    bbm_byte_write(handle, 0x5800, 0x8000, buf_int_status);
    fc8300_data(handle, 0x5800, buf_int_status);
  }
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x5800,%esi
mov    $0x8000,%edx
lea    -0x9(%rbp),%rcx
call   1030 <bbm_byte_read@plt>
cmpb   $0x0,-0x9(%rbp)
je     118a <fc8300_isr+0x5a>
mov    -0x8(%rbp),%rdi
mov    $0x5800,%esi
mov    $0x8000,%edx
movzbl -0x9(%rbp),%ecx
call   1040 <bbm_byte_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x5800,%esi
movzbl -0x9(%rbp),%edx
call   1050 <fc8300_data@plt>
movb   $0x0,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x5800,%esi
mov    $0x8000,%edx
lea    -0x9(%rbp),%rcx
call   1030 <bbm_byte_read@plt>
cmpb   $0x0,-0x9(%rbp)
je     11d8 <fc8300_isr+0xa8>
mov    -0x8(%rbp),%rdi
mov    $0x5800,%esi
mov    $0x8000,%edx
movzbl -0x9(%rbp),%ecx
call   1040 <bbm_byte_write@plt>
mov    -0x8(%rbp),%rdi
mov    $0x5800,%esi
movzbl -0x9(%rbp),%edx
call   1050 <fc8300_data@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movb   $0x0,0xf(%rsp)
lea    0xf(%rsp),%rcx
mov    $0x5800,%esi
mov    $0x8000,%edx
call   1030 <bbm_byte_read@plt>
mov    0xf(%rsp),%al
test   %al,%al
je     1180 <fc8300_isr+0x50>
movzbl %al,%ecx
mov    %rbx,%rdi
mov    $0x5800,%esi
mov    $0x8000,%edx
call   1040 <bbm_byte_write@plt>
movzbl 0xf(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5800,%esi
call   1050 <fc8300_data@plt>
movb   $0x0,0xf(%rsp)
lea    0xf(%rsp),%rcx
mov    %rbx,%rdi
mov    $0x5800,%esi
mov    $0x8000,%edx
call   1030 <bbm_byte_read@plt>
mov    0xf(%rsp),%al
test   %al,%al
je     11cb <fc8300_isr+0x9b>
movzbl %al,%ecx
mov    %rbx,%rdi
mov    $0x5800,%esi
mov    $0x8000,%edx
call   1040 <bbm_byte_write@plt>
movzbl 0xf(%rsp),%edx
mov    %rbx,%rdi
mov    $0x5800,%esi
call   1050 <fc8300_data@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @fc8300_isr(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
store i8 0, i8* %3
%4 = load i8*, i8** %2
%5 = call i32 @bbm_byte_read(i8* %4, i32 22528, i32 32768, i8* %3)
%6 = load i8, i8* %3
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = load i8, i8* %3
%11 = call i32 @bbm_byte_write(i8* %9, i32 22528, i32 32768, i8 zeroext %10)
%12 = load i8*, i8** %2
%13 = load i8, i8* %3
%14 = call i32 @fc8300_data(i8* %12, i32 22528, i8 zeroext %13)
br label %15
15: ; preds = %8, %1
store i8 0, i8* %3
%16 = load i8*, i8** %2
%17 = call i32 @bbm_byte_read(i8* %16, i32 22528, i32 32768, i8* %3)
%18 = load i8, i8* %3
%19 = icmp ne i8 %18, 0
br i1 %19, label %20, label %27
20: ; preds = %15
%21 = load i8*, i8** %2
%22 = load i8, i8* %3
%23 = call i32 @bbm_byte_write(i8* %21, i32 22528, i32 32768, i8 zeroext %22)
%24 = load i8*, i8** %2
%25 = load i8, i8* %3
%26 = call i32 @fc8300_data(i8* %24, i32 22528, i8 zeroext %25)
br label %27
27: ; preds = %20, %15
ret void
}

LLVM IR (-O2):
define void @fc8300_isr(i8* %0) {
%2 = alloca i8
store i8 0, i8* %2
%3 = call i32 @bbm_byte_read(i8* %0, i32 22528, i32 32768, i8* %2)
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = call i32 @bbm_byte_write(i8* %0, i32 22528, i32 32768, i8 zeroext %4)
%8 = load i8, i8* %2
%9 = call i32 @fc8300_data(i8* %0, i32 22528, i8 zeroext %8)
br label %10
10: ; preds = %6, %1
store i8 0, i8* %2
%11 = call i32 @bbm_byte_read(i8* %0, i32 22528, i32 32768, i8* %2)
%12 = load i8, i8* %2
%13 = icmp eq i8 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = call i32 @bbm_byte_write(i8* %0, i32 22528, i32 32768, i8 zeroext %12)
%16 = load i8, i8* %2
%17 = call i32 @fc8300_data(i8* %0, i32 22528, i8 zeroext %16)
br label %18
18: ; preds = %14, %10
ret void
}