#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 uint64_t;
typedef int uint32_t;
struct drand48_data {
  int __a;
  unsigned short __c;
  int __init;
  int /*<<< orphan*/ __x;
};

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/, unsigned short *, int);
int __lcong48_r(unsigned short int param[7], struct drand48_data *buffer) {
  memcpy(buffer->__x, &param[0], sizeof(buffer->__x));
  buffer->__a =
      ((uint64_t)param[5] << 32 | (uint32_t)param[4] << 16 | param[3]);
  buffer->__c = param[6];
  buffer->__init = 1;
  return 0;
}


x86 assembly (clang, -O0):
<__lcong48_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%edi
mov    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
movzwl 0xa(%rax),%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movzwl 0x8(%rax),%eax
shl    $0x10,%eax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
movzwl 0x6(%rax),%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%cx
mov    -0x10(%rbp),%rax
mov    %cx,0x4(%rax)
mov    -0x10(%rbp),%rax
movl   $0x1,0x8(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__lcong48_r>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    0xc(%rsi),%edi
mov    %r14,%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
movzwl 0xc(%r14),%eax
mov    %ax,0x4(%rbx)
movl   $0x1,0x8(%rbx)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.drand48_data = type { i32, i16, i32, i32 }
define i32 @__lcong48_r(i16* %0, %struct.drand48_data* %1) {
%3 = alloca i16*
%4 = alloca %struct.drand48_data*
store i16* %0, i16** %3
store %struct.drand48_data* %1, %struct.drand48_data** %4
%5 = load %struct.drand48_data*, %struct.drand48_data** %4
%6 = getelementptr inbounds %struct.drand48_data, %struct.drand48_data* %5, i32 0, i32 3
%7 = load i32, i32* %6
%8 = load i16*, i16** %3
%9 = getelementptr inbounds i16, i16* %8, i64 0
%10 = call i32 @memcpy(i32 %7, i16* %9, i32 4)
%11 = load i16*, i16** %3
%12 = getelementptr inbounds i16, i16* %11, i64 5
%13 = load i16, i16* %12
%14 = zext i16 %13 to i32
%15 = shl i32 %14, 32
%16 = load i16*, i16** %3
%17 = getelementptr inbounds i16, i16* %16, i64 4
%18 = load i16, i16* %17
%19 = zext i16 %18 to i32
%20 = shl i32 %19, 16
%21 = or i32 %15, %20
%22 = load i16*, i16** %3
%23 = getelementptr inbounds i16, i16* %22, i64 3
%24 = load i16, i16* %23
%25 = zext i16 %24 to i32
%26 = or i32 %21, %25
%27 = load %struct.drand48_data*, %struct.drand48_data** %4
%28 = getelementptr inbounds %struct.drand48_data, %struct.drand48_data* %27, i32 0, i32 0
store i32 %26, i32* %28
%29 = load i16*, i16** %3
%30 = getelementptr inbounds i16, i16* %29, i64 6
%31 = load i16, i16* %30
%32 = load %struct.drand48_data*, %struct.drand48_data** %4
%33 = getelementptr inbounds %struct.drand48_data, %struct.drand48_data* %32, i32 0, i32 1
store i16 %31, i16* %33
%34 = load %struct.drand48_data*, %struct.drand48_data** %4
%35 = getelementptr inbounds %struct.drand48_data, %struct.drand48_data* %34, i32 0, i32 2
store i32 1, i32* %35
ret i32 0
}

LLVM IR (-O2):
%struct.drand48_data = type { i32, i16, i32, i32 }
define i32 @__lcong48_r(i16* %0, %struct.drand48_data* nocapture %1) {
%3 = getelementptr inbounds %struct.drand48_data, %struct.drand48_data* %1, i64 0, i32 3
%4 = load i32, i32* %3
%5 = tail call i32 @memcpy(i32 %4, i16* %0, i32 4)
%6 = getelementptr inbounds i16, i16* %0, i64 6
%7 = load i16, i16* %6
%8 = getelementptr inbounds %struct.drand48_data, %struct.drand48_data* %1, i64 0, i32 1
store i16 %7, i16* %8
%9 = getelementptr inbounds %struct.drand48_data, %struct.drand48_data* %1, i64 0, i32 2
store i32 1, i32* %9
ret i32 0
}