#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *, char const *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void rpc_error(char *str, const char *xtra) {
  char buf[8192];
  sprintf(buf,
          "<rpc-error>\n"
          "  <error-type>application</error-type>\n"
          "  <error-tag>operation-failed</error-tag>\n"
          "  <error-severity>error</error-severity>\n"
          "  <error-message xml:lang='en'>\n"
          "    %s%s\n"
          "  </error-message>\n"
          "</rpc-error>\n",
          str, xtra);
  write(1, buf, strlen(buf));
  exit(0);
}


x86 assembly (clang, -O0):
<rpc_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2020,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x2010(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xe97(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x2010(%rbp),%rax
mov    %rax,-0x2018(%rbp)
lea    -0x2010(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x2018(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
xor    %edi,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<rpc_error>:
push   %rbx
sub    $0x2000,%rsp
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xeab(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [208 x i8] c"<rpc-error>\0A <error-type>application</error-type>\0A <error-tag>operation-failed</error-tag>\0A <error-severity>error</error-severity>\0A <error-message xml:lang='en'>\0A %s%s\0A </error-message>\0A</rpc-error>\0A\00"
define void @rpc_error(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [8192 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([208 x i8], [208 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
%10 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%11 = getelementptr inbounds [8192 x i8], [8192 x i8]* %5, i64 0, i64 0
%12 = call i32 @strlen(i8* %11)
%13 = call i32 @write(i32 1, i8* %10, i32 %12)
%14 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [208 x i8] c"<rpc-error>\0A <error-type>application</error-type>\0A <error-tag>operation-failed</error-tag>\0A <error-severity>error</error-severity>\0A <error-message xml:lang='en'>\0A %s%s\0A </error-message>\0A</rpc-error>\0A\00"
define void @rpc_error(i8* %0, i8* %1) {
%3 = alloca [8192 x i8]
%4 = getelementptr inbounds [8192 x i8], [8192 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([208 x i8], [208 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
%6 = call i32 @strlen(i8* %4)
%7 = call i32 @write(i32 1, i8* %4, i32 %6)
%8 = call i32 @exit(i32 0)
unreachable
}