#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*/ errno;
scalar_t__ strerror(int /*<<< orphan*/);
const char *cdiStringError(int cdiErrno) {
  static const char UnknownError[] = "Unknown Error";
  static const char _EUFTYPE[] = "Unsupported file type";
  static const char _ELIBNAVAIL[] =
      "Unsupported file type (library support not compiled in)";
  static const char _EUFSTRUCT[] = "Unsupported file structure";
  static const char _EUNC4[] = "Unsupported netCDF4 structure";
  static const char _ELIMIT[] = "Internal limits exceeded";
  switch (cdiErrno) {
  case -10: {
    char *cp = (char *)strerror(errno);
    if (cp == NULL)
      break;
    return cp;
  }
  case -21:
    return _EUFTYPE;
  case -22:
    return _ELIBNAVAIL;
  case -23:
    return _EUFSTRUCT;
  case -24:
    return _EUNC4;
  case -99:
    return _ELIMIT;
  }
  return UnknownError;
}


x86 assembly (clang, -O0):
<cdiStringError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0xffffff9d,%eax
je     11f3 <cdiStringError+0xe3>
jmp    112f <cdiStringError+0x1f>
mov    -0x1c(%rbp),%eax
sub    $0xffffffe8,%eax
je     11e3 <cdiStringError+0xd3>
jmp    1140 <cdiStringError+0x30>
mov    -0x1c(%rbp),%eax
sub    $0xffffffe9,%eax
je     11d3 <cdiStringError+0xc3>
jmp    1151 <cdiStringError+0x41>
mov    -0x1c(%rbp),%eax
sub    $0xffffffea,%eax
je     11c3 <cdiStringError+0xb3>
jmp    1162 <cdiStringError+0x52>
mov    -0x1c(%rbp),%eax
sub    $0xffffffeb,%eax
je     11b3 <cdiStringError+0xa3>
jmp    1173 <cdiStringError+0x63>
mov    -0x1c(%rbp),%eax
sub    $0xfffffff6,%eax
jne    1203 <cdiStringError+0xf3>
jmp    1184 <cdiStringError+0x74>
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
call   1030 <strerror@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a6 <cdiStringError+0x96>
jmp    1203 <cdiStringError+0xf3>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    120e <cdiStringError+0xfe>
lea    0xe56(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120e <cdiStringError+0xfe>
lea    0xe66(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120e <cdiStringError+0xfe>
lea    0xe96(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120e <cdiStringError+0xfe>
lea    0xea6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120e <cdiStringError+0xfe>
lea    0xeb6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    120e <cdiStringError+0xfe>
lea    0xdf6(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cdiStringError>:
push   %rax
lea    0x18(%rdi),%ecx
cmp    $0xe,%ecx
ja     1139 <cdiStringError+0x29>
lea    0xf30(%rip),%rax
lea    0xed9(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xf99(%rip),%rax
pop    %rcx
ret
cmp    $0xffffff9d,%edi
jne    116e <cdiStringError+0x5e>
lea    0xfab(%rip),%rax
pop    %rcx
ret
lea    0xf62(%rip),%rax
pop    %rcx
ret
lea    0xf19(%rip),%rax
pop    %rcx
ret
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
call   1030 <strerror@plt>
test   %rax,%rax
je     116e <cdiStringError+0x5e>
pop    %rcx
ret
lea    0xec7(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@cdiStringError.UnknownError = internal constant [14 x i8] c"Unknown Error\00"
@cdiStringError._EUFTYPE = internal constant [22 x i8] c"Unsupported file type\00"
@cdiStringError._ELIBNAVAIL = internal constant [56 x i8] c"Unsupported file type (library support not compiled in)\00"
@cdiStringError._EUFSTRUCT = internal constant [27 x i8] c"Unsupported file structure\00"
@cdiStringError._EUNC4 = internal constant [30 x i8] c"Unsupported netCDF4 structure\00"
@cdiStringError._ELIMIT = internal constant [25 x i8] c"Internal limits exceeded\00"
@errno = global i32 0
define i8* @cdiStringError(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
%5 = load i32, i32* %3
switch i32 %5, label %20 [
i32 -10, label %6
i32 -21, label %15
i32 -22, label %16
i32 -23, label %17
i32 -24, label %18
i32 -99, label %19
]
6: ; preds = %1
%7 = load i32, i32* @errno
%8 = call i64 @strerror(i32 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %6
br label %20
13: ; preds = %6
%14 = load i8*, i8** %4
store i8* %14, i8** %2
br label %21
15: ; preds = %1
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @cdiStringError._EUFTYPE, i64 0, i64 0), i8** %2
br label %21
16: ; preds = %1
store i8* getelementptr inbounds ([56 x i8], [56 x i8]* @cdiStringError._ELIBNAVAIL, i64 0, i64 0), i8** %2
br label %21
17: ; preds = %1
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @cdiStringError._EUFSTRUCT, i64 0, i64 0), i8** %2
br label %21
18: ; preds = %1
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @cdiStringError._EUNC4, i64 0, i64 0), i8** %2
br label %21
19: ; preds = %1
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @cdiStringError._ELIMIT, i64 0, i64 0), i8** %2
br label %21
20: ; preds = %1, %12
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @cdiStringError.UnknownError, i64 0, i64 0), i8** %2
br label %21
21: ; preds = %20, %19, %18, %17, %16, %15, %13
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
@cdiStringError.UnknownError = internal constant [14 x i8] c"Unknown Error\00"
@cdiStringError._EUFTYPE = internal constant [22 x i8] c"Unsupported file type\00"
@cdiStringError._ELIBNAVAIL = internal constant [56 x i8] c"Unsupported file type (library support not compiled in)\00"
@cdiStringError._EUFSTRUCT = internal constant [27 x i8] c"Unsupported file structure\00"
@cdiStringError._EUNC4 = internal constant [30 x i8] c"Unsupported netCDF4 structure\00"
@cdiStringError._ELIMIT = internal constant [25 x i8] c"Internal limits exceeded\00"
@errno = global i32 0
define i8* @cdiStringError(i32 %0) {
switch i32 %0, label %11 [
i32 -10, label %2
i32 -21, label %12
i32 -22, label %7
i32 -23, label %8
i32 -24, label %9
i32 -99, label %10
]
2: ; preds = %1
%3 = load i32, i32* @errno
%4 = tail call i64 @strerror(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %11, label %12
7: ; preds = %1
br label %12
8: ; preds = %1
br label %12
9: ; preds = %1
br label %12
10: ; preds = %1
br label %12
11: ; preds = %2, %1
br label %12
12: ; preds = %2, %1, %11, %10, %9, %8, %7
%13 = phi i8* [ getelementptr inbounds ([14 x i8], [14 x i8]* @cdiStringError.UnknownError, i64 0, i64 0), %11 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @cdiStringError._ELIMIT, i64 0, i64 0), %10 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @cdiStringError._EUNC4, i64 0, i64 0), %9 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @cdiStringError._EUFSTRUCT, i64 0, i64 0), %8 ], [ getelementptr inbounds ([56 x i8], [56 x i8]* @cdiStringError._ELIBNAVAIL, i64 0, i64 0), %7 ], [ %5, %2 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @cdiStringError._EUFTYPE, i64 0, i64 0), %1 ]
ret i8* %13
}