#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 */
unsigned int inl(unsigned int);
int /*<<< orphan*/ outl(unsigned int, unsigned int);
void setup_ss_table(unsigned index, unsigned where, unsigned control,
                    const unsigned int *register_values, int max) {
  int i;
  unsigned val;
  val = inl(control);
  val &= 0xfffffffe;
  outl(val, control);
  outl(0, index);
  for (i = 0; i < max; i++) {
    unsigned long reg;
    reg = register_values[i];
    outl(reg, where);
  }
  val = inl(control);
  val |= 1;
  outl(val, control);
}


x86 assembly (clang, -O0):
<setup_ss_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <inl@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
and    $0xfffffffe,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <outl@plt>
mov    -0x4(%rbp),%esi
xor    %edi,%edi
call   1030 <outl@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11a0 <setup_ss_table+0x80>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %eax,%edi
mov    -0x8(%rbp),%esi
call   1030 <outl@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1169 <setup_ss_table+0x49>
mov    -0xc(%rbp),%edi
call   1040 <inl@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <outl@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_ss_table>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r15d
mov    %rcx,%r13
mov    %edx,%r14d
mov    %esi,%r12d
mov    %edi,%ebx
mov    %edx,%edi
call   1040 <inl@plt>
and    $0xfffffffe,%eax
mov    %eax,%edi
mov    %r14d,%esi
call   1030 <outl@plt>
xor    %edi,%edi
mov    %ebx,%esi
call   1030 <outl@plt>
test   %r15d,%r15d
jle    1176 <setup_ss_table+0x56>
mov    %r15d,%ebx
xor    %ebp,%ebp
mov    0x0(%r13,%rbp,4),%edi
mov    %r12d,%esi
call   1030 <outl@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1160 <setup_ss_table+0x40>
mov    %r14d,%edi
call   1040 <inl@plt>
or     $0x1,%eax
mov    %eax,%edi
mov    %r14d,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <outl@plt>

LLVM IR (-O0):
define void @setup_ss_table(i32 %0, i32 %1, i32 %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32* %3, i32** %9
store i32 %4, i32* %10
%14 = load i32, i32* %8
%15 = call i32 @inl(i32 %14)
store i32 %15, i32* %12
%16 = load i32, i32* %12
%17 = and i32 %16, -2
store i32 %17, i32* %12
%18 = load i32, i32* %12
%19 = load i32, i32* %8
%20 = call i32 @outl(i32 %18, i32 %19)
%21 = load i32, i32* %6
%22 = call i32 @outl(i32 0, i32 %21)
store i32 0, i32* %11
br label %23
23: ; preds = %38, %5
%24 = load i32, i32* %11
%25 = load i32, i32* %10
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %41
27: ; preds = %23
%28 = load i32*, i32** %9
%29 = load i32, i32* %11
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %28, i64 %30
%32 = load i32, i32* %31
%33 = zext i32 %32 to i64
store i64 %33, i64* %13
%34 = load i64, i64* %13
%35 = trunc i64 %34 to i32
%36 = load i32, i32* %7
%37 = call i32 @outl(i32 %35, i32 %36)
br label %38
38: ; preds = %27
%39 = load i32, i32* %11
%40 = add nsw i32 %39, 1
store i32 %40, i32* %11
br label %23
41: ; preds = %23
%42 = load i32, i32* %8
%43 = call i32 @inl(i32 %42)
store i32 %43, i32* %12
%44 = load i32, i32* %12
%45 = or i32 %44, 1
store i32 %45, i32* %12
%46 = load i32, i32* %12
%47 = load i32, i32* %8
%48 = call i32 @outl(i32 %46, i32 %47)
ret void
}

LLVM IR (-O2):
define void @setup_ss_table(i32 %0, i32 %1, i32 %2, i32* nocapture %3, i32 %4) {
%6 = tail call i32 @inl(i32 %2)
%7 = and i32 %6, -2
%8 = tail call i32 @outl(i32 %7, i32 %2)
%9 = tail call i32 @outl(i32 0, i32 %0)
%10 = icmp sgt i32 %4, 0
br i1 %10, label %11, label %20
11: ; preds = %5
%12 = zext i32 %4 to i64
br label %13
13: ; preds = %11, %13
%14 = phi i64 [ 0, %11 ], [ %18, %13 ]
%15 = getelementptr inbounds i32, i32* %3, i64 %14
%16 = load i32, i32* %15
%17 = tail call i32 @outl(i32 %16, i32 %1)
%18 = add nuw nsw i64 %14, 1
%19 = icmp eq i64 %18, %12
br i1 %19, label %20, label %13
20: ; preds = %13, %5
%21 = tail call i32 @inl(i32 %2)
%22 = or i32 %21, 1
%23 = tail call i32 @outl(i32 %22, i32 %2)
ret void
}