#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 int /*<<< orphan*/ ut;
struct utmp {
  int /*<<< orphan*/ ut_time;
  int /*<<< orphan*/ ut_name;
  int /*<<< orphan*/ ut_line;
};

/* Variables and functions */
int /*<<< orphan*/ _PATH_WTMP;
int /*<<< orphan*/ memset(struct utmp *, int /*<<< orphan*/, int);
int /*<<< orphan*/ strncpy(int /*<<< orphan*/, char const *, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ updwtmp(int /*<<< orphan*/, struct utmp *);
void logwtmp(const char *line, const char *name, const char *host) {
  struct utmp ut;
  memset(&ut, 0, sizeof(ut));
  strncpy(ut.ut_line, line, sizeof ut.ut_line);
  strncpy(ut.ut_name, name, sizeof ut.ut_name);
  ut.ut_time = time(NULL);
  updwtmp(_PATH_WTMP, &ut);
}


x86 assembly (clang, -O0):
<logwtmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
mov    -0x20(%rbp),%edi
mov    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0x28(%rbp)
mov    0x2e47(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rsi
call   1040 <updwtmp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<logwtmp>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r15
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1050 <memset@plt>
mov    0x8(%rsp),%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
mov    0x4(%rsp),%edi
mov    %r15,%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,(%rsp)
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
call   1040 <updwtmp@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.utmp = type { i32, i32, i32 }
@_PATH_WTMP = global i32 0
define void @logwtmp(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca %struct.utmp
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = call i32 @memset(%struct.utmp* %7, i32 0, i32 12)
%9 = getelementptr inbounds %struct.utmp, %struct.utmp* %7, i32 0, i32 2
%10 = load i32, i32* %9
%11 = load i8*, i8** %4
%12 = call i32 @strncpy(i32 %10, i8* %11, i32 4)
%13 = getelementptr inbounds %struct.utmp, %struct.utmp* %7, i32 0, i32 1
%14 = load i32, i32* %13
%15 = load i8*, i8** %5
%16 = call i32 @strncpy(i32 %14, i8* %15, i32 4)
%17 = call i32 @time(i32* null)
%18 = getelementptr inbounds %struct.utmp, %struct.utmp* %7, i32 0, i32 0
store i32 %17, i32* %18
%19 = load i32, i32* @_PATH_WTMP
%20 = call i32 @updwtmp(i32 %19, %struct.utmp* %7)
ret void
}

LLVM IR (-O2):
%struct.utmp = type { i32, i32, i32 }
@_PATH_WTMP = global i32 0
define void @logwtmp(i8* %0, i8* %1, i8* nocapture readnone %2) {
%4 = alloca %struct.utmp
%5 = bitcast %struct.utmp* %4 to i8*
%6 = call i32 @memset(%struct.utmp* %4, i32 0, i32 12)
%7 = getelementptr inbounds %struct.utmp, %struct.utmp* %4, i64 0, i32 2
%8 = load i32, i32* %7
%9 = call i32 @strncpy(i32 %8, i8* %0, i32 4)
%10 = getelementptr inbounds %struct.utmp, %struct.utmp* %4, i64 0, i32 1
%11 = load i32, i32* %10
%12 = call i32 @strncpy(i32 %11, i8* %1, i32 4)
%13 = call i32 @time(i32* null)
%14 = getelementptr inbounds %struct.utmp, %struct.utmp* %4, i64 0, i32 0
store i32 %13, i32* %14
%15 = load i32, i32* @_PATH_WTMP
%16 = call i32 @updwtmp(i32 %15, %struct.utmp* %4)
ret void
}