#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;
  char *pw_name;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ append(char **, char *, unsigned int, unsigned int);
int /*<<< orphan*/ die(int /*<<< orphan*/, char *);
int /*<<< orphan*/ endpwent();
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
char *getenv(char *);
scalar_t__ getgid();
scalar_t__ getline(char **, size_t *, int /*<<< orphan*/ *);
char *getlogin();
struct passwd *getpwnam(char *);
struct passwd *getpwuid(scalar_t__);
scalar_t__ getuid();
int sscanf(char *, char *, unsigned int *, unsigned int *, size_t *);
scalar_t__ strchr(char *, char);
char *string(char *, unsigned int);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
scalar_t__ strtol(char *, char **, int);
char *readranges(int type) {
  char *line = NULL, *entry, *range, *user;
  size_t end, size;
  struct passwd *passwd;
  uid_t uid;
  unsigned int length, start;
  FILE *file;
  range = string("%u:1", ((unsigned)((type) == 0 ? getgid() : getuid())));
  if (!(file = fopen(((type) == 0 ? "/etc/subgid" : "/etc/subuid"), "r")))
    return range;
  uid = getuid();
  user = getenv("USER");
  user = user ? user : getenv("LOGNAME");
  user = user ? user : getlogin();
  if (!user || !(passwd = getpwnam(user)) || passwd->pw_uid != uid) {
    if (!(passwd = getpwuid(uid)))
      die(0, "Failed to validate your username");
    user = passwd->pw_name;
  }
  endpwent();
  while (getline(&line, &size, file) >= 0) {
    if (strtol(line, &entry, 10) != uid || entry == line) {
      if (strncmp(line, user, strlen(user)))
        continue;
      entry = line + strlen(user);
    }
    if (sscanf(entry, ":%u:%u%zn", &start, &length, &end) < 2)
      continue;
    if (strchr(":\n", entry[end + 1]))
      append(&range, ",%u:%u", start, length);
  }
  free(line);
  fclose(file);
  return range;
}


