#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 */
struct rlimit {
  void *rlim_max;
  void *rlim_cur;
};

/* Variables and functions */
int /*<<< orphan*/ Com_PrintWarning(char *, int /*<<< orphan*/);
int /*<<< orphan*/ RLIMIT_CORE;
void *RLIM_INFINITY;
int /*<<< orphan*/ errno;
scalar_t__ setrlimit(int /*<<< orphan*/, struct rlimit *);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void Sys_InitCrashDumps() {
  struct rlimit core_limit;
  core_limit.rlim_cur = RLIM_INFINITY;
  core_limit.rlim_max = RLIM_INFINITY;
  if (setrlimit(RLIMIT_CORE, &core_limit) < 0)
    Com_PrintWarning(
        "setrlimit: %s\nCore dumps may be truncated or non-existant\n",
        strerror(errno));
}


x86 assembly (clang, -O0):
<Sys_InitCrashDumps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e91(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    0x2e83(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1040 <setrlimit@plt>
cmp    $0x0,%rax
jge    118c <Sys_InitCrashDumps+0x5c>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
mov    %eax,%esi
lea    0xe79(%rip),%rdi
call   1030 <Com_PrintWarning@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sys_InitCrashDumps>:
sub    $0x18,%rsp
mov    0x2e95(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rsp)
mov    %rax,0x8(%rsp)
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1040 <setrlimit@plt>
test   %rax,%rax
js     1165 <Sys_InitCrashDumps+0x35>
add    $0x18,%rsp
ret
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1050 <strerror@plt>
lea    0xe86(%rip),%rdi
mov    %eax,%esi
call   1030 <Com_PrintWarning@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.rlimit = type { i8*, i8* }
@RLIM_INFINITY = global i8* null
@RLIMIT_CORE = global i32 0
@.str = [59 x i8] c"setrlimit: %s\0ACore dumps may be truncated or non-existant\0A\00"
@errno = global i32 0
define void @Sys_InitCrashDumps() {
%1 = alloca %struct.rlimit
%2 = load i8*, i8** @RLIM_INFINITY
%3 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i32 0, i32 1
store i8* %2, i8** %3
%4 = load i8*, i8** @RLIM_INFINITY
%5 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i32 0, i32 0
store i8* %4, i8** %5
%6 = load i32, i32* @RLIMIT_CORE
%7 = call i64 @setrlimit(i32 %6, %struct.rlimit* %1)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = load i32, i32* @errno
%11 = call i32 @strerror(i32 %10)
%12 = call i32 @Com_PrintWarning(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %9, %0
ret void
}

LLVM IR (-O2):
%struct.rlimit = type { i8*, i8* }
@RLIM_INFINITY = global i8* null
@RLIMIT_CORE = global i32 0
@.str = [59 x i8] c"setrlimit: %s\0ACore dumps may be truncated or non-existant\0A\00"
@errno = global i32 0
define void @Sys_InitCrashDumps() {
%1 = alloca %struct.rlimit
%2 = bitcast %struct.rlimit* %1 to i8*
%3 = load i8*, i8** @RLIM_INFINITY
%4 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 1
store i8* %3, i8** %4
%5 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 0
store i8* %3, i8** %5
%6 = load i32, i32* @RLIMIT_CORE
%7 = call i64 @setrlimit(i32 %6, %struct.rlimit* %1)
%8 = icmp slt i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = load i32, i32* @errno
%11 = call i32 @strerror(i32 %10)
%12 = call i32 @Com_PrintWarning(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %11)
br label %13
13: ; preds = %9, %0
ret void
}