#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 SSIAdvModeSet(uint32_t ui32Base, uint32_t ui32Mode) {
  ASSERT(_SSIBaseValid(ui32Base));
  ASSERT((ui32Mode == 0x00000000) || (ui32Mode == 0x000000c0) ||
         (ui32Mode == 0x000001c0) || (ui32Mode == 0x00000140) ||
         (ui32Mode == 0x00000040) || (ui32Mode == 0x00000180) ||
         (ui32Mode == 0x00000080));
  (*((volatile uint32_t *)(ui32Base + 0x00000004))) =
      (((*((volatile uint32_t *)(ui32Base + 0x00000004))) &
        ~(0x00000100 | 0x000000C0)) |
       ui32Mode);
}


x86 assembly (clang, -O0):
<SSIAdvModeSet>:
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    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     11b0 <SSIAdvModeSet+0x90>
mov    $0x1,%al
cmpl   $0xc0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     11b0 <SSIAdvModeSet+0x90>
mov    $0x1,%al
cmpl   $0x1c0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     11b0 <SSIAdvModeSet+0x90>
mov    $0x1,%al
cmpl   $0x140,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     11b0 <SSIAdvModeSet+0x90>
mov    $0x1,%al
cmpl   $0x40,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     11b0 <SSIAdvModeSet+0x90>
mov    $0x1,%al
cmpl   $0x180,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     11b0 <SSIAdvModeSet+0x90>
cmpl   $0x80,-0x8(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
mov    (%rax),%ecx
and    $0xfffffe3f,%ecx
or     -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIAdvModeSet>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <_SSIBaseValid@plt>
mov    %eax,%edi
call   1040 <ASSERT@plt>
mov    %ebx,%eax
rol    $0x1a,%eax
cmp    $0x8,%eax
jae    114c <SSIAdvModeSet+0x2c>
mov    $0x1,%edi
mov    $0xeb,%ecx
bt     %eax,%ecx
jb     1158 <SSIAdvModeSet+0x38>
xor    %edi,%edi
cmp    $0x80,%ebx
sete   %dil
call   1040 <ASSERT@plt>
movslq %ebp,%rax
mov    $0xfffffe3f,%ecx
and    0x4(%rax),%ecx
or     %ebx,%ecx
mov    %ecx,0x4(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @SSIAdvModeSet(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 = icmp eq i32 %8, 0
br i1 %9, label %28, label %10
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 192
br i1 %12, label %28, label %13
13: ; preds = %10
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 448
br i1 %15, label %28, label %16
16: ; preds = %13
%17 = load i32, i32* %4
%18 = icmp eq i32 %17, 320
br i1 %18, label %28, label %19
19: ; preds = %16
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 64
br i1 %21, label %28, label %22
22: ; preds = %19
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 384
br i1 %24, label %28, label %25
25: ; preds = %22
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 128
br label %28
28: ; preds = %25, %22, %19, %16, %13, %10, %2
%29 = phi i1 [ true, %22 ], [ true, %19 ], [ true, %16 ], [ true, %13 ], [ true, %10 ], [ true, %2 ], [ %27, %25 ]
%30 = zext i1 %29 to i32
%31 = call i32 @ASSERT(i32 %30)
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 4
%34 = sext i32 %33 to i64
%35 = inttoptr i64 %34 to i32*
%36 = load volatile i32, i32* %35
%37 = and i32 %36, -449
%38 = load i32, i32* %4
%39 = or i32 %37, %38
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 4
%42 = sext i32 %41 to i64
%43 = inttoptr i64 %42 to i32*
store volatile i32 %39, i32* %43
ret void
}

LLVM IR (-O2):
define void @SSIAdvModeSet(i32 %0, i32 %1) {
%3 = tail call i32 @_SSIBaseValid(i32 %0)
%4 = tail call i32 @ASSERT(i32 %3)
%5 = tail call i32 @llvm.fshl.i32(i32 %1, i32 %1, i32 26)
%6 = icmp ult i32 %5, 8
br i1 %6, label %10, label %7
7: ; preds = %10, %2
%8 = icmp eq i32 %1, 128
%9 = zext i1 %8 to i32
br label %15
10: ; preds = %2
%11 = trunc i32 %5 to i8
%12 = lshr i8 -21, %11
%13 = and i8 %12, 1
%14 = icmp eq i8 %13, 0
br i1 %14, label %7, label %15
15: ; preds = %10, %7
%16 = phi i32 [ %9, %7 ], [ 1, %10 ]
%17 = tail call i32 @ASSERT(i32 %16)
%18 = add nsw i32 %0, 4
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
%21 = load volatile i32, i32* %20
%22 = and i32 %21, -449
%23 = or i32 %22, %1
store volatile i32 %23, i32* %20
ret void
}