#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 INT_MAX;
void _ALG_ResetTileDistances(int (*dest)[320 * 320]) {
  for (int i = 0; i < 320 * 320; ++i) {
    (*dest)[i] = INT_MAX;
  }
}


x86 assembly (clang, -O0):
<_ALG_ResetTileDistances>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x19000,-0xc(%rbp)
jge    113e <_ALG_ResetTileDistances+0x3e>
mov    0x2ec5(%rip),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <_ALG_ResetTileDistances+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ALG_ResetTileDistances>:
mov    0x2ee1(%rip),%rax
lea    0x4(%rax),%rcx
cmp    %rcx,%rdi
jae    115c <_ALG_ResetTileDistances+0x5c>
lea    0x64000(%rdi),%rcx
cmp    0x2eca(%rip),%rcx
jbe    115c <_ALG_ResetTileDistances+0x5c>
mov    $0x4,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%rax),%edx
mov    %edx,-0x10(%rdi,%rcx,4)
mov    (%rax),%edx
mov    %edx,-0xc(%rdi,%rcx,4)
mov    (%rax),%edx
mov    %edx,-0x8(%rdi,%rcx,4)
mov    (%rax),%edx
mov    %edx,-0x4(%rdi,%rcx,4)
mov    (%rax),%edx
mov    %edx,(%rdi,%rcx,4)
add    $0x5,%rcx
cmp    $0x19004,%rcx
jne    1130 <_ALG_ResetTileDistances+0x30>
jmp    1193 <_ALG_ResetTileDistances+0x93>
movd   (%rax),%xmm0
pshufd $0x0,%xmm0,%xmm0
mov    $0xc,%eax
nopw   0x0(%rax,%rax,1)
movdqu %xmm0,-0x30(%rdi,%rax,4)
movdqu %xmm0,-0x20(%rdi,%rax,4)
movdqu %xmm0,-0x10(%rdi,%rax,4)
movdqu %xmm0,(%rdi,%rax,4)
add    $0x10,%rax
cmp    $0x1900c,%rax
jne    1170 <_ALG_ResetTileDistances+0x70>
ret

LLVM IR (-O0):
@INT_MAX = global i32 0
define void @_ALG_ResetTileDistances([102400 x i32]* %0) {
%2 = alloca [102400 x i32]*
%3 = alloca i32
store [102400 x i32]* %0, [102400 x i32]** %2
store i32 0, i32* %3
br label %4
4: ; preds = %13, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 102400
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* @INT_MAX
%9 = load [102400 x i32]*, [102400 x i32]** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [102400 x i32], [102400 x i32]* %9, i64 0, i64 %11
store i32 %8, i32* %12
br label %13
13: ; preds = %7
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %4
16: ; preds = %4
ret void
}

LLVM IR (-O2):
@INT_MAX = global i32 0
define void @_ALG_ResetTileDistances([102400 x i32]* nocapture writeonly %0) {
%2 = getelementptr [102400 x i32], [102400 x i32]* %0, i64 1, i64 0
%3 = icmp ult [102400 x i32]* %0, bitcast (i32* getelementptr inbounds (i32, i32* @INT_MAX, i64 1) to [102400 x i32]*)
%4 = icmp ugt i32* %2, @INT_MAX
%5 = and i1 %3, %4
br i1 %5, label %31, label %6
6: ; preds = %1
%7 = load i32, i32* @INT_MAX
%8 = insertelement <4 x i32> poison, i32 %7, i64 0
%9 = shufflevector <4 x i32> %8, <4 x i32> poison, <4 x i32> zeroinitializer
%10 = insertelement <4 x i32> poison, i32 %7, i64 0
%11 = shufflevector <4 x i32> %10, <4 x i32> poison, <4 x i32> zeroinitializer
%12 = load i32, i32* @INT_MAX
%13 = insertelement <4 x i32> poison, i32 %12, i64 0
%14 = shufflevector <4 x i32> %13, <4 x i32> poison, <4 x i32> zeroinitializer
%15 = insertelement <4 x i32> poison, i32 %12, i64 0
%16 = shufflevector <4 x i32> %15, <4 x i32> poison, <4 x i32> zeroinitializer
br label %17
17: ; preds = %17, %6
%18 = phi i64 [ 0, %6 ], [ %28, %17 ]
%19 = getelementptr inbounds [102400 x i32], [102400 x i32]* %0, i64 0, i64 %18
%20 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> %9, <4 x i32>* %20
%21 = getelementptr inbounds i32, i32* %19, i64 4
%22 = bitcast i32* %21 to <4 x i32>*
store <4 x i32> %11, <4 x i32>* %22
%23 = or i64 %18, 8
%24 = getelementptr inbounds [102400 x i32], [102400 x i32]* %0, i64 0, i64 %23
%25 = bitcast i32* %24 to <4 x i32>*
store <4 x i32> %14, <4 x i32>* %25
%26 = getelementptr inbounds i32, i32* %24, i64 4
%27 = bitcast i32* %26 to <4 x i32>*
store <4 x i32> %16, <4 x i32>* %27
%28 = add nuw nsw i64 %18, 16
%29 = icmp eq i64 %28, 102400
br i1 %29, label %30, label %17
30: ; preds = %17, %31
ret void
31: ; preds = %1, %31
%32 = phi i64 [ %47, %31 ], [ 0, %1 ]
%33 = load i32, i32* @INT_MAX
%34 = getelementptr inbounds [102400 x i32], [102400 x i32]* %0, i64 0, i64 %32
store i32 %33, i32* %34
%35 = add nuw nsw i64 %32, 1
%36 = load i32, i32* @INT_MAX
%37 = getelementptr inbounds [102400 x i32], [102400 x i32]* %0, i64 0, i64 %35
store i32 %36, i32* %37
%38 = add nuw nsw i64 %32, 2
%39 = load i32, i32* @INT_MAX
%40 = getelementptr inbounds [102400 x i32], [102400 x i32]* %0, i64 0, i64 %38
store i32 %39, i32* %40
%41 = add nuw nsw i64 %32, 3
%42 = load i32, i32* @INT_MAX
%43 = getelementptr inbounds [102400 x i32], [102400 x i32]* %0, i64 0, i64 %41
store i32 %42, i32* %43
%44 = add nuw nsw i64 %32, 4
%45 = load i32, i32* @INT_MAX
%46 = getelementptr inbounds [102400 x i32], [102400 x i32]* %0, i64 0, i64 %44
store i32 %45, i32* %46
%47 = add nuw nsw i64 %32, 5
%48 = icmp eq i64 %47, 102400
br i1 %48, label %30, label %31
}