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

/* Variables and functions */
void __malloc_deadbeef(void *ptr, size_t size) {
  uint32_t *x = ptr;
  size_t i, n = size / sizeof(uint32_t);
  for (i = 0; i < n; i++) {
    x[i] = 0xdeadbeef;
  }
}


x86 assembly (clang, -O0):
<__malloc_deadbeef>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x2,%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    1156 <__malloc_deadbeef+0x56>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
movl   $0xdeadbeef,(%rax,%rcx,4)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1128 <__malloc_deadbeef+0x28>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__malloc_deadbeef>:
cmp    $0x4,%rsi
jb     1214 <__malloc_deadbeef+0x114>
mov    %rsi,%rax
shr    $0x2,%rax
cmp    $0x20,%rsi
jae    111e <__malloc_deadbeef+0x1e>
xor    %ecx,%ecx
jmp    1204 <__malloc_deadbeef+0x104>
mov    %rax,%rcx
and    $0xfffffffffffffff8,%rcx
lea    -0x8(%rcx),%rdx
mov    %rdx,%rsi
shr    $0x3,%rsi
add    $0x1,%rsi
mov    %esi,%r8d
and    $0x7,%r8d
cmp    $0x38,%rdx
jae    1148 <__malloc_deadbeef+0x48>
xor    %edx,%edx
jmp    11d1 <__malloc_deadbeef+0xd1>
movabs $0x3ffffffffffffff8,%rdx
ff ff 3f
and    %rdx,%rsi
xor    %edx,%edx
movaps 0xea2(%rip),%xmm0
xchg   %ax,%ax
movups %xmm0,(%rdi,%rdx,4)
movups %xmm0,0x10(%rdi,%rdx,4)
movups %xmm0,0x20(%rdi,%rdx,4)
movups %xmm0,0x30(%rdi,%rdx,4)
movups %xmm0,0x40(%rdi,%rdx,4)
movups %xmm0,0x50(%rdi,%rdx,4)
movups %xmm0,0x60(%rdi,%rdx,4)
movups %xmm0,0x70(%rdi,%rdx,4)
movups %xmm0,0x80(%rdi,%rdx,4)
movups %xmm0,0x90(%rdi,%rdx,4)
movups %xmm0,0xa0(%rdi,%rdx,4)
movups %xmm0,0xb0(%rdi,%rdx,4)
movups %xmm0,0xc0(%rdi,%rdx,4)
movups %xmm0,0xd0(%rdi,%rdx,4)
movups %xmm0,0xe0(%rdi,%rdx,4)
movups %xmm0,0xf0(%rdi,%rdx,4)
add    $0x40,%rdx
add    $0xfffffffffffffff8,%rsi
jne    1160 <__malloc_deadbeef+0x60>
test   %r8,%r8
je     120f <__malloc_deadbeef+0x10f>
lea    (%rdi,%rdx,4),%rdx
add    $0x10,%rdx
shl    $0x5,%r8
xor    %esi,%esi
movaps 0xe15(%rip),%xmm0
nopl   0x0(%rax,%rax,1)
movups %xmm0,-0x10(%rdx,%rsi,1)
movups %xmm0,(%rdx,%rsi,1)
add    $0x20,%rsi
cmp    %rsi,%r8
jne    11f0 <__malloc_deadbeef+0xf0>
jmp    120f <__malloc_deadbeef+0x10f>
movl   $0xdeadbeef,(%rdi,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1204 <__malloc_deadbeef+0x104>
ret

LLVM IR (-O0):
define void @__malloc_deadbeef(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%8 = load i8*, i8** %3
%9 = bitcast i8* %8 to i32*
store i32* %9, i32** %5
%10 = load i64, i64* %4
%11 = udiv i64 %10, 4
store i64 %11, i64* %7
store i64 0, i64* %6
br label %12
12: ; preds = %20, %2
%13 = load i64, i64* %6
%14 = load i64, i64* %7
%15 = icmp ult i64 %13, %14
br i1 %15, label %16, label %23
16: ; preds = %12
%17 = load i32*, i32** %5
%18 = load i64, i64* %6
%19 = getelementptr inbounds i32, i32* %17, i64 %18
store i32 -559038737, i32* %19
br label %20
20: ; preds = %16
%21 = load i64, i64* %6
%22 = add i64 %21, 1
store i64 %22, i64* %6
br label %12
23: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @__malloc_deadbeef(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i32*
%4 = icmp ult i64 %1, 4
br i1 %4, label %84, label %5
5: ; preds = %2
%6 = lshr i64 %1, 2
%7 = icmp ult i64 %1, 32
br i1 %7, label %77, label %8
8: ; preds = %5
%9 = and i64 %6, 4611686018427387896
%10 = add nsw i64 %9, -8
%11 = lshr exact i64 %10, 3
%12 = add nuw nsw i64 %11, 1
%13 = and i64 %12, 7
%14 = icmp ult i64 %10, 56
br i1 %14, label %62, label %15
15: ; preds = %8
%16 = and i64 %12, 4611686018427387896
br label %17
17: ; preds = %17, %15
%18 = phi i64 [ 0, %15 ], [ %59, %17 ]
%19 = phi i64 [ 0, %15 ], [ %60, %17 ]
%20 = getelementptr inbounds i32, i32* %3, i64 %18
%21 = bitcast i32* %20 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %21
%22 = getelementptr inbounds i32, i32* %20, i64 4
%23 = bitcast i32* %22 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %23
%24 = or i64 %18, 8
%25 = getelementptr inbounds i32, i32* %3, i64 %24
%26 = bitcast i32* %25 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %26
%27 = getelementptr inbounds i32, i32* %25, i64 4
%28 = bitcast i32* %27 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %28
%29 = or i64 %18, 16
%30 = getelementptr inbounds i32, i32* %3, i64 %29
%31 = bitcast i32* %30 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %31
%32 = getelementptr inbounds i32, i32* %30, i64 4
%33 = bitcast i32* %32 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %33
%34 = or i64 %18, 24
%35 = getelementptr inbounds i32, i32* %3, i64 %34
%36 = bitcast i32* %35 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %36
%37 = getelementptr inbounds i32, i32* %35, i64 4
%38 = bitcast i32* %37 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %38
%39 = or i64 %18, 32
%40 = getelementptr inbounds i32, i32* %3, i64 %39
%41 = bitcast i32* %40 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %41
%42 = getelementptr inbounds i32, i32* %40, i64 4
%43 = bitcast i32* %42 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %43
%44 = or i64 %18, 40
%45 = getelementptr inbounds i32, i32* %3, i64 %44
%46 = bitcast i32* %45 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %46
%47 = getelementptr inbounds i32, i32* %45, i64 4
%48 = bitcast i32* %47 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %48
%49 = or i64 %18, 48
%50 = getelementptr inbounds i32, i32* %3, i64 %49
%51 = bitcast i32* %50 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %51
%52 = getelementptr inbounds i32, i32* %50, i64 4
%53 = bitcast i32* %52 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %53
%54 = or i64 %18, 56
%55 = getelementptr inbounds i32, i32* %3, i64 %54
%56 = bitcast i32* %55 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %56
%57 = getelementptr inbounds i32, i32* %55, i64 4
%58 = bitcast i32* %57 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %58
%59 = add nuw i64 %18, 64
%60 = add nuw i64 %19, 8
%61 = icmp eq i64 %60, %16
br i1 %61, label %62, label %17
62: ; preds = %17, %8
%63 = phi i64 [ 0, %8 ], [ %59, %17 ]
%64 = icmp eq i64 %13, 0
br i1 %64, label %75, label %65
65: ; preds = %62, %65
%66 = phi i64 [ %72, %65 ], [ %63, %62 ]
%67 = phi i64 [ %73, %65 ], [ 0, %62 ]
%68 = getelementptr inbounds i32, i32* %3, i64 %66
%69 = bitcast i32* %68 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %69
%70 = getelementptr inbounds i32, i32* %68, i64 4
%71 = bitcast i32* %70 to <4 x i32>*
store <4 x i32> <i32 -559038737, i32 -559038737, i32 -559038737, i32 -559038737>, <4 x i32>* %71
%72 = add nuw i64 %66, 8
%73 = add i64 %67, 1
%74 = icmp eq i64 %73, %13
br i1 %74, label %75, label %65
75: ; preds = %65, %62
%76 = icmp eq i64 %6, %9
br i1 %76, label %84, label %77
77: ; preds = %5, %75
%78 = phi i64 [ 0, %5 ], [ %9, %75 ]
br label %79
79: ; preds = %77, %79
%80 = phi i64 [ %82, %79 ], [ %78, %77 ]
%81 = getelementptr inbounds i32, i32* %3, i64 %80
store i32 -559038737, i32* %81
%82 = add nuw nsw i64 %80, 1
%83 = icmp eq i64 %82, %6
br i1 %83, label %84, label %79
84: ; preds = %79, %75, %2
ret void
}