#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 {
  int /*<<< orphan*/ rlim_max;
  int /*<<< orphan*/ rlim_cur;
};

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_CORE;
int /*<<< orphan*/ _err_exit(char *, int, int /*<<< orphan*/, char *);
int /*<<< orphan*/ errno;
int setrlimit(int /*<<< orphan*/, struct rlimit const *);
void disable_core(void) {
  const struct rlimit rlim = {.rlim_cur = 0, .rlim_max = 0};
  int rc;
  rc = setrlimit(RLIMIT_CORE, &rlim);
  if (rc != 0)
    _err_exit("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/Morgan-Stanley/treadmill-pid1/refs/"
              "heads/main/src/pid1.c",
              76, errno, "setrlimit");
}


x86 assembly (clang, -O0):
<disable_core>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1050 <setrlimit@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1188 <disable_core+0x58>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edx
lea    0xe89(%rip),%rdi
mov    $0x4c,%esi
lea    0xf10(%rip),%rcx
call   1040 <_err_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<disable_core>:
push   %rax
movq   $0x0,(%rsp)
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1040 <setrlimit@plt>
test   %eax,%eax
je     115f <disable_core+0x3f>
mov    0x2e93(%rip),%rax
mov    (%rax),%edx
lea    0xeb2(%rip),%rdi
lea    0xf3e(%rip),%rcx
mov    $0x4c,%esi
call   1030 <_err_exit@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.rlimit = type { i32, i32 }
@RLIMIT_CORE = global i32 0
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Morgan-Stanley/treadmill-pid1/refs/heads/main/src/pid1.c\00"
@errno = global i32 0
@.str.1 = [10 x i8] c"setrlimit\00"
define void @disable_core() {
%1 = alloca %struct.rlimit
%2 = alloca i32
%3 = bitcast %struct.rlimit* %1 to i8*
%4 = load i32, i32* @RLIMIT_CORE
%5 = call i32 @setrlimit(i32 %4, %struct.rlimit* %1)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* @errno
%10 = call i32 @_err_exit(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 76, i32 %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %8, %0
ret void
}

LLVM IR (-O2):
%struct.rlimit = type { i32, i32 }
@RLIMIT_CORE = global i32 0
@.str = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Morgan-Stanley/treadmill-pid1/refs/heads/main/src/pid1.c\00"
@errno = global i32 0
@.str.1 = [10 x i8] c"setrlimit\00"
define void @disable_core() {
%1 = alloca i64
%2 = bitcast i64* %1 to %struct.rlimit*
%3 = bitcast i64* %1 to i8*
store i64 0, i64* %1
%4 = load i32, i32* @RLIMIT_CORE
%5 = call i32 @setrlimit(i32 %4, %struct.rlimit* %2)
%6 = icmp eq i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %0
%8 = load i32, i32* @errno
%9 = call i32 @_err_exit(i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str, i64 0, i64 0), i32 76, i32 %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %7, %0
ret void
}