#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 utmp {
  scalar_t__ ut_type;
  char *ut_user;
  char *ut_line;
  char *ut_host;
  int /*<<< orphan*/ ut_time;
};

/* Variables and functions */
scalar_t__ USER_PROCESS;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ show_time(int /*<<< orphan*/);
void show_info(struct utmp *utbufp) {
  if (utbufp->ut_type != USER_PROCESS)
    return;
  printf("% -8.8s", utbufp->ut_user);
  printf(" ");
  printf("% -8.8s", utbufp->ut_line);
  printf(" ");
  show_time(utbufp->ut_time);
  if (utbufp->ut_host[0] != '\0')
    printf("(%s)", utbufp->ut_host);
  printf("\n");
}


x86 assembly (clang, -O0):
<show_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    0x2eae(%rip),%rcx
cmp    (%rcx),%rax
je     1148 <show_info+0x28>
jmp    11d4 <show_info+0xb4>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%edi
call   1040 <show_time@plt>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11c6 <show_info+0xa6>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rsi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_info>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%rax
mov    0x2eaa(%rip),%rcx
cmp    (%rcx),%rax
jne    11ad <show_info+0x7d>
mov    %rdi,%rbx
mov    0x8(%rdi),%rsi
lea    0xeaf(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x10(%rbx),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x20(%rbx),%edi
call   1050 <show_time@plt>
mov    0x18(%rbx),%rsi
cmpb   $0x0,(%rsi)
je     119c <show_info+0x6c>
lea    0xe73(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <putchar@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.utmp = type { i64, i8*, i8*, i8*, i32 }
@USER_PROCESS = global i64 0
@.str = [8 x i8] c"% -8.8s\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [5 x i8] c"(%s)\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @show_info(%struct.utmp* %0) {
%2 = alloca %struct.utmp*
store %struct.utmp* %0, %struct.utmp** %2
%3 = load %struct.utmp*, %struct.utmp** %2
%4 = getelementptr inbounds %struct.utmp, %struct.utmp* %3, i32 0, i32 0
%5 = load i64, i64* %4
%6 = load i64, i64* @USER_PROCESS
%7 = icmp ne i64 %5, %6
br i1 %7, label %8, label %9
8: ; preds = %1
br label %38
9: ; preds = %1
%10 = load %struct.utmp*, %struct.utmp** %2
%11 = getelementptr inbounds %struct.utmp, %struct.utmp* %10, i32 0, i32 1
%12 = load i8*, i8** %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = load %struct.utmp*, %struct.utmp** %2
%16 = getelementptr inbounds %struct.utmp, %struct.utmp* %15, i32 0, i32 2
%17 = load i8*, i8** %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = load %struct.utmp*, %struct.utmp** %2
%21 = getelementptr inbounds %struct.utmp, %struct.utmp* %20, i32 0, i32 4
%22 = load i32, i32* %21
%23 = call i32 @show_time(i32 %22)
%24 = load %struct.utmp*, %struct.utmp** %2
%25 = getelementptr inbounds %struct.utmp, %struct.utmp* %24, i32 0, i32 3
%26 = load i8*, i8** %25
%27 = getelementptr inbounds i8, i8* %26, i64 0
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %9
%32 = load %struct.utmp*, %struct.utmp** %2
%33 = getelementptr inbounds %struct.utmp, %struct.utmp* %32, i32 0, i32 3
%34 = load i8*, i8** %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %34)
br label %36
36: ; preds = %31, %9
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %38
38: ; preds = %36, %8
ret void
}

LLVM IR (-O2):
%struct.utmp = type { i64, i8*, i8*, i8*, i32 }
@USER_PROCESS = global i64 0
@.str = [8 x i8] c"% -8.8s\00"
@.str.2 = [5 x i8] c"(%s)\00"
define void @show_info(%struct.utmp* nocapture %0) {
%2 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 0
%3 = load i64, i64* %2
%4 = load i64, i64* @USER_PROCESS
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %26
6: ; preds = %1
%7 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 1
%8 = load i8*, i8** %7
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = tail call i32 @putchar(i32 32)
%11 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 2
%12 = load i8*, i8** %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = tail call i32 @putchar(i32 32)
%15 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 4
%16 = load i32, i32* %15
%17 = tail call i32 @show_time(i32 %16)
%18 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 3
%19 = load i8*, i8** %18
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %6
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %19)
br label %24
24: ; preds = %22, %6
%25 = tail call i32 @putchar(i32 10)
br label %26
26: ; preds = %1, %24
ret void
}