#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*/ CmdEndParagraph(int /*<<< orphan*/);
int /*<<< orphan*/ PopEnvironment();
int /*<<< orphan*/ PushEnvironment(int);
int /*<<< orphan*/ diagnostics(int, char *, int);
void Environment(int code) {
  if (code & 0x4000) {
    code &= ~(0x4000);
    diagnostics(4, "Entering Environment (%d)", code);
    PushEnvironment(15);
  } else {
    CmdEndParagraph(0);
    diagnostics(4, "Exiting  Environment (%d)", code);
    PopEnvironment();
  }
}


x86 assembly (clang, -O0):
<Environment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x4000,%eax
cmp    $0x0,%eax
je     118a <Environment+0x4a>
mov    -0x4(%rbp),%eax
and    $0xffffbfff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x4,%edi
lea    0xe8a(%rip),%rsi
call   1040 <diagnostics@plt>
mov    $0xf,%edi
call   1030 <PushEnvironment@plt>
jmp    11ac <Environment+0x6c>
xor    %edi,%edi
call   1060 <CmdEndParagraph@plt>
mov    -0x4(%rbp),%edx
mov    $0x4,%edi
lea    0xe7a(%rip),%rsi
call   1040 <diagnostics@plt>
mov    $0x0,%al
call   1050 <PopEnvironment@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Environment>:
push   %rbx
mov    %edi,%ebx
test   $0x4000,%edi
jne    116d <Environment+0x2d>
xor    %edi,%edi
call   1060 <CmdEndParagraph@plt>
lea    0xec1(%rip),%rsi
mov    $0x4,%edi
mov    %ebx,%edx
call   1040 <diagnostics@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <PopEnvironment@plt>
and    $0xffffbfff,%ebx
lea    0xe86(%rip),%rsi
mov    $0x4,%edi
mov    %ebx,%edx
call   1040 <diagnostics@plt>
mov    $0xf,%edi
pop    %rbx
jmp    1030 <PushEnvironment@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Entering Environment (%d)\00"
@.str.1 = [26 x i8] c"Exiting Environment (%d)\00"
define void @Environment(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 16384
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %2
%8 = and i32 %7, -16385
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = call i32 @diagnostics(i32 4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @PushEnvironment(i32 15)
br label %17
12: ; preds = %1
%13 = call i32 @CmdEndParagraph(i32 0)
%14 = load i32, i32* %2
%15 = call i32 @diagnostics(i32 4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = call i32 (...) @PopEnvironment()
br label %17
17: ; preds = %12, %6
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Entering Environment (%d)\00"
@.str.1 = [26 x i8] c"Exiting Environment (%d)\00"
define void @Environment(i32 %0) {
%2 = and i32 %0, 16384
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = and i32 %0, -16385
%6 = tail call i32 @diagnostics(i32 4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = tail call i32 @PushEnvironment(i32 15)
br label %12
8: ; preds = %1
%9 = tail call i32 @CmdEndParagraph(i32 0)
%10 = tail call i32 @diagnostics(i32 4, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%11 = tail call i32 (...) @PopEnvironment()
br label %12
12: ; preds = %8, %4
ret void
}