#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 */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int adapt_exit(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int exit_stacks(int message, uint64_t bid, int rid) {
  int error;
  if (message == 1)
    printf("\nExit region\n");
  error = adapt_exit(bid, 0, 0);
  if (message == 1)
    printf("Returned error code: %d\n", error);
  return error;
}


x86 assembly (clang, -O0):
<exit_stacks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1149 <exit_stacks+0x29>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <adapt_exit@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1173 <exit_stacks+0x53>
mov    -0x10(%rbp),%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exit_stacks>:
push   %rbx
mov    %esi,%ebx
cmp    $0x1,%edi
jne    1165 <exit_stacks+0x35>
lea    0xeda(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <adapt_exit@plt>
mov    %eax,%ebx
lea    0xea8(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
pop    %rbx
jmp    1050 <adapt_exit@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"\0AExit region\0A\00"
@.str.1 = [25 x i8] c"Returned error code: %d\0A\00"
define i32 @exit_stacks(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %3
%13 = load i32, i32* %5
%14 = call i32 @adapt_exit(i32 %13, i32 0, i32 0)
store i32 %14, i32* %7
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 1
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i32, i32* %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br label %20
20: ; preds = %17, %12
%21 = load i32, i32* %7
ret i32 %21
}

LLVM IR (-O2):
@.str.1 = [25 x i8] c"Returned error code: %d\0A\00"
@str = [13 x i8] c"\0AExit region\00"
define i32 @exit_stacks(i32 %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %0, 1
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @adapt_exit(i32 %1, i32 0, i32 0)
br label %11
7: ; preds = %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%9 = tail call i32 @adapt_exit(i32 %1, i32 0, i32 0)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %5, %7
%12 = phi i32 [ %9, %7 ], [ %6, %5 ]
ret i32 %12
}