#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 */
typedef scalar_t__ uid_t;
struct passwd {
  scalar_t__ pw_uid;
};
struct group {
  scalar_t__ gr_gid;
};

/* Variables and functions */
int /*<<< orphan*/ LogError(char *, ...);
scalar_t__ atol(char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
struct group *getgrnam(char *);
struct passwd *getpwnam(char *);
scalar_t__ getuid();
int setgid(scalar_t__);
int setuid(scalar_t__);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void SetPriv(char *userid, char *groupid) {
  struct passwd *pw_entry;
  struct group *gr_entry;
  uid_t myuid, newuid, newgid;
  int err;
  if (userid == 0 && groupid == 0)
    return;
  newuid = newgid = 0;
  myuid = getuid();
  if (myuid != 0) {
    LogError("Only root wants to change uid/gid");
    fprintf(stderr, "ERROR: Only root wants to change uid/gid\n");
    exit(255);
  }
  if (userid) {
    pw_entry = getpwnam(userid);
    newuid = pw_entry ? pw_entry->pw_uid : atol(userid);
    if (newuid == 0) {
      fprintf(stderr, "Invalid user '%s'\n", userid);
      exit(255);
    }
  }
  if (groupid) {
    gr_entry = getgrnam(groupid);
    newgid = gr_entry ? gr_entry->gr_gid : atol(groupid);
    if (newgid == 0) {
      fprintf(stderr, "Invalid group '%s'\n", groupid);
      exit(255);
    }
    err = setgid(newgid);
    if (err) {
      LogError("Can't set group id %ld for group '%s': %s", (long)newgid,
               groupid, strerror(errno));
      fprintf(stderr, "Can't set group id %ld for group '%s': %s\n",
              (long)newgid, groupid, strerror(errno));
      exit(255);
    }
  }
  if (newuid) {
    err = setuid(newuid);
    if (err) {
      LogError("Can't set user id %ld for user '%s': %s", (long)newuid, userid,
               strerror(errno));
      fprintf(stderr, "Can't set user id %ld for user '%s': %s\n", (long)newuid,
              userid, strerror(errno));
      exit(255);
    }
  }
}


x86 assembly (clang, -O0):
<SetPriv>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    11ce <SetPriv+0x2e>
cmpq   $0x0,-0x10(%rbp)
jne    11ce <SetPriv+0x2e>
jmp    147d <SetPriv+0x2dd>
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x30(%rbp)
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1223 <SetPriv+0x83>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1050 <LogError@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
lea    0xe10(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0xff,%edi
call   10a0 <exit@plt>
cmpq   $0x0,-0x8(%rbp)
je     12a0 <SetPriv+0x100>
mov    -0x8(%rbp),%rdi
call   1040 <getpwnam@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1256 <SetPriv+0xb6>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
jmp    1263 <SetPriv+0xc3>
mov    -0x8(%rbp),%rdi
call   1090 <atol@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    129b <SetPriv+0xfb>
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xdc2(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0xff,%edi
call   10a0 <exit@plt>
jmp    12a0 <SetPriv+0x100>
cmpq   $0x0,-0x10(%rbp)
je     13b9 <SetPriv+0x219>
mov    -0x10(%rbp),%rdi
call   1070 <getgrnam@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     12d3 <SetPriv+0x133>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x50(%rbp)
jmp    12e0 <SetPriv+0x140>
mov    -0x10(%rbp),%rdi
call   1090 <atol@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rax
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1318 <SetPriv+0x178>
mov    0x2ce6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xd58(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0xff,%edi
call   10a0 <exit@plt>
mov    -0x38(%rbp),%rdi
call   1080 <setgid@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     13b4 <SetPriv+0x214>
mov    -0x38(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    0x2c93(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x78(%rbp),%rsi
mov    -0x70(%rbp),%rdx
mov    %eax,%ecx
lea    0xd16(%rip),%rdi
mov    $0x0,%al
call   1050 <LogError@plt>
mov    0x2c75(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    0x2c51(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x64(%rbp),%edi
mov    -0x60(%rbp),%rdx
mov    -0x58(%rbp),%rcx
mov    %eax,%r8d
lea    0xcfa(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0xff,%edi
call   10a0 <exit@plt>
jmp    13b9 <SetPriv+0x219>
cmpq   $0x0,-0x30(%rbp)
je     147d <SetPriv+0x2dd>
mov    -0x30(%rbp),%rdi
call   10b0 <setuid@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     1478 <SetPriv+0x2d8>
mov    -0x30(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    0x2be1(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0xa0(%rbp),%rsi
mov    -0x98(%rbp),%rdx
mov    %eax,%ecx
lea    0xcb3(%rip),%rdi
mov    $0x0,%al
call   1050 <LogError@plt>
mov    0x2bbd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8c(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    0x2b93(%rip),%rax
mov    (%rax),%edi
call   10c0 <strerror@plt>
mov    -0x8c(%rbp),%edi
mov    -0x88(%rbp),%rdx
mov    -0x80(%rbp),%rcx
mov    %eax,%r8d
lea    0xc89(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
mov    $0xff,%edi
call   10a0 <exit@plt>
jmp    147d <SetPriv+0x2dd>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetPriv>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rdi,%rax
or     %rsi,%rax
je     1229 <SetPriv+0x89>
mov    %rsi,%rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <getuid@plt>
test   %rax,%rax
jne    128b <SetPriv+0xeb>
test   %r14,%r14
je     11e7 <SetPriv+0x47>
mov    %r14,%rdi
call   1040 <getpwnam@plt>
test   %rax,%rax
je     1232 <SetPriv+0x92>
mov    (%rax),%r15
test   %r15,%r15
je     1242 <SetPriv+0xa2>
test   %rbx,%rbx
jne    11ef <SetPriv+0x4f>
jmp    1214 <SetPriv+0x74>
xor    %r15d,%r15d
test   %rbx,%rbx
je     1214 <SetPriv+0x74>
mov    %rbx,%rdi
call   1070 <getgrnam@plt>
test   %rax,%rax
je     1257 <SetPriv+0xb7>
mov    (%rax),%r12
test   %r12,%r12
je     1267 <SetPriv+0xc7>
mov    %r12,%rdi
call   1080 <setgid@plt>
test   %eax,%eax
jne    12ba <SetPriv+0x11a>
test   %r15,%r15
je     1229 <SetPriv+0x89>
mov    %r15,%rdi
call   10b0 <setuid@plt>
test   %eax,%eax
jne    1301 <SetPriv+0x161>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r14,%rdi
call   1090 <atol@plt>
mov    %rax,%r15
test   %r15,%r15
jne    11e0 <SetPriv+0x40>
mov    0x2d97(%rip),%rax
mov    (%rax),%edi
lea    0xdfa(%rip),%rsi
mov    %r14,%rdx
jmp    127a <SetPriv+0xda>
mov    %rbx,%rdi
call   1090 <atol@plt>
mov    %rax,%r12
test   %r12,%r12
jne    1204 <SetPriv+0x64>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
lea    0xde8(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xff,%edi
call   10a0 <exit@plt>
lea    0xd6e(%rip),%rdi
xor    %eax,%eax
call   1050 <LogError@plt>
mov    0x2d40(%rip),%rax
mov    (%rax),%edi
lea    0xd79(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xff,%edi
call   10a0 <exit@plt>
mov    0x2d17(%rip),%r14
mov    (%r14),%edi
call   10c0 <strerror@plt>
lea    0xda3(%rip),%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <LogError@plt>
mov    0x2cfa(%rip),%rax
mov    (%rax),%ebp
mov    (%r14),%edi
call   10c0 <strerror@plt>
lea    0xda6(%rip),%rsi
mov    %ebp,%edi
mov    %r12,%rdx
mov    %rbx,%rcx
jmp    1346 <SetPriv+0x1a6>
mov    0x2cd0(%rip),%rbp
mov    0x0(%rbp),%edi
call   10c0 <strerror@plt>
lea    0xdb1(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <LogError@plt>
mov    0x2cb3(%rip),%rax
mov    (%rax),%ebx
mov    0x0(%rbp),%edi
call   10c0 <strerror@plt>
lea    0xdb2(%rip),%rsi
mov    %ebx,%edi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %eax,%r8d
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0xff,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
%struct.passwd = type { i64 }
%struct.group = type { i64 }
@.str = [34 x i8] c"Only root wants to change uid/gid\00"
@stderr = global i32 0
@.str.1 = [42 x i8] c"ERROR: Only root wants to change uid/gid\0A\00"
@.str.2 = [19 x i8] c"Invalid user '%s'\0A\00"
@.str.3 = [20 x i8] c"Invalid group '%s'\0A\00"
@.str.4 = [42 x i8] c"Can't set group id %ld for group '%s': %s\00"
@errno = global i32 0
@.str.5 = [43 x i8] c"Can't set group id %ld for group '%s': %s\0A\00"
@.str.6 = [40 x i8] c"Can't set user id %ld for user '%s': %s\00"
@.str.7 = [41 x i8] c"Can't set user id %ld for user '%s': %s\0A\00"
define void @SetPriv(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca %struct.passwd*
%6 = alloca %struct.group*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%11 = load i8*, i8** %3
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %17
16: ; preds = %13
br label %116
17: ; preds = %13, %2
store i64 0, i64* %9
store i64 0, i64* %8
%18 = call i64 (...) @getuid()
store i64 %18, i64* %7
%19 = load i64, i64* %7
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %17
%22 = call i32 (i8*, ...) @LogError(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @exit(i32 255)
unreachable
26: ; preds = %17
%27 = load i8*, i8** %3
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %51
29: ; preds = %26
%30 = load i8*, i8** %3
%31 = call %struct.passwd* @getpwnam(i8* %30)
store %struct.passwd* %31, %struct.passwd** %5
%32 = load %struct.passwd*, %struct.passwd** %5
%33 = icmp ne %struct.passwd* %32, null
br i1 %33, label %34, label %38
34: ; preds = %29
%35 = load %struct.passwd*, %struct.passwd** %5
%36 = getelementptr inbounds %struct.passwd, %struct.passwd* %35, i32 0, i32 0
%37 = load i64, i64* %36
br label %41
38: ; preds = %29
%39 = load i8*, i8** %3
%40 = call i64 @atol(i8* %39)
br label %41
41: ; preds = %38, %34
%42 = phi i64 [ %37, %34 ], [ %40, %38 ]
store i64 %42, i64* %8
%43 = load i64, i64* %8
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %50
45: ; preds = %41
%46 = load i32, i32* @stderr
%47 = load i8*, i8** %3
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %47)
%49 = call i32 @exit(i32 255)
unreachable
50: ; preds = %41
br label %51
51: ; preds = %50, %26
%52 = load i8*, i8** %4
%53 = icmp ne i8* %52, null
br i1 %53, label %54, label %94
54: ; preds = %51
%55 = load i8*, i8** %4
%56 = call %struct.group* @getgrnam(i8* %55)
store %struct.group* %56, %struct.group** %6
%57 = load %struct.group*, %struct.group** %6
%58 = icmp ne %struct.group* %57, null
br i1 %58, label %59, label %63
59: ; preds = %54
%60 = load %struct.group*, %struct.group** %6
%61 = getelementptr inbounds %struct.group, %struct.group* %60, i32 0, i32 0
%62 = load i64, i64* %61
br label %66
63: ; preds = %54
%64 = load i8*, i8** %4
%65 = call i64 @atol(i8* %64)
br label %66
66: ; preds = %63, %59
%67 = phi i64 [ %62, %59 ], [ %65, %63 ]
store i64 %67, i64* %9
%68 = load i64, i64* %9
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %75
70: ; preds = %66
%71 = load i32, i32* @stderr
%72 = load i8*, i8** %4
%73 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %72)
%74 = call i32 @exit(i32 255)
unreachable
75: ; preds = %66
%76 = load i64, i64* %9
%77 = call i32 @setgid(i64 %76)
store i32 %77, i32* %10
%78 = load i32, i32* %10
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %93
80: ; preds = %75
%81 = load i64, i64* %9
%82 = load i8*, i8** %4
%83 = load i32, i32* @errno
%84 = call i32 @strerror(i32 %83)
%85 = call i32 (i8*, ...) @LogError(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i64 %81, i8* %82, i32 %84)
%86 = load i32, i32* @stderr
%87 = load i64, i64* %9
%88 = load i8*, i8** %4
%89 = load i32, i32* @errno
%90 = call i32 @strerror(i32 %89)
%91 = call i32 (i32, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i64 %87, i8* %88, i32 %90)
%92 = call i32 @exit(i32 255)
unreachable
93: ; preds = %75
br label %94
94: ; preds = %93, %51
%95 = load i64, i64* %8
%96 = icmp ne i64 %95, 0
br i1 %96, label %97, label %116
97: ; preds = %94
%98 = load i64, i64* %8
%99 = call i32 @setuid(i64 %98)
store i32 %99, i32* %10
%100 = load i32, i32* %10
%101 = icmp ne i32 %100, 0
br i1 %101, label %102, label %115
102: ; preds = %97
%103 = load i64, i64* %8
%104 = load i8*, i8** %3
%105 = load i32, i32* @errno
%106 = call i32 @strerror(i32 %105)
%107 = call i32 (i8*, ...) @LogError(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i64 %103, i8* %104, i32 %106)
%108 = load i32, i32* @stderr
%109 = load i64, i64* %8
%110 = load i8*, i8** %3
%111 = load i32, i32* @errno
%112 = call i32 @strerror(i32 %111)
%113 = call i32 (i32, i8*, ...) @fprintf(i32 %108, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i64 %109, i8* %110, i32 %112)
%114 = call i32 @exit(i32 255)
unreachable
115: ; preds = %97
br label %116
116: ; preds = %16, %115, %94
ret void
}

LLVM IR (-O2):
%struct.passwd = type { i64 }
%struct.group = type { i64 }
@.str = [34 x i8] c"Only root wants to change uid/gid\00"
@stderr = global i32 0
@.str.1 = [42 x i8] c"ERROR: Only root wants to change uid/gid\0A\00"
@.str.2 = [19 x i8] c"Invalid user '%s'\0A\00"
@.str.3 = [20 x i8] c"Invalid group '%s'\0A\00"
@.str.4 = [42 x i8] c"Can't set group id %ld for group '%s': %s\00"
@errno = global i32 0
@.str.5 = [43 x i8] c"Can't set group id %ld for group '%s': %s\0A\00"
@.str.6 = [40 x i8] c"Can't set user id %ld for user '%s': %s\00"
@.str.7 = [41 x i8] c"Can't set user id %ld for user '%s': %s\0A\00"
define void @SetPriv(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %73, label %6
6: ; preds = %2
%7 = tail call i64 (...) @getuid()
%8 = icmp eq i64 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %6
%10 = tail call i32 (i8*, ...) @LogError(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @stderr
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%13 = tail call i32 @exit(i32 255)
unreachable
14: ; preds = %6
br i1 %3, label %30, label %15
15: ; preds = %14
%16 = tail call %struct.passwd* @getpwnam(i8* %0)
%17 = icmp eq %struct.passwd* %16, null
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = getelementptr inbounds %struct.passwd, %struct.passwd* %16, i64 0, i32 0
%20 = load i64, i64* %19
br label %23
21: ; preds = %15
%22 = tail call i64 @atol(i8* %0)
br label %23
23: ; preds = %21, %18
%24 = phi i64 [ %20, %18 ], [ %22, %21 ]
%25 = icmp eq i64 %24, 0
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load i32, i32* @stderr
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%29 = tail call i32 @exit(i32 255)
unreachable
30: ; preds = %23, %14
%31 = phi i64 [ %24, %23 ], [ 0, %14 ]
br i1 %4, label %59, label %32
32: ; preds = %30
%33 = tail call %struct.group* @getgrnam(i8* %1)
%34 = icmp eq %struct.group* %33, null
br i1 %34, label %38, label %35
35: ; preds = %32
%36 = getelementptr inbounds %struct.group, %struct.group* %33, i64 0, i32 0
%37 = load i64, i64* %36
br label %40
38: ; preds = %32
%39 = tail call i64 @atol(i8* %1)
br label %40
40: ; preds = %38, %35
%41 = phi i64 [ %37, %35 ], [ %39, %38 ]
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %40
%44 = load i32, i32* @stderr
%45 = tail call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%46 = tail call i32 @exit(i32 255)
unreachable
47: ; preds = %40
%48 = tail call i32 @setgid(i64 %41)
%49 = icmp eq i32 %48, 0
br i1 %49, label %59, label %50
50: ; preds = %47
%51 = load i32, i32* @errno
%52 = tail call i32 @strerror(i32 %51)
%53 = tail call i32 (i8*, ...) @LogError(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i64 %41, i8* %1, i32 %52)
%54 = load i32, i32* @stderr
%55 = load i32, i32* @errno
%56 = tail call i32 @strerror(i32 %55)
%57 = tail call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.5, i64 0, i64 0), i64 %41, i8* %1, i32 %56)
%58 = tail call i32 @exit(i32 255)
unreachable
59: ; preds = %47, %30
%60 = icmp eq i64 %31, 0
br i1 %60, label %73, label %61
61: ; preds = %59
%62 = tail call i32 @setuid(i64 %31)
%63 = icmp eq i32 %62, 0
br i1 %63, label %73, label %64
64: ; preds = %61
%65 = load i32, i32* @errno
%66 = tail call i32 @strerror(i32 %65)
%67 = tail call i32 (i8*, ...) @LogError(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i64 %31, i8* %0, i32 %66)
%68 = load i32, i32* @stderr
%69 = load i32, i32* @errno
%70 = tail call i32 @strerror(i32 %69)
%71 = tail call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0), i64 %31, i8* %0, i32 %70)
%72 = tail call i32 @exit(i32 255)
unreachable
73: ; preds = %59, %61, %2
ret void
}