#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 scalar_t__ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ __CPROVER_precondition(int /*<<< orphan*/, char *);
int /*<<< orphan*/ __CPROVER_w_ok(void *, size_t);
int /*<<< orphan*/ assert(int);
void *memset_override_0_impl(void *dst, int c, size_t n) {
  __CPROVER_precondition(__CPROVER_w_ok(dst, n),
                         "memset destination region writeable");
  assert(c == 0);
  size_t num_uint64s = n >> 3;
  size_t rem = n & 0x7;
  assert(rem == 0);
  uint64_t *d = (uint64_t *)dst;
  for (size_t i = 0; i < num_uint64s; ++i) {
    d[i] = 0;
  }
  return dst;
}


x86 assembly (clang, -O0):
<memset_override_0_impl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <__CPROVER_w_ok@plt>
mov    %eax,%edi
lea    0xea7(%rip),%rsi
call   1050 <__CPROVER_precondition@plt>
cmpl   $0x0,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x18(%rbp),%rax
shr    $0x3,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
and    $0x7,%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    11d8 <memset_override_0_impl+0xa8>
mov    -0x30(%rbp),%rax
mov    -0x38(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    11a9 <memset_override_0_impl+0x79>
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memset_override_0_impl>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %rdi,%r14
mov    %rdx,%rsi
call   1030 <__CPROVER_w_ok@plt>
lea    0xea5(%rip),%rsi
mov    %eax,%edi
call   1060 <__CPROVER_precondition@plt>
xor    %edi,%edi
test   %ebp,%ebp
sete   %dil
call   1050 <assert@plt>
xor    %edi,%edi
test   $0x7,%bl
sete   %dil
call   1050 <assert@plt>
cmp    $0x8,%rbx
jb     1194 <memset_override_0_impl+0x54>
and    $0xfffffffffffffff8,%rbx
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1040 <memset@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"memset destination region writeable\00"
define i8* @memset_override_0_impl(i8* %0, i32 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64*
%10 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%11 = load i8*, i8** %4
%12 = load i64, i64* %6
%13 = call i32 @__CPROVER_w_ok(i8* %11, i64 %12)
%14 = call i32 @__CPROVER_precondition(i32 %13, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
%19 = load i64, i64* %6
%20 = lshr i64 %19, 3
store i64 %20, i64* %7
%21 = load i64, i64* %6
%22 = and i64 %21, 7
store i64 %22, i64* %8
%23 = load i64, i64* %8
%24 = icmp eq i64 %23, 0
%25 = zext i1 %24 to i32
%26 = call i32 @assert(i32 %25)
%27 = load i8*, i8** %4
%28 = bitcast i8* %27 to i64*
store i64* %28, i64** %9
store i64 0, i64* %10
br label %29
29: ; preds = %37, %3
%30 = load i64, i64* %10
%31 = load i64, i64* %7
%32 = icmp ult i64 %30, %31
br i1 %32, label %33, label %40
33: ; preds = %29
%34 = load i64*, i64** %9
%35 = load i64, i64* %10
%36 = getelementptr inbounds i64, i64* %34, i64 %35
store i64 0, i64* %36
br label %37
37: ; preds = %33
%38 = load i64, i64* %10
%39 = add i64 %38, 1
store i64 %39, i64* %10
br label %29
40: ; preds = %29
%41 = load i8*, i8** %4
ret i8* %41
}

LLVM IR (-O2):
@.str = [36 x i8] c"memset destination region writeable\00"
define i8* @memset_override_0_impl(i8* returned %0, i32 %1, i64 %2) {
%4 = tail call i32 @__CPROVER_w_ok(i8* %0, i64 %2)
%5 = tail call i32 @__CPROVER_precondition(i32 %4, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %1, 0
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = and i64 %2, 7
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = icmp ult i64 %2, 8
br i1 %13, label %16, label %14
14: ; preds = %3
%15 = and i64 %2, -8
br label %16
16: ; preds = %14, %3
ret i8* %0
}