#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_FAILURE;
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *,
                           int);
int *malloc(size_t const);
int /*<<< orphan*/ stderr;
char *strerror(int);
int *stackint_data_allocate(const size_t capacity) {
  int *new_data = malloc(capacity * sizeof *new_data);
  if (!new_data) {
    fprintf(stderr,
            "Error: couldn't create stack data: "
            "%s, line %d\n    %s (%d)\n",
            "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
            "2022-01-22/02-19-57/repos/paulgriffiths/pgutils/refs/heads/master/"
            "datastruct/stackint.c",
            102, strerror(errno), errno);
    exit(EXIT_FAILURE);
  }
  return new_data;
}


x86 assembly (clang, -O0):
<stackint_data_allocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
shl    $0x2,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11b8 <stackint_data_allocate+0x78>
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%r8
mov    0x2e49(%rip),%rax
mov    (%rax),%r9d
lea    0xe67(%rip),%rsi
lea    0xe9c(%rip),%rdx
mov    $0x66,%ecx
call   1030 <fprintf@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stackint_data_allocate>:
push   %r14
push   %rbx
push   %rax
shl    $0x2,%rdi
call   1040 <malloc@plt>
test   %rax,%rax
je     115a <stackint_data_allocate+0x1a>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e7f(%rip),%rax
mov    (%rax),%ebx
mov    0x2e6e(%rip),%r14
mov    (%r14),%edi
call   1060 <strerror@plt>
mov    (%r14),%r9d
lea    0xe84(%rip),%rsi
lea    0xeb9(%rip),%rdx
mov    %ebx,%edi
mov    $0x66,%ecx
mov    %rax,%r8
call   1030 <fprintf@plt>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [60 x i8] c"Error: couldn't create stack data: %s, line %d\0A %s (%d)\0A\00"
@.str.1 = [152 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/paulgriffiths/pgutils/refs/heads/master/datastruct/stackint.c\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define i32* @stackint_data_allocate(i64 %0) {
%2 = alloca i64
%3 = alloca i32*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = mul i64 %4, 4
%6 = call i32* @malloc(i64 %5)
store i32* %6, i32** %3
%7 = load i32*, i32** %3
%8 = icmp ne i32* %7, null
br i1 %8, label %17, label %9
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = load i32, i32* @errno
%12 = call i8* @strerror(i32 %11)
%13 = load i32, i32* @errno
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.1, i64 0, i64 0), i32 102, i8* %12, i32 %13)
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %1
%18 = load i32*, i32** %3
ret i32* %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [60 x i8] c"Error: couldn't create stack data: %s, line %d\0A %s (%d)\0A\00"
@.str.1 = [152 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/paulgriffiths/pgutils/refs/heads/master/datastruct/stackint.c\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define noalias i32* @stackint_data_allocate(i64 %0) {
%2 = shl i64 %0, 2
%3 = tail call i32* @malloc(i64 %2)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %13
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = load i32, i32* @errno
%8 = tail call i8* @strerror(i32 %7)
%9 = load i32, i32* @errno
%10 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([152 x i8], [152 x i8]* @.str.1, i64 0, i64 0), i32 102, i8* %8, i32 %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %1
ret i32* %3
}