#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 passwd {
  int pw_uid;
  int pw_gid;
};
struct group {
  int gr_gid;
};
typedef int /*<<< orphan*/ errbuff;

/* Variables and functions */
scalar_t__ errno;
int /*<<< orphan*/ free(char *);
struct group *getgrnam(char const *);
struct passwd *getpwnam(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *);
scalar_t__ strtoul(char const *, char **, int);
const char *owner_parse(const char *spec, int *uid, int *gid) {
  static char errbuff[128];
  const char *u, *ue, *g;
  *uid = -1;
  *gid = -1;
  if (spec[0] == '\0')
    return ("Invalid empty user/group spec");
  if (*spec == ':' || *spec == '.') {
    ue = u = NULL;
    g = spec + 1;
  } else {
    ue = u = spec;
    while (*ue != ':' && *ue != '.' && *ue != '\0')
      ++ue;
    g = ue;
    if (*g != '\0')
      ++g;
  }
  if (u != NULL) {
    char *user;
    struct passwd *pwent;
    user = (char *)malloc(ue - u + 1);
    if (user == NULL)
      return ("Couldn't allocate memory");
    memcpy(user, u, ue - u);
    user[ue - u] = '\0';
    if ((pwent = getpwnam(user)) != NULL) {
      *uid = pwent->pw_uid;
      if (*ue != '\0')
        *gid = pwent->pw_gid;
    } else {
      char *end;
      errno = 0;
      *uid = (int)strtoul(user, &end, 10);
      if (errno || *end != '\0') {
        snprintf(errbuff, sizeof(errbuff), "Couldn't lookup user ``%s''", user);
        errbuff[sizeof(errbuff) - 1] = '\0';
        free(user);
        return (errbuff);
      }
    }
    free(user);
  }
  if (*g != '\0') {
    struct group *grp;
    if ((grp = getgrnam(g)) != NULL) {
      *gid = grp->gr_gid;
    } else {
      char *end;
      errno = 0;
      *gid = (int)strtoul(g, &end, 10);
      if (errno || *end != '\0') {
        snprintf(errbuff, sizeof(errbuff), "Couldn't lookup group ``%s''", g);
        errbuff[sizeof(errbuff) - 1] = '\0';
        return (errbuff);
      }
    }
  }
  return (NULL);
}


