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

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ print_backtrace();
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ ulimit_core_check();
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void panic_finish(const char *func, const char *file, int line, const char *fmt,
                  va_list ap) {
  fprintf(stderr, "\n");
  fprintf(stderr, "Error string:\n");
  fprintf(stderr, "\n");
  fprintf(stderr, "  ");
  vfprintf(stderr, fmt, ap);
  fprintf(stderr, "\n");
  fprintf(stderr, "Location:\n\n");
  fprintf(stderr, "  %s:%d: %s()\n", file, line, func);
  fprintf(stderr, "\n");
  print_backtrace();
  fprintf(stderr, "\n");
  ulimit_core_check();
  fprintf(stderr, "------------------------------------------------------------"
                  "----------->8-----\n");
  abort();
}


x86 assembly (clang, -O0):
<panic_finish>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
lea    0xe6e(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%edi
lea    0xe73(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e29(%rip),%rax
mov    (%rax),%edi
lea    0xe4f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1070 <vfprintf@plt>
mov    0x2dfd(%rip),%rax
mov    (%rax),%edi
lea    0xe30(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2de6(%rip),%rax
mov    (%rax),%edi
lea    0xe0f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dcf(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%r8
lea    0xdf9(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%edi
lea    0xde0(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x0,%al
call   1040 <print_backtrace@plt>
mov    0x2d8f(%rip),%rax
mov    (%rax),%edi
lea    0xdc2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x0,%al
call   1050 <ulimit_core_check@plt>
mov    0x2d71(%rip),%rax
mov    (%rax),%edi
lea    0xdb5(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<panic_finish>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%ebp
mov    %rcx,%rbx
mov    %edx,0x4(%rsp)
mov    %rsi,%r12
mov    %rdi,%r15
mov    0x2e6e(%rip),%r14
mov    (%r14),%edi
lea    0xea0(%rip),%r13
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r14),%edi
lea    0xe70(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r14),%edi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r14),%edi
lea    0xe61(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1070 <vfprintf@plt>
mov    (%r14),%edi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r14),%edi
lea    0xe39(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r14),%edi
lea    0xe34(%rip),%rsi
mov    %r12,%rdx
mov    0x4(%rsp),%ecx
mov    %r15,%r8
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    (%r14),%edi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1040 <print_backtrace@plt>
mov    (%r14),%edi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1050 <ulimit_core_check@plt>
mov    (%r14),%edi
lea    0xe00(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [15 x i8] c"Error string:\0A\00"
@.str.2 = [3 x i8] c" \00"
@.str.3 = [12 x i8] c"Location:\0A\0A\00"
@.str.4 = [15 x i8] c" %s:%d: %s()\0A\00"
@.str.5 = [80 x i8] c"----------------------------------------------------------------------->8-----\0A\00"
define void @panic_finish(i8* %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i32, i32* @stderr
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32, i32* @stderr
%20 = load i8*, i8** %9
%21 = load i32, i32* %10
%22 = call i32 @vfprintf(i32 %19, i8* %20, i32 %21)
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%27 = load i32, i32* @stderr
%28 = load i8*, i8** %7
%29 = load i32, i32* %8
%30 = load i8*, i8** %6
%31 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %28, i32 %29, i8* %30)
%32 = load i32, i32* @stderr
%33 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%34 = call i32 (...) @print_backtrace()
%35 = load i32, i32* @stderr
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%37 = call i32 (...) @ulimit_core_check()
%38 = load i32, i32* @stderr
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.5, i64 0, i64 0))
%40 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [15 x i8] c"Error string:\0A\00"
@.str.2 = [3 x i8] c" \00"
@.str.3 = [12 x i8] c"Location:\0A\0A\00"
@.str.4 = [15 x i8] c" %s:%d: %s()\0A\00"
@.str.5 = [80 x i8] c"----------------------------------------------------------------------->8-----\0A\00"
define void @panic_finish(i8* %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = tail call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @stderr
%13 = tail call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* @stderr
%15 = tail call i32 @vfprintf(i32 %14, i8* %3, i32 %4)
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%20 = load i32, i32* @stderr
%21 = tail call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0), i8* %1, i32 %2, i8* %0)
%22 = load i32, i32* @stderr
%23 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = tail call i32 (...) @print_backtrace()
%25 = load i32, i32* @stderr
%26 = tail call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%27 = tail call i32 (...) @ulimit_core_check()
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.5, i64 0, i64 0))
%30 = tail call i32 (...) @abort()
unreachable
}