#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 */
char *ModelicaAllocateStringWithErrorReturn(size_t);
int /*<<< orphan*/ ModelicaFormatError(char *, char *, int);
char *ModelicaAllocateString(size_t len) {
  char *res = ModelicaAllocateStringWithErrorReturn(len);
  if (!res) {
    ModelicaFormatError(
        "%s:%d: ModelicaAllocateString failed\n",
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/modelica-3rdparty/netCDF-DataReader/refs/"
        "heads/master/NcDataReader2/Resources/examples/ModelicaUtilities.c",
        37);
  }
  return res;
}


x86 assembly (clang, -O0):
<ModelicaAllocateString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ModelicaAllocateStringWithErrorReturn@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115c <ModelicaAllocateString+0x3c>
lea    0xeb5(%rip),%rdi
lea    0xed4(%rip),%rsi
mov    $0x25,%edx
call   1040 <ModelicaFormatError@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ModelicaAllocateString>:
push   %rbx
call   1030 <ModelicaAllocateStringWithErrorReturn@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1146 <ModelicaAllocateString+0x26>
lea    0xecb(%rip),%rdi
lea    0xeea(%rip),%rsi
mov    $0x25,%edx
call   1040 <ModelicaFormatError@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"%s:%d: ModelicaAllocateString failed\0A\00"
@.str.1 = [197 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/modelica-3rdparty/netCDF-DataReader/refs/heads/master/NcDataReader2/Resources/examples/ModelicaUtilities.c\00"
define i8* @ModelicaAllocateString(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @ModelicaAllocateStringWithErrorReturn(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @ModelicaFormatError(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.1, i64 0, i64 0), i32 37)
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [38 x i8] c"%s:%d: ModelicaAllocateString failed\0A\00"
@.str.1 = [197 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/modelica-3rdparty/netCDF-DataReader/refs/heads/master/NcDataReader2/Resources/examples/ModelicaUtilities.c\00"
define i8* @ModelicaAllocateString(i64 %0) {
%2 = tail call i8* @ModelicaAllocateStringWithErrorReturn(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @ModelicaFormatError(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([197 x i8], [197 x i8]* @.str.1, i64 0, i64 0), i32 37)
br label %6
6: ; preds = %4, %1
ret i8* %2
}