#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;
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int _SSIBaseValid(int);
int32_t SSIAdvDataPutFrameEndNonBlocking(uint32_t ui32Base, uint32_t ui32Data) {
  ASSERT(_SSIBaseValid(ui32Base));
  ASSERT((ui32Data & 0xff) == 0);
  if ((*((volatile uint32_t *)(ui32Base + 0x0000000C))) & 0x00000002) {
    (*((volatile uint32_t *)(ui32Base + 0x00000004))) |= 0x00000800;
    (*((volatile uint32_t *)(ui32Base + 0x00000008))) = ui32Data;
    return (1);
  } else {
    return (0);
  }
}


x86 assembly (clang, -O0):
<SSIAdvDataPutFrameEndNonBlocking>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <_SSIBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
mov    -0xc(%rbp),%eax
and    $0xff,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0x8(%rbp),%eax
add    $0xc,%eax
cltq
mov    (%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
je     1196 <SSIAdvDataPutFrameEndNonBlocking+0x76>
mov    -0x8(%rbp),%eax
add    $0x4,%eax
cltq
mov    (%rax),%ecx
or     $0x800,%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
add    $0x8,%eax
cltq
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
jmp    119d <SSIAdvDataPutFrameEndNonBlocking+0x7d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIAdvDataPutFrameEndNonBlocking>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <_SSIBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
xor    %edi,%edi
test   %bl,%bl
sete   %dil
call   1040 <ASSERT@plt>
movslq %ebp,%rcx
xor    %eax,%eax
testl  $0x2,0xc(%rcx)
je     115d <SSIAdvDataPutFrameEndNonBlocking+0x3d>
orl    $0x800,0x4(%rcx)
mov    %ebx,0x8(%rcx)
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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