#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_name;
  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("%-12.12s", utbufp->ut_name);
  printf(" ");
  printf("%-8.8s", utbufp->ut_line);
  printf(" ");
  show_time(utbufp->ut_time);
  printf(" ");
  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    11e2 <show_info+0xc2>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rsi
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%edi
call   1040 <show_time@plt>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11d4 <show_info+0xb4>
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rsi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_info>:
push   %rbx
mov    (%rdi),%rax
mov    0x2ead(%rip),%rcx
cmp    (%rcx),%rax
jne    11af <show_info+0x7f>
mov    %rdi,%rbx
mov    0x8(%rdi),%rsi
lea    0xeb2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x10(%rbx),%rsi
lea    0xe9f(%rip),%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    $0x20,%edi
call   1030 <putchar@plt>
mov    0x18(%rbx),%rsi
cmpb   $0x0,(%rsi)
je     11a4 <show_info+0x74>
lea    0xe73(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>
pop    %rbx
ret

LLVM IR (-O0):
%struct.utmp = type { i64, i8*, i8*, i8*, i32 }
@USER_PROCESS = global i64 0
@.str = [9 x i8] c"%-12.12s\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [7 x i8] c"%-8.8s\00"
@.str.3 = [5 x i8] c"(%s)\00"
@.str.4 = [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 %39
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 ([9 x i8], [9 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 ([7 x i8], [7 x i8]* @.str.2, 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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = load %struct.utmp*, %struct.utmp** %2
%26 = getelementptr inbounds %struct.utmp, %struct.utmp* %25, i32 0, i32 3
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i8, i8* %27, i64 0
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %9
%33 = load %struct.utmp*, %struct.utmp** %2
%34 = getelementptr inbounds %struct.utmp, %struct.utmp* %33, i32 0, i32 3
%35 = load i8*, i8** %34
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %35)
br label %37
37: ; preds = %32, %9
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %39
39: ; preds = %37, %8
ret void
}

LLVM IR (-O2):
%struct.utmp = type { i64, i8*, i8*, i8*, i32 }
@USER_PROCESS = global i64 0
@.str = [9 x i8] c"%-12.12s\00"
@.str.2 = [7 x i8] c"%-8.8s\00"
@.str.3 = [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 %27
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 ([9 x i8], [9 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 ([7 x i8], [7 x i8]* @.str.2, 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 = tail call i32 @putchar(i32 32)
%19 = getelementptr inbounds %struct.utmp, %struct.utmp* %0, i64 0, i32 3
%20 = load i8*, i8** %19
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %6
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %20)
br label %25
25: ; preds = %23, %6
%26 = tail call i32 @putchar(i32 10)
br label %27
27: ; preds = %1, %25
ret void
}