#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 utmpx {
  scalar_t__ ut_type;
  int /*<<< orphan*/ ut_user;
};

/* Variables and functions */
scalar_t__ LOGIN_PROCESS;
scalar_t__ USER_PROCESS;
int /*<<< orphan*/ endutxent();
int /*<<< orphan*/ exit(int);
struct utmpx *getutxent();
char **malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ qsort(char **, int, int,
                         int (*)(void const *, void const *));
char **realloc(char **, int);
int /*<<< orphan*/ strcmp(char *, char *);
char *strdup(int /*<<< orphan*/);
int main() {
  int i;
  struct utmpx *ut;
  char **users = malloc(1024 * sizeof(*users));
  int n_users = 0, n_uniq = 0;
  int allocd_users = 1024;
  while ((ut = getutxent()) != NULL) {
    if (ut->ut_type == LOGIN_PROCESS || ut->ut_type == USER_PROCESS) {
      if (n_users == allocd_users) {
        allocd_users *= 2;
        users = realloc(users, (allocd_users * sizeof(*users)));
        if (!users)
          exit(-2);
      }
      users[n_users++] = strdup(ut->ut_user);
    }
  }
  qsort(users, n_users, sizeof(*users),
        (int (*)(const void *, const void *))strcmp);
  printf("logged_in_users\ts\t");
  for (i = 0; i < n_users; i++)
    printf("%s%s", i ? "," : "", users[i]);
  printf("\n");
  printf("logged_in_count\tL\t%d\n", n_users);
  char *last_user = "";
  for (i = 0; i < n_users; i++) {
    if (!strcmp(users[i], last_user))
      users[i] = "";
    else
      last_user = users[i];
  }
  qsort(users, n_users, sizeof(*users),
        (int (*)(const void *, const void *))strcmp);
  printf("uniq_logged_in_users\ts\t");
  for (i = 0; i < n_users; i++) {
    if (!strcmp(users[i], ""))
      continue;
    printf("%s%s", n_uniq ? "," : "", users[i]);
    n_uniq++;
  }
  printf("\n");
  printf("uniq_logged_in_count\tL\t%d\n", n_uniq);
  endutxent();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2000,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x400,-0x24(%rbp)
mov    $0x0,%al
call   1080 <getutxent@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1265 <main+0xe5>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x2df3(%rip),%rcx
cmp    (%rcx),%rax
je     11f5 <main+0x75>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    0x2dfc(%rip),%rcx
cmp    (%rcx),%rax
jne    1260 <main+0xe0>
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jne    123b <main+0xbb>
mov    -0x24(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%esi
call   1070 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1236 <main+0xb6>
mov    $0xfffffffe,%edi
call   1090 <exit@plt>
jmp    123b <main+0xbb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%edi
call   10a0 <strdup@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x1c(%rbp)
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    11b2 <main+0x32>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    $0x8,%edx
mov    0x2d60(%rip),%rcx
call   1030 <qsort@plt>
lea    0xd88(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    12de <main+0x15e>
mov    -0x8(%rbp),%ecx
lea    0xd76(%rip),%rsi
lea    0xd56(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xd37(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1292 <main+0x112>
lea    0xd53(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%esi
lea    0xd2e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xd1a(%rip),%rax
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1374 <main+0x1f4>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x30(%rbp),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%eax
jne    1351 <main+0x1d1>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
lea    0xcd6(%rip),%rdx
mov    %rdx,(%rax,%rcx,8)
jmp    1361 <main+0x1e1>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
jmp    1366 <main+0x1e6>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    130f <main+0x18f>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    $0x8,%edx
mov    0x2c51(%rip),%rcx
call   1030 <qsort@plt>
lea    0xc74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    141c <main+0x29c>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc5e(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%eax
jne    13d3 <main+0x253>
jmp    140e <main+0x28e>
mov    -0x20(%rbp),%ecx
lea    0xc41(%rip),%rsi
lea    0xc21(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rsi
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,8),%rdx
lea    0xc02(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    13a1 <main+0x221>
lea    0xc15(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xbeb(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1040 <endutxent@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x2000,%edi
call   1070 <malloc@plt>
mov    %rax,%r15
xor    %r14d,%r14d
xor    %eax,%eax
call   1090 <getutxent@plt>
test   %rax,%rax
je     1234 <main+0xa4>
mov    %rax,%rbp
mov    $0x400,%ebx
mov    0x2e02(%rip),%r12
mov    0x2e1b(%rip),%r13
xor    %r14d,%r14d
jmp    1202 <main+0x72>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x8(%rbp),%edi
call   10b0 <strdup@plt>
movslq %r14d,%rcx
add    $0x1,%r14d
mov    %rax,(%r15,%rcx,8)
xor    %eax,%eax
call   1090 <getutxent@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1234 <main+0xa4>
mov    0x0(%rbp),%rax
cmp    (%r12),%rax
je     1212 <main+0x82>
cmp    0x0(%r13),%rax
jne    11f3 <main+0x63>
cmp    %ebx,%r14d
jne    11e0 <main+0x50>
mov    %ebx,%esi
shl    $0x4,%esi
mov    %r15,%rdi
call   1080 <realloc@plt>
test   %rax,%rax
je     1408 <main+0x278>
mov    %rax,%r15
add    %ebx,%ebx
jmp    11e0 <main+0x50>
mov    0x2d9d(%rip),%rcx
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x8,%edx
call   1040 <qsort@plt>
lea    0xdba(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14d,%r12d
test   %r14d,%r14d
jle    131f <main+0x18f>
mov    %r14d,0x4(%rsp)
lea    0xdad(%rip),%r14
lea    0xd8d(%rip),%r13
lea    0xd81(%rip),%rbp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %rbx,%rbx
mov    %r13,%rsi
cmove  %r14,%rsi
mov    (%r15,%rbx,8),%rdx
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1290 <main+0x100>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd62(%rip),%rdi
xor    %ebp,%ebp
mov    0x4(%rsp),%r14d
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
test   %r14d,%r14d
jle    13b1 <main+0x221>
xor    %r13d,%r13d
lea    0xd38(%rip),%rbp
jmp    12fc <main+0x16c>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r13
mov    %rbx,%rbp
cmp    %r13,%r12
je     133a <main+0x1aa>
mov    (%r15,%r13,8),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10c0 <strcmp@plt>
test   %eax,%eax
lea    0xd0a(%rip),%rax
jne    12f0 <main+0x160>
mov    %rax,(%r15,%r13,8)
mov    %rbp,%rbx
jmp    12f0 <main+0x160>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xcf4(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2c97(%rip),%rcx
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x8,%edx
call   1040 <qsort@plt>
lea    0xcaf(%rip),%rdi
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <printf@plt>
test   %r14d,%r14d
jle    13d6 <main+0x246>
lea    0xc98(%rip),%rbx
lea    0xc8c(%rip),%r14
xor    %r13d,%r13d
xor    %ebp,%ebp
jmp    1389 <main+0x1f9>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r13
cmp    %r13,%r12
je     13d6 <main+0x246>
mov    (%r15,%r13,8),%rdx
cmpb   $0x0,(%rdx)
je     1380 <main+0x1f0>
test   %ebp,%ebp
mov    %rbx,%rsi
lea    0xc80(%rip),%rax
cmove  %rax,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%ebp
jmp    1380 <main+0x1f0>
mov    0x2c20(%rip),%rcx
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x8,%edx
call   1040 <qsort@plt>
lea    0xc38(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xc38(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1050 <endutxent@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xfffffffe,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
%struct.utmpx = type { i64, i32 }
@LOGIN_PROCESS = global i64 0
@USER_PROCESS = global i64 0
@.str = [19 x i8] c"logged_in_users\09s\09\00"
@.str.1 = [5 x i8] c"%s%s\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [22 x i8] c"logged_in_count\09L\09%d\0A\00"
@.str.6 = [24 x i8] c"uniq_logged_in_users\09s\09\00"
@.str.7 = [27 x i8] c"uniq_logged_in_count\09L\09%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.utmpx*
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i32 0, i32* %1
%9 = call i8** @malloc(i32 8192)
store i8** %9, i8*** %4
store i32 0, i32* %5
store i32 0, i32* %6
store i32 1024, i32* %7
br label %10
10: ; preds = %53, %0
%11 = call %struct.utmpx* (...) @getutxent()
store %struct.utmpx* %11, %struct.utmpx** %3
%12 = icmp ne %struct.utmpx* %11, null
br i1 %12, label %13, label %54
13: ; preds = %10
%14 = load %struct.utmpx*, %struct.utmpx** %3
%15 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %14, i32 0, i32 0
%16 = load i64, i64* %15
%17 = load i64, i64* @LOGIN_PROCESS
%18 = icmp eq i64 %16, %17
br i1 %18, label %25, label %19
19: ; preds = %13
%20 = load %struct.utmpx*, %struct.utmpx** %3
%21 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %20, i32 0, i32 0
%22 = load i64, i64* %21
%23 = load i64, i64* @USER_PROCESS
%24 = icmp eq i64 %22, %23
br i1 %24, label %25, label %53
25: ; preds = %19, %13
%26 = load i32, i32* %5
%27 = load i32, i32* %7
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %43
29: ; preds = %25
%30 = load i32, i32* %7
%31 = mul nsw i32 %30, 2
store i32 %31, i32* %7
%32 = load i8**, i8*** %4
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = mul i64 %34, 8
%36 = trunc i64 %35 to i32
%37 = call i8** @realloc(i8** %32, i32 %36)
store i8** %37, i8*** %4
%38 = load i8**, i8*** %4
%39 = icmp ne i8** %38, null
br i1 %39, label %42, label %40
40: ; preds = %29
%41 = call i32 @exit(i32 -2)
unreachable
42: ; preds = %29
br label %43
43: ; preds = %42, %25
%44 = load %struct.utmpx*, %struct.utmpx** %3
%45 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %44, i32 0, i32 1
%46 = load i32, i32* %45
%47 = call i8* @strdup(i32 %46)
%48 = load i8**, i8*** %4
%49 = load i32, i32* %5
%50 = add nsw i32 %49, 1
store i32 %50, i32* %5
%51 = sext i32 %49 to i64
%52 = getelementptr inbounds i8*, i8** %48, i64 %51
store i8* %47, i8** %52
br label %53
53: ; preds = %43, %19
br label %10
54: ; preds = %10
%55 = load i8**, i8*** %4
%56 = load i32, i32* %5
%57 = call i32 @qsort(i8** %55, i32 %56, i32 8, i32 (i8*, i8*)* @strcmp)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %59
59: ; preds = %74, %54
%60 = load i32, i32* %2
%61 = load i32, i32* %5
%62 = icmp slt i32 %60, %61
br i1 %62, label %63, label %77
63: ; preds = %59
%64 = load i32, i32* %2
%65 = icmp ne i32 %64, 0
%66 = zext i1 %65 to i64
%67 = select i1 %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%68 = load i8**, i8*** %4
%69 = load i32, i32* %2
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds i8*, i8** %68, i64 %70
%72 = load i8*, i8** %71
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %67, i8* %72)
br label %74
74: ; preds = %63
%75 = load i32, i32* %2
%76 = add nsw i32 %75, 1
store i32 %76, i32* %2
br label %59
77: ; preds = %59
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%79 = load i32, i32* %5
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %79)
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8** %8
store i32 0, i32* %2
br label %81
81: ; preds = %106, %77
%82 = load i32, i32* %2
%83 = load i32, i32* %5
%84 = icmp slt i32 %82, %83
br i1 %84, label %85, label %109
85: ; preds = %81
%86 = load i8**, i8*** %4
%87 = load i32, i32* %2
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds i8*, i8** %86, i64 %88
%90 = load i8*, i8** %89
%91 = load i8*, i8** %8
%92 = call i32 @strcmp(i8* %90, i8* %91)
%93 = icmp ne i32 %92, 0
br i1 %93, label %99, label %94
94: ; preds = %85
%95 = load i8**, i8*** %4
%96 = load i32, i32* %2
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds i8*, i8** %95, i64 %97
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8** %98
br label %105
99: ; preds = %85
%100 = load i8**, i8*** %4
%101 = load i32, i32* %2
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i8*, i8** %100, i64 %102
%104 = load i8*, i8** %103
store i8* %104, i8** %8
br label %105
105: ; preds = %99, %94
br label %106
106: ; preds = %105
%107 = load i32, i32* %2
%108 = add nsw i32 %107, 1
store i32 %108, i32* %2
br label %81
109: ; preds = %81
%110 = load i8**, i8*** %4
%111 = load i32, i32* %5
%112 = call i32 @qsort(i8** %110, i32 %111, i32 8, i32 (i8*, i8*)* @strcmp)
%113 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %2
br label %114
114: ; preds = %140, %109
%115 = load i32, i32* %2
%116 = load i32, i32* %5
%117 = icmp slt i32 %115, %116
br i1 %117, label %118, label %143
118: ; preds = %114
%119 = load i8**, i8*** %4
%120 = load i32, i32* %2
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds i8*, i8** %119, i64 %121
%123 = load i8*, i8** %122
%124 = call i32 @strcmp(i8* %123, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0))
%125 = icmp ne i32 %124, 0
br i1 %125, label %127, label %126
126: ; preds = %118
br label %140
127: ; preds = %118
%128 = load i32, i32* %6
%129 = icmp ne i32 %128, 0
%130 = zext i1 %129 to i64
%131 = select i1 %129, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%132 = load i8**, i8*** %4
%133 = load i32, i32* %2
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds i8*, i8** %132, i64 %134
%136 = load i8*, i8** %135
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %131, i8* %136)
%138 = load i32, i32* %6
%139 = add nsw i32 %138, 1
store i32 %139, i32* %6
br label %140
140: ; preds = %127, %126
%141 = load i32, i32* %2
%142 = add nsw i32 %141, 1
store i32 %142, i32* %2
br label %114
143: ; preds = %114
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%145 = load i32, i32* %6
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i32 %145)
%147 = call i32 (...) @endutxent()
ret i32 0
}

LLVM IR (-O2):
%struct.utmpx = type { i64, i32 }
@LOGIN_PROCESS = global i64 0
@USER_PROCESS = global i64 0
@.str = [19 x i8] c"logged_in_users\09s\09\00"
@.str.1 = [5 x i8] c"%s%s\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.5 = [22 x i8] c"logged_in_count\09L\09%d\0A\00"
@.str.6 = [24 x i8] c"uniq_logged_in_users\09s\09\00"
@.str.7 = [27 x i8] c"uniq_logged_in_count\09L\09%d\0A\00"
define i32 @main() {
%1 = tail call i8** @malloc(i32 8192)
%2 = tail call %struct.utmpx* (...) @getutxent()
%3 = icmp eq %struct.utmpx* %2, null
br i1 %3, label %40, label %4
4: ; preds = %0, %34
%5 = phi %struct.utmpx* [ %38, %34 ], [ %2, %0 ]
%6 = phi i32 [ %37, %34 ], [ 1024, %0 ]
%7 = phi i32 [ %36, %34 ], [ 0, %0 ]
%8 = phi i8** [ %35, %34 ], [ %1, %0 ]
%9 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %5, i64 0, i32 0
%10 = load i64, i64* %9
%11 = load i64, i64* @LOGIN_PROCESS
%12 = icmp eq i64 %10, %11
%13 = load i64, i64* @USER_PROCESS
%14 = icmp eq i64 %10, %13
%15 = select i1 %12, i1 true, i1 %14
br i1 %15, label %16, label %34
16: ; preds = %4
%17 = icmp eq i32 %7, %6
br i1 %17, label %18, label %25
18: ; preds = %16
%19 = shl nsw i32 %6, 1
%20 = shl i32 %6, 4
%21 = tail call i8** @realloc(i8** %8, i32 %20)
%22 = icmp eq i8** %21, null
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = tail call i32 @exit(i32 -2)
unreachable
25: ; preds = %18, %16
%26 = phi i8** [ %21, %18 ], [ %8, %16 ]
%27 = phi i32 [ %19, %18 ], [ %6, %16 ]
%28 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %5, i64 0, i32 1
%29 = load i32, i32* %28
%30 = tail call i8* @strdup(i32 %29)
%31 = add nsw i32 %7, 1
%32 = sext i32 %7 to i64
%33 = getelementptr inbounds i8*, i8** %26, i64 %32
store i8* %30, i8** %33
br label %34
34: ; preds = %4, %25
%35 = phi i8** [ %26, %25 ], [ %8, %4 ]
%36 = phi i32 [ %31, %25 ], [ %7, %4 ]
%37 = phi i32 [ %27, %25 ], [ %6, %4 ]
%38 = tail call %struct.utmpx* (...) @getutxent()
%39 = icmp eq %struct.utmpx* %38, null
br i1 %39, label %40, label %4
40: ; preds = %34, %0
%41 = phi i8** [ %1, %0 ], [ %35, %34 ]
%42 = phi i32 [ 0, %0 ], [ %36, %34 ]
%43 = tail call i32 @qsort(i8** %41, i32 %42, i32 8, i32 (i8*, i8*)* @strcmp)
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%45 = icmp sgt i32 %42, 0
br i1 %45, label %46, label %74
46: ; preds = %40
%47 = zext i32 %42 to i64
br label %48
48: ; preds = %46, %48
%49 = phi i64 [ 0, %46 ], [ %55, %48 ]
%50 = icmp eq i64 %49, 0
%51 = select i1 %50, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%52 = getelementptr inbounds i8*, i8** %41, i64 %49
%53 = load i8*, i8** %52
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %51, i8* %53)
%55 = add nuw nsw i64 %49, 1
%56 = icmp eq i64 %55, %47
br i1 %56, label %57, label %48
57: ; preds = %48
%58 = tail call i32 @putchar(i32 10)
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %42)
br i1 %45, label %60, label %98
60: ; preds = %57
%61 = zext i32 %42 to i64
br label %62
62: ; preds = %60, %70
%63 = phi i64 [ 0, %60 ], [ %72, %70 ]
%64 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), %60 ], [ %71, %70 ]
%65 = getelementptr inbounds i8*, i8** %41, i64 %63
%66 = load i8*, i8** %65
%67 = tail call i32 @strcmp(i8* dereferenceable(1) %66, i8* dereferenceable(1) %64)
%68 = icmp eq i32 %67, 0
br i1 %68, label %69, label %70
69: ; preds = %62
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8** %65
br label %70
70: ; preds = %62, %69
%71 = phi i8* [ %64, %69 ], [ %66, %62 ]
%72 = add nuw nsw i64 %63, 1
%73 = icmp eq i64 %72, %61
br i1 %73, label %77, label %62
74: ; preds = %40
%75 = tail call i32 @putchar(i32 10)
%76 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i32 %42)
br label %77
77: ; preds = %70, %74
%78 = tail call i32 @qsort(i8** %41, i32 %42, i32 8, i32 (i8*, i8*)* @strcmp)
%79 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
br i1 %45, label %80, label %101
80: ; preds = %77
%81 = zext i32 %42 to i64
br label %82
82: ; preds = %80, %94
%83 = phi i64 [ 0, %80 ], [ %96, %94 ]
%84 = phi i32 [ 0, %80 ], [ %95, %94 ]
%85 = getelementptr inbounds i8*, i8** %41, i64 %83
%86 = load i8*, i8** %85
%87 = load i8, i8* %86
%88 = icmp eq i8 %87, 0
br i1 %88, label %94, label %89
89: ; preds = %82
%90 = icmp eq i32 %84, 0
%91 = select i1 %90, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%92 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %91, i8* %86)
%93 = add nsw i32 %84, 1
br label %94
94: ; preds = %82, %89
%95 = phi i32 [ %93, %89 ], [ %84, %82 ]
%96 = add nuw nsw i64 %83, 1
%97 = icmp eq i64 %96, %81
br i1 %97, label %101, label %82
98: ; preds = %57
%99 = tail call i32 @qsort(i8** %41, i32 %42, i32 8, i32 (i8*, i8*)* @strcmp)
%100 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.6, i64 0, i64 0))
br label %101
101: ; preds = %94, %98, %77
%102 = phi i32 [ 0, %77 ], [ 0, %98 ], [ %95, %94 ]
%103 = tail call i32 @putchar(i32 10)
%104 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i32 %102)
%105 = tail call i32 (...) @endutxent()
ret i32 0
}