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


x86 assembly (clang, -O0):
<malloc_failure_int>:
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>
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%esi
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xfffffed3,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<malloc_failure_int>:
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>
shl    $0x2,%ebx
lea    0xefb(%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 = [49 x i8] c"*** COMMAND WAS: %s = malloc(%d * sizeof(int));\0A\00"
@.str.2 = [42 x i8] c"*** STATUS - FAILED TO ALLOCATE %d bytes\0A\00"
define void @malloc_failure_int(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 ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %9, i32 %10)
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = mul i64 %13, 4
%15 = trunc i64 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %15)
%17 = call i32 @exit(i32 -301)
unreachable
}

LLVM IR (-O2):
@.str = [33 x i8] c"\0A*** FATAL ERROR IN %s FUNCTION\0A\00"
@.str.1 = [49 x i8] c"*** COMMAND WAS: %s = malloc(%d * sizeof(int));\0A\00"
@.str.2 = [42 x i8] c"*** STATUS - FAILED TO ALLOCATE %d bytes\0A\00"
define void @malloc_failure_int(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 ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i8* %1, i32 %2)
%6 = shl i32 %2, 2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = tail call i32 @exit(i32 -301)
unreachable
}