#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*/ SIGFPE;
int /*<<< orphan*/ SIGSEGV;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ _CRT_init();
int /*<<< orphan*/ _CRT_term();
int /*<<< orphan*/ __ctordtorInit();
int /*<<< orphan*/ __ctordtorTerm();
int /*<<< orphan*/ signal(int /*<<< orphan*/, int /*<<< orphan*/);
unsigned long _DLL_InitTerm(unsigned long mod_handle, unsigned long flag) {
  switch (flag) {
  case 0:
    if (_CRT_init())
      return 0;
    __ctordtorInit();
    signal(SIGSEGV, SIG_IGN);
    signal(SIGFPE, SIG_IGN);
    return 1;
  case 1:
    __ctordtorTerm();
    _CRT_term();
    return 1;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<_DLL_InitTerm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
test   %rax,%rax
je     1189 <_DLL_InitTerm+0x39>
jmp    1176 <_DLL_InitTerm+0x26>
mov    -0x20(%rbp),%rax
sub    $0x1,%rax
je     11e8 <_DLL_InitTerm+0x98>
jmp    1203 <_DLL_InitTerm+0xb3>
mov    $0x0,%al
call   1030 <_CRT_init@plt>
cmp    $0x0,%eax
je     11a6 <_DLL_InitTerm+0x56>
movq   $0x0,-0x8(%rbp)
jmp    120b <_DLL_InitTerm+0xbb>
mov    $0x0,%al
call   1060 <__ctordtorInit@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
mov    0x2e1b(%rip),%rax
mov    (%rax),%esi
call   1050 <signal@plt>
mov    0x2e15(%rip),%rax
mov    (%rax),%edi
mov    0x2e04(%rip),%rax
mov    (%rax),%esi
call   1050 <signal@plt>
movq   $0x1,-0x8(%rbp)
jmp    120b <_DLL_InitTerm+0xbb>
mov    $0x0,%al
call   1040 <__ctordtorTerm@plt>
mov    $0x0,%al
call   1070 <_CRT_term@plt>
movq   $0x1,-0x8(%rbp)
jmp    120b <_DLL_InitTerm+0xbb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_DLL_InitTerm>:
push   %rbx
cmp    $0x1,%rsi
je     1199 <_DLL_InitTerm+0x49>
xor    %ebx,%ebx
test   %rsi,%rsi
jne    11ac <_DLL_InitTerm+0x5c>
xor    %eax,%eax
call   1030 <_CRT_init@plt>
test   %eax,%eax
jne    11ac <_DLL_InitTerm+0x5c>
xor    %eax,%eax
call   1060 <__ctordtorInit@plt>
mov    0x2e71(%rip),%rax
mov    (%rax),%edi
mov    0x2e58(%rip),%rbx
mov    (%rbx),%esi
call   1050 <signal@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%esi
call   1050 <signal@plt>
jmp    11a7 <_DLL_InitTerm+0x57>
xor    %eax,%eax
call   1040 <__ctordtorTerm@plt>
xor    %eax,%eax
call   1070 <_CRT_term@plt>
mov    $0x1,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@SIGSEGV = global i32 0
@SIG_IGN = global i32 0
@SIGFPE = global i32 0
define i64 @_DLL_InitTerm(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %5
switch i64 %6, label %22 [
i64 0, label %7
i64 1, label %19
]
7: ; preds = %2
%8 = call i32 (...) @_CRT_init()
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %7
store i64 0, i64* %3
br label %23
11: ; preds = %7
%12 = call i32 (...) @__ctordtorInit()
%13 = load i32, i32* @SIGSEGV
%14 = load i32, i32* @SIG_IGN
%15 = call i32 @signal(i32 %13, i32 %14)
%16 = load i32, i32* @SIGFPE
%17 = load i32, i32* @SIG_IGN
%18 = call i32 @signal(i32 %16, i32 %17)
store i64 1, i64* %3
br label %23
19: ; preds = %2
%20 = call i32 (...) @__ctordtorTerm()
%21 = call i32 (...) @_CRT_term()
store i64 1, i64* %3
br label %23
22: ; preds = %2
store i64 0, i64* %3
br label %23
23: ; preds = %22, %19, %11, %10
%24 = load i64, i64* %3
ret i64 %24
}

LLVM IR (-O2):
@SIGSEGV = global i32 0
@SIG_IGN = global i32 0
@SIGFPE = global i32 0
define i64 @_DLL_InitTerm(i64 %0, i64 %1) {
switch i64 %1, label %17 [
i64 0, label %3
i64 1, label %14
]
3: ; preds = %2
%4 = tail call i32 (...) @_CRT_init()
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = tail call i32 (...) @__ctordtorInit()
%8 = load i32, i32* @SIGSEGV
%9 = load i32, i32* @SIG_IGN
%10 = tail call i32 @signal(i32 %8, i32 %9)
%11 = load i32, i32* @SIGFPE
%12 = load i32, i32* @SIG_IGN
%13 = tail call i32 @signal(i32 %11, i32 %12)
br label %17
14: ; preds = %2
%15 = tail call i32 (...) @__ctordtorTerm()
%16 = tail call i32 (...) @_CRT_term()
br label %17
17: ; preds = %2, %3, %14, %6
%18 = phi i64 [ 1, %14 ], [ 1, %6 ], [ 0, %3 ], [ 0, %2 ]
ret i64 %18
}