#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);
char *add_strerror(char *, int);
scalar_t__ asprintf(char **, char *, char const *, int);
int errno;
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ log_error(char *, char *);
int /*<<< orphan*/ stderr;
void panic_error(const char *filename, int line) {
  int last_errno = errno;
  char *message;
  do
    if (asprintf(&message, "panic at %s, line %d", filename, line)) {
    }
  while (0);
  message = add_strerror(message, last_errno);
  log_error("%s", message);
  free(message);
  fflush(stderr);
  _exit(255);
}


x86 assembly (clang, -O0):
<panic_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2e62(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    -0x18(%rbp),%rdi
lea    0xe73(%rip),%rsi
call   1070 <asprintf@plt>
cmp    $0x0,%rax
je     11a1 <panic_error+0x41>
jmp    11a1 <panic_error+0x41>
jmp    11a6 <panic_error+0x46>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1080 <add_strerror@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe54(%rip),%rdi
call   1050 <log_error@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    $0xff,%edi
call   1040 <_exit@plt>

x86 assembly (clang, -O2):
<panic_error>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ecx
mov    %rdi,%rdx
mov    0x2e67(%rip),%rax
mov    (%rax),%ebx
lea    0xe86(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1070 <asprintf@plt>
mov    0x8(%rsp),%rdi
mov    %ebx,%esi
call   1080 <add_strerror@plt>
mov    %rax,0x8(%rsp)
lea    0xe79(%rip),%rdi
mov    %rax,%rsi
call   1050 <log_error@plt>
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    $0xff,%edi
call   1040 <_exit@plt>

LLVM IR (-O0):
@errno = global i32 0
@.str = [21 x i8] c"panic at %s, line %d\00"
@.str.1 = [3 x i8] c"%s\00"
@stderr = global i32 0
define void @panic_error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* @errno
store i32 %7, i32* %5
br label %8
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = call i64 @asprintf(i8** %6, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %9, i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %8
br label %14
14: ; preds = %13, %8
br label %15
15: ; preds = %14
%16 = load i8*, i8** %6
%17 = load i32, i32* %5
%18 = call i8* @add_strerror(i8* %16, i32 %17)
store i8* %18, i8** %6
%19 = load i8*, i8** %6
%20 = call i32 @log_error(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = load i8*, i8** %6
%22 = call i32 @free(i8* %21)
%23 = load i32, i32* @stderr
%24 = call i32 @fflush(i32 %23)
%25 = call i32 @_exit(i32 255)
unreachable
}

LLVM IR (-O2):
@errno = global i32 0
@.str = [21 x i8] c"panic at %s, line %d\00"
@.str.1 = [3 x i8] c"%s\00"
@stderr = global i32 0
define void @panic_error(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = load i32, i32* @errno
%5 = bitcast i8** %3 to i8*
%6 = call i64 @asprintf(i8** %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
%7 = load i8*, i8** %3
%8 = call i8* @add_strerror(i8* %7, i32 %4)
store i8* %8, i8** %3
%9 = call i32 @log_error(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %3
%11 = call i32 @free(i8* %10)
%12 = load i32, i32* @stderr
%13 = call i32 @fflush(i32 %12)
%14 = call i32 @_exit(i32 255)
unreachable
}