#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);
int /*<<< orphan*/ kill_procs();
int /*<<< orphan*/ send_cmessage(int, char const *);
int /*<<< orphan*/ vscan_abort();
int /*<<< orphan*/ write_log(int, char const *);
void die(int loglevel, const char *lmessage, int mcode, const char *message,
         int exitcode) {
  if (message)
    send_cmessage(mcode, message);
  if (lmessage)
    write_log(loglevel, lmessage);
  write_log(20, "Closing session");
  kill_procs();
  vscan_abort();
  exit(exitcode);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1181 <die+0x31>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rsi
call   1060 <send_cmessage@plt>
cmpq   $0x0,-0x10(%rbp)
je     1198 <die+0x48>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <write_log@plt>
mov    $0x14,%edi
lea    0xe5c(%rip),%rsi
call   1050 <write_log@plt>
mov    $0x0,%al
call   1040 <kill_procs@plt>
mov    $0x0,%al
call   1030 <vscan_abort@plt>
mov    -0x24(%rbp),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rbp
push   %r14
push   %rbx
mov    %r8d,%r14d
mov    %rsi,%rbx
mov    %edi,%ebp
test   %rcx,%rcx
je     116b <die+0x1b>
mov    %edx,%edi
mov    %rcx,%rsi
call   1060 <send_cmessage@plt>
test   %rbx,%rbx
je     117a <die+0x2a>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <write_log@plt>
lea    0xe7f(%rip),%rsi
mov    $0x14,%edi
call   1050 <write_log@plt>
xor    %eax,%eax
call   1040 <kill_procs@plt>
xor    %eax,%eax
call   1030 <vscan_abort@plt>
mov    %r14d,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"Closing session\00"
define void @die(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
store i32 %0, i32* %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i8*, i8** %9
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %17
13: ; preds = %5
%14 = load i32, i32* %8
%15 = load i8*, i8** %9
%16 = call i32 @send_cmessage(i32 %14, i8* %15)
br label %17
17: ; preds = %13, %5
%18 = load i8*, i8** %7
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i32, i32* %6
%22 = load i8*, i8** %7
%23 = call i32 @write_log(i32 %21, i8* %22)
br label %24
24: ; preds = %20, %17
%25 = call i32 @write_log(i32 20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%26 = call i32 (...) @kill_procs()
%27 = call i32 (...) @vscan_abort()
%28 = load i32, i32* %10
%29 = call i32 @exit(i32 %28)
unreachable
}

LLVM IR (-O2):
@.str = [16 x i8] c"Closing session\00"
define void @die(i32 %0, i8* %1, i32 %2, i8* %3, i32 %4) {
%6 = icmp eq i8* %3, null
br i1 %6, label %9, label %7
7: ; preds = %5
%8 = tail call i32 @send_cmessage(i32 %2, i8* %3)
br label %9
9: ; preds = %7, %5
%10 = icmp eq i8* %1, null
br i1 %10, label %13, label %11
11: ; preds = %9
%12 = tail call i32 @write_log(i32 %0, i8* %1)
br label %13
13: ; preds = %11, %9
%14 = tail call i32 @write_log(i32 20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 (...) @kill_procs()
%16 = tail call i32 (...) @vscan_abort()
%17 = tail call i32 @exit(i32 %4)
unreachable
}