#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();
signed int fc8180_ppi_longwrite(void *handle, unsigned short addr,
                                unsigned int data) {
  unsigned int length = 4;
  unsigned char cmd = 0x80 | 0x00 | ((length & 0x0f0000) >> 16);
  OAL_OBTAIN_SEMAPHORE();
  (*(volatile unsigned char *)(0x00)) = addr;
  (*(volatile unsigned char *)(0x00)) = addr >> 4;
  (*(volatile unsigned char *)(0x00)) = addr >> 8;
  (*(volatile unsigned char *)(0x00)) = addr >> 12;
  (*(volatile unsigned char *)(0x00)) = cmd >> 4;
  (*(volatile unsigned char *)(0x00)) = cmd;
  (*(volatile unsigned char *)(0x00)) = length >> 12;
  (*(volatile unsigned char *)(0x00)) = length >> 8;
  (*(volatile unsigned char *)(0x00)) = length >> 4;
  (*(volatile unsigned char *)(0x00)) = length;
  (*(volatile unsigned char *)(0x00)) = (data >> 4) & 0x0f;
  (*(volatile unsigned char *)(0x00)) = data & 0x0f;
  (*(volatile unsigned char *)(0x00)) = (data >> 12) & 0x0f;
  (*(volatile unsigned char *)(0x00)) = (data >> 8) & 0x0f;
  (*(volatile unsigned char *)(0x00)) = (data >> 20) & 0x0f;
  (*(volatile unsigned char *)(0x00)) = (data >> 16) & 0x0f;
  (*(volatile unsigned char *)(0x00)) = (data >> 28) & 0x0f;
  (*(volatile unsigned char *)(0x00)) = (data >> 24) & 0x0f;
  OAL_RELEASE_SEMAPHORE();
  return 0;
}


x86 assembly (clang, -O0):
<fc8180_ppi_longwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0xf0000,%eax
shr    $0x10,%eax
or     $0x80,%eax
mov    %al,-0x15(%rbp)
mov    $0x0,%al
call   1040 <OAL_OBTAIN_SEMAPHORE@plt>
mov    -0xa(%rbp),%ax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
movzwl -0xa(%rbp),%eax
sar    $0x4,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
movzwl -0xa(%rbp),%eax
sar    $0x8,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
movzwl -0xa(%rbp),%eax
sar    $0xc,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
movzbl -0x15(%rbp),%eax
sar    $0x4,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x15(%rbp),%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
shr    $0xc,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
shr    $0x8,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
shr    $0x4,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x10(%rbp),%eax
shr    $0x4,%eax
and    $0xf,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x10(%rbp),%eax
and    $0xf,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x10(%rbp),%eax
shr    $0xc,%eax
and    $0xf,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x10(%rbp),%eax
shr    $0x8,%eax
and    $0xf,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x10(%rbp),%eax
shr    $0x14,%eax
and    $0xf,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x10(%rbp),%eax
shr    $0x10,%eax
and    $0xf,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x10(%rbp),%eax
shr    $0x1c,%eax
and    $0xf,%eax
mov    %al,%cl
xor    %eax,%eax
mov    %cl,(%rax)
mov    -0x10(%rbp),%eax
shr    $0x18,%eax
and    $0xf,%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):
<fc8180_ppi_longwrite>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %esi,%ebx
xor    %eax,%eax
call   1040 <OAL_OBTAIN_SEMAPHORE@plt>
mov    %bl,0x0
mov    %ebx,%eax
shr    $0x4,%eax
mov    %al,0x0
mov    %bh,0x0
shr    $0xc,%ebx
mov    %bl,0x0
movb   $0x8,0x0
08
movb   $0x80,0x0
80
movb   $0x0,0x0
movb   $0x0,0x0
movb   $0x0,0x0
movb   $0x4,0x0
04
mov    %ebp,%eax
shr    $0x4,%al
mov    %al,0x0
mov    %ebp,%eax
and    $0xf,%al
mov    %al,0x0
mov    %ebp,%eax
shr    $0xc,%eax
and    $0xf,%al
mov    %al,0x0
mov    %ebp,%eax
shr    $0x8,%eax
and    $0xf,%al
mov    %al,0x0
mov    %ebp,%eax
shr    $0x14,%eax
and    $0xf,%al
mov    %al,0x0
mov    %ebp,%eax
shr    $0x10,%eax
and    $0xf,%al
mov    %al,0x0
mov    %ebp,%eax
shr    $0x1c,%eax
mov    %al,0x0
shr    $0x18,%ebp
and    $0xf,%bpl
mov    %bpl,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 @fc8180_ppi_longwrite(i8* %0, i16 zeroext %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i16
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store i8* %0, i8** %4
store i16 %1, i16* %5
store i32 %2, i32* %6
store i32 4, i32* %7
%9 = load i32, i32* %7
%10 = and i32 %9, 983040
%11 = lshr i32 %10, 16
%12 = or i32 128, %11
%13 = trunc i32 %12 to i8
store i8 %13, i8* %8
%14 = call i32 (...) @OAL_OBTAIN_SEMAPHORE()
%15 = load i16, i16* %5
%16 = trunc i16 %15 to i8
store volatile i8 %16, i8* null
%17 = load i16, i16* %5
%18 = zext i16 %17 to i32
%19 = ashr i32 %18, 4
%20 = trunc i32 %19 to i8
store volatile i8 %20, i8* null
%21 = load i16, i16* %5
%22 = zext i16 %21 to i32
%23 = ashr i32 %22, 8
%24 = trunc i32 %23 to i8
store volatile i8 %24, i8* null
%25 = load i16, i16* %5
%26 = zext i16 %25 to i32
%27 = ashr i32 %26, 12
%28 = trunc i32 %27 to i8
store volatile i8 %28, i8* null
%29 = load i8, i8* %8
%30 = zext i8 %29 to i32
%31 = ashr i32 %30, 4
%32 = trunc i32 %31 to i8
store volatile i8 %32, i8* null
%33 = load i8, i8* %8
store volatile i8 %33, i8* null
%34 = load i32, i32* %7
%35 = lshr i32 %34, 12
%36 = trunc i32 %35 to i8
store volatile i8 %36, i8* null
%37 = load i32, i32* %7
%38 = lshr i32 %37, 8
%39 = trunc i32 %38 to i8
store volatile i8 %39, i8* null
%40 = load i32, i32* %7
%41 = lshr i32 %40, 4
%42 = trunc i32 %41 to i8
store volatile i8 %42, i8* null
%43 = load i32, i32* %7
%44 = trunc i32 %43 to i8
store volatile i8 %44, i8* null
%45 = load i32, i32* %6
%46 = lshr i32 %45, 4
%47 = and i32 %46, 15
%48 = trunc i32 %47 to i8
store volatile i8 %48, i8* null
%49 = load i32, i32* %6
%50 = and i32 %49, 15
%51 = trunc i32 %50 to i8
store volatile i8 %51, i8* null
%52 = load i32, i32* %6
%53 = lshr i32 %52, 12
%54 = and i32 %53, 15
%55 = trunc i32 %54 to i8
store volatile i8 %55, i8* null
%56 = load i32, i32* %6
%57 = lshr i32 %56, 8
%58 = and i32 %57, 15
%59 = trunc i32 %58 to i8
store volatile i8 %59, i8* null
%60 = load i32, i32* %6
%61 = lshr i32 %60, 20
%62 = and i32 %61, 15
%63 = trunc i32 %62 to i8
store volatile i8 %63, i8* null
%64 = load i32, i32* %6
%65 = lshr i32 %64, 16
%66 = and i32 %65, 15
%67 = trunc i32 %66 to i8
store volatile i8 %67, i8* null
%68 = load i32, i32* %6
%69 = lshr i32 %68, 28
%70 = and i32 %69, 15
%71 = trunc i32 %70 to i8
store volatile i8 %71, i8* null
%72 = load i32, i32* %6
%73 = lshr i32 %72, 24
%74 = and i32 %73, 15
%75 = trunc i32 %74 to i8
store volatile i8 %75, i8* null
%76 = call i32 (...) @OAL_RELEASE_SEMAPHORE()
ret i32 0
}

