#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 */
unsigned int SHORT_INODE;
unsigned int STICKY_TIMEOUTS;
unsigned int WHOLE_SECONDS;
unsigned int personality(unsigned int const);
int /*<<< orphan*/ printf(char *, unsigned int const);
int /*<<< orphan*/ puts(char *);
int main(void) {
  const unsigned int test_pers = SHORT_INODE | WHOLE_SECONDS | STICKY_TIMEOUTS;
  const unsigned int saved_pers = personality(0);
  printf("personality\\(PER_LINUX\\) = %#x \\([^)]*\\)\n", saved_pers);
  personality(test_pers);
  puts("personality\\(SHORT_INODE\\|WHOLE_SECONDS\\|STICKY_TIMEOUTS\\)"
       " = 0 \\(PER_LINUX\\)");
  personality(saved_pers);
  printf("personality\\([^)]*\\) = %#x"
         " \\(SHORT_INODE\\|WHOLE_SECONDS\\|STICKY_TIMEOUTS\\)\n",
         test_pers);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%eax
mov    0x2e91(%rip),%rcx
or     (%rcx),%eax
mov    0x2ea0(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x8(%rbp)
xor    %edi,%edi
call   1030 <personality@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe8f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%edi
call   1030 <personality@plt>
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
mov    -0xc(%rbp),%edi
call   1030 <personality@plt>
mov    -0x8(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    0x2e9e(%rip),%rax
mov    0x2e9f(%rip),%rcx
mov    (%rcx),%ebx
or     (%rax),%ebx
mov    0x2eac(%rip),%rax
or     (%rax),%ebx
xor    %edi,%edi
call   1030 <personality@plt>
mov    %eax,%ebp
lea    0xea2(%rip),%rdi
mov    %eax,%esi
call   1050 <printf@plt>
mov    %ebx,%edi
call   1030 <personality@plt>
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
call   1030 <personality@plt>
lea    0xef1(%rip),%rdi
mov    %ebx,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SHORT_INODE = global i32 0
@WHOLE_SECONDS = global i32 0
@STICKY_TIMEOUTS = global i32 0
@.str = [42 x i8] c"personality\\(PER_LINUX\\) = %#x \\([^)]*\\)\0A\00"
@.str.1 = [77 x i8] c"personality\\(SHORT_INODE\\|WHOLE_SECONDS\\|STICKY_TIMEOUTS\\) = 0 \\(PER_LINUX\\)\00"
@.str.2 = [76 x i8] c"personality\\([^)]*\\) = %#x \\(SHORT_INODE\\|WHOLE_SECONDS\\|STICKY_TIMEOUTS\\)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* @SHORT_INODE
%5 = load i32, i32* @WHOLE_SECONDS
%6 = or i32 %4, %5
%7 = load i32, i32* @STICKY_TIMEOUTS
%8 = or i32 %6, %7
store i32 %8, i32* %2
%9 = call i32 @personality(i32 0)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %2
%13 = call i32 @personality(i32 %12)
%14 = call i32 @puts(i8* getelementptr inbounds ([77 x i8], [77 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* %3
%16 = call i32 @personality(i32 %15)
%17 = load i32, i32* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.2, i64 0, i64 0), i32 %17)
ret i32 0
}

LLVM IR (-O2):
@SHORT_INODE = global i32 0
@WHOLE_SECONDS = global i32 0
@STICKY_TIMEOUTS = global i32 0
@.str = [42 x i8] c"personality\\(PER_LINUX\\) = %#x \\([^)]*\\)\0A\00"
@.str.1 = [77 x i8] c"personality\\(SHORT_INODE\\|WHOLE_SECONDS\\|STICKY_TIMEOUTS\\) = 0 \\(PER_LINUX\\)\00"
@.str.2 = [76 x i8] c"personality\\([^)]*\\) = %#x \\(SHORT_INODE\\|WHOLE_SECONDS\\|STICKY_TIMEOUTS\\)\0A\00"
define i32 @main() {
%1 = load i32, i32* @SHORT_INODE
%2 = load i32, i32* @WHOLE_SECONDS
%3 = or i32 %2, %1
%4 = load i32, i32* @STICKY_TIMEOUTS
%5 = or i32 %3, %4
%6 = tail call i32 @personality(i32 0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = tail call i32 @personality(i32 %5)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([77 x i8], [77 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @personality(i32 %6)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret i32 0
}