#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*/ sprintf(char *, char *, char *, int, 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(msg, "%s at line %d in file %s\n",
              "SUPERLU_MALLOC fails for buf in intCalloc()", 149,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/dribbroc/HONEI/refs/heads/master/"
              "honei/math/SuperLU_4.1/SRC/memory.c");
      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   1040 <superlu_malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    118e <intCalloc+0x5e>
lea    -0x120(%rbp),%rdi
lea    0xe96(%rip),%rsi
lea    0xea9(%rip),%rdx
mov    $0x95,%ecx
lea    0xec9(%rip),%r8
call   1050 <sprintf@plt>
lea    -0x120(%rbp),%rdi
call   1030 <superlu_abort_and_exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11be <intCalloc+0x8e>
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    1195 <intCalloc+0x65>
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   1050 <superlu_malloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     1186 <intCalloc+0x46>
test   %ebx,%ebx
jle    1176 <intCalloc+0x36>
mov    %ebx,%edx
shl    $0x2,%rdx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %r14,%rax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xe73(%rip),%rsi
lea    0xe86(%rip),%rdx
lea    0xeab(%rip),%r8
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x95,%ecx
call   1060 <sprintf@plt>
mov    %r15,%rdi
call   1030 <superlu_abort_and_exit@plt>
test   %ebx,%ebx
jg     1166 <intCalloc+0x26>
jmp    1176 <intCalloc+0x36>

LLVM IR (-O0):
@.str = [26 x i8] c"%s at line %d in file %s\0A\00"
@.str.1 = [44 x i8] c"SUPERLU_MALLOC fails for buf in intCalloc()\00"
@.str.2 = [159 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/dribbroc/HONEI/refs/heads/master/honei/math/SuperLU_4.1/SRC/memory.c\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 %19, label %14
14: ; preds = %1
%15 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%16 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 149, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str.2, i64 0, i64 0))
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%18 = call i32 @superlu_abort_and_exit(i8* %17)
br label %19
19: ; preds = %14, %1
store i32 0, i32* %4
br label %20
20: ; preds = %29, %19
%21 = load i32, i32* %4
%22 = load i32, i32* %2
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %32
24: ; preds = %20
%25 = load i32*, i32** %3
%26 = load i32, i32* %4
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
store i32 0, i32* %28
br label %29
29: ; preds = %24
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %20
32: ; preds = %20
%33 = load i32*, i32** %3
ret i32* %33
}

LLVM IR (-O2):
@.str = [26 x i8] c"%s at line %d in file %s\0A\00"
@.str.1 = [44 x i8] c"SUPERLU_MALLOC fails for buf in intCalloc()\00"
@.str.2 = [159 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/dribbroc/HONEI/refs/heads/master/honei/math/SuperLU_4.1/SRC/memory.c\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 %11
7: ; preds = %1
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%9 = call i32 @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0), i32 149, i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @superlu_abort_and_exit(i8* %8)
br label %11
11: ; preds = %7, %1
%12 = icmp sgt i32 %0, 0
br i1 %12, label %13, label %16
13: ; preds = %11
%14 = zext i32 %0 to i64
%15 = shl nuw nsw i64 %14, 2
br label %16
16: ; preds = %13, %11
%17 = inttoptr i64 %4 to i32*
ret i32* %17
}