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

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/, int /*<<< orphan*/, int);
void getutmp(const struct utmpx *utmpx, struct utmp *utmp) {
  memcpy(utmp->ut_line, utmpx->ut_line, sizeof(utmp->ut_line));
  memcpy(utmp->ut_user, utmpx->ut_user, sizeof(utmp->ut_user));
  utmp->ut_time = utmpx->ut_time;
}


x86 assembly (clang, -O0):
<getutmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%esi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getutmp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    0x8(%rsi),%edi
mov    0x8(%rbx),%esi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x4(%r14),%edi
mov    0x4(%rbx),%esi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    (%rbx),%eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.utmpx = type { i32, i32, i32 }
%struct.utmp = type { i32, i32, i32 }
define void @getutmp(%struct.utmpx* %0, %struct.utmp* %1) {
%3 = alloca %struct.utmpx*
%4 = alloca %struct.utmp*
store %struct.utmpx* %0, %struct.utmpx** %3
store %struct.utmp* %1, %struct.utmp** %4
%5 = load %struct.utmp*, %struct.utmp** %4
%6 = getelementptr inbounds %struct.utmp, %struct.utmp* %5, i32 0, i32 2
%7 = load i32, i32* %6
%8 = load %struct.utmpx*, %struct.utmpx** %3
%9 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %8, i32 0, i32 2
%10 = load i32, i32* %9
%11 = call i32 @memcpy(i32 %7, i32 %10, i32 4)
%12 = load %struct.utmp*, %struct.utmp** %4
%13 = getelementptr inbounds %struct.utmp, %struct.utmp* %12, i32 0, i32 1
%14 = load i32, i32* %13
%15 = load %struct.utmpx*, %struct.utmpx** %3
%16 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = call i32 @memcpy(i32 %14, i32 %17, i32 4)
%19 = load %struct.utmpx*, %struct.utmpx** %3
%20 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = load %struct.utmp*, %struct.utmp** %4
%23 = getelementptr inbounds %struct.utmp, %struct.utmp* %22, i32 0, i32 0
store i32 %21, i32* %23
ret void
}

LLVM IR (-O2):
%struct.utmpx = type { i32, i32, i32 }
%struct.utmp = type { i32, i32, i32 }
define void @getutmp(%struct.utmpx* nocapture %0, %struct.utmp* nocapture %1) {
%3 = getelementptr inbounds %struct.utmp, %struct.utmp* %1, i64 0, i32 2
%4 = load i32, i32* %3
%5 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %0, i64 0, i32 2
%6 = load i32, i32* %5
%7 = tail call i32 @memcpy(i32 %4, i32 %6, i32 4)
%8 = getelementptr inbounds %struct.utmp, %struct.utmp* %1, i64 0, i32 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %0, i64 0, i32 1
%11 = load i32, i32* %10
%12 = tail call i32 @memcpy(i32 %9, i32 %11, i32 4)
%13 = getelementptr inbounds %struct.utmpx, %struct.utmpx* %0, i64 0, i32 0
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.utmp, %struct.utmp* %1, i64 0, i32 0
store i32 %14, i32* %15
ret void
}