#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ tv_usec;
  int /*<<< orphan*/ tv_sec;
};
struct utmpx {
  scalar_t__ ut_type;
  char *ut_user;
  char *ut_line;
  char *ut_id;
  char *ut_host;
  unsigned long ut_pid;
  TYPE_1__ ut_tv;
};
struct utmp {
  char *ut_line;
  char *ut_name;
  char *ut_host;
  int /*<<< orphan*/ ut_time;
};

/* Variables and functions */
scalar_t__ ACCOUNTING;
scalar_t__ BOOT_TIME;
scalar_t__ DEAD_PROCESS;
scalar_t__ EMPTY;
scalar_t__ INIT_PROCESS;
scalar_t__ LOGIN_PROCESS;
scalar_t__ NEW_TIME;
scalar_t__ OLD_TIME;
scalar_t__ RUN_LVL;
scalar_t__ USER_PROCESS;
int UT_HOSTSIZE;
size_t UT_LINESIZE;
size_t UT_NAMESIZE;
int __strnlen(char const *, int);
int /*<<< orphan*/ memset(struct utmpx *, char, int);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char const *, size_t);
unsigned long strtoul(char *, char **, int);
int __utmp_to_utmpx(const struct utmp *u, struct utmpx *ux) {
  memset(ux, '\0', sizeof(struct utmpx));
  if (u->ut_line[0] == '\0' && u->ut_name[0] == '\0' && u->ut_host[0] == '\0') {
    ux->ut_type = EMPTY;
  } else {
    if (u->ut_line[0] == '~' && u->ut_line[1] == '\0') {
      if (strncmp(u->ut_name, "runlevel", UT_NAMESIZE) == 0)
        ux->ut_type = RUN_LVL;
      else if (strncmp(u->ut_name, "reboot", UT_NAMESIZE) == 0)
        ux->ut_type = BOOT_TIME;
      else if (strncmp(u->ut_name, "acct", UT_NAMESIZE) == 0)
        ux->ut_type = ACCOUNTING;
      else
        return -1;
    } else if (u->ut_line[0] == '{' && u->ut_line[1] == '\0') {
      if (strncmp(u->ut_name, "date", UT_NAMESIZE) == 0)
        ux->ut_type = NEW_TIME;
      else
        return -1;
    } else if (u->ut_line[0] == '|' && u->ut_line[1] == '\0') {
      if (strncmp(u->ut_name, "date", UT_NAMESIZE) == 0)
        ux->ut_type = OLD_TIME;
      else
        return -1;
    } else {
      if (strncmp(u->ut_name, "INIT", UT_NAMESIZE) == 0)
        ux->ut_type = INIT_PROCESS;
      else if (strncmp(u->ut_name, "LOGIN", UT_NAMESIZE) == 0)
        ux->ut_type = LOGIN_PROCESS;
      else if (strncmp(u->ut_name, "", UT_NAMESIZE) == 0)
        ux->ut_type = DEAD_PROCESS;
      else
        ux->ut_type = USER_PROCESS;
      if (ux->ut_type == LOGIN_PROCESS || ux->ut_type == USER_PROCESS)
        strncpy(ux->ut_user, u->ut_name, UT_NAMESIZE);
      if (strncmp(u->ut_line, "tty", 3) == 0) {
        strncpy(ux->ut_line, u->ut_line, UT_LINESIZE);
        strncpy(ux->ut_id, u->ut_line + 3, sizeof(ux->ut_id));
      } else {
        strncpy(ux->ut_id, u->ut_line, sizeof(ux->ut_id));
      }
    }
    strncpy(ux->ut_host, u->ut_host, UT_HOSTSIZE);
    if (__strnlen(u->ut_host, UT_HOSTSIZE) < UT_HOSTSIZE - 2) {
      const char *hidden = u->ut_host + strlen(u->ut_host) + 1;
      if (hidden[0] != '\0') {
        size_t n = UT_HOSTSIZE - strlen(u->ut_host) - 1;
        char buf[UT_HOSTSIZE];
        unsigned long pid;
        char *endp;
        strncpy(buf, hidden, n);
        buf[n] = '\0';
        pid = strtoul(buf, &endp, 10);
        if (endp != buf && *endp == '\0')
          ux->ut_pid = pid;
      }
    }
    ux->ut_tv.tv_sec = u->ut_time;
    ux->ut_tv.tv_usec = 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<__utmp_to_utmpx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1060 <memset@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11d1 <__utmp_to_utmpx+0x71>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11d1 <__utmp_to_utmpx+0x71>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11d1 <__utmp_to_utmpx+0x71>
mov    0x2e1e(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    16cf <__utmp_to_utmpx+0x56f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x7e,%eax
jne    12d3 <__utmp_to_utmpx+0x173>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    12d3 <__utmp_to_utmpx+0x173>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2df1(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
lea    0xded(%rip),%rsi
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1238 <__utmp_to_utmpx+0xd8>
mov    0x2d4f(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    12ce <__utmp_to_utmpx+0x16e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2db1(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
lea    0xdb6(%rip),%rsi
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1278 <__utmp_to_utmpx+0x118>
mov    0x2d37(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    12c9 <__utmp_to_utmpx+0x169>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2d71(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
lea    0xd7d(%rip),%rsi
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    12b8 <__utmp_to_utmpx+0x158>
mov    0x2d17(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    12c4 <__utmp_to_utmpx+0x164>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d6 <__utmp_to_utmpx+0x576>
jmp    12c9 <__utmp_to_utmpx+0x169>
jmp    12ce <__utmp_to_utmpx+0x16e>
jmp    1575 <__utmp_to_utmpx+0x415>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x7b,%eax
jne    134b <__utmp_to_utmpx+0x1eb>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    134b <__utmp_to_utmpx+0x1eb>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2cef(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
lea    0xd00(%rip),%rsi
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    133a <__utmp_to_utmpx+0x1da>
mov    0x2ca5(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    1346 <__utmp_to_utmpx+0x1e6>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d6 <__utmp_to_utmpx+0x576>
jmp    1570 <__utmp_to_utmpx+0x410>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x7c,%eax
jne    13c3 <__utmp_to_utmpx+0x263>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl 0x1(%rax),%eax
cmp    $0x0,%eax
jne    13c3 <__utmp_to_utmpx+0x263>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2c77(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
lea    0xc88(%rip),%rsi
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    13b2 <__utmp_to_utmpx+0x252>
mov    0x2c25(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    13be <__utmp_to_utmpx+0x25e>
movl   $0xffffffff,-0x4(%rbp)
jmp    16d6 <__utmp_to_utmpx+0x576>
jmp    156b <__utmp_to_utmpx+0x40b>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2c26(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
lea    0xc3c(%rip),%rsi
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1403 <__utmp_to_utmpx+0x2a3>
mov    0x2bb4(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    149e <__utmp_to_utmpx+0x33e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2be6(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
lea    0xc01(%rip),%rsi
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1443 <__utmp_to_utmpx+0x2e3>
mov    0x2b4c(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    1499 <__utmp_to_utmpx+0x339>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2ba6(%rip),%rax
mov    (%rax),%rax
mov    %eax,%edx
lea    0xbc6(%rip),%rsi
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1483 <__utmp_to_utmpx+0x323>
mov    0x2b1c(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    1494 <__utmp_to_utmpx+0x334>
mov    0x2b4e(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
jmp    1499 <__utmp_to_utmpx+0x339>
jmp    149e <__utmp_to_utmpx+0x33e>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    0x2ad4(%rip),%rcx
cmp    (%rcx),%rax
je     14cc <__utmp_to_utmpx+0x36c>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    0x2b15(%rip),%rcx
cmp    (%rcx),%rax
jne    14eb <__utmp_to_utmpx+0x38b>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    0x2b15(%rip),%rax
mov    (%rax),%rdx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xb2c(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    154d <__utmp_to_utmpx+0x3ed>
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    0x2a95(%rip),%rax
mov    (%rax),%rdx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
add    $0x3,%rsi
mov    $0x8,%edx
call   1030 <strncpy@plt>
jmp    1566 <__utmp_to_utmpx+0x406>
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    $0x8,%edx
call   1030 <strncpy@plt>
jmp    156b <__utmp_to_utmpx+0x40b>
jmp    1570 <__utmp_to_utmpx+0x410>
jmp    1575 <__utmp_to_utmpx+0x415>
mov    -0x18(%rbp),%rax
mov    0x20(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
mov    0x2a0c(%rip),%rax
movslq (%rax),%rdx
call   1030 <strncpy@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    0x29f5(%rip),%rax
mov    (%rax),%esi
call   1070 <__strnlen@plt>
mov    0x29e7(%rip),%rcx
mov    (%rcx),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jge    16b5 <__utmp_to_utmpx+0x555>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     16b0 <__utmp_to_utmpx+0x550>
mov    0x2996(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <strlen@plt>
mov    -0x64(%rbp),%edx
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
not    %ecx
add    %edx,%ecx
movslq %ecx,%rcx
mov    %rcx,-0x28(%rbp)
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x58(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x28(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x58(%rbp),%rdi
mov    -0x28(%rbp),%rax
movb   $0x0,(%rdi,%rax,1)
lea    -0x48(%rbp),%rsi
mov    $0xa,%edx
call   1080 <strtoul@plt>
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
mov    %rcx,-0x40(%rbp)
cmp    %rax,-0x48(%rbp)
je     16a9 <__utmp_to_utmpx+0x549>
mov    -0x48(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    16a9 <__utmp_to_utmpx+0x549>
mov    -0x40(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
jmp    16b5 <__utmp_to_utmpx+0x555>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x38(%rax)
mov    -0x18(%rbp),%rax
movq   $0x0,0x30(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__utmp_to_utmpx>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%r12
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1060 <memset@plt>
mov    (%r12),%rax
mov    (%rax),%cl
cmp    $0x7b,%cl
jg     11e3 <__utmp_to_utmpx+0x83>
test   %cl,%cl
je     126e <__utmp_to_utmpx+0x10e>
cmp    $0x7b,%cl
jne    129e <__utmp_to_utmpx+0x13e>
cmpb   $0x0,0x1(%rax)
jne    129e <__utmp_to_utmpx+0x13e>
mov    0x8(%r12),%rdi
mov    0x2e40(%rip),%rax
mov    (%rax),%edx
lea    0xe54(%rip),%rsi
call   1040 <strncmp@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    145e <__utmp_to_utmpx+0x2fe>
mov    0x2df2(%rip),%rax
jmp    14ad <__utmp_to_utmpx+0x34d>
cmp    $0x7c,%cl
je     1294 <__utmp_to_utmpx+0x134>
cmp    $0x7e,%cl
jne    129e <__utmp_to_utmpx+0x13e>
cmpb   $0x0,0x1(%rax)
jne    129e <__utmp_to_utmpx+0x13e>
mov    0x8(%r12),%rdi
mov    0x2ded(%rip),%rbx
mov    (%rbx),%edx
lea    0xdec(%rip),%rsi
call   1040 <strncmp@plt>
test   %rax,%rax
je     149d <__utmp_to_utmpx+0x33d>
mov    0x8(%r12),%rdi
mov    (%rbx),%edx
lea    0xdd9(%rip),%rsi
call   1040 <strncmp@plt>
test   %rax,%rax
je     14a6 <__utmp_to_utmpx+0x346>
mov    0x8(%r12),%rdi
mov    (%rbx),%edx
lea    0xdc4(%rip),%rsi
call   1040 <strncmp@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    145e <__utmp_to_utmpx+0x2fe>
mov    0x2d57(%rip),%rax
jmp    14ad <__utmp_to_utmpx+0x34d>
mov    0x8(%r12),%rax
cmpb   $0x0,(%rax)
jne    129e <__utmp_to_utmpx+0x13e>
mov    0x10(%r12),%rax
cmpb   $0x0,(%rax)
jne    129e <__utmp_to_utmpx+0x13e>
mov    0x2d57(%rip),%rax
mov    (%rax),%rax
mov    %rax,(%r14)
jmp    145c <__utmp_to_utmpx+0x2fc>
cmpb   $0x0,0x1(%rax)
je     146d <__utmp_to_utmpx+0x30d>
mov    0x8(%r12),%rdi
mov    0x2d4e(%rip),%rbx
mov    (%rbx),%edx
lea    0xd67(%rip),%rsi
call   1040 <strncmp@plt>
test   %rax,%rax
je     12f6 <__utmp_to_utmpx+0x196>
mov    0x8(%r12),%rdi
mov    (%rbx),%edx
lea    0xd54(%rip),%rsi
call   1040 <strncmp@plt>
test   %rax,%rax
je     12ff <__utmp_to_utmpx+0x19f>
mov    0x8(%r12),%rdi
mov    (%rbx),%edx
lea    0xd41(%rip),%rsi
call   1040 <strncmp@plt>
test   %rax,%rax
jne    1308 <__utmp_to_utmpx+0x1a8>
mov    0x2c9c(%rip),%rax
jmp    130f <__utmp_to_utmpx+0x1af>
mov    0x2cab(%rip),%rax
jmp    130f <__utmp_to_utmpx+0x1af>
mov    0x2c7a(%rip),%rax
jmp    130f <__utmp_to_utmpx+0x1af>
mov    0x2cc9(%rip),%rax
mov    (%rax),%rax
mov    %rax,(%r14)
mov    0x2c64(%rip),%rcx
cmp    (%rcx),%rax
je     132d <__utmp_to_utmpx+0x1cd>
mov    0x2cb0(%rip),%rcx
cmp    (%rcx),%rax
jne    133e <__utmp_to_utmpx+0x1de>
mov    0x8(%r14),%rdi
mov    0x8(%r12),%rsi
mov    (%rbx),%rdx
call   1030 <strncpy@plt>
mov    (%r12),%rdi
lea    0xcdc(%rip),%rsi
mov    $0x3,%edx
call   1040 <strncmp@plt>
test   %rax,%rax
je     1362 <__utmp_to_utmpx+0x202>
mov    0x18(%r14),%rdi
mov    (%r12),%rsi
jmp    1385 <__utmp_to_utmpx+0x225>
mov    0x10(%r14),%rdi
mov    (%r12),%rsi
mov    0x2c47(%rip),%rax
mov    (%rax),%rdx
call   1030 <strncpy@plt>
mov    0x18(%r14),%rdi
mov    (%r12),%rsi
add    $0x3,%rsi
mov    $0x8,%edx
call   1030 <strncpy@plt>
mov    0x20(%r14),%rdi
mov    0x10(%r12),%rsi
mov    0x2bf9(%rip),%r15
movslq (%r15),%rdx
call   1030 <strncpy@plt>
mov    0x10(%r12),%rdi
mov    (%r15),%esi
call   1070 <__strnlen@plt>
mov    (%r15),%ecx
add    $0xfffffffe,%ecx
cmp    %ecx,%eax
jge    144b <__utmp_to_utmpx+0x2eb>
mov    0x10(%r12),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
cmpb   $0x0,0x1(%rbx,%rax,1)
je     144b <__utmp_to_utmpx+0x2eb>
add    %rbx,%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
mov    (%r15),%ebx
mov    0x10(%r12),%rdi
call   1050 <strlen@plt>
mov    %rsp,-0x38(%rbp)
not    %eax
add    %ebx,%eax
movslq %eax,%r13
mov    (%r15),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    -0x30(%rbp),%rsi
mov    %r13,%rdx
call   1030 <strncpy@plt>
movb   $0x0,0x0(%r13,%rbx,1)
lea    -0x40(%rbp),%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1080 <strtoul@plt>
mov    -0x40(%rbp),%rcx
cmp    %rbx,%rcx
je     1447 <__utmp_to_utmpx+0x2e7>
cmpb   $0x0,(%rcx)
jne    1447 <__utmp_to_utmpx+0x2e7>
mov    %rax,0x28(%r14)
mov    -0x38(%rbp),%rsp
mov    0x18(%r12),%eax
mov    %eax,0x38(%r14)
movq   $0x0,0x30(%r14)
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x8(%r12),%rdi
mov    0x2b7f(%rip),%rax
mov    (%rax),%edx
lea    0xb93(%rip),%rsi
call   1040 <strncmp@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jne    145e <__utmp_to_utmpx+0x2fe>
mov    0x2b2d(%rip),%rax
jmp    14ad <__utmp_to_utmpx+0x34d>
mov    0x2ad4(%rip),%rax
jmp    14ad <__utmp_to_utmpx+0x34d>
mov    0x2af3(%rip),%rax
mov    (%rax),%rax
mov    %rax,(%r14)
jmp    138f <__utmp_to_utmpx+0x22f>

LLVM IR (-O0):
%struct.utmp = type { i8*, i8*, i8*, i32 }
%struct.utmpx = type { i64, i8*, i8*, i8*, i8*, i64, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64, i32 }
@EMPTY = global i64 0
@.str = [9 x i8] c"runlevel\00"
@UT_NAMESIZE = global i64 0
@RUN_LVL = global i64 0
@.str.1 = [7 x i8] c"reboot\00"
@BOOT_TIME = global i64 0
@.str.2 = [5 x i8] c"acct\00"
@ACCOUNTING = global i64 0
@.str.3 = [5 x i8] c"date\00"
@NEW_TIME = global i64 0
@OLD_TIME = global i64 0
@.str.4 = [5 x i8] c"INIT\00"
@INIT_PROCESS = global i64 0
@.str.5 = [6 x i8] c"LOGIN\00"
@LOGIN_PROCESS = global i64 0
@.str.6 = [1 x i8] zeroinitializer
@DEAD_PROCESS = global i64 0
@USER_PROCESS = global i64 0
@.str.7 = [4 x i8] c"tty\00"
@UT_LINESIZE = global i64 0
@UT_HOSTSIZE = global i32 0
define i32 @__utmp_to_utmpx(%struct.utmp* %0, %struct.utmpx* %1) {
%3 = alloca i32
%4 = alloca %struct.utmp*
%5 = alloca %struct.utmpx*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i8*
store %struct.utmp* %0, %struct.utmp** %4
store %struct.utmpx* %1, %struct.utmpx** %5
%12 = load %struct.utmpx*, %struct.utmpx** %5
%13 = call i32 @memset(%struct.utmpx* %12, i8 signext 0, i32 64)
%14 = load %struct.utmp*, %struct.utmp** %4
%15 = getelementptr inbounds %struct.utmp, %struct.utmp* %14, i32 0, i32 0
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %41
21: ; preds = %2
%22 = load %struct.utmp*, %struct.utmp** %4
%23 = getelementptr inbounds %struct.utmp, %struct.utmp* %22, i32 0, i32 1
%24 = load i8*, i8** %23
%25 = getelementptr inbounds i8, i8* %24, i64 0
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %41
29: ; preds = %21
%30 = load %struct.utmp*, %struct.utmp** %4
%31 = getelementptr inbounds %struct.utmp, %struct.utmp* %30, i32 0, i32 2
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i64 0
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %29
%38 = load i64, i64* @EMPTY
%39 = load %struct.utmpx*, %struct.utmpx** %5
%40 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %39, i32 0, i32 0
store i64 %38, i64* %40
br label %331
41: ; preds = %29, %21, %2
%42 = load %struct.utmp*, %struct.utmp** %4
%43 = getelementptr inbounds %struct.utmp, %struct.utmp* %42, i32 0, i32 0
%44 = load i8*, i8** %43
%45 = getelementptr inbounds i8, i8* %44, i64 0
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 126
br i1 %48, label %49, label %97
49: ; preds = %41
%50 = load %struct.utmp*, %struct.utmp** %4
%51 = getelementptr inbounds %struct.utmp, %struct.utmp* %50, i32 0, i32 0
%52 = load i8*, i8** %51
%53 = getelementptr inbounds i8, i8* %52, i64 1
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %97
57: ; preds = %49
%58 = load %struct.utmp*, %struct.utmp** %4
%59 = getelementptr inbounds %struct.utmp, %struct.utmp* %58, i32 0, i32 1
%60 = load i8*, i8** %59
%61 = load i64, i64* @UT_NAMESIZE
%62 = trunc i64 %61 to i32
%63 = call i64 @strncmp(i8* %60, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %62)
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %69
65: ; preds = %57
%66 = load i64, i64* @RUN_LVL
%67 = load %struct.utmpx*, %struct.utmpx** %5
%68 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %67, i32 0, i32 0
store i64 %66, i64* %68
br label %96
69: ; preds = %57
%70 = load %struct.utmp*, %struct.utmp** %4
%71 = getelementptr inbounds %struct.utmp, %struct.utmp* %70, i32 0, i32 1
%72 = load i8*, i8** %71
%73 = load i64, i64* @UT_NAMESIZE
%74 = trunc i64 %73 to i32
%75 = call i64 @strncmp(i8* %72, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %74)
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %81
77: ; preds = %69
%78 = load i64, i64* @BOOT_TIME
%79 = load %struct.utmpx*, %struct.utmpx** %5
%80 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %79, i32 0, i32 0
store i64 %78, i64* %80
br label %95
81: ; preds = %69
%82 = load %struct.utmp*, %struct.utmp** %4
%83 = getelementptr inbounds %struct.utmp, %struct.utmp* %82, i32 0, i32 1
%84 = load i8*, i8** %83
%85 = load i64, i64* @UT_NAMESIZE
%86 = trunc i64 %85 to i32
%87 = call i64 @strncmp(i8* %84, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %86)
%88 = icmp eq i64 %87, 0
br i1 %88, label %89, label %93
89: ; preds = %81
%90 = load i64, i64* @ACCOUNTING
%91 = load %struct.utmpx*, %struct.utmpx** %5
%92 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %91, i32 0, i32 0
store i64 %90, i64* %92
br label %94
93: ; preds = %81
store i32 -1, i32* %3
br label %332
94: ; preds = %89
br label %95
95: ; preds = %94, %77
br label %96
96: ; preds = %95, %65
br label %254
97: ; preds = %49, %41
%98 = load %struct.utmp*, %struct.utmp** %4
%99 = getelementptr inbounds %struct.utmp, %struct.utmp* %98, i32 0, i32 0
%100 = load i8*, i8** %99
%101 = getelementptr inbounds i8, i8* %100, i64 0
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = icmp eq i32 %103, 123
br i1 %104, label %105, label %127
105: ; preds = %97
%106 = load %struct.utmp*, %struct.utmp** %4
%107 = getelementptr inbounds %struct.utmp, %struct.utmp* %106, i32 0, i32 0
%108 = load i8*, i8** %107
%109 = getelementptr inbounds i8, i8* %108, i64 1
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
%112 = icmp eq i32 %111, 0
br i1 %112, label %113, label %127
113: ; preds = %105
%114 = load %struct.utmp*, %struct.utmp** %4
%115 = getelementptr inbounds %struct.utmp, %struct.utmp* %114, i32 0, i32 1
%116 = load i8*, i8** %115
%117 = load i64, i64* @UT_NAMESIZE
%118 = trunc i64 %117 to i32
%119 = call i64 @strncmp(i8* %116, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %118)
%120 = icmp eq i64 %119, 0
br i1 %120, label %121, label %125
121: ; preds = %113
%122 = load i64, i64* @NEW_TIME
%123 = load %struct.utmpx*, %struct.utmpx** %5
%124 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %123, i32 0, i32 0
store i64 %122, i64* %124
br label %126
125: ; preds = %113
store i32 -1, i32* %3
br label %332
126: ; preds = %121
br label %253
127: ; preds = %105, %97
%128 = load %struct.utmp*, %struct.utmp** %4
%129 = getelementptr inbounds %struct.utmp, %struct.utmp* %128, i32 0, i32 0
%130 = load i8*, i8** %129
%131 = getelementptr inbounds i8, i8* %130, i64 0
%132 = load i8, i8* %131
%133 = sext i8 %132 to i32
%134 = icmp eq i32 %133, 124
br i1 %134, label %135, label %157
135: ; preds = %127
%136 = load %struct.utmp*, %struct.utmp** %4
%137 = getelementptr inbounds %struct.utmp, %struct.utmp* %136, i32 0, i32 0
%138 = load i8*, i8** %137
%139 = getelementptr inbounds i8, i8* %138, i64 1
%140 = load i8, i8* %139
%141 = sext i8 %140 to i32
%142 = icmp eq i32 %141, 0
br i1 %142, label %143, label %157
143: ; preds = %135
%144 = load %struct.utmp*, %struct.utmp** %4
%145 = getelementptr inbounds %struct.utmp, %struct.utmp* %144, i32 0, i32 1
%146 = load i8*, i8** %145
%147 = load i64, i64* @UT_NAMESIZE
%148 = trunc i64 %147 to i32
%149 = call i64 @strncmp(i8* %146, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %148)
%150 = icmp eq i64 %149, 0
br i1 %150, label %151, label %155
151: ; preds = %143
%152 = load i64, i64* @OLD_TIME
%153 = load %struct.utmpx*, %struct.utmpx** %5
%154 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %153, i32 0, i32 0
store i64 %152, i64* %154
br label %156
155: ; preds = %143
store i32 -1, i32* %3
br label %332
156: ; preds = %151
br label %252
157: ; preds = %135, %127
%158 = load %struct.utmp*, %struct.utmp** %4
%159 = getelementptr inbounds %struct.utmp, %struct.utmp* %158, i32 0, i32 1
%160 = load i8*, i8** %159
%161 = load i64, i64* @UT_NAMESIZE
%162 = trunc i64 %161 to i32
%163 = call i64 @strncmp(i8* %160, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %162)
%164 = icmp eq i64 %163, 0
br i1 %164, label %165, label %169
165: ; preds = %157
%166 = load i64, i64* @INIT_PROCESS
%167 = load %struct.utmpx*, %struct.utmpx** %5
%168 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %167, i32 0, i32 0
store i64 %166, i64* %168
br label %199
169: ; preds = %157
%170 = load %struct.utmp*, %struct.utmp** %4
%171 = getelementptr inbounds %struct.utmp, %struct.utmp* %170, i32 0, i32 1
%172 = load i8*, i8** %171
%173 = load i64, i64* @UT_NAMESIZE
%174 = trunc i64 %173 to i32
%175 = call i64 @strncmp(i8* %172, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %174)
%176 = icmp eq i64 %175, 0
br i1 %176, label %177, label %181
177: ; preds = %169
%178 = load i64, i64* @LOGIN_PROCESS
%179 = load %struct.utmpx*, %struct.utmpx** %5
%180 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %179, i32 0, i32 0
store i64 %178, i64* %180
br label %198
181: ; preds = %169
%182 = load %struct.utmp*, %struct.utmp** %4
%183 = getelementptr inbounds %struct.utmp, %struct.utmp* %182, i32 0, i32 1
%184 = load i8*, i8** %183
%185 = load i64, i64* @UT_NAMESIZE
%186 = trunc i64 %185 to i32
%187 = call i64 @strncmp(i8* %184, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i32 %186)
%188 = icmp eq i64 %187, 0
br i1 %188, label %189, label %193
189: ; preds = %181
%190 = load i64, i64* @DEAD_PROCESS
%191 = load %struct.utmpx*, %struct.utmpx** %5
%192 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %191, i32 0, i32 0
store i64 %190, i64* %192
br label %197
193: ; preds = %181
%194 = load i64, i64* @USER_PROCESS
%195 = load %struct.utmpx*, %struct.utmpx** %5
%196 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %195, i32 0, i32 0
store i64 %194, i64* %196
br label %197
197: ; preds = %193, %189
br label %198
198: ; preds = %197, %177
br label %199
199: ; preds = %198, %165
%200 = load %struct.utmpx*, %struct.utmpx** %5
%201 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %200, i32 0, i32 0
%202 = load i64, i64* %201
%203 = load i64, i64* @LOGIN_PROCESS
%204 = icmp eq i64 %202, %203
br i1 %204, label %211, label %205
205: ; preds = %199
%206 = load %struct.utmpx*, %struct.utmpx** %5
%207 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %206, i32 0, i32 0
%208 = load i64, i64* %207
%209 = load i64, i64* @USER_PROCESS
%210 = icmp eq i64 %208, %209
br i1 %210, label %211, label %220
211: ; preds = %205, %199
%212 = load %struct.utmpx*, %struct.utmpx** %5
%213 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %212, i32 0, i32 1
%214 = load i8*, i8** %213
%215 = load %struct.utmp*, %struct.utmp** %4
%216 = getelementptr inbounds %struct.utmp, %struct.utmp* %215, i32 0, i32 1
%217 = load i8*, i8** %216
%218 = load i64, i64* @UT_NAMESIZE
%219 = call i32 @strncpy(i8* %214, i8* %217, i64 %218)
br label %220
220: ; preds = %211, %205
%221 = load %struct.utmp*, %struct.utmp** %4
%222 = getelementptr inbounds %struct.utmp, %struct.utmp* %221, i32 0, i32 0
%223 = load i8*, i8** %222
%224 = call i64 @strncmp(i8* %223, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 3)
%225 = icmp eq i64 %224, 0
br i1 %225, label %226, label %243
226: ; preds = %220
%227 = load %struct.utmpx*, %struct.utmpx** %5
%228 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %227, i32 0, i32 2
%229 = load i8*, i8** %228
%230 = load %struct.utmp*, %struct.utmp** %4
%231 = getelementptr inbounds %struct.utmp, %struct.utmp* %230, i32 0, i32 0
%232 = load i8*, i8** %231
%233 = load i64, i64* @UT_LINESIZE
%234 = call i32 @strncpy(i8* %229, i8* %232, i64 %233)
%235 = load %struct.utmpx*, %struct.utmpx** %5
%236 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %235, i32 0, i32 3
%237 = load i8*, i8** %236
%238 = load %struct.utmp*, %struct.utmp** %4
%239 = getelementptr inbounds %struct.utmp, %struct.utmp* %238, i32 0, i32 0
%240 = load i8*, i8** %239
%241 = getelementptr inbounds i8, i8* %240, i64 3
%242 = call i32 @strncpy(i8* %237, i8* %241, i64 8)
br label %251
243: ; preds = %220
%244 = load %struct.utmpx*, %struct.utmpx** %5
%245 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %244, i32 0, i32 3
%246 = load i8*, i8** %245
%247 = load %struct.utmp*, %struct.utmp** %4
%248 = getelementptr inbounds %struct.utmp, %struct.utmp* %247, i32 0, i32 0
%249 = load i8*, i8** %248
%250 = call i32 @strncpy(i8* %246, i8* %249, i64 8)
br label %251
251: ; preds = %243, %226
br label %252
252: ; preds = %251, %156
br label %253
253: ; preds = %252, %126
br label %254
254: ; preds = %253, %96
%255 = load %struct.utmpx*, %struct.utmpx** %5
%256 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %255, i32 0, i32 4
%257 = load i8*, i8** %256
%258 = load %struct.utmp*, %struct.utmp** %4
%259 = getelementptr inbounds %struct.utmp, %struct.utmp* %258, i32 0, i32 2
%260 = load i8*, i8** %259
%261 = load i32, i32* @UT_HOSTSIZE
%262 = sext i32 %261 to i64
%263 = call i32 @strncpy(i8* %257, i8* %260, i64 %262)
%264 = load %struct.utmp*, %struct.utmp** %4
%265 = getelementptr inbounds %struct.utmp, %struct.utmp* %264, i32 0, i32 2
%266 = load i8*, i8** %265
%267 = load i32, i32* @UT_HOSTSIZE
%268 = call i32 @__strnlen(i8* %266, i32 %267)
%269 = load i32, i32* @UT_HOSTSIZE
%270 = sub nsw i32 %269, 2
%271 = icmp slt i32 %268, %270
br i1 %271, label %272, label %321
272: ; preds = %254
%273 = load %struct.utmp*, %struct.utmp** %4
%274 = getelementptr inbounds %struct.utmp, %struct.utmp* %273, i32 0, i32 2
%275 = load i8*, i8** %274
%276 = load %struct.utmp*, %struct.utmp** %4
%277 = getelementptr inbounds %struct.utmp, %struct.utmp* %276, i32 0, i32 2
%278 = load i8*, i8** %277
%279 = call i32 @strlen(i8* %278)
%280 = sext i32 %279 to i64
%281 = getelementptr inbounds i8, i8* %275, i64 %280
%282 = getelementptr inbounds i8, i8* %281, i64 1
store i8* %282, i8** %6
%283 = load i8*, i8** %6
%284 = getelementptr inbounds i8, i8* %283, i64 0
%285 = load i8, i8* %284
%286 = sext i8 %285 to i32
%287 = icmp ne i32 %286, 0
br i1 %287, label %288, label %320
288: ; preds = %272
%289 = load i32, i32* @UT_HOSTSIZE
%290 = load %struct.utmp*, %struct.utmp** %4
%291 = getelementptr inbounds %struct.utmp, %struct.utmp* %290, i32 0, i32 2
%292 = load i8*, i8** %291
%293 = call i32 @strlen(i8* %292)
%294 = sub nsw i32 %289, %293
%295 = sub nsw i32 %294, 1
%296 = sext i32 %295 to i64
store i64 %296, i64* %7
%297 = load i32, i32* @UT_HOSTSIZE
%298 = zext i32 %297 to i64
%299 = call i8* @llvm.stacksave()
store i8* %299, i8** %8
%300 = alloca i8, i64 %298
store i64 %298, i64* %9
%301 = load i8*, i8** %6
%302 = load i64, i64* %7
%303 = call i32 @strncpy(i8* %300, i8* %301, i64 %302)
%304 = load i64, i64* %7
%305 = getelementptr inbounds i8, i8* %300, i64 %304
store i8 0, i8* %305
%306 = call i64 @strtoul(i8* %300, i8** %11, i32 10)
store i64 %306, i64* %10
%307 = load i8*, i8** %11
%308 = icmp ne i8* %307, %300
br i1 %308, label %309, label %318
309: ; preds = %288
%310 = load i8*, i8** %11
%311 = load i8, i8* %310
%312 = sext i8 %311 to i32
%313 = icmp eq i32 %312, 0
br i1 %313, label %314, label %318
314: ; preds = %309
%315 = load i64, i64* %10
%316 = load %struct.utmpx*, %struct.utmpx** %5
%317 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %316, i32 0, i32 5
store i64 %315, i64* %317
br label %318
318: ; preds = %314, %309, %288
%319 = load i8*, i8** %8
br label %320
320: ; preds = %318, %272
br label %321
321: ; preds = %320, %254
%322 = load %struct.utmp*, %struct.utmp** %4
%323 = getelementptr inbounds %struct.utmp, %struct.utmp* %322, i32 0, i32 3
%324 = load i32, i32* %323
%325 = load %struct.utmpx*, %struct.utmpx** %5
%326 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %325, i32 0, i32 6
%327 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %326, i32 0, i32 1
store i32 %324, i32* %327
%328 = load %struct.utmpx*, %struct.utmpx** %5
%329 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %328, i32 0, i32 6
%330 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %329, i32 0, i32 0
store i64 0, i64* %330
br label %331
331: ; preds = %321, %37
store i32 0, i32* %3
br label %332
332: ; preds = %331, %155, %125, %93
%333 = load i32, i32* %3
ret i32 %333
}

LLVM IR (-O2):
%struct.utmp = type { i8*, i8*, i8*, i32 }
%struct.utmpx = type { i64, i8*, i8*, i8*, i8*, i64, %struct.TYPE_2__ }
%struct.TYPE_2__ = type { i64, i32 }
@EMPTY = global i64 0
@.str = [9 x i8] c"runlevel\00"
@UT_NAMESIZE = global i64 0
@RUN_LVL = global i64 0
@.str.1 = [7 x i8] c"reboot\00"
@BOOT_TIME = global i64 0
@.str.2 = [5 x i8] c"acct\00"
@ACCOUNTING = global i64 0
@.str.3 = [5 x i8] c"date\00"
@NEW_TIME = global i64 0
@OLD_TIME = global i64 0
@.str.4 = [5 x i8] c"INIT\00"
@INIT_PROCESS = global i64 0
@.str.5 = [6 x i8] c"LOGIN\00"
@LOGIN_PROCESS = global i64 0
@.str.6 = [1 x i8] zeroinitializer
@DEAD_PROCESS = global i64 0
@USER_PROCESS = global i64 0
@.str.7 = [4 x i8] c"tty\00"
@UT_LINESIZE = global i64 0
@UT_HOSTSIZE = global i32 0
define i32 @__utmp_to_utmpx(%struct.utmp* nocapture %0, %struct.utmpx* %1) {
%3 = alloca i8*
%4 = tail call i32 @memset(%struct.utmpx* %1, i8 signext 0, i32 64)
%5 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 0
%6 = load i8*, i8** %5
%7 = load i8, i8* %6
switch i8 %7, label %81 [
i8 0, label %8
i8 126, label %21
i8 123, label %53
i8 124, label %67
]
8: ; preds = %2
%9 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 1
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %81
13: ; preds = %8
%14 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 2
%15 = load i8*, i8** %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %16, 0
br i1 %17, label %18, label %81
18: ; preds = %13
%19 = load i64, i64* @EMPTY
%20 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 0
store i64 %19, i64* %20
br label %186
21: ; preds = %2
%22 = getelementptr inbounds i8, i8* %6, i64 1
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 0
br i1 %24, label %25, label %81
25: ; preds = %21
%26 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 1
%27 = load i8*, i8** %26
%28 = load i64, i64* @UT_NAMESIZE
%29 = trunc i64 %28 to i32
%30 = tail call i64 @strncmp(i8* %27, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %25
%33 = load i64, i64* @RUN_LVL
%34 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 0
store i64 %33, i64* %34
br label %136
35: ; preds = %25
%36 = load i8*, i8** %26
%37 = load i64, i64* @UT_NAMESIZE
%38 = trunc i64 %37 to i32
%39 = tail call i64 @strncmp(i8* %36, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %35
%42 = load i64, i64* @BOOT_TIME
%43 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 0
store i64 %42, i64* %43
br label %136
44: ; preds = %35
%45 = load i8*, i8** %26
%46 = load i64, i64* @UT_NAMESIZE
%47 = trunc i64 %46 to i32
%48 = tail call i64 @strncmp(i8* %45, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %47)
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %186
50: ; preds = %44
%51 = load i64, i64* @ACCOUNTING
%52 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 0
store i64 %51, i64* %52
br label %136
53: ; preds = %2
%54 = getelementptr inbounds i8, i8* %6, i64 1
%55 = load i8, i8* %54
%56 = icmp eq i8 %55, 0
br i1 %56, label %57, label %81
57: ; preds = %53
%58 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 1
%59 = load i8*, i8** %58
%60 = load i64, i64* @UT_NAMESIZE
%61 = trunc i64 %60 to i32
%62 = tail call i64 @strncmp(i8* %59, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %61)
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %186
64: ; preds = %57
%65 = load i64, i64* @NEW_TIME
%66 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 0
store i64 %65, i64* %66
br label %136
67: ; preds = %2
%68 = getelementptr inbounds i8, i8* %6, i64 1
%69 = load i8, i8* %68
%70 = icmp eq i8 %69, 0
br i1 %70, label %71, label %81
71: ; preds = %67
%72 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 1
%73 = load i8*, i8** %72
%74 = load i64, i64* @UT_NAMESIZE
%75 = trunc i64 %74 to i32
%76 = tail call i64 @strncmp(i8* %73, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %75)
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %186
78: ; preds = %71
%79 = load i64, i64* @OLD_TIME
%80 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 0
store i64 %79, i64* %80
br label %136
81: ; preds = %2, %21, %13, %8, %53, %67
%82 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 1
%83 = load i8*, i8** %82
%84 = load i64, i64* @UT_NAMESIZE
%85 = trunc i64 %84 to i32
%86 = tail call i64 @strncmp(i8* %83, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %85)
%87 = icmp eq i64 %86, 0
br i1 %87, label %101, label %88
88: ; preds = %81
%89 = load i8*, i8** %82
%90 = load i64, i64* @UT_NAMESIZE
%91 = trunc i64 %90 to i32
%92 = tail call i64 @strncmp(i8* %89, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %91)
%93 = icmp eq i64 %92, 0
br i1 %93, label %101, label %94
94: ; preds = %88
%95 = load i8*, i8** %82
%96 = load i64, i64* @UT_NAMESIZE
%97 = trunc i64 %96 to i32
%98 = tail call i64 @strncmp(i8* %95, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.6, i64 0, i64 0), i32 %97)
%99 = icmp eq i64 %98, 0
%100 = select i1 %99, i64* @DEAD_PROCESS, i64* @USER_PROCESS
br label %101
101: ; preds = %94, %88, %81
%102 = phi i64* [ @INIT_PROCESS, %81 ], [ @LOGIN_PROCESS, %88 ], [ %100, %94 ]
%103 = load i64, i64* %102
%104 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 0
store i64 %103, i64* %104
%105 = load i64, i64* @LOGIN_PROCESS
%106 = icmp eq i64 %103, %105
%107 = load i64, i64* @USER_PROCESS
%108 = icmp eq i64 %103, %107
%109 = select i1 %106, i1 true, i1 %108
br i1 %109, label %110, label %116
110: ; preds = %101
%111 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 1
%112 = load i8*, i8** %111
%113 = load i8*, i8** %82
%114 = load i64, i64* @UT_NAMESIZE
%115 = tail call i32 @strncpy(i8* %112, i8* %113, i64 %114)
br label %116
116: ; preds = %101, %110
%117 = load i8*, i8** %5
%118 = tail call i64 @strncmp(i8* %117, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32 3)
%119 = icmp eq i64 %118, 0
br i1 %119, label %120, label %131
120: ; preds = %116
%121 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 2
%122 = load i8*, i8** %121
%123 = load i8*, i8** %5
%124 = load i64, i64* @UT_LINESIZE
%125 = tail call i32 @strncpy(i8* %122, i8* %123, i64 %124)
%126 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 3
%127 = load i8*, i8** %126
%128 = load i8*, i8** %5
%129 = getelementptr inbounds i8, i8* %128, i64 3
%130 = tail call i32 @strncpy(i8* %127, i8* %129, i64 8)
br label %136
131: ; preds = %116
%132 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 3
%133 = load i8*, i8** %132
%134 = load i8*, i8** %5
%135 = tail call i32 @strncpy(i8* %133, i8* %134, i64 8)
br label %136
136: ; preds = %64, %120, %131, %78, %32, %50, %41
%137 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 4
%138 = load i8*, i8** %137
%139 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 2
%140 = load i8*, i8** %139
%141 = load i32, i32* @UT_HOSTSIZE
%142 = sext i32 %141 to i64
%143 = tail call i32 @strncpy(i8* %138, i8* %140, i64 %142)
%144 = load i8*, i8** %139
%145 = load i32, i32* @UT_HOSTSIZE
%146 = tail call i32 @__strnlen(i8* %144, i32 %145)
%147 = load i32, i32* @UT_HOSTSIZE
%148 = add nsw i32 %147, -2
%149 = icmp slt i32 %146, %148
br i1 %149, label %150, label %181
150: ; preds = %136
%151 = load i8*, i8** %139
%152 = tail call i32 @strlen(i8* %151)
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds i8, i8* %151, i64 %153
%155 = getelementptr inbounds i8, i8* %154, i64 1
%156 = load i8, i8* %155
%157 = icmp eq i8 %156, 0
br i1 %157, label %181, label %158
158: ; preds = %150
%159 = load i32, i32* @UT_HOSTSIZE
%160 = load i8*, i8** %139
%161 = tail call i32 @strlen(i8* %160)
%162 = xor i32 %161, -1
%163 = add i32 %159, %162
%164 = sext i32 %163 to i64
%165 = load i32, i32* @UT_HOSTSIZE
%166 = zext i32 %165 to i64
%167 = tail call i8* @llvm.stacksave()
%168 = alloca i8, i64 %166
%169 = bitcast i8** %3 to i8*
%170 = call i32 @strncpy(i8* %168, i8* %155, i64 %164)
%171 = getelementptr inbounds i8, i8* %168, i64 %164
store i8 0, i8* %171
%172 = call i64 @strtoul(i8* %168, i8** %3, i32 10)
%173 = load i8*, i8** %3
%174 = icmp eq i8* %173, %168
br i1 %174, label %180, label %175
175: ; preds = %158
%176 = load i8, i8* %173
%177 = icmp eq i8 %176, 0
br i1 %177, label %178, label %180
178: ; preds = %175
%179 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 5
store i64 %172, i64* %179
br label %180
180: ; preds = %178, %175, %158
br label %181
181: ; preds = %150, %180, %136
%182 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 3
%183 = load i32, i32* %182
%184 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 6, i32 1
store i32 %183, i32* %184
%185 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %1, i64 0, i32 6, i32 0
store i64 0, i64* %185
br label %186
186: ; preds = %18, %181, %71, %57, %44
%187 = phi i32 [ -1, %44 ], [ -1, %57 ], [ -1, %71 ], [ 0, %181 ], [ 0, %18 ]
ret i32 %187
}