#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 /*<<< orphan*/ errbuf;

/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ snprintf(char *, int, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
const char *uu_lockerr(int uu_lockresult) {
  static char errbuf[128];
  const char *fmt;
  switch (uu_lockresult) {
  case (1):
    return "device in use";
  case (0):
    return "";
  case (-1):
    fmt = "open error: %s";
    break;
  case (-2):
    fmt = "read error: %s";
    break;
  case (-3):
    fmt = "creat error: %s";
    break;
  case (-4):
    fmt = "write error: %s";
    break;
  case (-5):
    fmt = "link error: %s";
    break;
  case (-6):
    fmt = "too many tries: %s";
    break;
  case (-7):
    fmt = "not locking process: %s";
    break;
  default:
    fmt = "undefined error: %s";
    break;
  }
  (void)snprintf(errbuf, sizeof(errbuf), fmt, strerror(errno));
  return errbuf;
}


x86 assembly (clang, -O0):
<uu_lockerr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x7,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x8,%eax
ja     11e4 <uu_lockerr+0xc4>
mov    -0x20(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1227 <uu_lockerr+0x107>
lea    0xec6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1227 <uu_lockerr+0x107>
lea    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11ef <uu_lockerr+0xcf>
lea    0xeb6(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11ef <uu_lockerr+0xcf>
lea    0xeb5(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11ef <uu_lockerr+0xcf>
lea    0xeb5(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11ef <uu_lockerr+0xcf>
lea    0xeb5(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11ef <uu_lockerr+0xcf>
lea    0xeb4(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11ef <uu_lockerr+0xcf>
lea    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    11ef <uu_lockerr+0xcf>
lea    0xebf(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x28(%rbp),%rdx
mov    %eax,%ecx
lea    0x2e2e(%rip),%rdi
mov    $0x80,%esi
call   1030 <snprintf@plt>
lea    0x2e1d(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uu_lockerr>:
push   %r14
push   %rbx
push   %rax
add    $0x7,%edi
cmp    $0x8,%edi
ja     1153 <uu_lockerr+0x33>
lea    0xeff(%rip),%r14
lea    0xeea(%rip),%rbx
lea    0xebf(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xf41(%rip),%r14
jmp    1187 <uu_lockerr+0x67>
lea    0xf50(%rip),%r14
jmp    1187 <uu_lockerr+0x67>
lea    0xf1c(%rip),%r14
jmp    1187 <uu_lockerr+0x67>
lea    0xf04(%rip),%r14
jmp    1187 <uu_lockerr+0x67>
lea    0xeeb(%rip),%r14
jmp    1187 <uu_lockerr+0x67>
lea    0xed2(%rip),%r14
jmp    1187 <uu_lockerr+0x67>
lea    0xeba(%rip),%r14
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0x2ea4(%rip),%rbx
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %r14,%rdx
mov    %eax,%ecx
call   1030 <snprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe71(%rip),%rbx
jmp    11ae <uu_lockerr+0x8e>

LLVM IR (-O0):
@uu_lockerr.errbuf = internal global [128 x i8] zeroinitializer
@.str = [14 x i8] c"device in use\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [15 x i8] c"open error: %s\00"
@.str.3 = [15 x i8] c"read error: %s\00"
@.str.4 = [16 x i8] c"creat error: %s\00"
@.str.5 = [16 x i8] c"write error: %s\00"
@.str.6 = [15 x i8] c"link error: %s\00"
@.str.7 = [19 x i8] c"too many tries: %s\00"
@.str.8 = [24 x i8] c"not locking process: %s\00"
@.str.9 = [20 x i8] c"undefined error: %s\00"
@errno = global i32 0
define i8* @uu_lockerr(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
%5 = load i32, i32* %3
switch i32 %5, label %15 [
i32 1, label %6
i32 0, label %7
i32 -1, label %8
i32 -2, label %9
i32 -3, label %10
i32 -4, label %11
i32 -5, label %12
i32 -6, label %13
i32 -7, label %14
]
6: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
br label %21
7: ; preds = %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %21
8: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8** %4
br label %16
9: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i8** %4
br label %16
10: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8** %4
br label %16
11: ; preds = %1
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8** %4
br label %16
12: ; preds = %1
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i8** %4
br label %16
13: ; preds = %1
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i8** %4
br label %16
14: ; preds = %1
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), i8** %4
br label %16
15: ; preds = %1
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), i8** %4
br label %16
16: ; preds = %15, %14, %13, %12, %11, %10, %9, %8
%17 = load i8*, i8** %4
%18 = load i32, i32* @errno
%19 = call i32 @strerror(i32 %18)
%20 = call i32 @snprintf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @uu_lockerr.errbuf, i64 0, i64 0), i32 128, i8* %17, i32 %19)
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @uu_lockerr.errbuf, i64 0, i64 0), i8** %2
br label %21
21: ; preds = %16, %7, %6
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
@uu_lockerr.errbuf = internal global [128 x i8] zeroinitializer
@.str = [14 x i8] c"device in use\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [15 x i8] c"open error: %s\00"
@.str.3 = [15 x i8] c"read error: %s\00"
@.str.4 = [16 x i8] c"creat error: %s\00"
@.str.5 = [16 x i8] c"write error: %s\00"
@.str.6 = [15 x i8] c"link error: %s\00"
@.str.7 = [19 x i8] c"too many tries: %s\00"
@.str.8 = [24 x i8] c"not locking process: %s\00"
@.str.9 = [20 x i8] c"undefined error: %s\00"
@errno = global i32 0
define i8* @uu_lockerr(i32 %0) {
switch i32 %0, label %9 [
i32 1, label %15
i32 0, label %2
i32 -1, label %10
i32 -2, label %3
i32 -3, label %4
i32 -4, label %5
i32 -5, label %6
i32 -6, label %7
i32 -7, label %8
]
2: ; preds = %1
br label %15
3: ; preds = %1
br label %10
4: ; preds = %1
br label %10
5: ; preds = %1
br label %10
6: ; preds = %1
br label %10
7: ; preds = %1
br label %10
8: ; preds = %1
br label %10
9: ; preds = %1
br label %10
10: ; preds = %1, %9, %8, %7, %6, %5, %4, %3
%11 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.9, i64 0, i64 0), %9 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.8, i64 0, i64 0), %8 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), %7 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), %6 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), %5 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), %4 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %3 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), %1 ]
%12 = load i32, i32* @errno
%13 = tail call i32 @strerror(i32 %12)
%14 = tail call i32 @snprintf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @uu_lockerr.errbuf, i64 0, i64 0), i32 128, i8* %11, i32 %13)
br label %15
15: ; preds = %1, %10, %2
%16 = phi i8* [ getelementptr inbounds ([128 x i8], [128 x i8]* @uu_lockerr.errbuf, i64 0, i64 0), %10 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %16
}