#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 EXIT_SUCCESS;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ log_xxx(int /*<<< orphan*/, int, char *, char *, char *,
                           int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void myexit(char *n, int e) {
  log_xxx(stdout, 1, " [info] ", n, "exiting with process status=[%d]\n", e);
  if (e != EXIT_SUCCESS) {
    log_xxx(stderr, 1, " [error] ", n, "exit with process status[%d]\n", e);
  }
  exit(e);
}


x86 assembly (clang, -O0):
<myexit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%r9d
mov    $0x1,%esi
lea    0xeb4(%rip),%rdx
lea    0xeb6(%rip),%r8
call   1030 <log_xxx@plt>
mov    -0xc(%rbp),%eax
mov    0x2e6e(%rip),%rcx
cmp    (%rcx),%eax
je     1193 <myexit+0x73>
mov    0x2e6f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rcx
mov    -0xc(%rbp),%r9d
mov    $0x1,%esi
lea    0xea4(%rip),%rdx
lea    0xea7(%rip),%r8
call   1030 <log_xxx@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<myexit>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
lea    0xec7(%rip),%rdx
lea    0xec9(%rip),%r8
mov    $0x1,%esi
mov    %r14,%rcx
mov    %ebx,%r9d
call   1030 <log_xxx@plt>
mov    0x2e79(%rip),%rax
cmp    %ebx,(%rax)
je     1182 <myexit+0x62>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
lea    0xec0(%rip),%rdx
lea    0xec3(%rip),%r8
mov    $0x1,%esi
mov    %r14,%rcx
mov    %ebx,%r9d
call   1030 <log_xxx@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [9 x i8] c" [info] \00"
@.str.1 = [34 x i8] c"exiting with process status=[%d]\0A\00"
@EXIT_SUCCESS = global i32 0
@stderr = global i32 0
@.str.2 = [10 x i8] c" [error] \00"
@.str.3 = [30 x i8] c"exit with process status[%d]\0A\00"
define void @myexit(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @stdout
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = call i32 @log_xxx(i32 %5, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %4
%10 = load i32, i32* @EXIT_SUCCESS
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %17
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = call i32 @log_xxx(i32 %13, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %12, %2
%18 = load i32, i32* %4
%19 = call i32 @exit(i32 %18)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [9 x i8] c" [info] \00"
@.str.1 = [34 x i8] c"exiting with process status=[%d]\0A\00"
@EXIT_SUCCESS = global i32 0
@stderr = global i32 0
@.str.2 = [10 x i8] c" [error] \00"
@.str.3 = [30 x i8] c"exit with process status[%d]\0A\00"
define void @myexit(i8* %0, i32 %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @log_xxx(i32 %3, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%5 = load i32, i32* @EXIT_SUCCESS
%6 = icmp eq i32 %5, %1
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = tail call i32 @log_xxx(i32 %8, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32 %1)
br label %10
10: ; preds = %7, %2
%11 = tail call i32 @exit(i32 %1)
unreachable
}