#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*/ WriteSLUErrorMessage(char *);
int /*<<< orphan*/ sprintf_s(char *, int, char *, char *);
int /*<<< orphan*/ superlu_abort_and_exit(char *);
scalar_t__ superlu_malloc(int);
int *intMalloc(int n) {
  int *buf;
  buf = (int *)superlu_malloc(n * sizeof(int));
  if (!buf) {
    {
      char msg[256];
      sprintf_s(msg, 256, "Error: %s",
                "SUPERLU_MALLOC fails for buf in intMalloc()");
      WriteSLUErrorMessage(msg);
      superlu_abort_and_exit(msg);
    };
  }
  return (buf);
}


x86 assembly (clang, -O0):
<intMalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1060 <superlu_malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11a3 <intMalloc+0x63>
lea    -0x110(%rbp),%rdi
mov    $0x100,%esi
lea    0xe81(%rip),%rdx
lea    0xe84(%rip),%rcx
call   1030 <sprintf_s@plt>
lea    -0x110(%rbp),%rdi
call   1050 <WriteSLUErrorMessage@plt>
lea    -0x110(%rbp),%rdi
call   1040 <superlu_abort_and_exit@plt>
mov    -0x10(%rbp),%rax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intMalloc>:
push   %r14
push   %rbx
sub    $0x108,%rsp
shl    $0x2,%edi
call   1060 <superlu_malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1188 <intMalloc+0x48>
lea    0xe9f(%rip),%rdx
lea    0xea2(%rip),%rcx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x100,%esi
call   1030 <sprintf_s@plt>
mov    %r14,%rdi
call   1050 <WriteSLUErrorMessage@plt>
mov    %r14,%rdi
call   1040 <superlu_abort_and_exit@plt>
mov    %rbx,%rax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Error: %s\00"
@.str.1 = [44 x i8] c"SUPERLU_MALLOC fails for buf in intMalloc()\00"
define i32* @intMalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [256 x i8]
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = sext i32 %5 to i64
%7 = mul i64 %6, 4
%8 = trunc i64 %7 to i32
%9 = call i64 @superlu_malloc(i32 %8)
%10 = inttoptr i64 %9 to i32*
store i32* %10, i32** %3
%11 = load i32*, i32** %3
%12 = icmp ne i32* %11, null
br i1 %12, label %20, label %13
13: ; preds = %1
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%15 = call i32 @sprintf_s(i8* %14, i32 256, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%17 = call i32 @WriteSLUErrorMessage(i8* %16)
%18 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%19 = call i32 @superlu_abort_and_exit(i8* %18)
br label %20
20: ; preds = %13, %1
%21 = load i32*, i32** %3
ret i32* %21
}

LLVM IR (-O2):
@.str = [10 x i8] c"Error: %s\00"
@.str.1 = [44 x i8] c"SUPERLU_MALLOC fails for buf in intMalloc()\00"
define i32* @intMalloc(i32 %0) {
%2 = alloca [256 x i8]
%3 = shl i32 %0, 2
%4 = tail call i64 @superlu_malloc(i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%8 = call i32 @sprintf_s(i8* %7, i32 256, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @WriteSLUErrorMessage(i8* %7)
%10 = call i32 @superlu_abort_and_exit(i8* %7)
br label %11
11: ; preds = %6, %1
%12 = inttoptr i64 %4 to i32*
ret i32* %12
}