#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;
char **calloc(size_t const, int);
int errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *,
                           int);
int /*<<< orphan*/ stderr;
char *strerror(int);
char **stringlist_list_allocate(const size_t capacity) {
  char **new_list = calloc(capacity, sizeof *new_list);
  if (!new_list) {
    fprintf(stderr,
            "Error: couldn't create string list: "
            "%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/stringlist.c",
            197, strerror(errno), errno);
    exit(EXIT_FAILURE);
  }
  return new_list;
}


x86 assembly (clang, -O0):
<stringlist_list_allocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11b9 <stringlist_list_allocate+0x79>
mov    0x2e70(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
call   1060 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%r8
mov    0x2e48(%rip),%rax
mov    (%rax),%r9d
lea    0xe66(%rip),%rsi
lea    0xe9c(%rip),%rdx
mov    $0xc5,%ecx
call   1040 <fprintf@plt>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringlist_list_allocate>:
push   %r14
push   %rbx
push   %rax
mov    $0x8,%esi
call   1030 <calloc@plt>
test   %rax,%rax
je     115b <stringlist_list_allocate+0x1b>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e7e(%rip),%rax
mov    (%rax),%ebx
mov    0x2e6d(%rip),%r14
mov    (%r14),%edi
call   1060 <strerror@plt>
mov    (%r14),%r9d
lea    0xe83(%rip),%rsi
lea    0xeb9(%rip),%rdx
mov    %ebx,%edi
mov    $0xc5,%ecx
mov    %rax,%r8
call   1040 <fprintf@plt>
mov    0x2e36(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [61 x i8] c"Error: couldn't create string list: %s, line %d\0A %s (%d)\0A\00"
@.str.1 = [154 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/stringlist.c\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define i8** @stringlist_list_allocate(i64 %0) {
%2 = alloca i64
%3 = alloca i8**
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8** @calloc(i64 %4, i32 8)
store i8** %5, i8*** %3
%6 = load i8**, i8*** %3
%7 = icmp ne i8** %6, null
br i1 %7, label %16, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i32, i32* @errno
%11 = call i8* @strerror(i32 %10)
%12 = load i32, i32* @errno
%13 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 197, i8* %11, i32 %12)
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %1
%17 = load i8**, i8*** %3
ret i8** %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [61 x i8] c"Error: couldn't create string list: %s, line %d\0A %s (%d)\0A\00"
@.str.1 = [154 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/stringlist.c\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
define i8** @stringlist_list_allocate(i64 %0) {
%2 = tail call i8** @calloc(i64 %0, i32 8)
%3 = icmp eq i8** %2, null
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = load i32, i32* @errno
%7 = tail call i8* @strerror(i32 %6)
%8 = load i32, i32* @errno
%9 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.1, i64 0, i64 0), i32 197, i8* %7, i32 %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %1
ret i8** %2
}