LLVM IR (-O2):
define i32 @fc8180_ppi_longwrite(i8* nocapture readnone %0, i16 zeroext %1, i32 %2) {
%4 = tail call i32 (...) @OAL_OBTAIN_SEMAPHORE()
%5 = trunc i16 %1 to i8
store volatile i8 %5, i8* null
%6 = lshr i16 %1, 4
%7 = trunc i16 %6 to i8
store volatile i8 %7, i8* null
%8 = lshr i16 %1, 8
%9 = trunc i16 %8 to i8
store volatile i8 %9, i8* null
%10 = lshr i16 %1, 12
%11 = trunc i16 %10 to i8
store volatile i8 %11, i8* null
store volatile i8 8, i8* null
store volatile i8 -128, i8* null
store volatile i8 0, i8* null
store volatile i8 0, i8* null
store volatile i8 0, i8* null
store volatile i8 4, i8* null
%12 = trunc i32 %2 to i8
%13 = lshr i8 %12, 4
store volatile i8 %13, i8* null
%14 = and i8 %12, 15
store volatile i8 %14, i8* null
%15 = lshr i32 %2, 12
%16 = trunc i32 %15 to i8
%17 = and i8 %16, 15
store volatile i8 %17, i8* null
%18 = lshr i32 %2, 8
%19 = trunc i32 %18 to i8
%20 = and i8 %19, 15
store volatile i8 %20, i8* null
%21 = lshr i32 %2, 20
%22 = trunc i32 %21 to i8
%23 = and i8 %22, 15
store volatile i8 %23, i8* null
%24 = lshr i32 %2, 16
%25 = trunc i32 %24 to i8
%26 = and i8 %25, 15
store volatile i8 %26, i8* null
%27 = lshr i32 %2, 28
%28 = trunc i32 %27 to i8
store volatile i8 %28, i8* null
%29 = lshr i32 %2, 24
%30 = trunc i32 %29 to i8
%31 = and i8 %30, 15
store volatile i8 %31, i8* null
%32 = tail call i32 (...) @OAL_RELEASE_SEMAPHORE()
ret i32 0
}