#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*/ printf(char *, ...);
void malloc_failure_char(char *routine, char *var_name, int chars_requested) {
  printf("\n*** FATAL ERROR IN %s FUNCTION\n", routine);
  printf("m*** COMMAND WAS: %s = malloc(%d * sizeof(char));\n", var_name,
         chars_requested);
  printf("*** STATUS - FAILED TO ALLOCATE %d bytes\n", chars_requested);
  exit(-301);
}


x86 assembly (clang, -O0):
<malloc_failure_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xfffffed3,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<malloc_failure_char>:
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%rsi
lea    0xecd(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xfffffed3,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"\0A*** FATAL ERROR IN %s FUNCTION\0A\00"
@.str.1 = [51 x i8] c"m*** COMMAND WAS: %s = malloc(%d * sizeof(char));\0A\00"
@.str.2 = [42 x i8] c"*** STATUS - FAILED TO ALLOCATE %d bytes\0A\00"
define void @malloc_failure_char(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 %10)
%12 = load i32, i32* %6
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = call i32 @exit(i32 -301)
unreachable
}

LLVM IR (-O2):
@.str = [33 x i8] c"\0A*** FATAL ERROR IN %s FUNCTION\0A\00"
@.str.1 = [51 x i8] c"m*** COMMAND WAS: %s = malloc(%d * sizeof(char));\0A\00"
@.str.2 = [42 x i8] c"*** STATUS - FAILED TO ALLOCATE %d bytes\0A\00"
define void @malloc_failure_char(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %2)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %2)
%7 = tail call i32 @exit(i32 -301)
unreachable
}