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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ memcpy(void *, void const *, int);
void fill_marker(void *dest, const void *src, size_t n) {
  assert(n >= ((8) * (int)sizeof(uint64_t)) && ((n & (n - 1)) == 0));
  while (n > 0) {
    memcpy(dest, src, ((8) * (int)sizeof(uint64_t)));
    dest = ((8) * (int)sizeof(uint64_t)) + (unsigned char *)dest;
    n -= ((8) * (int)sizeof(uint64_t));
  }
}


x86 assembly (clang, -O0):
<fill_marker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x20,-0x18(%rbp)
mov    %al,-0x19(%rbp)
jb     115d <fill_marker+0x3d>
mov    -0x18(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
cmpq   $0x0,-0x18(%rbp)
jbe    11a4 <fill_marker+0x84>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
sub    $0x20,%rax
mov    %rax,-0x18(%rbp)
jmp    116a <fill_marker+0x4a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_marker>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
cmp    $0x20,%rdx
jb     1148 <fill_marker+0x28>
lea    -0x1(%r15),%rax
xor    %edi,%edi
test   %rax,%r15
sete   %dil
call   1030 <assert@plt>
jmp    1160 <fill_marker+0x40>
xor    %edi,%edi
call   1030 <assert@plt>
test   %r15,%r15
je     117a <fill_marker+0x5a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x20,%edx
call   1040 <memcpy@plt>
add    $0x20,%rbx
add    $0xffffffffffffffe0,%r15
jne    1160 <fill_marker+0x40>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @fill_marker(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i64, i64* %6
%8 = icmp uge i64 %7, 32
br i1 %8, label %9, label %15
9: ; preds = %3
%10 = load i64, i64* %6
%11 = load i64, i64* %6
%12 = sub i64 %11, 1
%13 = and i64 %10, %12
%14 = icmp eq i64 %13, 0
br label %15
15: ; preds = %9, %3
%16 = phi i1 [ false, %3 ], [ %14, %9 ]
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
br label %19
19: ; preds = %22, %15
%20 = load i64, i64* %6
%21 = icmp ugt i64 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = load i8*, i8** %4
%24 = load i8*, i8** %5
%25 = call i32 @memcpy(i8* %23, i8* %24, i32 32)
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 32
store i8* %27, i8** %4
%28 = load i64, i64* %6
%29 = sub i64 %28, 32
store i64 %29, i64* %6
br label %19
30: ; preds = %19
ret void
}

LLVM IR (-O2):
define void @fill_marker(i8* %0, i8* %1, i64 %2) {
%4 = icmp ugt i64 %2, 31
br i1 %4, label %5, label %10
5: ; preds = %3
%6 = tail call i64 @llvm.ctpop.i64(i64 %2)
%7 = icmp ult i64 %6, 2
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
br label %13
10: ; preds = %3
%11 = tail call i32 @assert(i32 0)
%12 = icmp eq i64 %2, 0
br i1 %12, label %21, label %13
13: ; preds = %5, %10
br label %14
14: ; preds = %13, %14
%15 = phi i64 [ %19, %14 ], [ %2, %13 ]
%16 = phi i8* [ %18, %14 ], [ %0, %13 ]
%17 = tail call i32 @memcpy(i8* %16, i8* %1, i32 32)
%18 = getelementptr inbounds i8, i8* %16, i64 32
%19 = add i64 %15, -32
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %14
21: ; preds = %14, %10
ret void
}