#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*/ __m128d;

/* Variables and functions */
unsigned long mand8(int /*<<< orphan*/ *, int /*<<< orphan*/);
unsigned long mand64(__m128d *init_r, __m128d init_i) {
  unsigned long pix64 = 0;
  for (long byte = 0; byte < 8; byte++) {
    unsigned long pix8 = mand8(init_r, init_i);
    pix64 = (pix64 >> 8) | (pix8 << 56);
    init_r += 4;
  }
  return pix64;
}


x86 assembly (clang, -O0):
<mand64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x8,-0x20(%rbp)
jge    117e <mand64+0x6e>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <mand8@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
shr    $0x8,%rax
mov    -0x28(%rbp),%rcx
shl    $0x38,%rcx
or     %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x8(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112f <mand64+0x1f>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mand64>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%rbx
call   1030 <mand8@plt>
mov    %rax,%rbp
shl    $0x38,%rbp
lea    0x10(%rbx),%rdi
mov    %r14d,%esi
call   1030 <mand8@plt>
mov    %rax,%r15
shld   $0x38,%rbp,%r15
lea    0x20(%rbx),%rdi
mov    %r14d,%esi
call   1030 <mand8@plt>
mov    %rax,%rbp
shld   $0x38,%r15,%rbp
lea    0x30(%rbx),%rdi
mov    %r14d,%esi
call   1030 <mand8@plt>
mov    %rax,%r15
shld   $0x38,%rbp,%r15
lea    0x40(%rbx),%rdi
mov    %r14d,%esi
call   1030 <mand8@plt>
mov    %rax,%rbp
shld   $0x38,%r15,%rbp
lea    0x50(%rbx),%rdi
mov    %r14d,%esi
call   1030 <mand8@plt>
mov    %rax,%r15
shld   $0x38,%rbp,%r15
lea    0x60(%rbx),%rdi
mov    %r14d,%esi
call   1030 <mand8@plt>
mov    %rax,%rbp
shld   $0x38,%r15,%rbp
add    $0x70,%rbx
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <mand8@plt>
shld   $0x38,%rbp,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i64 @mand64(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i32* %0, i32** %3
store i32 %1, i32* %4
store i64 0, i64* %5
store i64 0, i64* %6
br label %8
8: ; preds = %22, %2
%9 = load i64, i64* %6
%10 = icmp slt i64 %9, 8
br i1 %10, label %11, label %25
11: ; preds = %8
%12 = load i32*, i32** %3
%13 = load i32, i32* %4
%14 = call i64 @mand8(i32* %12, i32 %13)
store i64 %14, i64* %7
%15 = load i64, i64* %5
%16 = lshr i64 %15, 8
%17 = load i64, i64* %7
%18 = shl i64 %17, 56
%19 = or i64 %16, %18
store i64 %19, i64* %5
%20 = load i32*, i32** %3
%21 = getelementptr inbounds i32, i32* %20, i64 4
store i32* %21, i32** %3
br label %22
22: ; preds = %11
%23 = load i64, i64* %6
%24 = add nsw i64 %23, 1
store i64 %24, i64* %6
br label %8
25: ; preds = %8
%26 = load i64, i64* %5
ret i64 %26
}

LLVM IR (-O2):
define i64 @mand64(i32* %0, i32 %1) {
%3 = tail call i64 @mand8(i32* %0, i32 %1)
%4 = shl i64 %3, 56
%5 = getelementptr inbounds i32, i32* %0, i64 4
%6 = tail call i64 @mand8(i32* %5, i32 %1)
%7 = tail call i64 @llvm.fshl.i64(i64 %6, i64 %4, i64 56)
%8 = getelementptr inbounds i32, i32* %0, i64 8
%9 = tail call i64 @mand8(i32* %8, i32 %1)
%10 = tail call i64 @llvm.fshl.i64(i64 %9, i64 %7, i64 56)
%11 = getelementptr inbounds i32, i32* %0, i64 12
%12 = tail call i64 @mand8(i32* %11, i32 %1)
%13 = tail call i64 @llvm.fshl.i64(i64 %12, i64 %10, i64 56)
%14 = getelementptr inbounds i32, i32* %0, i64 16
%15 = tail call i64 @mand8(i32* %14, i32 %1)
%16 = tail call i64 @llvm.fshl.i64(i64 %15, i64 %13, i64 56)
%17 = getelementptr inbounds i32, i32* %0, i64 20
%18 = tail call i64 @mand8(i32* %17, i32 %1)
%19 = tail call i64 @llvm.fshl.i64(i64 %18, i64 %16, i64 56)
%20 = getelementptr inbounds i32, i32* %0, i64 24
%21 = tail call i64 @mand8(i32* %20, i32 %1)
%22 = tail call i64 @llvm.fshl.i64(i64 %21, i64 %19, i64 56)
%23 = getelementptr inbounds i32, i32* %0, i64 28
%24 = tail call i64 @mand8(i32* %23, i32 %1)
%25 = tail call i64 @llvm.fshl.i64(i64 %24, i64 %22, i64 56)
ret i64 %25
}