x86 assembly (clang, -O0):
<owner_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x20(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11b8 <owner_parse+0x48>
lea    0xe51(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1494 <owner_parse+0x324>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
je     11d8 <owner_parse+0x68>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    11f9 <owner_parse+0x89>
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1289 <owner_parse+0x119>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x3a,%ecx
mov    %al,-0x61(%rbp)
je     123f <owner_parse+0xcf>
mov    -0x30(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x2e,%ecx
mov    %al,-0x61(%rbp)
je     123f <owner_parse+0xcf>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x61(%rbp)
mov    -0x61(%rbp),%al
test   $0x1,%al
jne    124f <owner_parse+0xdf>
jmp    1260 <owner_parse+0xf0>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1205 <owner_parse+0x95>
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1284 <owner_parse+0x114>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1289 <owner_parse+0x119>
cmpq   $0x0,-0x28(%rbp)
je     13ce <owner_parse+0x25e>
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    %rcx,%rax
add    $0x1,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    12c9 <owner_parse+0x159>
lea    0xd5e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1494 <owner_parse+0x324>
mov    -0x40(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rax
mov    -0x28(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1060 <memcpy@plt>
mov    -0x40(%rbp),%rax
mov    -0x30(%rbp),%rcx
mov    -0x28(%rbp),%rdx
sub    %rdx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x40(%rbp),%rdi
call   1050 <getpwnam@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
je     133b <owner_parse+0x1cb>
mov    -0x48(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1336 <owner_parse+0x1c6>
mov    -0x48(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    13c5 <owner_parse+0x255>
mov    0x2c9e(%rip),%rax
movq   $0x0,(%rax)
mov    -0x40(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    $0xa,%edx
call   1090 <strtoul@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2c76(%rip),%rax
cmpq   $0x0,(%rax)
jne    1384 <owner_parse+0x214>
mov    -0x50(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     13c0 <owner_parse+0x250>
mov    -0x40(%rbp),%rcx
lea    0x2ce1(%rip),%rdi
mov    $0x80,%esi
lea    0xc9c(%rip),%rdx
call   1040 <snprintf@plt>
movb   $0x0,0x2d48(%rip)
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
lea    0x2cb9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1494 <owner_parse+0x324>
jmp    13c5 <owner_parse+0x255>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     148c <owner_parse+0x31c>
mov    -0x38(%rbp),%rdi
call   1070 <getgrnam@plt>
mov    %rax,-0x58(%rbp)
cmp    $0x0,%rax
je     1406 <owner_parse+0x296>
mov    -0x58(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    1487 <owner_parse+0x317>
mov    0x2bd3(%rip),%rax
movq   $0x0,(%rax)
mov    -0x38(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0xa,%edx
call   1090 <strtoul@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2bab(%rip),%rax
cmpq   $0x0,(%rax)
jne    144f <owner_parse+0x2df>
mov    -0x60(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1482 <owner_parse+0x312>
mov    -0x38(%rbp),%rcx
lea    0x2c16(%rip),%rdi
mov    $0x80,%esi
lea    0xbed(%rip),%rdx
call   1040 <snprintf@plt>
movb   $0x0,0x2c7d(%rip)
lea    0x2bf7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1494 <owner_parse+0x324>
jmp    1487 <owner_parse+0x317>
jmp    148c <owner_parse+0x31c>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<owner_parse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0xffffffff,(%rsi)
movl   $0xffffffff,(%rdx)
mov    (%rdi),%al
test   %al,%al
je     11c5 <owner_parse+0x55>
mov    %rdx,%r14
mov    %rdi,%r13
cmp    $0x2e,%al
je     119b <owner_parse+0x2b>
cmp    $0x3a,%al
jne    11d1 <owner_parse+0x61>
add    $0x1,%r13
mov    %r13,%r15
cmpb   $0x0,(%r15)
je     11be <owner_parse+0x4e>
mov    %r15,%rdi
call   1070 <getgrnam@plt>
test   %rax,%rax
je     1275 <owner_parse+0x105>
mov    (%rax),%eax
mov    %eax,(%r14)
xor    %ebx,%ebx
jmp    133d <owner_parse+0x1cd>
lea    0xe34(%rip),%rbx
jmp    133d <owner_parse+0x1cd>
mov    %rsi,%r12
xor    %ebx,%ebx
movabs $0x400400000000001,%rcx
jmp    11fa <owner_parse+0x8a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0x1(%r13,%rbx,1),%eax
add    $0x1,%rbx
cmp    $0x3a,%al
ja     11f0 <owner_parse+0x80>
movzbl %al,%edx
bt     %rdx,%rcx
jae    11f0 <owner_parse+0x80>
cmp    $0x1,%al
mov    %r13,%r15
sbb    $0xffffffffffffffff,%r15
lea    0x1(%rbx),%edi
call   1080 <malloc@plt>
test   %rax,%rax
je     12d0 <owner_parse+0x160>
mov    %rax,%rbp
mov    %rax,%rdi
mov    %r13,%rsi
mov    %ebx,%edx
call   1060 <memcpy@plt>
movb   $0x0,0x0(%rbp,%rbx,1)
mov    %rbp,%rdi
call   1050 <getpwnam@plt>
test   %rax,%rax
je     12d9 <owner_parse+0x169>
mov    (%rax),%ecx
mov    %ecx,(%r12)
cmpb   $0x0,0x0(%r13,%rbx,1)
je     125b <owner_parse+0xeb>
mov    0x4(%rax),%eax
mov    %eax,(%r14)
add    %rbx,%r15
mov    %rbp,%rdi
call   1030 <free@plt>
cmpb   $0x0,(%r15)
jne    11a8 <owner_parse+0x38>
jmp    11be <owner_parse+0x4e>
mov    0x2d64(%rip),%rbx
movq   $0x0,(%rbx)
mov    %rsp,%rsi
mov    %r15,%rdi
mov    $0xa,%edx
call   1090 <strtoul@plt>
mov    %eax,(%r14)
cmpq   $0x0,(%rbx)
jne    12a9 <owner_parse+0x139>
mov    (%rsp),%rax
cmpb   $0x0,(%rax)
je     11be <owner_parse+0x4e>
lea    0x2dc0(%rip),%rbx
lea    0xd9c(%rip),%rdx
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %r15,%rcx
call   1040 <snprintf@plt>
movb   $0x0,0x2e21(%rip)
jmp    133d <owner_parse+0x1cd>
lea    0xd47(%rip),%rbx
jmp    133d <owner_parse+0x1cd>
mov    0x2d00(%rip),%r13
movq   $0x0,0x0(%r13)
mov    %rsp,%rsi
mov    %rbp,%rdi
mov    $0xa,%edx
call   1090 <strtoul@plt>
mov    %eax,(%r12)
cmpq   $0x0,0x0(%r13)
jne    1310 <owner_parse+0x1a0>
mov    (%rsp),%rax
cmpb   $0x0,(%rax)
je     125b <owner_parse+0xeb>
lea    0x2d59(%rip),%rbx
lea    0xd19(%rip),%rdx
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %rbp,%rcx
call   1040 <snprintf@plt>
movb   $0x0,0x2dba(%rip)
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.passwd = type { i32, i32 }
%struct.group = type { i32 }
@owner_parse.errbuff = internal global [128 x i8] zeroinitializer
@.str = [30 x i8] c"Invalid empty user/group spec\00"
@.str.1 = [25 x i8] c"Couldn't allocate memory\00"
@errno = global i64 0
@.str.2 = [28 x i8] c"Couldn't lookup user ``%s''\00"
@.str.3 = [29 x i8] c"Couldn't lookup group ``%s''\00"
define i8* @owner_parse(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca %struct.passwd*
%13 = alloca i8*
%14 = alloca %struct.group*
%15 = alloca i8*
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%16 = load i32*, i32** %6
store i32 -1, i32* %16
%17 = load i32*, i32** %7
store i32 -1, i32* %17
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %3
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8** %4
br label %173
24: ; preds = %3
%25 = load i8*, i8** %5
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 58
br i1 %28, label %34, label %29
29: ; preds = %24
%30 = load i8*, i8** %5
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 46
br i1 %33, label %34, label %37
34: ; preds = %29, %24
store i8* null, i8** %8
store i8* null, i8** %9
%35 = load i8*, i8** %5
%36 = getelementptr inbounds i8, i8* %35, i64 1
store i8* %36, i8** %10
br label %69
37: ; preds = %29
%38 = load i8*, i8** %5
store i8* %38, i8** %8
store i8* %38, i8** %9
br label %39
39: ; preds = %56, %37
%40 = load i8*, i8** %9
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp ne i32 %42, 58
br i1 %43, label %44, label %54
44: ; preds = %39
%45 = load i8*, i8** %9
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 46
br i1 %48, label %49, label %54
49: ; preds = %44
%50 = load i8*, i8** %9
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp ne i32 %52, 0
br label %54
54: ; preds = %49, %44, %39
%55 = phi i1 [ false, %44 ], [ false, %39 ], [ %53, %49 ]
br i1 %55, label %56, label %59
56: ; preds = %54
%57 = load i8*, i8** %9
%58 = getelementptr inbounds i8, i8* %57, i32 1
store i8* %58, i8** %9
br label %39
59: ; preds = %54
%60 = load i8*, i8** %9
store i8* %60, i8** %10
%61 = load i8*, i8** %10
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = icmp ne i32 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %59
%66 = load i8*, i8** %10
%67 = getelementptr inbounds i8, i8* %66, i32 1
store i8* %67, i8** %10
br label %68
68: ; preds = %65, %59
br label %69
69: ; preds = %68, %34
%70 = load i8*, i8** %8
%71 = icmp ne i8* %70, null
br i1 %71, label %72, label %141
72: ; preds = %69
%73 = load i8*, i8** %9
%74 = load i8*, i8** %8
%75 = ptrtoint i8* %73 to i64
%76 = ptrtoint i8* %74 to i64
%77 = sub i64 %75, %76
%78 = add nsw i64 %77, 1
%79 = trunc i64 %78 to i32
%80 = call i64 @malloc(i32 %79)
%81 = inttoptr i64 %80 to i8*
store i8* %81, i8** %11
%82 = load i8*, i8** %11
%83 = icmp eq i8* %82, null
br i1 %83, label %84, label %85
84: ; preds = %72
store i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8** %4
br label %173
85: ; preds = %72
%86 = load i8*, i8** %11
%87 = load i8*, i8** %8
%88 = load i8*, i8** %9
%89 = load i8*, i8** %8
%90 = ptrtoint i8* %88 to i64
%91 = ptrtoint i8* %89 to i64
%92 = sub i64 %90, %91
%93 = trunc i64 %92 to i32
%94 = call i32 @memcpy(i8* %86, i8* %87, i32 %93)
%95 = load i8*, i8** %11
%96 = load i8*, i8** %9
%97 = load i8*, i8** %8
%98 = ptrtoint i8* %96 to i64
%99 = ptrtoint i8* %97 to i64
%100 = sub i64 %98, %99
%101 = getelementptr inbounds i8, i8* %95, i64 %100
store i8 0, i8* %101
%102 = load i8*, i8** %11
%103 = call %struct.passwd* @getpwnam(i8* %102)
store %struct.passwd* %103, %struct.passwd** %12
%104 = icmp ne %struct.passwd* %103, null
br i1 %104, label %105, label %120
105: ; preds = %85
%106 = load %struct.passwd*, %struct.passwd** %12
%107 = getelementptr inbounds %struct.passwd, %struct.passwd* %106, i32 0, i32 0
%108 = load i32, i32* %107
%109 = load i32*, i32** %6
store i32 %108, i32* %109
%110 = load i8*, i8** %9
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = icmp ne i32 %112, 0
br i1 %113, label %114, label %119
114: ; preds = %105
%115 = load %struct.passwd*, %struct.passwd** %12
%116 = getelementptr inbounds %struct.passwd, %struct.passwd* %115, i32 0, i32 1
%117 = load i32, i32* %116
%118 = load i32*, i32** %7
store i32 %117, i32* %118
br label %119
119: ; preds = %114, %105
br label %138
120: ; preds = %85
store i64 0, i64* @errno
%121 = load i8*, i8** %11
%122 = call i64 @strtoul(i8* %121, i8** %13, i32 10)
%123 = trunc i64 %122 to i32
%124 = load i32*, i32** %6
store i32 %123, i32* %124
%125 = load i64, i64* @errno
%126 = icmp ne i64 %125, 0
br i1 %126, label %132, label %127
127: ; preds = %120
%128 = load i8*, i8** %13
%129 = load i8, i8* %128
%130 = sext i8 %129 to i32
%131 = icmp ne i32 %130, 0
br i1 %131, label %132, label %137
132: ; preds = %127, %120
%133 = load i8*, i8** %11
%134 = call i32 @snprintf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @owner_parse.errbuff, i64 0, i64 0), i32 128, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %133)
store i8 0, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @owner_parse.errbuff, i64 0, i64 127)
%135 = load i8*, i8** %11
%136 = call i32 @free(i8* %135)
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @owner_parse.errbuff, i64 0, i64 0), i8** %4
br label %173
137: ; preds = %127
br label %138
138: ; preds = %137, %119
%139 = load i8*, i8** %11
%140 = call i32 @free(i8* %139)
br label %141
141: ; preds = %138, %69
%142 = load i8*, i8** %10
%143 = load i8, i8* %142
%144 = sext i8 %143 to i32
%145 = icmp ne i32 %144, 0
br i1 %145, label %146, label %172
146: ; preds = %141
%147 = load i8*, i8** %10
%148 = call %struct.group* @getgrnam(i8* %147)
store %struct.group* %148, %struct.group** %14
%149 = icmp ne %struct.group* %148, null
br i1 %149, label %150, label %155
150: ; preds = %146
%151 = load %struct.group*, %struct.group** %14
%152 = getelementptr inbounds %struct.group, %struct.group* %151, i32 0, i32 0
%153 = load i32, i32* %152
%154 = load i32*, i32** %7
store i32 %153, i32* %154
br label %171
155: ; preds = %146
store i64 0, i64* @errno
%156 = load i8*, i8** %10
%157 = call i64 @strtoul(i8* %156, i8** %15, i32 10)
%158 = trunc i64 %157 to i32
%159 = load i32*, i32** %7
store i32 %158, i32* %159
%160 = load i64, i64* @errno
%161 = icmp ne i64 %160, 0
br i1 %161, label %167, label %162
162: ; preds = %155
%163 = load i8*, i8** %15
%164 = load i8, i8* %163
%165 = sext i8 %164 to i32
%166 = icmp ne i32 %165, 0
br i1 %166, label %167, label %170
167: ; preds = %162, %155
%168 = load i8*, i8** %10
%169 = call i32 @snprintf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @owner_parse.errbuff, i64 0, i64 0), i32 128, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %168)
store i8 0, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @owner_parse.errbuff, i64 0, i64 127)
store i8* getelementptr inbounds ([128 x i8], [128 x i8]* @owner_parse.errbuff, i64 0, i64 0), i8** %4
br label %173
170: ; preds = %162
br label %171
171: ; preds = %170, %150
br label %172
172: ; preds = %171, %141
store i8* null, i8** %4
br label %173
173: ; preds = %172, %167, %132, %84, %23
%174 = load i8*, i8** %4
ret i8* %174
}

LLVM IR (-O2):
%struct.passwd = type { i32, i32 }
%struct.group = type { i32 }
@owner_parse.errbuff = internal global [128 x i8] zeroinitializer
@.str = [30 x i8] c"Invalid empty user/group spec\00"
@.str.1 = [25 x i8] c"Couldn't allocate memory\00"
@errno = global i64 0
@.str.2 = [28 x i8] c"Couldn't lookup user ``%s''\00"
@.str.3 = [29 x i8] c"Couldn't lookup group ``%s''\00"
define i8* @owner_parse(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca i8*
%5 = alloca i8*
store i32 -1, i32* %1
store i32 -1, i32* %2
%6 = load i8, i8* %0
switch i8 %6, label %9 [
i8 0, label %79
i8 58, label %7
i8 46, label %7
]
7: ; preds = %3, %3
%8 = getelementptr inbounds i8, i8* %0, i64 1
br label %56
9: ; preds = %3, %12
%10 = phi i8 [ %14, %12 ], [ %6, %3 ]
%11 = phi i8* [ %13, %12 ], [ %0, %3 ]
switch i8 %10, label %12 [
i8 58, label %15
i8 46, label %15
i8 0, label %15
]
12: ; preds = %9
%13 = getelementptr inbounds i8, i8* %11, i64 1
%14 = load i8, i8* %13
br label %9
15: ; preds = %9, %9, %9
%16 = icmp ne i8 %10, 0
%17 = zext i1 %16 to i64
%18 = getelementptr i8, i8* %11, i64 %17
%19 = ptrtoint i8* %11 to i64
%20 = ptrtoint i8* %0 to i64
%21 = sub i64 %19, %20
%22 = trunc i64 %21 to i32
%23 = add i32 %22, 1
%24 = tail call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to i8*
%26 = icmp eq i64 %24, 0
br i1 %26, label %79, label %27
27: ; preds = %15
%28 = tail call i32 @memcpy(i8* %25, i8* %0, i32 %22)
%29 = getelementptr inbounds i8, i8* %25, i64 %21
store i8 0, i8* %29
%30 = tail call %struct.passwd* @getpwnam(i8* %25)
%31 = icmp eq %struct.passwd* %30, null
br i1 %31, label %40, label %32
32: ; preds = %27
%33 = getelementptr inbounds %struct.passwd, %struct.passwd* %30, i64 0, i32 0
%34 = load i32, i32* %33
store i32 %34, i32* %1
%35 = load i8, i8* %11
%36 = icmp eq i8 %35, 0
br i1 %36, label %54, label %37
37: ; preds = %32
%38 = getelementptr inbounds %struct.passwd, %struct.passwd* %30, i64 0, i32 1
%39 = load i32, i32* %38
store i32 %39, i32* %2
br label %54
40: ; preds = %27
%41 = bitcast i8** %4 to i8*
store i64 0, i64* @errno
%42 = call i64 @strtoul(i8* %25, i8** %4, i32 10)
%43 = trunc i64 %42 to i32
store i32 %43, i32* %1
%44 = load i64, i64* @errno
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %40
%47 = load i8*, i8** %4
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 0
br i1 %49, label %53, label %50
50: ; preds = %46, %40
%51 = tail call i32 @snprintf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @owner_parse.errbuff, i64 0, i64 0), i32 128, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %25)
store i8 0, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @owner_parse.errbuff, i64 0, i64 127)
%52 = tail call i32 @free(i8* %25)
br label %79
53: ; preds = %46
br label %54
54: ; preds = %37, %32, %53
%55 = tail call i32 @free(i8* %25)
br label %56
56: ; preds = %54, %7
%57 = phi i8* [ %18, %54 ], [ %8, %7 ]
%58 = load i8, i8* %57
%59 = icmp eq i8 %58, 0
br i1 %59, label %79, label %60
60: ; preds = %56
%61 = tail call %struct.group* @getgrnam(i8* %57)
%62 = icmp eq %struct.group* %61, null
br i1 %62, label %66, label %63
63: ; preds = %60
%64 = getelementptr inbounds %struct.group, %struct.group* %61, i64 0, i32 0
%65 = load i32, i32* %64
store i32 %65, i32* %2
br label %79
66: ; preds = %60
%67 = bitcast i8** %5 to i8*
store i64 0, i64* @errno
%68 = call i64 @strtoul(i8* %57, i8** %5, i32 10)
%69 = trunc i64 %68 to i32
store i32 %69, i32* %2
%70 = load i64, i64* @errno
%71 = icmp eq i64 %70, 0
br i1 %71, label %72, label %77
72: ; preds = %66
%73 = load i8*, i8** %5
%74 = load i8, i8* %73
%75 = icmp eq i8 %74, 0
br i1 %75, label %76, label %77
76: ; preds = %72
br label %79
77: ; preds = %72, %66
%78 = tail call i32 @snprintf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @owner_parse.errbuff, i64 0, i64 0), i32 128, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %57)
store i8 0, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @owner_parse.errbuff, i64 0, i64 127)
br label %79
79: ; preds = %63, %76, %50, %15, %56, %77, %3
%80 = phi i8* [ getelementptr inbounds ([128 x i8], [128 x i8]* @owner_parse.errbuff, i64 0, i64 0), %77 ], [ getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), %3 ], [ null, %56 ], [ getelementptr inbounds ([128 x i8], [128 x i8]* @owner_parse.errbuff, i64 0, i64 0), %50 ], [ getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), %15 ], [ null, %76 ], [ null, %63 ]
ret i8* %80
}