#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*/ xerbla_(char *, int *);
int sp_ienv(int ispec) {
  int i;
  switch (ispec) {
  case 1:
    return (20);
  case 2:
    return (6);
  case 3:
    return (100);
  case 4:
    return (800);
  case 5:
    return (100);
  case 6:
    return (-100);
  case 7:
    return (-100);
  case 8:
    return (-100);
  }
  i = 1;
  xerbla_("sp_ienv", &i);
  return 0;
}


x86 assembly (clang, -O0):
<sp_ienv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x7,%eax
ja     11a4 <sp_ienv+0x94>
mov    -0x18(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x14,-0x4(%rbp)
jmp    11c2 <sp_ienv+0xb2>
movl   $0x6,-0x4(%rbp)
jmp    11c2 <sp_ienv+0xb2>
movl   $0x64,-0x4(%rbp)
jmp    11c2 <sp_ienv+0xb2>
movl   $0x320,-0x4(%rbp)
jmp    11c2 <sp_ienv+0xb2>
movl   $0x64,-0x4(%rbp)
jmp    11c2 <sp_ienv+0xb2>
movl   $0xffffff9c,-0x4(%rbp)
jmp    11c2 <sp_ienv+0xb2>
movl   $0xffffff9c,-0x4(%rbp)
jmp    11c2 <sp_ienv+0xb2>
movl   $0xffffff9c,-0x4(%rbp)
jmp    11c2 <sp_ienv+0xb2>
movl   $0x1,-0xc(%rbp)
lea    0xe6e(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <xerbla_@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sp_ienv>:
push   %rax
add    $0xffffffff,%edi
cmp    $0x8,%edi
jae    1128 <sp_ienv+0x18>
movslq %edi,%rax
lea    0xee5(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret
movl   $0x1,0x4(%rsp)
lea    0xec9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <xerbla_@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"sp_ienv\00"
define i32 @sp_ienv(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
switch i32 %5, label %14 [
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
i32 5, label %10
i32 6, label %11
i32 7, label %12
i32 8, label %13
]
6: ; preds = %1
store i32 20, i32* %2
br label %16
7: ; preds = %1
store i32 6, i32* %2
br label %16
8: ; preds = %1
store i32 100, i32* %2
br label %16
9: ; preds = %1
store i32 800, i32* %2
br label %16
10: ; preds = %1
store i32 100, i32* %2
br label %16
11: ; preds = %1
store i32 -100, i32* %2
br label %16
12: ; preds = %1
store i32 -100, i32* %2
br label %16
13: ; preds = %1
store i32 -100, i32* %2
br label %16
14: ; preds = %1
store i32 1, i32* %4
%15 = call i32 @xerbla_(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %4)
store i32 0, i32* %2
br label %16
16: ; preds = %14, %13, %12, %11, %10, %9, %8, %7, %6
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@.str = [8 x i8] c"sp_ienv\00"
@switch.table.sp_ienv = [8 x i32] [i32 20, i32 6, i32 100, i32 800, i32 100, i32 -100, i32 -100, i32 -100]
define i32 @sp_ienv(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = add i32 %0, -1
%5 = icmp ult i32 %4, 8
br i1 %5, label %8, label %6
6: ; preds = %1
store i32 1, i32* %2
%7 = call i32 @xerbla_(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %12
8: ; preds = %1
%9 = sext i32 %4 to i64
%10 = getelementptr inbounds [8 x i32], [8 x i32]* @switch.table.sp_ienv, i64 0, i64 %9
%11 = load i32, i32* %10
br label %12
12: ; preds = %8, %6
%13 = phi i32 [ 0, %6 ], [ %11, %8 ]
ret i32 %13
}