#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[4] = ((block_no >> 56ULL) & 0x0f);
  tweak[5] = ((block_no >> 48ULL) & 0xff);
  tweak[6] = ((block_no >> 40ULL) & 0xff);
  tweak[7] = ((block_no >> 32ULL) & 0xff);
  tweak[8] = ((block_no >> 24ULL) & 0xff);
  tweak[9] = ((block_no >> 16ULL) & 0xff);
  tweak[10] = ((block_no >> 8ULL) & 0xff);
  tweak[11] = ((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    $0xf,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x20(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x30,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x28(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x28,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x30(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x20,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x38(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x18,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x40(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x10,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x48(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x8,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x50(%rax)
mov    -0x10(%rbp),%rcx
shr    $0x0,%rcx
and    $0xff,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,0x58(%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
and    $0xf,%eax
mov    %rax,0x20(%rdi)
shr    $0x30,%r8
movzbl %r8b,%eax
mov    %rax,0x28(%rdi)
shr    $0x28,%r9
movzbl %r9b,%eax
mov    %rax,0x30(%rdi)
shr    $0x20,%rsi
movzbl %sil,%eax
mov    %rax,0x38(%rdi)
shr    $0x18,%ecx
mov    %rcx,0x40(%rdi)
shr    $0x10,%edx
movzbl %dl,%eax
mov    %rax,0x48(%rdi)
mov    %rbp,0x50(%rdi)
mov    %rbx,0x58(%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, 15
%8 = load i64*, i64** %3
%9 = getelementptr inbounds i64, i64* %8, i64 4
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 5
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 6
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 7
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 8
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 9
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 10
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 11
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
%4 = and i64 %3, 15
%5 = getelementptr inbounds i64, i64* %0, i64 4
store i64 %4, i64* %5
%6 = lshr i64 %1, 48
%7 = and i64 %6, 255
%8 = getelementptr inbounds i64, i64* %0, i64 5
store i64 %7, i64* %8
%9 = lshr i64 %1, 40
%10 = and i64 %9, 255
%11 = getelementptr inbounds i64, i64* %0, i64 6
store i64 %10, i64* %11
%12 = lshr i64 %1, 32
%13 = and i64 %12, 255
%14 = getelementptr inbounds i64, i64* %0, i64 7
store i64 %13, i64* %14
%15 = lshr i64 %1, 24
%16 = and i64 %15, 255
%17 = getelementptr inbounds i64, i64* %0, i64 8
store i64 %16, i64* %17
%18 = lshr i64 %1, 16
%19 = and i64 %18, 255
%20 = getelementptr inbounds i64, i64* %0, i64 9
store i64 %19, i64* %20
%21 = lshr i64 %1, 8
%22 = and i64 %21, 255
%23 = getelementptr inbounds i64, i64* %0, i64 10
store i64 %22, i64* %23
%24 = and i64 %1, 255
%25 = getelementptr inbounds i64, i64* %0, i64 11
store i64 %24, i64* %25
ret void
}