#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(int);
int /*<<< orphan*/ haltcrypt();
int /*<<< orphan*/ printf(char *);
int CORE_CTRL(int type, int code) {
  if (type == 0) {
    if (code == 0) {
      printf("\x1B[37m"
             "[  "
             "\x1B[32m"
             "  "
             "\x1B[37m"
             "  ] stop\r");
      exit(00);
      printf("\x1B[37m"
             "[  "
             "\x1B[32m"
             "OK"
             "\x1B[37m"
             "  ] stop\n");
    }
    if (code == 1) {
      printf("\x1B[37m"
             "[  "
             "\x1B[32m"
             "  "
             "\x1B[37m"
             "  ] halt\r");
      haltcrypt();
      exit(01);
      printf("\x1B[37m"
             "[  "
             "\x1B[32m"
             "OK"
             "\x1B[37m"
             "  ] halt\n");
    }
  }
  if (type == 1) {
    ;
  }
}


x86 assembly (clang, -O0):
<CORE_CTRL>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1191 <CORE_CTRL+0x61>
cmpl   $0x0,-0xc(%rbp)
jne    1165 <CORE_CTRL+0x35>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>
cmpl   $0x1,-0xc(%rbp)
jne    118c <CORE_CTRL+0x5c>
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <haltcrypt@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    1191 <CORE_CTRL+0x61>
cmpl   $0x1,-0x8(%rbp)
jne    11a0 <CORE_CTRL+0x70>
jmp    11a0 <CORE_CTRL+0x70>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CORE_CTRL>:
push   %rax
test   %edi,%edi
jne    113e <CORE_CTRL+0xe>
cmp    $0x1,%esi
je     1140 <CORE_CTRL+0x10>
test   %esi,%esi
je     115d <CORE_CTRL+0x2d>
pop    %rcx
ret
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <haltcrypt@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"\1B[37m[ \1B[32m \1B[37m ] stop\0D\00"
@.str.1 = [30 x i8] c"\1B[37m[ \1B[32m \1B[37m ] halt\0D\00"
define i32 @CORE_CTRL(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %8
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 (...) @haltcrypt()
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %14
br label %22
22: ; preds = %21, %2
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %26
25: ; preds = %22
br label %26
26: ; preds = %25, %22
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
@.str = [30 x i8] c"\1B[37m[ \1B[32m \1B[37m ] stop\0D\00"
@.str.1 = [30 x i8] c"\1B[37m[ \1B[32m \1B[37m ] halt\0D\00"
define i32 @CORE_CTRL(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %12
4: ; preds = %2
switch i32 %1, label %12 [
i32 0, label %5
i32 1, label %8
]
5: ; preds = %4
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %4
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 (...) @haltcrypt()
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %4, %2
ret i32 undef
}