#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*/ RLIMIT_CORE;
void *RLIM_INFINITY;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int setrlimit(int /*<<< orphan*/, struct rlimit *);
int /*<<< orphan*/ stderr;
void allow_core_dumps(void) {
  struct rlimit limits;
  int res;
  limits.rlim_cur = RLIM_INFINITY;
  limits.rlim_max = RLIM_INFINITY;
  res = setrlimit(RLIMIT_CORE, &limits);
  if (res == -1)
    fprintf(stderr, "couldnt set CORE dump size\n");
}


x86 assembly (clang, -O0):
<allow_core_dumps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1040 <setrlimit@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1178 <allow_core_dumps+0x58>
mov    0x2e6e(%rip),%rax
mov    (%rax),%edi
lea    0xe8d(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allow_core_dumps>:
sub    $0x18,%rsp
mov    0x2ea5(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x10(%rsp)
mov    %rax,0x8(%rsp)
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1040 <setrlimit@plt>
cmp    $0xffffffff,%eax
je     1155 <allow_core_dumps+0x35>
add    $0x18,%rsp
ret
mov    0x2e7c(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.rlimit = type { i8*, i8* }
@RLIM_INFINITY = global i8* null
@RLIMIT_CORE = global i32 0
@stderr = global i32 0
@.str = [28 x i8] c"couldnt set CORE dump size\0A\00"
define void @allow_core_dumps() {
%1 = alloca %struct.rlimit
%2 = alloca i32
%3 = load i8*, i8** @RLIM_INFINITY
%4 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i32 0, i32 1
store i8* %3, i8** %4
%5 = load i8*, i8** @RLIM_INFINITY
%6 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i32 0, i32 0
store i8* %5, i8** %6
%7 = load i32, i32* @RLIMIT_CORE
%8 = call i32 @setrlimit(i32 %7, %struct.rlimit* %1)
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %14
11: ; preds = %0
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %11, %0
ret void
}

LLVM IR (-O2):
%struct.rlimit = type { i8*, i8* }
@RLIM_INFINITY = global i8* null
@RLIMIT_CORE = global i32 0
@stderr = global i32 0
@.str = [28 x i8] c"couldnt set CORE dump size\0A\00"
define void @allow_core_dumps() {
%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 i32 @setrlimit(i32 %6, %struct.rlimit* %1)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %9, %0
ret void
}