#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*/ OAL_OBTAIN_SEMAPHORE();
int /*<<< orphan*/ OAL_RELEASE_SEMAPHORE();
int fc8300_ppi_wordwrite(void *handle, unsigned short devid,
                         unsigned short addr, unsigned short data) {
  unsigned short length = 2;
  unsigned char command = 0x80 | 0x00;
  OAL_OBTAIN_SEMAPHORE();
  (*(volatile unsigned char *)0x00) = (addr & 0xff00) >> 8;
  (*(volatile unsigned char *)0x00) = addr & 0xff;
  (*(volatile unsigned char *)0x00) = command;
  (*(volatile unsigned char *)0x00) = length & 0xff;
  (*(volatile unsigned char *)0x00) = data & 0xff;
  (*(volatile unsigned char *)0x00) = (data & 0xff00) >> 8;
  OAL_RELEASE_SEMAPHORE();
  return 0;
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %cx,%ax
mov    %dx,%cx
mov    %si,%dx
mov    %rdi,-0x8(%rbp)
mov    %dx,-0xa(%rbp)
mov    %cx,-0xc(%rbp)
mov    %ax,-0xe(%rbp)
movw   $0x2,-0x10(%rbp)
movb   $0x80,-0x11(%rbp)
mov    $0x0,%al
call   1040 <OAL_OBTAIN_SEMAPHORE@plt>
movzwl -0xc(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
movzwl -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x11(%rbp),%cl
xor    %eax,%eax
mov    %cl,(%rax)
movzwl -0x10(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
movzwl -0xe(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
movzwl -0xe(%rbp),%eax
and    $0xff00,%eax
sar    $0x8,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    $0x0,%al
call   1030 <OAL_RELEASE_SEMAPHORE@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %edx,%ebx
xor    %eax,%eax
call   1040 <OAL_OBTAIN_SEMAPHORE@plt>
mov    %bh,0x0
mov    %bl,0x0
movb   $0x80,0x0
80
movb   $0x2,0x0
02
mov    %ebp,%eax
mov    %al,0x0
mov    %ah,0x0
xor    %eax,%eax
call   1030 <OAL_RELEASE_SEMAPHORE@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @fc8300_ppi_wordwrite(i8* %0, i16 zeroext %1, i16 zeroext %2, i16 zeroext %3) {
%5 = alloca i8*
%6 = alloca i16
%7 = alloca i16
%8 = alloca i16
%9 = alloca i16
%10 = alloca i8
store i8* %0, i8** %5
store i16 %1, i16* %6
store i16 %2, i16* %7
store i16 %3, i16* %8
store i16 2, i16* %9
store i8 -128, i8* %10
%11 = call i32 (...) @OAL_OBTAIN_SEMAPHORE()
%12 = load i16, i16* %7
%13 = zext i16 %12 to i32
%14 = and i32 %13, 65280
%15 = ashr i32 %14, 8
%16 = trunc i32 %15 to i8
store volatile i8 %16, i8* null
%17 = load i16, i16* %7
%18 = zext i16 %17 to i32
%19 = and i32 %18, 255
%20 = trunc i32 %19 to i8
store volatile i8 %20, i8* null
%21 = load i8, i8* %10
store volatile i8 %21, i8* null
%22 = load i16, i16* %9
%23 = zext i16 %22 to i32
%24 = and i32 %23, 255
%25 = trunc i32 %24 to i8
store volatile i8 %25, i8* null
%26 = load i16, i16* %8
%27 = zext i16 %26 to i32
%28 = and i32 %27, 255
%29 = trunc i32 %28 to i8
store volatile i8 %29, i8* null
%30 = load i16, i16* %8
%31 = zext i16 %30 to i32
%32 = and i32 %31, 65280
%33 = ashr i32 %32, 8
%34 = trunc i32 %33 to i8
store volatile i8 %34, i8* null
%35 = call i32 (...) @OAL_RELEASE_SEMAPHORE()
ret i32 0
}

LLVM IR (-O2):
define i32 @fc8300_ppi_wordwrite(i8* nocapture readnone %0, i16 zeroext %1, i16 zeroext %2, i16 zeroext %3) {
%5 = tail call i32 (...) @OAL_OBTAIN_SEMAPHORE()
%6 = lshr i16 %2, 8
%7 = trunc i16 %6 to i8
store volatile i8 %7, i8* null
%8 = trunc i16 %2 to i8
store volatile i8 %8, i8* null
store volatile i8 -128, i8* null
store volatile i8 2, i8* null
%9 = trunc i16 %3 to i8
store volatile i8 %9, i8* null
%10 = lshr i16 %3, 8
%11 = trunc i16 %10 to i8
store volatile i8 %11, i8* null
%12 = tail call i32 (...) @OAL_RELEASE_SEMAPHORE()
ret i32 0
}