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


x86 assembly (clang, -O0):
<intCalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%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 <intCalloc+0x63>
lea    -0x120(%rbp),%rdi
mov    $0x100,%esi
lea    0xe81(%rip),%rdx
lea    0xe84(%rip),%rcx
call   1030 <sprintf_s@plt>
lea    -0x120(%rbp),%rdi
call   1050 <WriteSLUErrorMessage@plt>
lea    -0x120(%rbp),%rdi
call   1040 <superlu_abort_and_exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11d3 <intCalloc+0x93>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11aa <intCalloc+0x6a>
mov    -0x10(%rbp),%rax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intCalloc>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %edi,%ebx
lea    0x0(,%rbx,4),%edi
call   1070 <superlu_malloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     1196 <intCalloc+0x46>
test   %ebx,%ebx
jle    1186 <intCalloc+0x36>
mov    %ebx,%edx
shl    $0x2,%rdx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
mov    %r14,%rax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe63(%rip),%rdx
lea    0xe66(%rip),%rcx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x100,%esi
call   1030 <sprintf_s@plt>
mov    %r15,%rdi
call   1060 <WriteSLUErrorMessage@plt>
mov    %r15,%rdi
call   1040 <superlu_abort_and_exit@plt>
test   %ebx,%ebx
jg     1176 <intCalloc+0x26>
jmp    1186 <intCalloc+0x36>

LLVM IR (-O0):
@.str = [10 x i8] c"Error: %s\00"
@.str.1 = [44 x i8] c"SUPERLU_MALLOC fails for buf in intCalloc()\00"
define i32* @intCalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
%5 = alloca [256 x i8]
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 4
%9 = trunc i64 %8 to i32
%10 = call i64 @superlu_malloc(i32 %9)
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %3
%12 = load i32*, i32** %3
%13 = icmp ne i32* %12, null
br i1 %13, label %21, label %14
14: ; preds = %1
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%16 = call i32 @sprintf_s(i8* %15, 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))
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%18 = call i32 @WriteSLUErrorMessage(i8* %17)
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%20 = call i32 @superlu_abort_and_exit(i8* %19)
br label %21
21: ; preds = %14, %1
store i32 0, i32* %4
br label %22
22: ; preds = %31, %21
%23 = load i32, i32* %4
%24 = load i32, i32* %2
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %34
26: ; preds = %22
%27 = load i32*, i32** %3
%28 = load i32, i32* %4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
store i32 0, i32* %30
br label %31
31: ; preds = %26
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %22
34: ; preds = %22
%35 = load i32*, i32** %3
ret i32* %35
}

LLVM IR (-O2):
@.str = [10 x i8] c"Error: %s\00"
@.str.1 = [44 x i8] c"SUPERLU_MALLOC fails for buf in intCalloc()\00"
define i32* @intCalloc(i32 %0) {
%2 = alloca [256 x i8]
%3 = shl i32 %0, 2
%4 = tail call i64 @superlu_malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%9 = call i32 @sprintf_s(i8* %8, 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))
%10 = call i32 @WriteSLUErrorMessage(i8* %8)
%11 = call i32 @superlu_abort_and_exit(i8* %8)
br label %12
12: ; preds = %7, %1
%13 = icmp sgt i32 %0, 0
br i1 %13, label %14, label %17
14: ; preds = %12
%15 = zext i32 %0 to i64
%16 = shl nuw nsw i64 %15, 2
br label %17
17: ; preds = %14, %12
%18 = inttoptr i64 %4 to i32*
ret i32* %18
}