#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;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int _SSIBaseValid(int);
void SSIAdvDataPutFrameEnd(uint32_t ui32Base, uint32_t ui32Data) {
  ASSERT(_SSIBaseValid(ui32Base));
  ASSERT((ui32Data & 0xff) == 0);
  while (!((*((volatile uint32_t *)(ui32Base + 0x0000000C))) & 0x00000002)) {
  }
  (*((volatile uint32_t *)(ui32Base + 0x00000004))) |= 0x00000800;
  (*((volatile uint32_t *)(ui32Base + 0x00000008))) = ui32Data;
}


x86 assembly (clang, -O0):
<SSIAdvDataPutFrameEnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_SSIBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
mov    -0x8(%rbp),%eax
and    $0xff,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0xc,%eax
cltq
mov    (%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1177 <SSIAdvDataPutFrameEnd+0x57>
jmp    117c <SSIAdvDataPutFrameEnd+0x5c>
jmp    1155 <SSIAdvDataPutFrameEnd+0x35>
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
mov    (%rax),%ecx
or     $0x800,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIAdvDataPutFrameEnd>:
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,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
testl  $0x2,0xc(%rax)
je     1150 <SSIAdvDataPutFrameEnd+0x30>
orl    $0x800,0x4(%rax)
mov    %ebx,0x8(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @SSIAdvDataPutFrameEnd(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*
br label %12
12: ; preds = %12, %2
%13 = load volatile i32, i32* %11
%14 = and i32 %13, 2
%15 = icmp eq i32 %14, 0
br i1 %15, label %12, label %16
16: ; preds = %12
%17 = add nsw i32 %0, 4
%18 = sext i32 %17 to i64
%19 = inttoptr i64 %18 to i32*
%20 = load volatile i32, i32* %19
%21 = or i32 %20, 2048
store volatile i32 %21, i32* %19
%22 = add nsw i32 %0, 8
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
store volatile i32 %1, i32* %24
ret void
}