#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 unsigned long long uint8_t;
typedef unsigned long long uint64_t;

/* Variables and functions */
void set_block_number_in_tweak(uint8_t *tweak, const uint64_t block_no) {
  tweak[0] = ((block_no >> 56ULL) & 0xff);
  tweak[1] = ((block_no >> 48ULL) & 0xff);
  tweak[2] = ((block_no >> 40ULL) & 0xff);
  tweak[3] = ((block_no >> 32ULL) & 0xff);
  tweak[4] = ((block_no >> 24ULL) & 0xff);
  tweak[5] = ((block_no >> 16ULL) & 0xff);
  tweak[6] = ((block_no >> 8ULL) & 0xff);
  tweak[7] = ((block_no >> 0ULL) & 0xff);
}


x86 assembly (clang, -O0):
<set_block_number_in_tweak>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
shr    $0x38,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x30,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x28,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x20,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x18(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x18,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x10,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x8,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x30(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x0,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x38(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_block_number_in_tweak>:
push   %rbp
push   %rbx
mov    %rsi,%rax
mov    %rsi,%r8
mov    %rsi,%r9
mov    %eax,%ecx
mov    %eax,%edx
movzbl %ah,%ebp
movzbl %al,%ebx
shr    $0x38,%rax
mov    %rax,(%rdi)
shr    $0x30,%r8
movzbl %r8b,%eax
mov    %rax,0x8(%rdi)
shr    $0x28,%r9
movzbl %r9b,%eax
mov    %rax,0x10(%rdi)
shr    $0x20,%rsi
movzbl %sil,%eax
mov    %rax,0x18(%rdi)
shr    $0x18,%ecx
mov    %rcx,0x20(%rdi)
shr    $0x10,%edx
movzbl %dl,%eax
mov    %rax,0x28(%rdi)
mov    %rbp,0x30(%rdi)
mov    %rbx,0x38(%rdi)
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @set_block_number_in_tweak(i64* %0, i64 %1) {
%3 = alloca i64*
%4 = alloca i64
store i64* %0, i64** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = lshr i64 %5, 56
%7 = and i64 %6, 255
%8 = load i64*, i64** %3
%9 = getelementptr inbounds i64, i64* %8, i64 0
store i64 %7, i64* %9
%10 = load i64, i64* %4
%11 = lshr i64 %10, 48
%12 = and i64 %11, 255
%13 = load i64*, i64** %3
%14 = getelementptr inbounds i64, i64* %13, i64 1
store i64 %12, i64* %14
%15 = load i64, i64* %4
%16 = lshr i64 %15, 40
%17 = and i64 %16, 255
%18 = load i64*, i64** %3
%19 = getelementptr inbounds i64, i64* %18, i64 2
store i64 %17, i64* %19
%20 = load i64, i64* %4
%21 = lshr i64 %20, 32
%22 = and i64 %21, 255
%23 = load i64*, i64** %3
%24 = getelementptr inbounds i64, i64* %23, i64 3
store i64 %22, i64* %24
%25 = load i64, i64* %4
%26 = lshr i64 %25, 24
%27 = and i64 %26, 255
%28 = load i64*, i64** %3
%29 = getelementptr inbounds i64, i64* %28, i64 4
store i64 %27, i64* %29
%30 = load i64, i64* %4
%31 = lshr i64 %30, 16
%32 = and i64 %31, 255
%33 = load i64*, i64** %3
%34 = getelementptr inbounds i64, i64* %33, i64 5
store i64 %32, i64* %34
%35 = load i64, i64* %4
%36 = lshr i64 %35, 8
%37 = and i64 %36, 255
%38 = load i64*, i64** %3
%39 = getelementptr inbounds i64, i64* %38, i64 6
store i64 %37, i64* %39
%40 = load i64, i64* %4
%41 = lshr i64 %40, 0
%42 = and i64 %41, 255
%43 = load i64*, i64** %3
%44 = getelementptr inbounds i64, i64* %43, i64 7
store i64 %42, i64* %44
ret void
}

LLVM IR (-O2):
define void @set_block_number_in_tweak(i64* nocapture writeonly %0, i64 %1) {
%3 = lshr i64 %1, 56
store i64 %3, i64* %0
%4 = lshr i64 %1, 48
%5 = and i64 %4, 255
%6 = getelementptr inbounds i64, i64* %0, i64 1
store i64 %5, i64* %6
%7 = lshr i64 %1, 40
%8 = and i64 %7, 255
%9 = getelementptr inbounds i64, i64* %0, i64 2
store i64 %8, i64* %9
%10 = lshr i64 %1, 32
%11 = and i64 %10, 255
%12 = getelementptr inbounds i64, i64* %0, i64 3
store i64 %11, i64* %12
%13 = lshr i64 %1, 24
%14 = and i64 %13, 255
%15 = getelementptr inbounds i64, i64* %0, i64 4
store i64 %14, i64* %15
%16 = lshr i64 %1, 16
%17 = and i64 %16, 255
%18 = getelementptr inbounds i64, i64* %0, i64 5
store i64 %17, i64* %18
%19 = lshr i64 %1, 8
%20 = and i64 %19, 255
%21 = getelementptr inbounds i64, i64* %0, i64 6
store i64 %20, i64* %21
%22 = and i64 %1, 255
%23 = getelementptr inbounds i64, i64* %0, i64 7
store i64 %22, i64* %23
ret void
}