#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 */
struct stat {
  scalar_t__ st_uid;
  scalar_t__ st_gid;
  scalar_t__ st_size;
  scalar_t__ st_mode;
};
struct passwd {
  char *pw_name;
  scalar_t__ pw_uid;
};

/* Variables and functions */
scalar_t__ EPERM;
int O_CREAT;
int O_RDWR;
int S_IRUSR;
int S_IWUSR;
scalar_t__ errno;
scalar_t__ fstat(int, struct stat *);
scalar_t__ ftruncate(int, int);
struct passwd *getpwent();
scalar_t__ getuid();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ seteuid(scalar_t__);
int shm_open(char *, int, int);
int shm_unlink(char *);
scalar_t__ strcmp(char *, char *);
int main(void) {
  int fd, result;
  struct passwd *pw;
  struct stat stat_before, stat_after;
  fd = shm_open("posixtest_9-1", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
  if (fd == -1) {
    perror("An error occurs when calling shm_open()");
    return 2;
  }
  if (ftruncate(fd, 8) != 0) {
    perror("An error occurs when calling ftruncate()");
    shm_unlink("posixtest_9-1");
    return 2;
  }
  if (fstat(fd, &stat_before) != 0) {
    perror("An error occurs when calling fstat()");
    shm_unlink("posixtest_9-1");
    return 2;
  }
  while ((pw = getpwent()) != NULL)
    if (strcmp(pw->pw_name, "root") && pw->pw_uid != getuid())
      break;
  if (pw == NULL) {
    printf("There is no other user than current and root.\n");
    return 2;
  }
  if (seteuid(pw->pw_uid) != 0) {
    if (errno == EPERM) {
      printf("You don't have permission to change your UID.\nTry to rerun this "
             "test as root.\n");
      return 2;
    }
    perror("An error occurs when calling seteuid()");
    return 2;
  }
  printf("Testing with user '%s' (uid: %i)\n", pw->pw_name, pw->pw_uid);
  result = shm_unlink("posixtest_9-1");
  if (result == 0) {
    printf("shm_unlink() success.\n");
    return 2;
  }
  seteuid(getuid());
  if (fstat(fd, &stat_after) != 0) {
    perror("An error occurs when calling fstat()");
    shm_unlink("posixtest_9-1");
    return 2;
  }
  if (stat_after.st_uid != stat_before.st_uid ||
      stat_after.st_gid != stat_before.st_gid ||
      stat_after.st_size != stat_before.st_size ||
      stat_after.st_mode != stat_before.st_mode) {
    printf("The shared memory object has changed.\n");
    return 1;
  }
  printf("Test PASSED\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e2a(%rip),%rax
mov    (%rax),%esi
mov    0x2e39(%rip),%rax
or     (%rax),%esi
mov    0x2df8(%rip),%rax
mov    (%rax),%edx
mov    0x2e07(%rip),%rax
or     (%rax),%edx
lea    0xe26(%rip),%rdi
call   1090 <shm_open@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    1204 <main+0x64>
lea    0xe1b(%rip),%rdi
call   1080 <perror@plt>
movl   $0x2,-0x4(%rbp)
jmp    1465 <main+0x2c5>
mov    -0x8(%rbp),%edi
mov    $0x8,%esi
call   1050 <ftruncate@plt>
cmp    $0x0,%rax
je     123f <main+0x9f>
lea    0xe14(%rip),%rdi
call   1080 <perror@plt>
lea    0xdd2(%rip),%rdi
call   10a0 <shm_unlink@plt>
movl   $0x2,-0x4(%rbp)
jmp    1465 <main+0x2c5>
mov    -0x8(%rbp),%edi
lea    -0x38(%rbp),%rsi
call   10b0 <fstat@plt>
cmp    $0x0,%rax
je     1279 <main+0xd9>
lea    0xe03(%rip),%rdi
call   1080 <perror@plt>
lea    0xd98(%rip),%rdi
call   10a0 <shm_unlink@plt>
movl   $0x2,-0x4(%rbp)
jmp    1465 <main+0x2c5>
jmp    127e <main+0xde>
mov    $0x0,%al
call   1070 <getpwent@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     12dd <main+0x13d>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
lea    0xde3(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     12d8 <main+0x138>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x60(%rbp)
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
cmp    %rcx,%rax
je     12d8 <main+0x138>
jmp    12dd <main+0x13d>
jmp    127e <main+0xde>
cmpq   $0x0,-0x18(%rbp)
jne    1302 <main+0x162>
lea    0xd9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1465 <main+0x2c5>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
call   10c0 <seteuid@plt>
cmp    $0x0,%rax
je     1365 <main+0x1c5>
mov    0x2ca8(%rip),%rax
mov    (%rax),%rax
mov    0x2c86(%rip),%rcx
cmp    (%rcx),%rax
jne    134d <main+0x1ad>
lea    0xd7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1465 <main+0x2c5>
lea    0xdb3(%rip),%rdi
call   1080 <perror@plt>
movl   $0x2,-0x4(%rbp)
jmp    1465 <main+0x2c5>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc77(%rip),%rdi
call   10a0 <shm_unlink@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    13b5 <main+0x215>
lea    0xdae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    1465 <main+0x2c5>
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %rax,%rdi
call   10c0 <seteuid@plt>
mov    -0x8(%rbp),%edi
lea    -0x58(%rbp),%rsi
call   10b0 <fstat@plt>
cmp    $0x0,%rax
je     13fe <main+0x25e>
lea    0xc7e(%rip),%rdi
call   1080 <perror@plt>
lea    0xc13(%rip),%rdi
call   10a0 <shm_unlink@plt>
movl   $0x2,-0x4(%rbp)
jmp    1465 <main+0x2c5>
mov    -0x58(%rbp),%rax
cmp    -0x38(%rbp),%rax
jne    1436 <main+0x296>
mov    -0x50(%rbp),%rax
cmp    -0x30(%rbp),%rax
jne    1436 <main+0x296>
mov    -0x48(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    1436 <main+0x296>
mov    -0x40(%rbp),%rax
cmp    -0x20(%rbp),%rax
je     1450 <main+0x2b0>
lea    0xd2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1465 <main+0x2c5>
lea    0xd37(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    0x2e1f(%rip),%rax
mov    0x2e30(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2ded(%rip),%rax
mov    0x2dfe(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
lea    0xe1b(%rip),%rdi
call   10a0 <shm_open@plt>
cmp    $0xffffffff,%eax
je     1349 <main+0x199>
mov    %eax,%r14d
mov    %eax,%edi
mov    $0x8,%esi
call   1060 <ftruncate@plt>
test   %rax,%rax
jne    135a <main+0x1aa>
lea    0x28(%rsp),%rsi
mov    %r14d,%edi
call   10c0 <fstat@plt>
test   %rax,%rax
jne    1363 <main+0x1b3>
xor    %eax,%eax
call   1080 <getpwent@plt>
test   %rax,%rax
je     12a0 <main+0xf0>
mov    %rax,%rbx
lea    0xe4d(%rip),%r15
jmp    124f <main+0x9f>
nopl   0x0(%rax)
xor    %eax,%eax
call   1080 <getpwent@plt>
mov    %rax,%rbx
test   %rax,%rax
je     12a0 <main+0xf0>
mov    (%rbx),%rdi
mov    %r15,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     1240 <main+0x90>
mov    0x8(%rbx),%rbp
xor    %eax,%eax
call   1040 <getuid@plt>
cmp    %rax,%rbp
je     1240 <main+0x90>
mov    0x8(%rbx),%rdi
call   10d0 <seteuid@plt>
test   %rax,%rax
je     12bc <main+0x10c>
mov    0x2d44(%rip),%rax
mov    (%rax),%rax
mov    0x2d22(%rip),%rcx
cmp    (%rcx),%rax
jne    13a2 <main+0x1f2>
lea    0xe7c(%rip),%rdi
jmp    12a7 <main+0xf7>
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%rbx),%rsi
mov    0x8(%rbx),%rdx
lea    0xde6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd28(%rip),%rdi
call   10b0 <shm_unlink@plt>
test   %eax,%eax
je     1396 <main+0x1e6>
xor    %eax,%eax
call   1040 <getuid@plt>
mov    %rax,%rdi
call   10d0 <seteuid@plt>
lea    0x8(%rsp),%rsi
mov    %r14d,%edi
call   10c0 <fstat@plt>
test   %rax,%rax
jne    1363 <main+0x1b3>
mov    0x8(%rsp),%rax
cmp    0x28(%rsp),%rax
jne    1380 <main+0x1d0>
mov    0x10(%rsp),%rax
cmp    0x30(%rsp),%rax
jne    1380 <main+0x1d0>
mov    0x18(%rsp),%rax
cmp    0x38(%rsp),%rax
jne    1380 <main+0x1d0>
mov    0x20(%rsp),%rax
cmp    0x40(%rsp),%rax
jne    1380 <main+0x1d0>
lea    0xd95(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
jmp    12b1 <main+0x101>
lea    0xcbe(%rip),%rdi
call   1090 <perror@plt>
jmp    12ac <main+0xfc>
lea    0xcd5(%rip),%rdi
jmp    136a <main+0x1ba>
lea    0xcf5(%rip),%rdi
call   1090 <perror@plt>
lea    0xc8a(%rip),%rdi
call   10b0 <shm_unlink@plt>
jmp    12ac <main+0xfc>
lea    0xd57(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    12b1 <main+0x101>
lea    0xd67(%rip),%rdi
jmp    12a7 <main+0xf7>
lea    0xce0(%rip),%rdi
jmp    1350 <main+0x1a0>

LLVM IR (-O0):
%struct.passwd = type { i8*, i64 }
%struct.stat = type { i64, i64, i64, i64 }
@.str = [14 x i8] c"posixtest_9-1\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.1 = [40 x i8] c"An error occurs when calling shm_open()\00"
@.str.2 = [41 x i8] c"An error occurs when calling ftruncate()\00"
@.str.3 = [37 x i8] c"An error occurs when calling fstat()\00"
@.str.4 = [5 x i8] c"root\00"
@.str.5 = [47 x i8] c"There is no other user than current and root.\0A\00"
@errno = global i64 0
@EPERM = global i64 0
@.str.6 = [79 x i8] c"You don't have permission to change your UID.\0ATry to rerun this test as root.\0A\00"
@.str.7 = [39 x i8] c"An error occurs when calling seteuid()\00"
@.str.8 = [34 x i8] c"Testing with user '%s' (uid: %i)\0A\00"
@.str.9 = [23 x i8] c"shm_unlink() success.\0A\00"
@.str.10 = [39 x i8] c"The shared memory object has changed.\0A\00"
@.str.11 = [13 x i8] c"Test PASSED\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.passwd*
%5 = alloca %struct.stat
%6 = alloca %struct.stat
store i32 0, i32* %1
%7 = load i32, i32* @O_RDWR
%8 = load i32, i32* @O_CREAT
%9 = or i32 %7, %8
%10 = load i32, i32* @S_IRUSR
%11 = load i32, i32* @S_IWUSR
%12 = or i32 %10, %11
%13 = call i32 @shm_open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %12)
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
store i32 2, i32* %1
br label %119
18: ; preds = %0
%19 = load i32, i32* %2
%20 = call i64 @ftruncate(i32 %19, i32 8)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = call i32 @perror(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @shm_unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %1
br label %119
25: ; preds = %18
%26 = load i32, i32* %2
%27 = call i64 @fstat(i32 %26, %struct.stat* %5)
%28 = icmp ne i64 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = call i32 @perror(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%31 = call i32 @shm_unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %1
br label %119
32: ; preds = %25
br label %33
33: ; preds = %49, %32
%34 = call %struct.passwd* (...) @getpwent()
store %struct.passwd* %34, %struct.passwd** %4
%35 = icmp ne %struct.passwd* %34, null
br i1 %35, label %36, label %50
36: ; preds = %33
%37 = load %struct.passwd*, %struct.passwd** %4
%38 = getelementptr inbounds %struct.passwd, %struct.passwd* %37, i32 0, i32 0
%39 = load i8*, i8** %38
%40 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %49
42: ; preds = %36
%43 = load %struct.passwd*, %struct.passwd** %4
%44 = getelementptr inbounds %struct.passwd, %struct.passwd* %43, i32 0, i32 1
%45 = load i64, i64* %44
%46 = call i64 (...) @getuid()
%47 = icmp ne i64 %45, %46
br i1 %47, label %48, label %49
48: ; preds = %42
br label %50
49: ; preds = %42, %36
br label %33
50: ; preds = %48, %33
%51 = load %struct.passwd*, %struct.passwd** %4
%52 = icmp eq %struct.passwd* %51, null
br i1 %52, label %53, label %55
53: ; preds = %50
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0))
store i32 2, i32* %1
br label %119
55: ; preds = %50
%56 = load %struct.passwd*, %struct.passwd** %4
%57 = getelementptr inbounds %struct.passwd, %struct.passwd* %56, i32 0, i32 1
%58 = load i64, i64* %57
%59 = call i64 @seteuid(i64 %58)
%60 = icmp ne i64 %59, 0
br i1 %60, label %61, label %69
61: ; preds = %55
%62 = load i64, i64* @errno
%63 = load i64, i64* @EPERM
%64 = icmp eq i64 %62, %63
br i1 %64, label %65, label %67
65: ; preds = %61
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.6, i64 0, i64 0))
store i32 2, i32* %1
br label %119
67: ; preds = %61
%68 = call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
store i32 2, i32* %1
br label %119
69: ; preds = %55
%70 = load %struct.passwd*, %struct.passwd** %4
%71 = getelementptr inbounds %struct.passwd, %struct.passwd* %70, i32 0, i32 0
%72 = load i8*, i8** %71
%73 = load %struct.passwd*, %struct.passwd** %4
%74 = getelementptr inbounds %struct.passwd, %struct.passwd* %73, i32 0, i32 1
%75 = load i64, i64* %74
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i8* %72, i64 %75)
%77 = call i32 @shm_unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 %77, i32* %3
%78 = load i32, i32* %3
%79 = icmp eq i32 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %69
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
store i32 2, i32* %1
br label %119
82: ; preds = %69
%83 = call i64 (...) @getuid()
%84 = call i64 @seteuid(i64 %83)
%85 = load i32, i32* %2
%86 = call i64 @fstat(i32 %85, %struct.stat* %6)
%87 = icmp ne i64 %86, 0
br i1 %87, label %88, label %91
88: ; preds = %82
%89 = call i32 @perror(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%90 = call i32 @shm_unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %1
br label %119
91: ; preds = %82
%92 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
%93 = load i64, i64* %92
%94 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%95 = load i64, i64* %94
%96 = icmp ne i64 %93, %95
br i1 %96, label %115, label %97
97: ; preds = %91
%98 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 1
%99 = load i64, i64* %98
%100 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 1
%101 = load i64, i64* %100
%102 = icmp ne i64 %99, %101
br i1 %102, label %115, label %103
103: ; preds = %97
%104 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 2
%105 = load i64, i64* %104
%106 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 2
%107 = load i64, i64* %106
%108 = icmp ne i64 %105, %107
br i1 %108, label %115, label %109
109: ; preds = %103
%110 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 3
%111 = load i64, i64* %110
%112 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 3
%113 = load i64, i64* %112
%114 = icmp ne i64 %111, %113
br i1 %114, label %115, label %117
115: ; preds = %109, %103, %97, %91
%116 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %1
br label %119
117: ; preds = %109
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %1
br label %119
119: ; preds = %117, %115, %88, %80, %67, %65, %53, %29, %22, %16
%120 = load i32, i32* %1
ret i32 %120
}

LLVM IR (-O2):
%struct.stat = type { i64, i64, i64, i64 }
%struct.passwd = type { i8*, i64 }
@.str = [14 x i8] c"posixtest_9-1\00"
@O_RDWR = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.1 = [40 x i8] c"An error occurs when calling shm_open()\00"
@.str.2 = [41 x i8] c"An error occurs when calling ftruncate()\00"
@.str.3 = [37 x i8] c"An error occurs when calling fstat()\00"
@.str.4 = [5 x i8] c"root\00"
@errno = global i64 0
@EPERM = global i64 0
@.str.7 = [39 x i8] c"An error occurs when calling seteuid()\00"
@.str.8 = [34 x i8] c"Testing with user '%s' (uid: %i)\0A\00"
@str = [12 x i8] c"Test PASSED\00"
@str.12 = [38 x i8] c"The shared memory object has changed.\00"
@str.13 = [22 x i8] c"shm_unlink() success.\00"
@str.14 = [78 x i8] c"You don't have permission to change your UID.\0ATry to rerun this test as root.\00"
@str.15 = [46 x i8] c"There is no other user than current and root.\00"
define i32 @main() {
%1 = alloca %struct.stat
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %1 to i8*
%4 = bitcast %struct.stat* %2 to i8*
%5 = load i32, i32* @O_RDWR
%6 = load i32, i32* @O_CREAT
%7 = or i32 %6, %5
%8 = load i32, i32* @S_IRUSR
%9 = load i32, i32* @S_IWUSR
%10 = or i32 %9, %8
%11 = tail call i32 @shm_open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = tail call i32 @perror(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %104
15: ; preds = %0
%16 = tail call i64 @ftruncate(i32 %11, i32 8)
%17 = icmp eq i64 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = tail call i32 @perror(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0))
%20 = tail call i32 @shm_unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %104
21: ; preds = %15
%22 = call i64 @fstat(i32 %11, %struct.stat* %1)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = tail call %struct.passwd* (...) @getpwent()
%26 = icmp eq %struct.passwd* %25, null
br i1 %26, label %44, label %30
27: ; preds = %21
%28 = tail call i32 @perror(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%29 = tail call i32 @shm_unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %104
30: ; preds = %24, %41
%31 = phi %struct.passwd* [ %42, %41 ], [ %25, %24 ]
%32 = getelementptr inbounds %struct.passwd, %struct.passwd* %31, i64 0, i32 0
%33 = load i8*, i8** %32
%34 = tail call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %41, label %36
36: ; preds = %30
%37 = getelementptr inbounds %struct.passwd, %struct.passwd* %31, i64 0, i32 1
%38 = load i64, i64* %37
%39 = tail call i64 (...) @getuid()
%40 = icmp eq i64 %38, %39
br i1 %40, label %41, label %46
41: ; preds = %36, %30
%42 = tail call %struct.passwd* (...) @getpwent()
%43 = icmp eq %struct.passwd* %42, null
br i1 %43, label %44, label %30
44: ; preds = %41, %24
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.15, i64 0, i64 0))
br label %104
46: ; preds = %36
%47 = getelementptr inbounds %struct.passwd, %struct.passwd* %31, i64 0, i32 1
%48 = load i64, i64* %47
%49 = tail call i64 @seteuid(i64 %48)
%50 = icmp eq i64 %49, 0
br i1 %50, label %59, label %51
51: ; preds = %46
%52 = load i64, i64* @errno
%53 = load i64, i64* @EPERM
%54 = icmp eq i64 %52, %53
br i1 %54, label %55, label %57
55: ; preds = %51
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.14, i64 0, i64 0))
br label %104
57: ; preds = %51
%58 = tail call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
br label %104
59: ; preds = %46
%60 = getelementptr inbounds %struct.passwd, %struct.passwd* %31, i64 0, i32 0
%61 = load i8*, i8** %60
%62 = load i64, i64* %47
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i8* %61, i64 %62)
%64 = tail call i32 @shm_unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%65 = icmp eq i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %59
%67 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.13, i64 0, i64 0))
br label %104
68: ; preds = %59
%69 = tail call i64 (...) @getuid()
%70 = tail call i64 @seteuid(i64 %69)
%71 = call i64 @fstat(i32 %11, %struct.stat* %2)
%72 = icmp eq i64 %71, 0
br i1 %72, label %76, label %73
73: ; preds = %68
%74 = tail call i32 @perror(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%75 = tail call i32 @shm_unlink(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %104
76: ; preds = %68
%77 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%78 = load i64, i64* %77
%79 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%80 = load i64, i64* %79
%81 = icmp eq i64 %78, %80
br i1 %81, label %82, label %100
82: ; preds = %76
%83 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 1
%84 = load i64, i64* %83
%85 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 1
%86 = load i64, i64* %85
%87 = icmp eq i64 %84, %86
br i1 %87, label %88, label %100
88: ; preds = %82
%89 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 2
%90 = load i64, i64* %89
%91 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 2
%92 = load i64, i64* %91
%93 = icmp eq i64 %90, %92
br i1 %93, label %94, label %100
94: ; preds = %88
%95 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 3
%96 = load i64, i64* %95
%97 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 3
%98 = load i64, i64* %97
%99 = icmp eq i64 %96, %98
br i1 %99, label %102, label %100
100: ; preds = %94, %88, %82, %76
%101 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.12, i64 0, i64 0))
br label %104
102: ; preds = %94
%103 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
br label %104
104: ; preds = %102, %100, %73, %66, %57, %55, %44, %27, %18, %13
%105 = phi i32 [ 2, %13 ], [ 2, %18 ], [ 2, %27 ], [ 2, %44 ], [ 2, %55 ], [ 2, %57 ], [ 2, %66 ], [ 2, %73 ], [ 1, %100 ], [ 0, %102 ]
ret i32 %105
}