#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 *realloc(int *, size_t const);
int /*<<< orphan*/ stderr;
char *strerror(int);
int *stackint_data_reallocate(int *data, const size_t capacity) {
  int *new_data = realloc(data, capacity * sizeof *new_data);
  if (!new_data) {
    fprintf(stderr,
            "Error: couldn't resize 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",
            114, strerror(errno), errno);
    exit(EXIT_FAILURE);
  }
  return new_data;
}


x86 assembly (clang, -O0):
<stackint_data_reallocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
shl    $0x2,%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11c0 <stackint_data_reallocate+0x80>
mov    0x2e69(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    0x2e55(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x1c(%rbp),%edi
mov    %rax,%r8
mov    0x2e41(%rip),%rax
mov    (%rax),%r9d
lea    0xe5f(%rip),%rsi
lea    0xe94(%rip),%rdx
mov    $0x72,%ecx
call   1030 <fprintf@plt>
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stackint_data_reallocate>:
push   %r14
push   %rbx
push   %rax
shl    $0x2,%rsi
call   1040 <realloc@plt>
test   %rax,%rax
je     115a <stackint_data_reallocate+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    $0x72,%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 resize 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_reallocate(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i32*
store i32* %0, i32** %3
store i64 %1, i64* %4
%6 = load i32*, i32** %3
%7 = load i64, i64* %4
%8 = mul i64 %7, 4
%9 = call i32* @realloc(i32* %6, i64 %8)
store i32* %9, i32** %5
%10 = load i32*, i32** %5
%11 = icmp ne i32* %10, null
br i1 %11, label %20, label %12
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i32, i32* @errno
%15 = call i8* @strerror(i32 %14)
%16 = load i32, i32* @errno
%17 = call i32 @fprintf(i32 %13, 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 114, i8* %15, i32 %16)
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %2
%21 = load i32*, i32** %5
ret i32* %21
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [60 x i8] c"Error: couldn't resize 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_reallocate(i32* nocapture %0, i64 %1) {
%3 = shl i64 %1, 2
%4 = tail call i32* @realloc(i32* %0, i64 %3)
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %14
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i32, i32* @errno
%9 = tail call i8* @strerror(i32 %8)
%10 = load i32, i32* @errno
%11 = tail call i32 @fprintf(i32 %7, 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 114, i8* %9, i32 %10)
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
ret i32* %4
}