#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 */
char const *_bz2_strerror(int);
const char *_cfr_compressor_strerror(int format, int err) {
  switch (format) {
  case 0:
    return ("file not open");
    break;
  case 1:
    return ("file not compressed");
    break;
  case 2:
    return (_bz2_strerror(err));
    break;
  case 3:
    return NULL;
    break;
  default:
    return ("unknowen compressor code");
  }
}


x86 assembly (clang, -O0):
<_cfr_compressor_strerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x3,%rax
ja     1181 <_cfr_compressor_strerror+0x71>
mov    -0x18(%rbp),%rax
lea    0xec6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    118c <_cfr_compressor_strerror+0x7c>
lea    0xec4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    118c <_cfr_compressor_strerror+0x7c>
mov    -0x10(%rbp),%edi
call   1030 <_bz2_strerror@plt>
mov    %rax,-0x8(%rbp)
jmp    118c <_cfr_compressor_strerror+0x7c>
movq   $0x0,-0x8(%rbp)
jmp    118c <_cfr_compressor_strerror+0x7c>
lea    0xeaa(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cfr_compressor_strerror>:
cmp    $0x3,%edi
ja     1136 <_cfr_compressor_strerror+0x26>
lea    0xef4(%rip),%rax
mov    %edi,%ecx
lea    0xedb(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
lea    0xee9(%rip),%rax
ret
lea    0xef5(%rip),%rax
ret
mov    %esi,%edi
jmp    1030 <_bz2_strerror@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [14 x i8] c"file not open\00"
@.str.1 = [20 x i8] c"file not compressed\00"
@.str.2 = [25 x i8] c"unknowen compressor code\00"
define i8* @_cfr_compressor_strerror(i32 %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
switch i32 %6, label %13 [
i32 0, label %7
i32 1, label %8
i32 2, label %9
i32 3, label %12
]
7: ; preds = %2
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %3
br label %14
8: ; preds = %2
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8** %3
br label %14
9: ; preds = %2
%10 = load i32, i32* %5
%11 = call i8* @_bz2_strerror(i32 %10)
store i8* %11, i8** %3
br label %14
12: ; preds = %2
store i8* null, i8** %3
br label %14
13: ; preds = %2
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8** %3
br label %14
14: ; preds = %13, %12, %9, %8, %7
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [14 x i8] c"file not open\00"
@.str.1 = [20 x i8] c"file not compressed\00"
@.str.2 = [25 x i8] c"unknowen compressor code\00"
define i8* @_cfr_compressor_strerror(i32 %0, i32 %1) {
switch i32 %0, label %7 [
i32 0, label %8
i32 1, label %3
i32 2, label %4
i32 3, label %6
]
3: ; preds = %2
br label %8
4: ; preds = %2
%5 = tail call i8* @_bz2_strerror(i32 %1)
br label %8
6: ; preds = %2
br label %8
7: ; preds = %2
br label %8
8: ; preds = %2, %7, %6, %4, %3
%9 = phi i8* [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), %7 ], [ null, %6 ], [ %5, %4 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %2 ]
ret i8* %9
}