#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*/ DEBUG_ASSERT(int);
int SSIBaseValid(unsigned long);
long SSIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData) {
  DEBUG_ASSERT(SSIBaseValid(ulBase));
  DEBUG_ASSERT(
      (ulData &
       (0xfffffffe << ((*((volatile unsigned long *)(ulBase + 0x00000000))) &
                       0x0000000F))) == 0);
  if ((*((volatile unsigned long *)(ulBase + 0x0000000C))) & 0x00000002) {
    (*((volatile unsigned long *)(ulBase + 0x00000008))) = ulData;
    return (1);
  } else {
    return (0);
  }
}


x86 assembly (clang, -O0):
<SSIDataPutNonBlocking>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <SSIBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rcx),%rcx
and    $0xf,%rcx
mov    $0xfffffffe,%edx
shl    %cl,%edx
mov    %edx,%ecx
mov    %ecx,%ecx
and    %rcx,%rax
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%rax
and    $0x2,%rax
cmp    $0x0,%rax
je     119d <SSIDataPutNonBlocking+0x7d>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
movq   $0x1,-0x8(%rbp)
jmp    11a5 <SSIDataPutNonBlocking+0x85>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIDataPutNonBlocking>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <SSIBaseValid@plt>
mov    %eax,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    (%rbx),%rcx
and    $0xf,%cl
mov    %r14d,%eax
shr    %cl,%eax
xor    %edi,%edi
test   $0xfffffffe,%eax
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
testq  $0x2,0xc(%rbx)
jne    115f <SSIDataPutNonBlocking+0x3f>
xor    %eax,%eax
jmp    1168 <SSIDataPutNonBlocking+0x48>
mov    %r14,0x8(%rbx)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @SSIDataPutNonBlocking(i64 %0, i64 %1) {
%3 = tail call i32 @SSIBaseValid(i64 %0)
%4 = tail call i32 @DEBUG_ASSERT(i32 %3)
%5 = inttoptr i64 %0 to i64*
%6 = load volatile i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = and i32 %7, 15
%9 = shl nsw i32 -2, %8
%10 = zext i32 %9 to i64
%11 = and i64 %10, %1
%12 = icmp eq i64 %11, 0
%13 = zext i1 %12 to i32
%14 = tail call i32 @DEBUG_ASSERT(i32 %13)
%15 = add i64 %0, 12
%16 = inttoptr i64 %15 to i64*
%17 = load volatile i64, i64* %16
%18 = and i64 %17, 2
%19 = icmp eq i64 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %2
%21 = add i64 %0, 8
%22 = inttoptr i64 %21 to i64*
store volatile i64 %1, i64* %22
br label %23
23: ; preds = %2, %20
%24 = phi i64 [ 1, %20 ], [ 0, %2 ]
ret i64 %24
}