#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 */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char *getenv(char *);
__attribute__((__noreturn__)) void terminate(bool exit3) {
  char *s = getenv("EF_DUMPCORE");
  if (s != NULL && *s != '\0')
    abort();
  else if (exit3)
    exit(EXIT_FAILURE);
  else
    _exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<terminate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xeae(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     117d <terminate+0x3d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     117d <terminate+0x3d>
mov    $0x0,%al
call   1040 <abort@plt>
cmpl   $0x0,-0x4(%rbp)
je     1195 <terminate+0x55>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
call   1050 <_exit@plt>

x86 assembly (clang, -O2):
<terminate>:
push   %rbx
mov    %edi,%ebx
lea    0xeb6(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1159 <terminate+0x19>
cmpb   $0x0,(%rax)
jne    1170 <terminate+0x30>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
test   %ebx,%ebx
jne    116b <terminate+0x2b>
call   1050 <_exit@plt>
call   1060 <exit@plt>
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"EF_DUMPCORE\00"
@EXIT_FAILURE = global i32 0
define void @terminate(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %7, %1
%15 = load i32, i32* %2
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* @EXIT_FAILURE
%19 = call i32 @exit(i32 %18)
unreachable
20: ; preds = %14
%21 = load i32, i32* @EXIT_FAILURE
%22 = call i32 @_exit(i32 %21)
unreachable
}

LLVM IR (-O2):
@.str = [12 x i8] c"EF_DUMPCORE\00"
@EXIT_FAILURE = global i32 0
define void @terminate(i32 %0) {
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %4, %1
%10 = icmp eq i32 %0, 0
%11 = load i32, i32* @EXIT_FAILURE
br i1 %10, label %14, label %12
12: ; preds = %9
%13 = tail call i32 @exit(i32 %11)
unreachable
14: ; preds = %9
%15 = tail call i32 @_exit(i32 %11)
unreachable
}