#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 */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int re_status;
  int /*<<< orphan*/ re_errno;
};
struct TYPE_4__ {
  int cf_stat;
  TYPE_1__ cf_error;
};

/* Variables and functions */
#define RPC_AUTHERROR 145
#define RPC_CANTDECODEARGS 144
#define RPC_CANTDECODERES 143
#define RPC_CANTENCODEARGS 142
#define RPC_CANTRECV 141
#define RPC_CANTSEND 140
#define RPC_FAILED 139
#define RPC_PMAPFAILURE 138
#define RPC_PROCUNAVAIL 137
#define RPC_PROGNOTREGISTERED 136
#define RPC_PROGUNAVAIL 135
#define RPC_PROGVERSMISMATCH 134
#define RPC_SUCCESS 133
#define RPC_SYSTEMERROR 132
#define RPC_TIMEDOUT 131
#define RPC_UNKNOWNHOST 130
#define RPC_UNKNOWNPROTO 129
#define RPC_VERSMISMATCH 128
char *_buf();
int /*<<< orphan*/ assert(int /*<<< orphan*/);
char *clnt_sperrno(int);
TYPE_2__ rpc_createerr;
size_t snprintf(char *, size_t, char *, char const *);
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ strncat(char *, char *, size_t);
char *clnt_spcreateerror(const char *s) {
  char *str;
  size_t len, i;
  assert(s != NULL);
  str = _buf();
  if (str == NULL)
    return (0);
  len = 256;
  i = snprintf(str, len, "%s: ", s);
  if (i > 0)
    len -= i;
  (void)strncat(str, clnt_sperrno(rpc_createerr.cf_stat), len - 1);
  switch (rpc_createerr.cf_stat) {
  case RPC_PMAPFAILURE:
    (void)strncat(str, " - ", len - 1);
    (void)strncat(str, clnt_sperrno(rpc_createerr.cf_error.re_status), len - 4);
    break;
  case RPC_SYSTEMERROR:
    (void)strncat(str, " - ", len - 1);
    (void)strncat(str, strerror(rpc_createerr.cf_error.re_errno), len - 4);
    break;
  case RPC_CANTSEND:
  case RPC_CANTDECODERES:
  case RPC_CANTENCODEARGS:
  case RPC_SUCCESS:
  case RPC_UNKNOWNPROTO:
  case RPC_PROGNOTREGISTERED:
  case RPC_FAILED:
  case RPC_UNKNOWNHOST:
  case RPC_CANTDECODEARGS:
  case RPC_PROCUNAVAIL:
  case RPC_PROGVERSMISMATCH:
  case RPC_PROGUNAVAIL:
  case RPC_AUTHERROR:
  case RPC_VERSMISMATCH:
  case RPC_TIMEDOUT:
  case RPC_CANTRECV:
  default:
    break;
  }
  str[256 - 1] = '\0';
  return (str);
}


