#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);
double *malloc(size_t const);
int /*<<< orphan*/ stderr;
char *strerror(int);
double *stackdouble_data_allocate(const size_t capacity) {
  double *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/stackdouble.c",
            103, strerror(errno), errno);
    exit(EXIT_FAILURE);
  }
  return new_data;
}


x86 assembly (clang, -O0):
<stackdouble_data_allocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
shl    $0x3,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11b8 <stackdouble_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    $0x67,%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):
<stackdouble_data_allocate>:
push   %r14
push   %rbx
push   %rax
shl    $0x3,%rdi
call   1040 <malloc@plt>
test   %rax,%rax
je     115a <stackdouble_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    $0x67,%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 = [155 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/stackdouble.c\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define double* @stackdouble_data_allocate(i64 %0) {
%2 = alloca i64
%3 = alloca double*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = mul i64 %4, 8
%6 = call double* @malloc(i64 %5)
store double* %6, double** %3
%7 = load double*, double** %3
%8 = icmp ne double* %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 ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 103, i8* %12, i32 %13)
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %1
%18 = load double*, double** %3
ret double* %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 = [155 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/stackdouble.c\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define noalias double* @stackdouble_data_allocate(i64 %0) {
%2 = shl i64 %0, 3
%3 = tail call double* @malloc(i64 %2)
%4 = icmp eq double* %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 ([155 x i8], [155 x i8]* @.str.1, i64 0, i64 0), i32 103, i8* %8, i32 %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %1
ret double* %3
}