#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*/ carmen_commander_print_message(char *);
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ getch();
scalar_t__ malloc(int);
int /*<<< orphan*/ nocbreak();
int /*<<< orphan*/ raw();
int /*<<< orphan*/ sprintf(char *, char *, char *);
int strlen(char *);
void carmen_commander_die(char *msg, int exit_code) {
  char *nmsg = (char *)malloc(strlen(msg) * sizeof(char) + 25);
  sprintf(nmsg, "%s Press any key to quit.", msg);
  carmen_commander_print_message(nmsg);
  free(nmsg);
  nocbreak();
  raw();
  getch();
  endwin();
  exit(exit_code);
}


x86 assembly (clang, -O0):
<carmen_commander_die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
cltq
shl    $0x0,%rax
add    $0x19,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe24(%rip),%rsi
call   10b0 <sprintf@plt>
mov    -0x18(%rbp),%rdi
call   1070 <carmen_commander_print_message@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   10a0 <nocbreak@plt>
mov    $0x0,%al
call   1050 <raw@plt>
mov    $0x0,%al
call   1080 <getch@plt>
mov    $0x0,%al
call   1090 <endwin@plt>
mov    -0xc(%rbp),%edi
call   10c0 <exit@plt>

x86 assembly (clang, -O2):
<carmen_commander_die>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x19(%rax),%edi
call   1060 <malloc@plt>
mov    %rax,%rbp
lea    0xe3f(%rip),%rsi
mov    %rax,%rdi
mov    %rbx,%rdx
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1070 <carmen_commander_print_message@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   10a0 <nocbreak@plt>
xor    %eax,%eax
call   1050 <raw@plt>
xor    %eax,%eax
call   1080 <getch@plt>
xor    %eax,%eax
call   1090 <endwin@plt>
mov    %r14d,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"%s Press any key to quit.\00"
define void @carmen_commander_die(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = sext i32 %7 to i64
%9 = mul i64 %8, 1
%10 = add i64 %9, 25
%11 = trunc i64 %10 to i32
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = load i8*, i8** %3
%16 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %5
%18 = call i32 @carmen_commander_print_message(i8* %17)
%19 = load i8*, i8** %5
%20 = call i32 @free(i8* %19)
%21 = call i32 (...) @nocbreak()
%22 = call i32 (...) @raw()
%23 = call i32 (...) @getch()
%24 = call i32 (...) @endwin()
%25 = load i32, i32* %4
%26 = call i32 @exit(i32 %25)
unreachable
}

LLVM IR (-O2):
@.str = [26 x i8] c"%s Press any key to quit.\00"
define void @carmen_commander_die(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = add i32 %3, 25
%5 = tail call i64 @malloc(i32 %4)
%6 = inttoptr i64 %5 to i8*
%7 = tail call i32 @sprintf(i8* dereferenceable(1) %6, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = tail call i32 @carmen_commander_print_message(i8* %6)
%9 = tail call i32 @free(i8* %6)
%10 = tail call i32 (...) @nocbreak()
%11 = tail call i32 (...) @raw()
%12 = tail call i32 (...) @getch()
%13 = tail call i32 (...) @endwin()
%14 = tail call i32 @exit(i32 %1)
unreachable
}