#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 blosc_compcode_to_compname(int compcode, char **compname) {
  int code = -1;
  char *name = NULL;
  if (compcode == 0)
    name = "blosclz";
  else if (compcode == 1)
    name = "lz4";
  else if (compcode == 2)
    name = "lz4hc";
  else if (compcode == 3)
    name = "snappy";
  else if (compcode == 4)
    name = "zlib";
  *compname = name;
  if (compcode == 0)
    code = 0;
  return code;
}


x86 assembly (clang, -O0):
<blosc_compcode_to_compname>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1134 <blosc_compcode_to_compname+0x34>
lea    0xed5(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11ab <blosc_compcode_to_compname+0xab>
cmpl   $0x1,-0x4(%rbp)
jne    114e <blosc_compcode_to_compname+0x4e>
lea    0xec3(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11a6 <blosc_compcode_to_compname+0xa6>
cmpl   $0x2,-0x4(%rbp)
jne    1168 <blosc_compcode_to_compname+0x68>
lea    0xead(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    11a1 <blosc_compcode_to_compname+0xa1>
cmpl   $0x3,-0x4(%rbp)
jne    1182 <blosc_compcode_to_compname+0x82>
lea    0xe99(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    119c <blosc_compcode_to_compname+0x9c>
cmpl   $0x4,-0x4(%rbp)
jne    1197 <blosc_compcode_to_compname+0x97>
lea    0xe86(%rip),%rax
mov    %rax,-0x20(%rbp)
jmp    119c <blosc_compcode_to_compname+0x9c>
jmp    11a1 <blosc_compcode_to_compname+0xa1>
jmp    11a6 <blosc_compcode_to_compname+0xa6>
jmp    11ab <blosc_compcode_to_compname+0xab>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
cmpl   $0x0,-0x4(%rbp)
jne    11c7 <blosc_compcode_to_compname+0xc7>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<blosc_compcode_to_compname>:
test   %edi,%edi
je     111e <blosc_compcode_to_compname+0x1e>
lea    -0x1(%rdi),%eax
cmp    $0x3,%eax
ja     1127 <blosc_compcode_to_compname+0x27>
cltq
lea    0xf0b(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    1129 <blosc_compcode_to_compname+0x29>
lea    0xedb(%rip),%rax
jmp    1129 <blosc_compcode_to_compname+0x29>
xor    %eax,%eax
mov    %rax,(%rsi)
neg    %edi
sbb    %eax,%eax
ret

LLVM IR (-O0):
@.str = [8 x i8] c"blosclz\00"
@.str.1 = [4 x i8] c"lz4\00"
@.str.2 = [6 x i8] c"lz4hc\00"
@.str.3 = [7 x i8] c"snappy\00"
@.str.4 = [5 x i8] c"zlib\00"
define i32 @blosc_compcode_to_compname(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 -1, i32* %5
store i8* null, i8** %6
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %6
br label %30
10: ; preds = %2
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %14
13: ; preds = %10
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %6
br label %29
14: ; preds = %10
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 2
br i1 %16, label %17, label %18
17: ; preds = %14
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8** %6
br label %28
18: ; preds = %14
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, 3
br i1 %20, label %21, label %22
21: ; preds = %18
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %6
br label %27
22: ; preds = %18
%23 = load i32, i32* %3
%24 = icmp eq i32 %23, 4
br i1 %24, label %25, label %26
25: ; preds = %22
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %6
br label %26
26: ; preds = %25, %22
br label %27
27: ; preds = %26, %21
br label %28
28: ; preds = %27, %17
br label %29
29: ; preds = %28, %13
br label %30
30: ; preds = %29, %9
%31 = load i8*, i8** %6
%32 = load i8**, i8*** %4
store i8* %31, i8** %32
%33 = load i32, i32* %3
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %30
store i32 0, i32* %5
br label %36
36: ; preds = %35, %30
%37 = load i32, i32* %5
ret i32 %37
}

LLVM IR (-O2):
@.str = [8 x i8] c"blosclz\00"
@.str.1 = [4 x i8] c"lz4\00"
@.str.2 = [6 x i8] c"lz4hc\00"
@.str.3 = [7 x i8] c"snappy\00"
@.str.4 = [5 x i8] c"zlib\00"
@reltable.blosc_compcode_to_compname = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.blosc_compcode_to_compname to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.blosc_compcode_to_compname to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.blosc_compcode_to_compname to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.4 to i64), i64 ptrtoint ([4 x i32]* @reltable.blosc_compcode_to_compname to i64)) to i32)]
define i32 @blosc_compcode_to_compname(i32 %0, i8** nocapture writeonly %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = add i32 %0, -1
%6 = icmp ult i32 %5, 4
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = sext i32 %5 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.blosc_compcode_to_compname to i8*), i64 %9)
br label %11
11: ; preds = %4, %7, %2
%12 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %2 ], [ %10, %7 ], [ null, %4 ]
store i8* %12, i8** %1
%13 = xor i1 %3, true
%14 = sext i1 %13 to i32
ret i32 %14
}