#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*/ printf(char *, char const *, char const *);
void print_dcderror(const char *func, int errcode) {
  const char *errstr;
  switch (errcode) {
  case -1:
    errstr = "end of file";
    break;
  case -2:
    errstr = "file not found";
    break;
  case -3:
    errstr = "file open failed";
    break;
  case -4:
    errstr = "error during read";
    break;
  case -5:
    errstr = "premature end of file";
    break;
  case -6:
    errstr = "corruption or unrecognized file structure";
    break;
  case -7:
    errstr = "output file already exists";
    break;
  case -8:
    errstr = "memory allocation failed";
    break;
  case -9:
    errstr = "error during write";
    break;
  case 0:
  default:
    errstr = "no error";
    break;
  }
  printf("dcdplugin) %s: %s\n", func, errstr);
}


x86 assembly (clang, -O0):
<print_dcderror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x9,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x9,%eax
ja     11dd <print_dcderror+0xcd>
mov    -0x20(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf15(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11e8 <print_dcderror+0xd8>
lea    0xec9(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11e8 <print_dcderror+0xd8>
lea    0xec8(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11e8 <print_dcderror+0xd8>
lea    0xec9(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11e8 <print_dcderror+0xd8>
lea    0xecb(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11e8 <print_dcderror+0xd8>
lea    0xed1(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11e8 <print_dcderror+0xd8>
lea    0xeeb(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11e8 <print_dcderror+0xd8>
lea    0xef6(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11e8 <print_dcderror+0xd8>
lea    0xeff(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11e8 <print_dcderror+0xd8>
jmp    11dd <print_dcderror+0xcd>
lea    0xefd(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xef3(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_dcderror>:
mov    %rdi,%rax
cmp    $0xfffffff7,%esi
jb     112e <print_dcderror+0x1e>
add    $0x9,%esi
movslq %esi,%rcx
lea    0xfb3(%rip),%rsi
movslq (%rsi,%rcx,4),%rdx
add    %rsi,%rdx
jmp    1135 <print_dcderror+0x25>
lea    0xf84(%rip),%rdx
lea    0xf86(%rip),%rdi
mov    %rax,%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"end of file\00"
@.str.1 = [15 x i8] c"file not found\00"
@.str.2 = [17 x i8] c"file open failed\00"
@.str.3 = [18 x i8] c"error during read\00"
@.str.4 = [22 x i8] c"premature end of file\00"
@.str.5 = [42 x i8] c"corruption or unrecognized file structure\00"
@.str.6 = [27 x i8] c"output file already exists\00"
@.str.7 = [25 x i8] c"memory allocation failed\00"
@.str.8 = [19 x i8] c"error during write\00"
@.str.9 = [9 x i8] c"no error\00"
@.str.10 = [19 x i8] c"dcdplugin) %s: %s\0A\00"
define void @print_dcderror(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
switch i32 %6, label %17 [
i32 -1, label %7
i32 -2, label %8
i32 -3, label %9
i32 -4, label %10
i32 -5, label %11
i32 -6, label %12
i32 -7, label %13
i32 -8, label %14
i32 -9, label %15
i32 0, label %16
]
7: ; preds = %2
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %5
br label %18
8: ; preds = %2
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %18
9: ; preds = %2
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8** %5
br label %18
10: ; preds = %2
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8** %5
br label %18
11: ; preds = %2
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8** %5
br label %18
12: ; preds = %2
store i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i8** %5
br label %18
13: ; preds = %2
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8** %5
br label %18
14: ; preds = %2
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8** %5
br label %18
15: ; preds = %2
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8** %5
br label %18
16: ; preds = %2
br label %17
17: ; preds = %2, %16
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), i8** %5
br label %18
18: ; preds = %17, %15, %14, %13, %12, %11, %10, %9, %8, %7
%19 = load i8*, i8** %3
%20 = load i8*, i8** %5
%21 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i8* %19, i8* %20)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"end of file\00"
@.str.1 = [15 x i8] c"file not found\00"
@.str.2 = [17 x i8] c"file open failed\00"
@.str.3 = [18 x i8] c"error during read\00"
@.str.4 = [22 x i8] c"premature end of file\00"
@.str.5 = [42 x i8] c"corruption or unrecognized file structure\00"
@.str.6 = [27 x i8] c"output file already exists\00"
@.str.7 = [25 x i8] c"memory allocation failed\00"
@.str.8 = [19 x i8] c"error during write\00"
@.str.9 = [9 x i8] c"no error\00"
@.str.10 = [19 x i8] c"dcdplugin) %s: %s\0A\00"
@reltable.print_dcderror = [9 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.8 to i64), i64 ptrtoint ([9 x i32]* @reltable.print_dcderror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([25 x i8]* @.str.7 to i64), i64 ptrtoint ([9 x i32]* @reltable.print_dcderror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.6 to i64), i64 ptrtoint ([9 x i32]* @reltable.print_dcderror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([42 x i8]* @.str.5 to i64), i64 ptrtoint ([9 x i32]* @reltable.print_dcderror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.4 to i64), i64 ptrtoint ([9 x i32]* @reltable.print_dcderror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str.3 to i64), i64 ptrtoint ([9 x i32]* @reltable.print_dcderror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str.2 to i64), i64 ptrtoint ([9 x i32]* @reltable.print_dcderror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.1 to i64), i64 ptrtoint ([9 x i32]* @reltable.print_dcderror to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str to i64), i64 ptrtoint ([9 x i32]* @reltable.print_dcderror to i64)) to i32)]
define void @print_dcderror(i8* %0, i32 %1) {
%3 = icmp ugt i32 %1, -10
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = add i32 %1, 9
%6 = sext i32 %5 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([9 x i32]* @reltable.print_dcderror to i8*), i64 %7)
br label %9
9: ; preds = %2, %4
%10 = phi i8* [ %8, %4 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), %2 ]
%11 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0), i8* %0, i8* %10)
ret void
}