#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 MAP_ANONYMOUS;
int MAP_FIXED;
int MAP_PRIVATE;
int MAP_SHARED;
char *print_flags(int flags) {
  if (flags & MAP_SHARED)
    return "MAP_SHARED";
  if (flags & MAP_PRIVATE)
    return "MAP_PRIVATE";
  if (flags & MAP_FIXED)
    return "MAP_FIXED";
  if (flags & MAP_ANONYMOUS)
    return "MAP_ANONYMOUS";
  return "MAP_DONTKNOW";
}


x86 assembly (clang, -O0):
<print_flags>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2edf(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     112c <print_flags+0x2c>
lea    0xedd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a6 <print_flags+0xa6>
mov    -0xc(%rbp),%eax
mov    0x2e9a(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1151 <print_flags+0x51>
lea    0xec3(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a6 <print_flags+0xa6>
mov    -0xc(%rbp),%eax
mov    0x2e6d(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     1176 <print_flags+0x76>
lea    0xeaa(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a6 <print_flags+0xa6>
mov    -0xc(%rbp),%eax
mov    0x2e60(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     119b <print_flags+0x9b>
lea    0xe8f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a6 <print_flags+0xa6>
lea    0xe8d(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_flags>:
mov    0x2ee9(%rip),%rax
test   %edi,(%rax)
je     1113 <print_flags+0x13>
lea    0xeee(%rip),%rax
ret
mov    0x2eb6(%rip),%rax
test   %edi,(%rax)
je     1126 <print_flags+0x26>
lea    0xee6(%rip),%rax
ret
mov    0x2e9b(%rip),%rax
test   %edi,(%rax)
je     1139 <print_flags+0x39>
lea    0xedf(%rip),%rax
ret
mov    0x2ea0(%rip),%rax
test   %edi,(%rax)
lea    0xee6(%rip),%rcx
lea    0xed1(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@MAP_SHARED = global i32 0
@.str = [11 x i8] c"MAP_SHARED\00"
@MAP_PRIVATE = global i32 0
@.str.1 = [12 x i8] c"MAP_PRIVATE\00"
@MAP_FIXED = global i32 0
@.str.2 = [10 x i8] c"MAP_FIXED\00"
@MAP_ANONYMOUS = global i32 0
@.str.3 = [14 x i8] c"MAP_ANONYMOUS\00"
@.str.4 = [13 x i8] c"MAP_DONTKNOW\00"
define i8* @print_flags(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* @MAP_SHARED
%6 = and i32 %4, %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %2
br label %28
9: ; preds = %1
%10 = load i32, i32* %3
%11 = load i32, i32* @MAP_PRIVATE
%12 = and i32 %10, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %28
15: ; preds = %9
%16 = load i32, i32* %3
%17 = load i32, i32* @MAP_FIXED
%18 = and i32 %16, %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %28
21: ; preds = %15
%22 = load i32, i32* %3
%23 = load i32, i32* @MAP_ANONYMOUS
%24 = and i32 %22, %23
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %21
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %28
27: ; preds = %21
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %28
28: ; preds = %27, %26, %20, %14, %8
%29 = load i8*, i8** %2
ret i8* %29
}

LLVM IR (-O2):
@MAP_SHARED = global i32 0
@.str = [11 x i8] c"MAP_SHARED\00"
@MAP_PRIVATE = global i32 0
@.str.1 = [12 x i8] c"MAP_PRIVATE\00"
@MAP_FIXED = global i32 0
@.str.2 = [10 x i8] c"MAP_FIXED\00"
@MAP_ANONYMOUS = global i32 0
@.str.3 = [14 x i8] c"MAP_ANONYMOUS\00"
@.str.4 = [13 x i8] c"MAP_DONTKNOW\00"
define i8* @print_flags(i32 %0) {
%2 = load i32, i32* @MAP_SHARED
%3 = and i32 %2, %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %18
5: ; preds = %1
%6 = load i32, i32* @MAP_PRIVATE
%7 = and i32 %6, %0
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = load i32, i32* @MAP_FIXED
%11 = and i32 %10, %0
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = load i32, i32* @MAP_ANONYMOUS
%15 = and i32 %14, %0
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0)
br label %18
18: ; preds = %13, %9, %5, %1
%19 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), %9 ], [ %17, %13 ]
ret i8* %19
}