x86 assembly (clang, -O0):
<clnt_spcreateerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    $0x0,%al
call   1070 <_buf@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a1 <clnt_spcreateerror+0x41>
movq   $0x0,-0x8(%rbp)
jmp    1326 <clnt_spcreateerror+0x1c6>
movq   $0x100,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rcx
lea    0xe44(%rip),%rdx
call   1030 <snprintf@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jbe    11df <clnt_spcreateerror+0x7f>
mov    -0x28(%rbp),%rcx
mov    -0x20(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    0x2e02(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    (%rax),%edi
call   1060 <clnt_sperrno@plt>
mov    -0x40(%rbp),%rdi
mov    %rax,%rsi
mov    -0x20(%rbp),%rdx
add    $0xffffffffffffffff,%rdx
call   1040 <strncat@plt>
mov    -0x38(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
add    $0xffffff80,%eax
sub    $0x4,%eax
jb     1309 <clnt_spcreateerror+0x1a9>
jmp    1227 <clnt_spcreateerror+0xc7>
mov    -0x2c(%rbp),%eax
sub    $0x84,%eax
je     12c1 <clnt_spcreateerror+0x161>
jmp    123a <clnt_spcreateerror+0xda>
mov    -0x2c(%rbp),%eax
add    $0xffffff7b,%eax
sub    $0x5,%eax
jb     1309 <clnt_spcreateerror+0x1a9>
jmp    1250 <clnt_spcreateerror+0xf0>
mov    -0x2c(%rbp),%eax
sub    $0x8a,%eax
je     1279 <clnt_spcreateerror+0x119>
jmp    1263 <clnt_spcreateerror+0x103>
mov    -0x2c(%rbp),%eax
add    $0xffffff75,%eax
sub    $0x7,%eax
jb     1309 <clnt_spcreateerror+0x1a9>
jmp    130e <clnt_spcreateerror+0x1ae>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
sub    $0x1,%rdx
lea    0xd79(%rip),%rsi
call   1040 <strncat@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    0x2d50(%rip),%rax
mov    0x4(%rax),%edi
call   1060 <clnt_sperrno@plt>
mov    -0x48(%rbp),%rdi
mov    %rax,%rsi
mov    -0x20(%rbp),%rdx
sub    $0x4,%rdx
call   1040 <strncat@plt>
jmp    1313 <clnt_spcreateerror+0x1b3>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rdx
sub    $0x1,%rdx
lea    0xd31(%rip),%rsi
call   1040 <strncat@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    0x2d08(%rip),%rax
mov    0x8(%rax),%edi
call   1080 <strerror@plt>
mov    -0x50(%rbp),%rdi
mov    %rax,%rsi
mov    -0x20(%rbp),%rdx
sub    $0x4,%rdx
call   1040 <strncat@plt>
jmp    1313 <clnt_spcreateerror+0x1b3>
jmp    130e <clnt_spcreateerror+0x1ae>
jmp    1313 <clnt_spcreateerror+0x1b3>
mov    -0x18(%rbp),%rax
movb   $0x0,0xff(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clnt_spcreateerror>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %edi,%edi
test   %r14,%r14
setne  %dil
call   1050 <assert@plt>
xor    %eax,%eax
call   1070 <_buf@plt>
mov    %rax,%r15
test   %rax,%rax
je     1233 <clnt_spcreateerror+0xd3>
lea    0xe6d(%rip),%rdx
mov    $0x100,%esi
mov    %r15,%rdi
mov    %r14,%rcx
call   1030 <snprintf@plt>
mov    %rax,%r14
mov    0x2e43(%rip),%r12
mov    (%r12),%edi
call   1060 <clnt_sperrno@plt>
mov    $0xff,%ebx
sub    %r14,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1040 <strncat@plt>
mov    (%r12),%eax
cmp    $0x84,%eax
je     11fc <clnt_spcreateerror+0x9c>
cmp    $0x8a,%eax
jne    122b <clnt_spcreateerror+0xcb>
lea    0xe20(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
call   1040 <strncat@plt>
mov    0x4(%r12),%edi
call   1060 <clnt_sperrno@plt>
jmp    1218 <clnt_spcreateerror+0xb8>
lea    0xe02(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
call   1040 <strncat@plt>
mov    0x8(%r12),%edi
call   1080 <strerror@plt>
mov    $0xfc,%edx
sub    %r14,%rdx
mov    %r15,%rdi
mov    %rax,%rsi
call   1040 <strncat@plt>
movb   $0x0,0xff(%r15)
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32, %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32, i32 }
@.str = [5 x i8] c"%s: \00"
@rpc_createerr = global %struct.TYPE_4__ zeroinitializer
@.str.1 = [4 x i8] c" - \00"
define i8* @clnt_spcreateerror(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = call i8* (...) @_buf()
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %15
14: ; preds = %1
store i8* null, i8** %2
br label %62
15: ; preds = %1
store i64 256, i64* %5
%16 = load i8*, i8** %4
%17 = load i64, i64* %5
%18 = load i8*, i8** %3
%19 = call i64 @snprintf(i8* %16, i64 %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %18)
store i64 %19, i64* %6
%20 = load i64, i64* %6
%21 = icmp ugt i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %15
%23 = load i64, i64* %6
%24 = load i64, i64* %5
%25 = sub i64 %24, %23
store i64 %25, i64* %5
br label %26
26: ; preds = %22, %15
%27 = load i8*, i8** %4
%28 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @rpc_createerr, i32 0, i32 0)
%29 = call i8* @clnt_sperrno(i32 %28)
%30 = load i64, i64* %5
%31 = sub i64 %30, 1
%32 = call i32 @strncat(i8* %27, i8* %29, i64 %31)
%33 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @rpc_createerr, i32 0, i32 0)
switch i32 %33, label %57 [
i32 138, label %34
i32 132, label %45
i32 140, label %56
i32 143, label %56
i32 142, label %56
i32 133, label %56
i32 129, label %56
i32 136, label %56
i32 139, label %56
i32 130, label %56
i32 144, label %56
i32 137, label %56
i32 134, label %56
i32 135, label %56
i32 145, label %56
i32 128, label %56
i32 131, label %56
i32 141, label %56
]
34: ; preds = %26
%35 = load i8*, i8** %4
%36 = load i64, i64* %5
%37 = sub i64 %36, 1
%38 = call i32 @strncat(i8* %35, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %37)
%39 = load i8*, i8** %4
%40 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @rpc_createerr, i32 0, i32 1, i32 0)
%41 = call i8* @clnt_sperrno(i32 %40)
%42 = load i64, i64* %5
%43 = sub i64 %42, 4
%44 = call i32 @strncat(i8* %39, i8* %41, i64 %43)
br label %58
45: ; preds = %26
%46 = load i8*, i8** %4
%47 = load i64, i64* %5
%48 = sub i64 %47, 1
%49 = call i32 @strncat(i8* %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %48)
%50 = load i8*, i8** %4
%51 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @rpc_createerr, i32 0, i32 1, i32 1)
%52 = call i8* @strerror(i32 %51)
%53 = load i64, i64* %5
%54 = sub i64 %53, 4
%55 = call i32 @strncat(i8* %50, i8* %52, i64 %54)
br label %58
56: ; preds = %26, %26, %26, %26, %26, %26, %26, %26, %26, %26, %26, %26, %26, %26, %26, %26
br label %57
57: ; preds = %26, %56
br label %58
58: ; preds = %57, %45, %34
%59 = load i8*, i8** %4
%60 = getelementptr inbounds i8, i8* %59, i64 255
store i8 0, i8* %60
%61 = load i8*, i8** %4
store i8* %61, i8** %2
br label %62
62: ; preds = %58, %14
%63 = load i8*, i8** %2
ret i8* %63
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32, %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32, i32 }
@.str = [5 x i8] c"%s: \00"
@rpc_createerr = global %struct.TYPE_4__ zeroinitializer
@.str.1 = [4 x i8] c" - \00"
define i8* @clnt_spcreateerror(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i8* (...) @_buf()
%6 = icmp eq i8* %5, null
br i1 %6, label %28, label %7
7: ; preds = %1
%8 = tail call i64 @snprintf(i8* %5, i64 256, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @rpc_createerr, i64 0, i32 0)
%10 = tail call i8* @clnt_sperrno(i32 %9)
%11 = sub i64 255, %8
%12 = tail call i32 @strncat(i8* %5, i8* %10, i64 %11)
%13 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @rpc_createerr, i64 0, i32 0)
switch i32 %13, label %26 [
i32 138, label %14
i32 132, label %18
]
14: ; preds = %7
%15 = tail call i32 @strncat(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %11)
%16 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @rpc_createerr, i64 0, i32 1, i32 0)
%17 = tail call i8* @clnt_sperrno(i32 %16)
br label %22
18: ; preds = %7
%19 = tail call i32 @strncat(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64 %11)
%20 = load i32, i32* getelementptr inbounds (%struct.TYPE_4__, %struct.TYPE_4__* @rpc_createerr, i64 0, i32 1, i32 1)
%21 = tail call i8* @strerror(i32 %20)
br label %22
22: ; preds = %14, %18
%23 = phi i8* [ %21, %18 ], [ %17, %14 ]
%24 = sub i64 252, %8
%25 = tail call i32 @strncat(i8* %5, i8* %23, i64 %24)
br label %26
26: ; preds = %22, %7
%27 = getelementptr inbounds i8, i8* %5, i64 255
store i8 0, i8* %27
br label %28
28: ; preds = %1, %26
ret i8* %5
}