x86 assembly (clang, -O0):
<readranges>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1260 <readranges+0x30>
mov    $0x0,%al
call   10f0 <getgid@plt>
mov    %rax,-0x68(%rbp)
jmp    126b <readranges+0x3b>
mov    $0x0,%al
call   10a0 <getuid@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    %eax,%esi
lea    0xd88(%rip),%rdi
call   10c0 <string@plt>
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%ecx
lea    0xd86(%rip),%rdi
lea    0xd73(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rdi
lea    0xd7d(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,-0x60(%rbp)
cmp    $0x0,%rax
jne    12c0 <readranges+0x90>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    14cc <readranges+0x29c>
mov    $0x0,%al
call   10a0 <getuid@plt>
mov    %rax,-0x50(%rbp)
lea    0xd4d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     12f3 <readranges+0xc3>
mov    -0x30(%rbp),%rax
mov    %rax,-0x70(%rbp)
jmp    1303 <readranges+0xd3>
lea    0xd2a(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x70(%rbp)
mov    -0x70(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1323 <readranges+0xf3>
mov    -0x30(%rbp),%rax
mov    %rax,-0x78(%rbp)
jmp    132e <readranges+0xfe>
mov    $0x0,%al
call   1120 <getlogin@plt>
mov    %rax,-0x78(%rbp)
mov    -0x78(%rbp),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1369 <readranges+0x139>
mov    -0x30(%rbp),%rdi
call   10d0 <getpwnam@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
je     1369 <readranges+0x139>
mov    -0x48(%rbp),%rax
mov    (%rax),%rax
cmp    -0x50(%rbp),%rax
je     139a <readranges+0x16a>
mov    -0x50(%rbp),%rdi
call   1080 <getpwuid@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    138e <readranges+0x15e>
xor    %edi,%edi
lea    0xca3(%rip),%rsi
call   1140 <die@plt>
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x30(%rbp)
mov    $0x0,%al
call   1100 <endpwent@plt>
mov    -0x60(%rbp),%rdx
lea    -0x18(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1150 <getline@plt>
cmp    $0x0,%rax
jl     14b2 <readranges+0x282>
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   10e0 <strtol@plt>
cmp    -0x50(%rbp),%rax
jne    13e6 <readranges+0x1b6>
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    144a <readranges+0x21a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x30(%rbp),%rdi
call   1090 <strlen@plt>
mov    -0x88(%rbp),%rdi
mov    -0x80(%rbp),%rsi
mov    %eax,%edx
call   1060 <strncmp@plt>
cmp    $0x0,%rax
je     1423 <readranges+0x1f3>
jmp    13a1 <readranges+0x171>
mov    -0x18(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x30(%rbp),%rdi
call   1090 <strlen@plt>
mov    %eax,%ecx
mov    -0x90(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xbf8(%rip),%rsi
lea    -0x58(%rbp),%rdx
lea    -0x54(%rbp),%rcx
lea    -0x38(%rbp),%r8
call   1110 <sscanf@plt>
cmp    $0x2,%eax
jge    1474 <readranges+0x244>
jmp    13a1 <readranges+0x171>
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%rcx
lea    0xbd4(%rip),%rdi
movsbl 0x1(%rax,%rcx,1),%esi
call   10b0 <strchr@plt>
cmp    $0x0,%rax
je     14ad <readranges+0x27d>
mov    -0x58(%rbp),%edx
mov    -0x54(%rbp),%ecx
lea    -0x28(%rbp),%rdi
lea    0xbb2(%rip),%rsi
call   1050 <append@plt>
jmp    13a1 <readranges+0x171>
mov    -0x18(%rbp),%rdi
call   1040 <free@plt>
mov    -0x60(%rbp),%rdi
call   1070 <fclose@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readranges>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movq   $0x0,(%rsp)
xor    %eax,%eax
test   %edi,%edi
je     125d <readranges+0x2d>
call   10a0 <getuid@plt>
mov    %rax,%rsi
lea    0xdb6(%rip),%rbx
jmp    126c <readranges+0x3c>
call   10f0 <getgid@plt>
mov    %rax,%rsi
lea    0xd99(%rip),%rbx
lea    0xd8d(%rip),%rdi
call   10c0 <string@plt>
mov    %rax,%rbp
mov    %rax,0x10(%rsp)
lea    0xd96(%rip),%rsi
mov    %rbx,%rdi
call   1130 <fopen@plt>
test   %rax,%rax
je     144d <readranges+0x21d>
mov    %rax,%r15
xor    %eax,%eax
call   10a0 <getuid@plt>
mov    %rax,%r14
lea    0xd73(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    12dc <readranges+0xac>
lea    0xd64(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    12dc <readranges+0xac>
xor    %eax,%eax
call   1120 <getlogin@plt>
mov    %rax,%rbx
test   %rax,%rax
je     12ee <readranges+0xbe>
mov    %rbx,%rdi
call   10d0 <getpwnam@plt>
test   %rax,%rax
je     12ee <readranges+0xbe>
cmp    %r14,(%rax)
je     1310 <readranges+0xe0>
mov    %r14,%rdi
call   1080 <getpwuid@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    130c <readranges+0xdc>
lea    0xd27(%rip),%rsi
xor    %edi,%edi
call   1140 <die@plt>
mov    0x8(%rbx),%rbx
xor    %eax,%eax
call   1100 <endpwent@plt>
mov    %rsp,%rdi
lea    0x28(%rsp),%rsi
mov    %r15,%rdx
call   1150 <getline@plt>
test   %rax,%rax
js     1437 <readranges+0x207>
lea    0x18(%rsp),%rbp
lea    0xd11(%rip),%r13
mov    %r15,0x20(%rsp)
jmp    1369 <readranges+0x139>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rsp,%rdi
lea    0x28(%rsp),%rsi
mov    %r15,%rdx
call   1150 <getline@plt>
test   %rax,%rax
js     1437 <readranges+0x207>
mov    (%rsp),%rdi
mov    %rbp,%rsi
mov    $0xa,%edx
call   10e0 <strtol@plt>
cmp    %r14,%rax
jne    1390 <readranges+0x160>
mov    0x18(%rsp),%r12
cmp    (%rsp),%r12
jne    13d6 <readranges+0x1a6>
jmp    1394 <readranges+0x164>
nopl   0x0(%rax)
mov    (%rsp),%r12
mov    %rbx,%rdi
call   1090 <strlen@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <strncmp@plt>
test   %rax,%rax
jne    1350 <readranges+0x120>
mov    %r14,%r15
mov    %r13,%r14
mov    (%rsp),%r13
mov    %rbx,%rdi
call   1090 <strlen@plt>
movslq %eax,%r12
add    %r13,%r12
mov    %r14,%r13
mov    %r15,%r14
mov    0x20(%rsp),%r15
mov    %r12,0x18(%rsp)
mov    %r12,%rdi
mov    %r13,%rsi
lea    0x8(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x30(%rsp),%r8
call   1110 <sscanf@plt>
cmp    $0x2,%eax
jl     1350 <readranges+0x120>
mov    0x30(%rsp),%rax
movsbl 0x1(%rax,%r12,1),%esi
lea    0xc4c(%rip),%rdi
call   10b0 <strchr@plt>
test   %rax,%rax
je     1350 <readranges+0x120>
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0x10(%rsp),%rdi
lea    0xc2d(%rip),%rsi
call   1050 <append@plt>
jmp    1350 <readranges+0x120>
mov    (%rsp),%rdi
call   1040 <free@plt>
mov    %r15,%rdi
call   1070 <fclose@plt>
mov    0x10(%rsp),%rbp
mov    %rbp,%rax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.passwd = type { i64, i8* }
@.str = [5 x i8] c"%u:1\00"
@.str.1 = [12 x i8] c"/etc/subgid\00"
@.str.2 = [12 x i8] c"/etc/subuid\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [5 x i8] c"USER\00"
@.str.5 = [8 x i8] c"LOGNAME\00"
@.str.6 = [33 x i8] c"Failed to validate your username\00"
@.str.7 = [10 x i8] c":%u:%u%zn\00"
@.str.8 = [3 x i8] c":\0A\00"
@.str.9 = [7 x i8] c",%u:%u\00"
define i8* @readranges(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca %struct.passwd*
%11 = alloca i64
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32*
store i32 %0, i32* %3
store i8* null, i8** %4
%15 = load i32, i32* %3
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %1
%18 = call i64 (...) @getgid()
br label %21
19: ; preds = %1
%20 = call i64 (...) @getuid()
br label %21
21: ; preds = %19, %17
%22 = phi i64 [ %18, %17 ], [ %20, %19 ]
%23 = trunc i64 %22 to i32
%24 = call i8* @string(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %23)
store i8* %24, i8** %6
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 0
%27 = zext i1 %26 to i64
%28 = select i1 %26, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0)
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %29, i32** %14
%30 = icmp ne i32* %29, null
br i1 %30, label %33, label %31
31: ; preds = %21
%32 = load i8*, i8** %6
store i8* %32, i8** %2
br label %127
33: ; preds = %21
%34 = call i64 (...) @getuid()
store i64 %34, i64* %11
%35 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
store i8* %35, i8** %7
%36 = load i8*, i8** %7
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %40
38: ; preds = %33
%39 = load i8*, i8** %7
br label %42
40: ; preds = %33
%41 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %42
42: ; preds = %40, %38
%43 = phi i8* [ %39, %38 ], [ %41, %40 ]
store i8* %43, i8** %7
%44 = load i8*, i8** %7
%45 = icmp ne i8* %44, null
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = load i8*, i8** %7
br label %50
48: ; preds = %42
%49 = call i8* (...) @getlogin()
br label %50
50: ; preds = %48, %46
%51 = phi i8* [ %47, %46 ], [ %49, %48 ]
store i8* %51, i8** %7
%52 = load i8*, i8** %7
%53 = icmp ne i8* %52, null
br i1 %53, label %54, label %64
54: ; preds = %50
%55 = load i8*, i8** %7
%56 = call %struct.passwd* @getpwnam(i8* %55)
store %struct.passwd* %56, %struct.passwd** %10
%57 = icmp ne %struct.passwd* %56, null
br i1 %57, label %58, label %64
58: ; preds = %54
%59 = load %struct.passwd*, %struct.passwd** %10
%60 = getelementptr inbounds %struct.passwd, %struct.passwd* %59, i32 0, i32 0
%61 = load i64, i64* %60
%62 = load i64, i64* %11
%63 = icmp ne i64 %61, %62
br i1 %63, label %64, label %74
64: ; preds = %58, %54, %50
%65 = load i64, i64* %11
%66 = call %struct.passwd* @getpwuid(i64 %65)
store %struct.passwd* %66, %struct.passwd** %10
%67 = icmp ne %struct.passwd* %66, null
br i1 %67, label %70, label %68
68: ; preds = %64
%69 = call i32 @die(i32 0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
br label %70
70: ; preds = %68, %64
%71 = load %struct.passwd*, %struct.passwd** %10
%72 = getelementptr inbounds %struct.passwd, %struct.passwd* %71, i32 0, i32 1
%73 = load i8*, i8** %72
store i8* %73, i8** %7
br label %74
74: ; preds = %70, %58
%75 = call i32 (...) @endpwent()
br label %76
76: ; preds = %120, %107, %96, %74
%77 = load i32*, i32** %14
%78 = call i64 @getline(i8** %4, i64* %9, i32* %77)
%79 = icmp sge i64 %78, 0
br i1 %79, label %80, label %121
80: ; preds = %76
%81 = load i8*, i8** %4
%82 = call i64 @strtol(i8* %81, i8** %5, i32 10)
%83 = load i64, i64* %11
%84 = icmp ne i64 %82, %83
br i1 %84, label %89, label %85
85: ; preds = %80
%86 = load i8*, i8** %5
%87 = load i8*, i8** %4
%88 = icmp eq i8* %86, %87
br i1 %88, label %89, label %103
89: ; preds = %85, %80
%90 = load i8*, i8** %4
%91 = load i8*, i8** %7
%92 = load i8*, i8** %7
%93 = call i32 @strlen(i8* %92)
%94 = call i64 @strncmp(i8* %90, i8* %91, i32 %93)
%95 = icmp ne i64 %94, 0
br i1 %95, label %96, label %97
96: ; preds = %89
br label %76
97: ; preds = %89
%98 = load i8*, i8** %4
%99 = load i8*, i8** %7
%100 = call i32 @strlen(i8* %99)
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds i8, i8* %98, i64 %101
store i8* %102, i8** %5
br label %103
103: ; preds = %97, %85
%104 = load i8*, i8** %5
%105 = call i32 @sscanf(i8* %104, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32* %13, i32* %12, i64* %8)
%106 = icmp slt i32 %105, 2
br i1 %106, label %107, label %108
107: ; preds = %103
br label %76
108: ; preds = %103
%109 = load i8*, i8** %5
%110 = load i64, i64* %8
%111 = add i64 %110, 1
%112 = getelementptr inbounds i8, i8* %109, i64 %111
%113 = load i8, i8* %112
%114 = call i64 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8 signext %113)
%115 = icmp ne i64 %114, 0
br i1 %115, label %116, label %120
116: ; preds = %108
%117 = load i32, i32* %13
%118 = load i32, i32* %12
%119 = call i32 @append(i8** %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 %117, i32 %118)
br label %120
120: ; preds = %116, %108
br label %76
121: ; preds = %76
%122 = load i8*, i8** %4
%123 = call i32 @free(i8* %122)
%124 = load i32*, i32** %14
%125 = call i32 @fclose(i32* %124)
%126 = load i8*, i8** %6
store i8* %126, i8** %2
br label %127
127: ; preds = %121, %31
%128 = load i8*, i8** %2
ret i8* %128
}

LLVM IR (-O2):
%struct.passwd = type { i64, i8* }
@.str = [5 x i8] c"%u:1\00"
@.str.1 = [12 x i8] c"/etc/subgid\00"
@.str.2 = [12 x i8] c"/etc/subuid\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [5 x i8] c"USER\00"
@.str.5 = [8 x i8] c"LOGNAME\00"
@.str.6 = [33 x i8] c"Failed to validate your username\00"
@.str.7 = [10 x i8] c":%u:%u%zn\00"
@.str.8 = [3 x i8] c":\0A\00"
@.str.9 = [7 x i8] c",%u:%u\00"
define i8* @readranges(i32 %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%10 = bitcast i8** %3 to i8*
%11 = bitcast i8** %4 to i8*
%12 = bitcast i64* %5 to i8*
%13 = bitcast i64* %6 to i8*
%14 = bitcast i32* %7 to i8*
%15 = bitcast i32* %8 to i8*
%16 = icmp eq i32 %0, 0
br i1 %16, label %17, label %19
17: ; preds = %1
%18 = tail call i64 (...) @getgid()
br label %21
19: ; preds = %1
%20 = tail call i64 (...) @getuid()
br label %21
21: ; preds = %19, %17
%22 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), %19 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %17 ]
%23 = phi i64 [ %20, %19 ], [ %18, %17 ]
%24 = trunc i64 %23 to i32
%25 = tail call i8* @string(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %24)
store i8* %25, i8** %4
%26 = tail call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%27 = icmp eq i32* %26, null
br i1 %27, label %102, label %28
28: ; preds = %21
%29 = tail call i64 (...) @getuid()
%30 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%31 = icmp eq i8* %30, null
br i1 %31, label %32, label %38
32: ; preds = %28
%33 = tail call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%34 = icmp eq i8* %33, null
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = tail call i8* (...) @getlogin()
%37 = icmp eq i8* %36, null
br i1 %37, label %46, label %38
38: ; preds = %28, %32, %35
%39 = phi i8* [ %36, %35 ], [ %33, %32 ], [ %30, %28 ]
%40 = tail call %struct.passwd* @getpwnam(i8* %39)
%41 = icmp eq %struct.passwd* %40, null
br i1 %41, label %46, label %42
42: ; preds = %38
%43 = getelementptr inbounds %struct.passwd, %struct.passwd* %40, i64 0, i32 0
%44 = load i64, i64* %43
%45 = icmp eq i64 %44, %29
br i1 %45, label %54, label %46
46: ; preds = %42, %38, %35
%47 = tail call %struct.passwd* @getpwuid(i64 %29)
%48 = icmp eq %struct.passwd* %47, null
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = tail call i32 @die(i32 0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
br label %51
51: ; preds = %49, %46
%52 = getelementptr inbounds %struct.passwd, %struct.passwd* %47, i64 0, i32 1
%53 = load i8*, i8** %52
br label %54
54: ; preds = %51, %42
%55 = phi i8* [ %53, %51 ], [ %39, %42 ]
%56 = tail call i32 (...) @endpwent()
%57 = call i64 @getline(i8** %2, i64* %6, i32* %26)
%58 = icmp sgt i64 %57, -1
br i1 %58, label %59, label %97
59: ; preds = %54, %94
%60 = load i8*, i8** %2
%61 = call i64 @strtol(i8* %60, i8** %3, i32 10)
%62 = icmp eq i64 %61, %29
br i1 %62, label %65, label %63
63: ; preds = %59
%64 = load i8*, i8** %2
br label %69
65: ; preds = %59
%66 = load i8*, i8** %3
%67 = load i8*, i8** %2
%68 = icmp eq i8* %66, %67
br i1 %68, label %69, label %79
69: ; preds = %63, %65
%70 = phi i8* [ %64, %63 ], [ %66, %65 ]
%71 = call i32 @strlen(i8* %55)
%72 = call i64 @strncmp(i8* %70, i8* %55, i32 %71)
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %94
74: ; preds = %69
%75 = load i8*, i8** %2
%76 = call i32 @strlen(i8* %55)
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %75, i64 %77
store i8* %78, i8** %3
br label %79
79: ; preds = %74, %65
%80 = phi i8* [ %78, %74 ], [ %66, %65 ]
%81 = call i32 @sscanf(i8* %80, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32* %8, i32* %7, i64* %5)
%82 = icmp slt i32 %81, 2
br i1 %82, label %94, label %83
83: ; preds = %79
%84 = load i64, i64* %5
%85 = add i64 %84, 1
%86 = getelementptr inbounds i8, i8* %80, i64 %85
%87 = load i8, i8* %86
%88 = call i64 @strchr(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8 signext %87)
%89 = icmp eq i64 %88, 0
br i1 %89, label %94, label %90
90: ; preds = %83
%91 = load i32, i32* %8
%92 = load i32, i32* %7
%93 = call i32 @append(i8** %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32 %91, i32 %92)
br label %94
94: ; preds = %83, %90, %69, %79
%95 = call i64 @getline(i8** %2, i64* %6, i32* %26)
%96 = icmp sgt i64 %95, -1
br i1 %96, label %59, label %97
97: ; preds = %94, %54
%98 = load i8*, i8** %2
%99 = call i32 @free(i8* %98)
%100 = call i32 @fclose(i32* %26)
%101 = load i8*, i8** %4
br label %102
102: ; preds = %21, %97
%103 = phi i8* [ %25, %21 ], [ %101, %97 ]
ret i8* %103
}