#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 uint8_t;

/* Variables and functions */
void prefix6zero(uint8_t *a, uint8_t prefix) {
  uint8_t i;
  a[prefix / 8] &= 0xff & ~((1 << (8 - (prefix % 8))) - 1);
  for (i = (prefix / 8) + 1; i < 16; i++)
    a[i] = 0;
}


x86 assembly (clang, -O0):
<prefix6zero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0x8,%ecx
sub    %edx,%ecx
mov    $0x1,%eax
shl    %cl,%eax
sub    $0x1,%eax
xor    $0xffffffff,%eax
and    $0xff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
and    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x10,-0x10(%rbp)
jge    118f <prefix6zero+0x8f>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1168 <prefix6zero+0x68>
pop    %rbp
ret

x86 assembly (clang, -O2):
<prefix6zero>:
push   %rax
lea    0x7(%rsi),%eax
test   %esi,%esi
cmovns %esi,%eax
mov    %eax,%ecx
and    $0xfffffff8,%ecx
mov    %esi,%edx
sub    %ecx,%edx
mov    $0x8,%cl
sub    %dl,%cl
sar    $0x3,%eax
cltq
mov    (%rdi,%rax,4),%edx
shr    %cl,%edx
shl    %cl,%edx
movzbl %dl,%ecx
mov    %ecx,(%rdi,%rax,4)
cmp    $0x77,%esi
jg     1161 <prefix6zero+0x51>
lea    (%rdi,%rax,4),%rdi
add    $0x4,%rdi
cmp    $0xf,%eax
mov    $0xe,%ecx
cmovge %eax,%ecx
sub    %eax,%ecx
lea    0x4(,%rcx,4),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @prefix6zero(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = srem i32 %6, 8
%8 = sub nsw i32 8, %7
%9 = shl i32 1, %8
%10 = sub nsw i32 %9, 1
%11 = xor i32 %10, -1
%12 = and i32 255, %11
%13 = load i32*, i32** %3
%14 = load i32, i32* %4
%15 = sdiv i32 %14, 8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %13, i64 %16
%18 = load i32, i32* %17
%19 = and i32 %18, %12
store i32 %19, i32* %17
%20 = load i32, i32* %4
%21 = sdiv i32 %20, 8
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %23
23: ; preds = %31, %2
%24 = load i32, i32* %5
%25 = icmp slt i32 %24, 16
br i1 %25, label %26, label %34
26: ; preds = %23
%27 = load i32*, i32** %3
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
store i32 0, i32* %30
br label %31
31: ; preds = %26
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %23
34: ; preds = %23
ret void
}

LLVM IR (-O2):
define void @prefix6zero(i32* nocapture %0, i32 %1) {
%3 = srem i32 %1, 8
%4 = sub nsw i32 8, %3
%5 = shl nsw i32 -1, %4
%6 = and i32 %5, 255
%7 = sdiv i32 %1, 8
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = and i32 %6, %10
store i32 %11, i32* %9
%12 = icmp slt i32 %1, 120
br i1 %12, label %13, label %22
13: ; preds = %2
%14 = add nsw i64 %8, 1
%15 = getelementptr i32, i32* %0, i64 %14
%16 = bitcast i32* %15 to i8*
%17 = call i32 @llvm.smax.i32(i32 %7, i32 14)
%18 = sub nsw i32 %17, %7
%19 = zext i32 %18 to i64
%20 = shl nuw nsw i64 %19, 2
%21 = add nuw nsw i64 %20, 4
br label %22
22: ; preds = %13, %2
ret void
}