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

/* Variables and functions */
int /*<<< orphan*/ assert(int);
void init_array(int *arr, int val) {
  for (int i = 0; i < 15; i++) {
    arr[i] = val;
  }
  assert(arr[2] == val);
  assert(arr[10] == val);
}


x86 assembly (clang, -O0):
<init_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0xf,-0x10(%rbp)
jge    114c <init_array+0x3c>
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <init_array+0x16>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    0x28(%rax),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_array>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
movd   %esi,%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqu %xmm0,(%rdi)
movdqu %xmm0,0x10(%rdi)
movdqu %xmm0,0x20(%rdi)
mov    %esi,0x30(%rdi)
mov    %esi,0x34(%rdi)
mov    %esi,0x38(%rdi)
mov    $0x1,%edi
call   1030 <assert@plt>
xor    %edi,%edi
cmp    %ebp,0x28(%rbx)
sete   %dil
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <assert@plt>

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

LLVM IR (-O2):
define void @init_array(i32* nocapture %0, i32 %1) {
%3 = insertelement <4 x i32> poison, i32 %1, i64 0
%4 = shufflevector <4 x i32> %3, <4 x i32> poison, <4 x i32> zeroinitializer
%5 = bitcast i32* %0 to <4 x i32>*
store <4 x i32> %4, <4 x i32>* %5
%6 = getelementptr inbounds i32, i32* %0, i64 4
%7 = bitcast i32* %6 to <4 x i32>*
store <4 x i32> %4, <4 x i32>* %7
%8 = getelementptr inbounds i32, i32* %0, i64 8
%9 = getelementptr inbounds i32, i32* %0, i64 10
%10 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> %4, <4 x i32>* %10
%11 = getelementptr inbounds i32, i32* %0, i64 12
store i32 %1, i32* %11
%12 = getelementptr inbounds i32, i32* %0, i64 13
store i32 %1, i32* %12
%13 = getelementptr inbounds i32, i32* %0, i64 14
store i32 %1, i32* %13
%14 = tail call i32 @assert(i32 1)
%15 = load i32, i32* %9
%16 = icmp eq i32 %15, %1
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
ret void
}