#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*/ ClearAcFlag_asm();
int GetFlags_asm();
int /*<<< orphan*/ SetAppFlags_asm(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main() {
  unsigned int flags;
  SetAppFlags_asm(0x40000);
  flags = GetFlags_asm();
  ClearAcFlag_asm();
  if ((GetFlags_asm() & 0x40000) != 0) {
    exit(0);
  }
  SetAppFlags_asm(0x40000);
  flags = GetFlags_asm();
  ClearAcFlag_asm();
  printf("SUCCESS\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x40000,%edi
call   1060 <SetAppFlags_asm@plt>
mov    $0x0,%al
call   1050 <GetFlags_asm@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <ClearAcFlag_asm@plt>
mov    $0x0,%al
call   1050 <GetFlags_asm@plt>
and    $0x40000,%eax
cmp    $0x0,%eax
je     1196 <main+0x46>
xor    %edi,%edi
call   1070 <exit@plt>
mov    $0x40000,%edi
call   1060 <SetAppFlags_asm@plt>
mov    $0x0,%al
call   1050 <GetFlags_asm@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <ClearAcFlag_asm@plt>
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x40000,%edi
call   1060 <SetAppFlags_asm@plt>
xor    %eax,%eax
call   1050 <GetFlags_asm@plt>
xor    %eax,%eax
call   1040 <ClearAcFlag_asm@plt>
xor    %eax,%eax
call   1050 <GetFlags_asm@plt>
test   $0x40000,%eax
jne    11a2 <main+0x52>
mov    $0x40000,%edi
call   1060 <SetAppFlags_asm@plt>
xor    %eax,%eax
call   1050 <GetFlags_asm@plt>
xor    %eax,%eax
call   1040 <ClearAcFlag_asm@plt>
lea    0xe6a(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"SUCCESS\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @SetAppFlags_asm(i32 262144)
%4 = call i32 (...) @GetFlags_asm()
store i32 %4, i32* %2
%5 = call i32 (...) @ClearAcFlag_asm()
%6 = call i32 (...) @GetFlags_asm()
%7 = and i32 %6, 262144
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %0
%12 = call i32 @SetAppFlags_asm(i32 262144)
%13 = call i32 (...) @GetFlags_asm()
store i32 %13, i32* %2
%14 = call i32 (...) @ClearAcFlag_asm()
%15 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [8 x i8] c"SUCCESS\00"
define i32 @main() {
%1 = tail call i32 @SetAppFlags_asm(i32 262144)
%2 = tail call i32 (...) @GetFlags_asm()
%3 = tail call i32 (...) @ClearAcFlag_asm()
%4 = tail call i32 (...) @GetFlags_asm()
%5 = and i32 %4, 262144
%6 = icmp eq i32 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %0
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %0
%10 = tail call i32 @SetAppFlags_asm(i32 262144)
%11 = tail call i32 (...) @GetFlags_asm()
%12 = tail call i32 (...) @ClearAcFlag_asm()
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @exit(i32 0)
unreachable
}