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

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_CORE;
int /*<<< orphan*/ SIGSEGV;
int /*<<< orphan*/ getrlimit(int /*<<< orphan*/, struct rlimit *);
int /*<<< orphan*/ raise(int /*<<< orphan*/);
int /*<<< orphan*/ setrlimit(int /*<<< orphan*/, struct rlimit *);
int main(int argc, char **argv) {
  char *p;
  struct rlimit r = {
      0,
  };
  getrlimit(RLIMIT_CORE, &r);
  r.rlim_cur = 0;
  setrlimit(RLIMIT_CORE, &r);
  raise(SIGSEGV);
  p = NULL;
  *p = 'a';
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
call   1060 <getrlimit@plt>
movq   $0x0,-0x28(%rbp)
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
call   1050 <setrlimit@plt>
mov    0x2e4f(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x61,(%rax)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,(%rsp)
mov    0x2e9b(%rip),%r14
mov    (%r14),%edi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <getrlimit@plt>
movq   $0x0,(%rsp)
mov    (%r14),%edi
mov    %rbx,%rsi
call   1040 <setrlimit@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>

LLVM IR (-O0):
%struct.rlimit = type { i64, i32 }
@RLIMIT_CORE = global i32 0
@SIGSEGV = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca %struct.rlimit
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast %struct.rlimit* %7 to i8*
%9 = load i32, i32* @RLIMIT_CORE
%10 = call i32 @getrlimit(i32 %9, %struct.rlimit* %7)
%11 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %7, i32 0, i32 0
store i64 0, i64* %11
%12 = load i32, i32* @RLIMIT_CORE
%13 = call i32 @setrlimit(i32 %12, %struct.rlimit* %7)
%14 = load i32, i32* @SIGSEGV
%15 = call i32 @raise(i32 %14)
store i8* null, i8** %6
%16 = load i8*, i8** %6
store i8 97, i8* %16
ret i32 0
}

LLVM IR (-O2):
%struct.rlimit = type { i64, i32 }
@RLIMIT_CORE = global i32 0
@SIGSEGV = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.rlimit
%4 = bitcast %struct.rlimit* %3 to i8*
%5 = load i32, i32* @RLIMIT_CORE
%6 = call i32 @getrlimit(i32 %5, %struct.rlimit* %3)
%7 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %3, i64 0, i32 0
store i64 0, i64* %7
%8 = load i32, i32* @RLIMIT_CORE
%9 = call i32 @setrlimit(i32 %8, %struct.rlimit* %3)
%10 = load i32, i32* @SIGSEGV
%11 = call i32 @raise(i32 %10)
unreachable
}