#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 */
typedef int uint32_t;
typedef int /*<<< orphan*/ names;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
const char *pn_binop_get_name(uint32_t op) {
  const char *names[] = {"add", "sub",  "mul",  "udiv", "sdiv", "urem", "srem",
                         "shl", "lshr", "ashr", "and",  "or",   "xor"};
  if (op >= (sizeof(names) / sizeof((names)[0]))) {
    do {
      fprintf(stderr, "Invalid op: %u\n", op);
      exit(1);
    } while (0);
  }
  return names[op];
}


x86 assembly (clang, -O0):
<pn_binop_get_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0x2c6a(%rip),%rsi
mov    $0x68,%edx
call   1040 <memcpy@plt>
movslq -0x4(%rbp),%rax
cmp    $0xd,%rax
jb     1185 <pn_binop_get_name+0x55>
jmp    1163 <pn_binop_get_name+0x33>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movslq -0x4(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pn_binop_get_name>:
push   %rax
mov    %edi,%edx
cmp    $0xd,%edi
jae    113a <pn_binop_get_name+0x1a>
mov    %edx,%eax
lea    0xf17(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
pop    %rcx
ret
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
lea    0xeec(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"add\00"
@.str.1 = [4 x i8] c"sub\00"
@.str.2 = [4 x i8] c"mul\00"
@.str.3 = [5 x i8] c"udiv\00"
@.str.4 = [5 x i8] c"sdiv\00"
@.str.5 = [5 x i8] c"urem\00"
@.str.6 = [5 x i8] c"srem\00"
@.str.7 = [4 x i8] c"shl\00"
@.str.8 = [5 x i8] c"lshr\00"
@.str.9 = [5 x i8] c"ashr\00"
@.str.10 = [4 x i8] c"and\00"
@.str.11 = [3 x i8] c"or\00"
@.str.12 = [4 x i8] c"xor\00"
@__const.pn_binop_get_name.names = [13 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i32 0, i32 0)]
@stderr = global i32 0
@.str.13 = [16 x i8] c"Invalid op: %u\0A\00"
define i8* @pn_binop_get_name(i32 %0) {
%2 = alloca i32
%3 = alloca [13 x i8*]
store i32 %0, i32* %2
%4 = bitcast [13 x i8*]* %3 to i8*
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = icmp uge i64 %6, 13
br i1 %7, label %8, label %15
8: ; preds = %1
br label %9
9: ; preds = %8
%10 = load i32, i32* @stderr
%11 = load i32, i32* %2
%12 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i32 %11)
%13 = call i32 @exit(i32 1)
unreachable
14: ; No predecessors!
br label %15
15: ; preds = %14, %1
%16 = load i32, i32* %2
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [13 x i8*], [13 x i8*]* %3, i64 0, i64 %17
%19 = load i8*, i8** %18
ret i8* %19
}

LLVM IR (-O2):
@.str = [4 x i8] c"add\00"
@.str.1 = [4 x i8] c"sub\00"
@.str.2 = [4 x i8] c"mul\00"
@.str.3 = [5 x i8] c"udiv\00"
@.str.4 = [5 x i8] c"sdiv\00"
@.str.5 = [5 x i8] c"urem\00"
@.str.6 = [5 x i8] c"srem\00"
@.str.7 = [4 x i8] c"shl\00"
@.str.8 = [5 x i8] c"lshr\00"
@.str.9 = [5 x i8] c"ashr\00"
@.str.10 = [4 x i8] c"and\00"
@.str.11 = [3 x i8] c"or\00"
@.str.12 = [4 x i8] c"xor\00"
@reltable.pn_binop_get_name = [13 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([13 x i32]* @reltable.pn_binop_get_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([13 x i32]* @reltable.pn_binop_get_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([13 x i32]* @reltable.pn_binop_get_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.3 to i64), i64 ptrtoint ([13 x i32]* @reltable.pn_binop_get_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.4 to i64), i64 ptrtoint ([13 x i32]* @reltable.pn_binop_get_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.5 to i64), i64 ptrtoint ([13 x i32]* @reltable.pn_binop_get_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.6 to i64), i64 ptrtoint ([13 x i32]* @reltable.pn_binop_get_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.7 to i64), i64 ptrtoint ([13 x i32]* @reltable.pn_binop_get_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.8 to i64), i64 ptrtoint ([13 x i32]* @reltable.pn_binop_get_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.9 to i64), i64 ptrtoint ([13 x i32]* @reltable.pn_binop_get_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.10 to i64), i64 ptrtoint ([13 x i32]* @reltable.pn_binop_get_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.11 to i64), i64 ptrtoint ([13 x i32]* @reltable.pn_binop_get_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.12 to i64), i64 ptrtoint ([13 x i32]* @reltable.pn_binop_get_name to i64)) to i32)]
@stderr = global i32 0
@.str.13 = [16 x i8] c"Invalid op: %u\0A\00"
define i8* @pn_binop_get_name(i32 %0) {
%2 = icmp ugt i32 %0, 12
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i64 0, i64 0), i32 %0)
%6 = tail call i32 @exit(i32 1)
unreachable
7: ; preds = %1
%8 = zext i32 %0 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([13 x i32]* @reltable.pn_binop_get_name to i8*), i64 %9)
ret i8* %10
}