#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 */
const char *calcErrorStr(short error) {
  static const char *errStrs[] = {
      "No error",
      "Too many results returned",
      "Badly formed numeric literal",
      "Bad assignment target",
      "Comma without enclosing parentheses",
      "Close parenthesis found without open",
      "Parenthesis still open at end of expression",
      "Unbalanced conditional ?: operators",
      "Incomplete expression, operand missing",
      "Not enough operands provided",
      "Runtime stack overflow",
      "Syntax error, unknown operator/operand",
      "NULL or empty input argument to postfix()",
      "Internal error, unknown element type",
  };
  if (error < 0 || error > 13)
    return NULL;
  return errStrs[error];
}


x86 assembly (clang, -O0):
<calcErrorStr>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0xa(%rbp)
movswl -0xa(%rbp),%eax
cmp    $0x0,%eax
jl     1125 <calcErrorStr+0x25>
movswl -0xa(%rbp),%eax
cmp    $0xd,%eax
jle    1132 <calcErrorStr+0x32>
movq   $0x0,-0x8(%rbp)
jmp    1146 <calcErrorStr+0x46>
movswq -0xa(%rbp),%rcx
lea    0x2ef2(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcErrorStr>:
cmp    $0xd,%di
jbe    1109 <calcErrorStr+0x9>
xor    %eax,%eax
ret
movzwl %di,%eax
lea    0xeed(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@calcErrorStr.errStrs = internal global [14 x i8*] [i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.13, i32 0, i32 0)]
@.str = [9 x i8] c"No error\00"
@.str.1 = [26 x i8] c"Too many results returned\00"
@.str.2 = [29 x i8] c"Badly formed numeric literal\00"
@.str.3 = [22 x i8] c"Bad assignment target\00"
@.str.4 = [36 x i8] c"Comma without enclosing parentheses\00"
@.str.5 = [37 x i8] c"Close parenthesis found without open\00"
@.str.6 = [44 x i8] c"Parenthesis still open at end of expression\00"
@.str.7 = [36 x i8] c"Unbalanced conditional ?: operators\00"
@.str.8 = [39 x i8] c"Incomplete expression, operand missing\00"
@.str.9 = [29 x i8] c"Not enough operands provided\00"
@.str.10 = [23 x i8] c"Runtime stack overflow\00"
@.str.11 = [39 x i8] c"Syntax error, unknown operator/operand\00"
@.str.12 = [42 x i8] c"NULL or empty input argument to postfix()\00"
@.str.13 = [37 x i8] c"Internal error, unknown element type\00"
define i8* @calcErrorStr(i16 signext %0) {
%2 = alloca i8*
%3 = alloca i16
store i16 %0, i16* %3
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = icmp slt i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %1
%8 = load i16, i16* %3
%9 = sext i16 %8 to i32
%10 = icmp sgt i32 %9, 13
br i1 %10, label %11, label %12
11: ; preds = %7, %1
store i8* null, i8** %2
br label %17
12: ; preds = %7
%13 = load i16, i16* %3
%14 = sext i16 %13 to i64
%15 = getelementptr inbounds [14 x i8*], [14 x i8*]* @calcErrorStr.errStrs, i64 0, i64 %14
%16 = load i8*, i8** %15
store i8* %16, i8** %2
br label %17
17: ; preds = %12, %11
%18 = load i8*, i8** %2
ret i8* %18
}

LLVM IR (-O2):
@reltable.calcErrorStr = internal unnamed_addr constant [14 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.1 to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([29 x i8]* @.str.2 to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.3 to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([36 x i8]* @.str.4 to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([37 x i8]* @.str.5 to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([44 x i8]* @.str.6 to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([36 x i8]* @.str.7 to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.8 to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([29 x i8]* @.str.9 to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.10 to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([39 x i8]* @.str.11 to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([42 x i8]* @.str.12 to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([37 x i8]* @.str.13 to i64), i64 ptrtoint ([14 x i32]* @reltable.calcErrorStr to i64)) to i32)]
@.str = [9 x i8] c"No error\00"
@.str.1 = [26 x i8] c"Too many results returned\00"
@.str.2 = [29 x i8] c"Badly formed numeric literal\00"
@.str.3 = [22 x i8] c"Bad assignment target\00"
@.str.4 = [36 x i8] c"Comma without enclosing parentheses\00"
@.str.5 = [37 x i8] c"Close parenthesis found without open\00"
@.str.6 = [44 x i8] c"Parenthesis still open at end of expression\00"
@.str.7 = [36 x i8] c"Unbalanced conditional ?: operators\00"
@.str.8 = [39 x i8] c"Incomplete expression, operand missing\00"
@.str.9 = [29 x i8] c"Not enough operands provided\00"
@.str.10 = [23 x i8] c"Runtime stack overflow\00"
@.str.11 = [39 x i8] c"Syntax error, unknown operator/operand\00"
@.str.12 = [42 x i8] c"NULL or empty input argument to postfix()\00"
@.str.13 = [37 x i8] c"Internal error, unknown element type\00"
define i8* @calcErrorStr(i16 signext %0) {
%2 = icmp ugt i16 %0, 13
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = zext i16 %0 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([14 x i32]* @reltable.calcErrorStr to i8*), i64 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i8* [ %6, %3 ], [ null, %1 ]
ret i8* %8
}