#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 (10);
  case 2:
    return (5);
  case 3:
    return (100);
  case 4:
    return (200);
  case 5:
    return (40);
  case 6:
    return (20);
  }
  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    $0x5,%eax
ja     118c <sp_ienv+0x7c>
mov    -0x18(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xa,-0x4(%rbp)
jmp    11aa <sp_ienv+0x9a>
movl   $0x5,-0x4(%rbp)
jmp    11aa <sp_ienv+0x9a>
movl   $0x64,-0x4(%rbp)
jmp    11aa <sp_ienv+0x9a>
movl   $0xc8,-0x4(%rbp)
jmp    11aa <sp_ienv+0x9a>
movl   $0x28,-0x4(%rbp)
jmp    11aa <sp_ienv+0x9a>
movl   $0x14,-0x4(%rbp)
jmp    11aa <sp_ienv+0x9a>
movl   $0x1,-0xc(%rbp)
lea    0xe7e(%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    $0x6,%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 %12 [
i32 1, label %6
i32 2, label %7
i32 3, label %8
i32 4, label %9
i32 5, label %10
i32 6, label %11
]
6: ; preds = %1
store i32 10, i32* %2
br label %14
7: ; preds = %1
store i32 5, i32* %2
br label %14
8: ; preds = %1
store i32 100, i32* %2
br label %14
9: ; preds = %1
store i32 200, i32* %2
br label %14
10: ; preds = %1
store i32 40, i32* %2
br label %14
11: ; preds = %1
store i32 20, i32* %2
br label %14
12: ; preds = %1
store i32 1, i32* %4
%13 = 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 %14
14: ; preds = %12, %11, %10, %9, %8, %7, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [8 x i8] c"sp_ienv\00"
@switch.table.sp_ienv = [6 x i32] [i32 10, i32 5, i32 100, i32 200, i32 40, i32 20]
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, 6
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 [6 x i32], [6 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
}