#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;
typedef int /*<<< orphan*/ u;
typedef scalar_t__ time_t;
struct utmp {
  scalar_t__ ut_type;
  int /*<<< orphan*/ ut_line;
  int /*<<< orphan*/ ut_name;
};

/* Variables and functions */
scalar_t__ USER_PROCESS;
int /*<<< orphan*/ endutent();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
char *gettext(char *);
struct utmp *getutent();
int /*<<< orphan*/ memcpy(struct utmp *, struct utmp *, int);
int /*<<< orphan*/ setutent();
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strncmp(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strncpy(char *, int /*<<< orphan*/, int);
scalar_t__ term_chk(char *, int *, scalar_t__ *, int /*<<< orphan*/);
int /*<<< orphan*/ utmpname(char *);
void search_utmp(char *user, char *tty, char *mytty, uid_t myuid) {
  struct utmp u;
  struct utmp *uptr;
  time_t bestatime, atime;
  int nloggedttys, nttys, msgsok, user_is_me;
  char atty[sizeof(u.ut_line) + 1];
  utmpname("/var/run/utmp");
  setutent();
  nloggedttys = nttys = 0;
  bestatime = 0;
  user_is_me = 0;
  while ((uptr = getutent())) {
    memcpy(&u, uptr, sizeof(u));
    if (strncmp(user, u.ut_name, sizeof(u.ut_name)) == 0) {
      ++nloggedttys;
      (void)strncpy(atty, u.ut_line, sizeof(u.ut_line));
      atty[sizeof(u.ut_line)] = '\0';
      if (term_chk(atty, &msgsok, &atime, 0))
        continue;
      if (myuid && !msgsok)
        continue;
      if (strcmp(atty, mytty) == 0) {
        user_is_me = 1;
        continue;
      }
      if (u.ut_type != USER_PROCESS)
        continue;
      ++nttys;
      if (atime > bestatime) {
        bestatime = atime;
        (void)strcpy(tty, atty);
      }
    }
  }
  endutent();
  if (nloggedttys == 0) {
    (void)fprintf(stderr, gettext("write: %s is not logged in\n"), user);
    exit(1);
  }
  if (nttys == 0) {
    if (user_is_me) {
      (void)strcpy(tty, mytty);
      return;
    }
    (void)fprintf(stderr, gettext("write: %s has messages disabled\n"), user);
    exit(1);
  } else if (nttys > 1) {
    (void)fprintf(
        stderr,
        gettext("write: %s is logged in more than once; writing to %s\n"), user,
        tty);
  }
}


x86 assembly (clang, -O0):
<search_utmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xe11(%rip),%rdi
call   1080 <utmpname@plt>
mov    $0x0,%al
call   10e0 <setutent@plt>
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x4c(%rbp)
movq   $0x0,-0x40(%rbp)
movl   $0x0,-0x58(%rbp)
mov    $0x0,%al
call   10d0 <getutent@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
je     1326 <search_utmp+0x156>
mov    -0x38(%rbp),%rsi
lea    -0x30(%rbp),%rdi
mov    $0x10,%edx
call   10c0 <memcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    $0x4,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1321 <search_utmp+0x151>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
lea    -0x5d(%rbp),%rdi
mov    -0x28(%rbp),%esi
mov    $0x4,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x59(%rbp)
lea    -0x5d(%rbp),%rdi
lea    -0x54(%rbp),%rsi
lea    -0x48(%rbp),%rdx
xor    %ecx,%ecx
call   1060 <term_chk@plt>
cmp    $0x0,%rax
je     129a <search_utmp+0xca>
jmp    1218 <search_utmp+0x48>
cmpq   $0x0,-0x20(%rbp)
je     12b4 <search_utmp+0xe4>
cmpl   $0x0,-0x54(%rbp)
jne    12b4 <search_utmp+0xe4>
jmp    1218 <search_utmp+0x48>
lea    -0x5d(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    12d7 <search_utmp+0x107>
movl   $0x1,-0x58(%rbp)
jmp    1218 <search_utmp+0x48>
mov    -0x30(%rbp),%rax
mov    0x2d06(%rip),%rcx
cmp    (%rcx),%rax
je     12f0 <search_utmp+0x120>
jmp    1218 <search_utmp+0x48>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x40(%rbp),%rax
jle    131c <search_utmp+0x14c>
mov    -0x48(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x5d(%rbp),%rsi
call   1050 <strcpy@plt>
jmp    1321 <search_utmp+0x151>
jmp    1218 <search_utmp+0x48>
mov    $0x0,%al
call   1090 <endutent@plt>
cmpl   $0x0,-0x4c(%rbp)
jne    136a <search_utmp+0x19a>
mov    0x2c9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
lea    0xcc4(%rip),%rdi
call   1070 <gettext@plt>
mov    -0x64(%rbp),%edi
mov    %rax,%rsi
mov    -0x8(%rbp),%rdx
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmpl   $0x0,-0x50(%rbp)
jne    13c3 <search_utmp+0x1f3>
cmpl   $0x0,-0x58(%rbp)
je     1390 <search_utmp+0x1c0>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <strcpy@plt>
jmp    13ff <search_utmp+0x22f>
mov    0x2c41(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x68(%rbp)
lea    0xc87(%rip),%rdi
call   1070 <gettext@plt>
mov    -0x68(%rbp),%edi
mov    %rax,%rsi
mov    -0x8(%rbp),%rdx
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
cmpl   $0x1,-0x50(%rbp)
jle    13fa <search_utmp+0x22a>
mov    0x2c04(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
lea    0xc6b(%rip),%rdi
call   1070 <gettext@plt>
mov    -0x6c(%rbp),%edi
mov    %rax,%rsi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    13ff <search_utmp+0x22f>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<search_utmp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rcx,0x38(%rsp)
mov    %rdx,0x30(%rsp)
mov    %rsi,0x18(%rsp)
mov    %rdi,%rbx
lea    0xe09(%rip),%rdi
call   1080 <utmpname@plt>
xor    %eax,%eax
call   10e0 <setutent@plt>
xor    %eax,%eax
call   10d0 <getutent@plt>
test   %rax,%rax
je     13da <search_utmp+0x20a>
lea    0x48(%rsp),%r13
lea    0x2b(%rsp),%rbp
lea    0x24(%rsp),%r14
lea    0x40(%rsp),%r15
movl   $0x0,0x8(%rsp)
movl   $0x0,0xc(%rsp)
xor    %r12d,%r12d
xor    %ecx,%ecx
jmp    1265 <search_utmp+0x95>
mov    0x18(%rsp),%rdi
mov    %rbp,%rsi
mov    %rdx,0x10(%rsp)
call   1050 <strcpy@plt>
xor    %eax,%eax
call   10d0 <getutent@plt>
mov    0x10(%rsp),%rcx
test   %rax,%rax
je     1363 <search_utmp+0x193>
mov    %rcx,0x10(%rsp)
mov    %r12d,%ecx
jmp    1285 <search_utmp+0xb5>
nop
xor    %eax,%eax
call   10d0 <getutent@plt>
lea    0x1(%r12),%ecx
test   %rax,%rax
je     135f <search_utmp+0x18f>
mov    %ecx,%r12d
mov    %r13,%rdi
mov    %rax,%rsi
mov    $0x10,%edx
call   10c0 <memcpy@plt>
mov    0x54(%rsp),%esi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
jne    1250 <search_utmp+0x80>
mov    0x50(%rsp),%esi
mov    %rbp,%rdi
mov    $0x4,%edx
call   1030 <strncpy@plt>
movb   $0x0,0x2f(%rsp)
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %ecx,%ecx
call   1060 <term_chk@plt>
test   %rax,%rax
jne    1270 <search_utmp+0xa0>
cmpq   $0x0,0x38(%rsp)
je     12e8 <search_utmp+0x118>
cmpl   $0x0,0x24(%rsp)
je     1270 <search_utmp+0xa0>
mov    %rbp,%rdi
mov    0x30(%rsp),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1311 <search_utmp+0x141>
mov    0x48(%rsp),%rax
mov    0x2ce2(%rip),%rcx
cmp    (%rcx),%rax
jne    1270 <search_utmp+0xa0>
jmp    1333 <search_utmp+0x163>
xor    %eax,%eax
call   10d0 <getutent@plt>
lea    0x1(%r12),%ecx
movl   $0x1,0x8(%rsp)
test   %rax,%rax
jne    1285 <search_utmp+0xb5>
jmp    13cc <search_utmp+0x1fc>
mov    0xc(%rsp),%eax
add    $0x1,%eax
mov    0x40(%rsp),%rdx
add    $0x1,%r12d
mov    0x10(%rsp),%rcx
cmp    %rcx,%rdx
mov    %eax,0xc(%rsp)
jg     123e <search_utmp+0x6e>
mov    %rcx,0x10(%rsp)
jmp    1250 <search_utmp+0x80>
add    $0x1,%r12d
xor    %eax,%eax
call   1090 <endutent@plt>
test   %r12d,%r12d
je     13e1 <search_utmp+0x211>
mov    0xc(%rsp),%eax
test   %eax,%eax
je     13a7 <search_utmp+0x1d7>
cmp    $0x2,%eax
jl     13bd <search_utmp+0x1ed>
mov    0x2c55(%rip),%rax
mov    (%rax),%ebp
lea    0xcbf(%rip),%rdi
call   1070 <gettext@plt>
mov    %ebp,%edi
mov    %rax,%rsi
mov    %rbx,%rdx
mov    0x18(%rsp),%rcx
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    13bd <search_utmp+0x1ed>
cmpl   $0x0,0x8(%rsp)
je     140f <search_utmp+0x23f>
mov    0x18(%rsp),%rdi
mov    0x30(%rsp),%rsi
call   1050 <strcpy@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0x1,%r12d
movl   $0x1,0x8(%rsp)
jmp    1363 <search_utmp+0x193>
xor    %eax,%eax
call   1090 <endutent@plt>
mov    0x2bf0(%rip),%rax
mov    (%rax),%ebp
lea    0xc1d(%rip),%rdi
call   1070 <gettext@plt>
mov    %ebp,%edi
mov    %rax,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   10f0 <exit@plt>
mov    0x2bc2(%rip),%rax
mov    (%rax),%ebp
lea    0xc0b(%rip),%rdi
jmp    13f1 <search_utmp+0x221>

LLVM IR (-O0):
%struct.utmp = type { i64, i32, i32 }
@.str = [14 x i8] c"/var/run/utmp\00"
@USER_PROCESS = global i64 0
@stderr = global i32 0
@.str.1 = [28 x i8] c"write: %s is not logged in\0A\00"
@.str.2 = [33 x i8] c"write: %s has messages disabled\0A\00"
@.str.3 = [54 x i8] c"write: %s is logged in more than once; writing to %s\0A\00"
define void @search_utmp(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca %struct.utmp
%10 = alloca %struct.utmp*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [5 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%18 = call i32 @utmpname(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%19 = call i32 (...) @setutent()
store i32 0, i32* %14
store i32 0, i32* %13
store i64 0, i64* %11
store i32 0, i32* %16
br label %20
20: ; preds = %74, %61, %55, %49, %42, %4
%21 = call %struct.utmp* (...) @getutent()
store %struct.utmp* %21, %struct.utmp** %10
%22 = icmp ne %struct.utmp* %21, null
br i1 %22, label %23, label %75
23: ; preds = %20
%24 = load %struct.utmp*, %struct.utmp** %10
%25 = call i32 @memcpy(%struct.utmp* %9, %struct.utmp* %24, i32 16)
%26 = load i8*, i8** %5
%27 = getelementptr inbounds %struct.utmp, %struct.utmp* %9, i32 0, i32 2
%28 = load i32, i32* %27
%29 = call i64 @strncmp(i8* %26, i32 %28, i32 4)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %74
31: ; preds = %23
%32 = load i32, i32* %13
%33 = add nsw i32 %32, 1
store i32 %33, i32* %13
%34 = getelementptr inbounds [5 x i8], [5 x i8]* %17, i64 0, i64 0
%35 = getelementptr inbounds %struct.utmp, %struct.utmp* %9, i32 0, i32 1
%36 = load i32, i32* %35
%37 = call i32 @strncpy(i8* %34, i32 %36, i32 4)
%38 = getelementptr inbounds [5 x i8], [5 x i8]* %17, i64 0, i64 4
store i8 0, i8* %38
%39 = getelementptr inbounds [5 x i8], [5 x i8]* %17, i64 0, i64 0
%40 = call i64 @term_chk(i8* %39, i32* %15, i64* %12, i32 0)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %31
br label %20
43: ; preds = %31
%44 = load i64, i64* %8
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %43
%47 = load i32, i32* %15
%48 = icmp ne i32 %47, 0
br i1 %48, label %50, label %49
49: ; preds = %46
br label %20
50: ; preds = %46, %43
%51 = getelementptr inbounds [5 x i8], [5 x i8]* %17, i64 0, i64 0
%52 = load i8*, i8** %7
%53 = call i64 @strcmp(i8* %51, i8* %52)
%54 = icmp eq i64 %53, 0
br i1 %54, label %55, label %56
55: ; preds = %50
store i32 1, i32* %16
br label %20
56: ; preds = %50
%57 = getelementptr inbounds %struct.utmp, %struct.utmp* %9, i32 0, i32 0
%58 = load i64, i64* %57
%59 = load i64, i64* @USER_PROCESS
%60 = icmp ne i64 %58, %59
br i1 %60, label %61, label %62
61: ; preds = %56
br label %20
62: ; preds = %56
%63 = load i32, i32* %14
%64 = add nsw i32 %63, 1
store i32 %64, i32* %14
%65 = load i64, i64* %12
%66 = load i64, i64* %11
%67 = icmp sgt i64 %65, %66
br i1 %67, label %68, label %73
68: ; preds = %62
%69 = load i64, i64* %12
store i64 %69, i64* %11
%70 = load i8*, i8** %6
%71 = getelementptr inbounds [5 x i8], [5 x i8]* %17, i64 0, i64 0
%72 = call i32 @strcpy(i8* %70, i8* %71)
br label %73
73: ; preds = %68, %62
br label %74
74: ; preds = %73, %23
br label %20
75: ; preds = %20
%76 = call i32 (...) @endutent()
%77 = load i32, i32* %13
%78 = icmp eq i32 %77, 0
br i1 %78, label %79, label %85
79: ; preds = %75
%80 = load i32, i32* @stderr
%81 = call i8* @gettext(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%82 = load i8*, i8** %5
%83 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %80, i8* %81, i8* %82)
%84 = call i32 @exit(i32 1)
unreachable
85: ; preds = %75
%86 = load i32, i32* %14
%87 = icmp eq i32 %86, 0
br i1 %87, label %88, label %101
88: ; preds = %85
%89 = load i32, i32* %16
%90 = icmp ne i32 %89, 0
br i1 %90, label %91, label %95
91: ; preds = %88
%92 = load i8*, i8** %6
%93 = load i8*, i8** %7
%94 = call i32 @strcpy(i8* %92, i8* %93)
br label %111
95: ; preds = %88
%96 = load i32, i32* @stderr
%97 = call i8* @gettext(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%98 = load i8*, i8** %5
%99 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %96, i8* %97, i8* %98)
%100 = call i32 @exit(i32 1)
unreachable
101: ; preds = %85
%102 = load i32, i32* %14
%103 = icmp sgt i32 %102, 1
br i1 %103, label %104, label %110
104: ; preds = %101
%105 = load i32, i32* @stderr
%106 = call i8* @gettext(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0))
%107 = load i8*, i8** %5
%108 = load i8*, i8** %6
%109 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %105, i8* %106, i8* %107, i8* %108)
br label %110
110: ; preds = %104, %101
br label %111
111: ; preds = %91, %110
ret void
}

LLVM IR (-O2):
%struct.utmp = type { i64, i32, i32 }
@.str = [14 x i8] c"/var/run/utmp\00"
@USER_PROCESS = global i64 0
@stderr = global i32 0
@.str.1 = [28 x i8] c"write: %s is not logged in\0A\00"
@.str.2 = [33 x i8] c"write: %s has messages disabled\0A\00"
@.str.3 = [54 x i8] c"write: %s is logged in more than once; writing to %s\0A\00"
define void @search_utmp(i8* %0, i8* %1, i8* %2, i64 %3) {
%5 = alloca %struct.utmp
%6 = alloca i64
%7 = alloca i32
%8 = alloca [5 x i8]
%9 = bitcast %struct.utmp* %5 to i8*
%10 = bitcast i64* %6 to i8*
%11 = bitcast i32* %7 to i8*
%12 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 0
%13 = tail call i32 @utmpname(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32 (...) @setutent()
%15 = call %struct.utmp* (...) @getutent()
%16 = icmp eq %struct.utmp* %15, null
br i1 %16, label %17, label %19
17: ; preds = %4
%18 = call i32 (...) @endutent()
br label %83
19: ; preds = %4
%20 = getelementptr inbounds %struct.utmp, %struct.utmp* %5, i64 0, i32 2
%21 = getelementptr inbounds %struct.utmp, %struct.utmp* %5, i64 0, i32 1
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %8, i64 0, i64 4
%23 = icmp eq i64 %3, 0
%24 = getelementptr inbounds %struct.utmp, %struct.utmp* %5, i64 0, i32 0
br label %25
25: ; preds = %19, %71
%26 = phi %struct.utmp* [ %15, %19 ], [ %75, %71 ]
%27 = phi i32 [ 0, %19 ], [ %36, %71 ]
%28 = phi i32 [ 0, %19 ], [ %74, %71 ]
%29 = phi i32 [ 0, %19 ], [ %73, %71 ]
%30 = phi i64 [ 0, %19 ], [ %72, %71 ]
br label %34
31: ; preds = %58
%32 = call %struct.utmp* (...) @getutent()
%33 = icmp eq %struct.utmp* %32, null
br i1 %33, label %77, label %34
34: ; preds = %25, %31
%35 = phi %struct.utmp* [ %26, %25 ], [ %32, %31 ]
%36 = phi i32 [ %27, %25 ], [ 1, %31 ]
%37 = phi i32 [ %29, %25 ], [ %46, %31 ]
br label %38
38: ; preds = %34, %51
%39 = phi %struct.utmp* [ %35, %34 ], [ %52, %51 ]
%40 = phi i32 [ %37, %34 ], [ %46, %51 ]
%41 = call i32 @memcpy(%struct.utmp* %5, %struct.utmp* %39, i32 16)
%42 = load i32, i32* %20
%43 = call i64 @strncmp(i8* %0, i32 %42, i32 4)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %71
45: ; preds = %38
%46 = add nsw i32 %40, 1
%47 = load i32, i32* %21
%48 = call i32 @strncpy(i8* %12, i32 %47, i32 4)
store i8 0, i8* %22
%49 = call i64 @term_chk(i8* %12, i32* %7, i64* %6, i32 0)
%50 = icmp eq i64 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %45, %54, %61
%52 = call %struct.utmp* (...) @getutent()
%53 = icmp eq %struct.utmp* %52, null
br i1 %53, label %77, label %38
54: ; preds = %45
%55 = load i32, i32* %7
%56 = icmp ne i32 %55, 0
%57 = select i1 %23, i1 true, i1 %56
br i1 %57, label %58, label %51
58: ; preds = %54
%59 = call i64 @strcmp(i8* %12, i8* %2)
%60 = icmp eq i64 %59, 0
br i1 %60, label %31, label %61
61: ; preds = %58
%62 = load i64, i64* %24
%63 = load i64, i64* @USER_PROCESS
%64 = icmp eq i64 %62, %63
br i1 %64, label %65, label %51
65: ; preds = %61
%66 = add nsw i32 %28, 1
%67 = load i64, i64* %6
%68 = icmp sgt i64 %67, %30
br i1 %68, label %69, label %71
69: ; preds = %65
%70 = call i32 @strcpy(i8* %1, i8* %12)
br label %71
71: ; preds = %38, %65, %69
%72 = phi i64 [ %67, %69 ], [ %30, %65 ], [ %30, %38 ]
%73 = phi i32 [ %46, %69 ], [ %46, %65 ], [ %40, %38 ]
%74 = phi i32 [ %66, %69 ], [ %66, %65 ], [ %28, %38 ]
%75 = call %struct.utmp* (...) @getutent()
%76 = icmp eq %struct.utmp* %75, null
br i1 %76, label %77, label %25
77: ; preds = %71, %31, %51
%78 = phi i32 [ %28, %51 ], [ %28, %31 ], [ %74, %71 ]
%79 = phi i32 [ %36, %51 ], [ 1, %31 ], [ %36, %71 ]
%80 = phi i32 [ %46, %51 ], [ %46, %31 ], [ %73, %71 ]
%81 = call i32 (...) @endutent()
%82 = icmp eq i32 %80, 0
br i1 %82, label %83, label %88
83: ; preds = %17, %77
%84 = load i32, i32* @stderr
%85 = call i8* @gettext(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%86 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %84, i8* %85, i8* %0)
%87 = call i32 @exit(i32 1)
unreachable
88: ; preds = %77
%89 = icmp eq i32 %78, 0
br i1 %89, label %90, label %99
90: ; preds = %88
%91 = icmp eq i32 %79, 0
br i1 %91, label %94, label %92
92: ; preds = %90
%93 = call i32 @strcpy(i8* %1, i8* %2)
br label %105
94: ; preds = %90
%95 = load i32, i32* @stderr
%96 = call i8* @gettext(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%97 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %95, i8* %96, i8* %0)
%98 = call i32 @exit(i32 1)
unreachable
99: ; preds = %88
%100 = icmp sgt i32 %78, 1
br i1 %100, label %101, label %105
101: ; preds = %99
%102 = load i32, i32* @stderr
%103 = call i8* @gettext(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0))
%104 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %102, i8* %103, i8* %0, i8* %1)
br label %105
105: ; preds = %101, %99, %92
ret void
}