#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 */
struct factory {
  int dummy;
};

/* Variables and functions */
double Distance_Function(int, int, struct factory *);
void Init_Distance_Information_Function(struct factory *factoryInfo,
                                        double (*distance)[100 + 1]) {
  int i, j;
  for (i = 0; i < 100 + 1; i++) {
    for (j = 0; j < 100 + 1; j++) {
      distance[i][j] = Distance_Function(i, j, factoryInfo);
    }
  }
  return;
}


x86 assembly (clang, -O0):
<Init_Distance_Information_Function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x65,-0x14(%rbp)
jge    118d <Init_Distance_Information_Function+0x7d>
movl   $0x0,-0x18(%rbp)
cmpl   $0x65,-0x18(%rbp)
jge    117a <Init_Distance_Information_Function+0x6a>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1030 <Distance_Function@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x328,%rcx,%rcx
add    %rcx,%rax
movslq -0x18(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1138 <Init_Distance_Information_Function+0x28>
jmp    117f <Init_Distance_Information_Function+0x6f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <Init_Distance_Information_Function+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Init_Distance_Information_Function>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12d,%edi
mov    %ebx,%esi
mov    %r14,%rdx
call   1030 <Distance_Function@plt>
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    $0x65,%rbx
jne    1140 <Init_Distance_Information_Function+0x30>
add    $0x1,%r12
add    $0x328,%r15
cmp    $0x65,%r12
jne    1130 <Init_Distance_Information_Function+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
%struct.factory = type { i32 }
define void @Init_Distance_Information_Function(%struct.factory* %0, [101 x double]* nocapture writeonly %1) {
br label %3
3: ; preds = %2, %13
%4 = phi i64 [ 0, %2 ], [ %14, %13 ]
%5 = trunc i64 %4 to i32
br label %6
6: ; preds = %3, %6
%7 = phi i64 [ 0, %3 ], [ %11, %6 ]
%8 = trunc i64 %7 to i32
%9 = tail call double @Distance_Function(i32 %5, i32 %8, %struct.factory* %0)
%10 = getelementptr inbounds [101 x double], [101 x double]* %1, i64 %4, i64 %7
store double %9, double* %10
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, 101
br i1 %12, label %13, label %6
13: ; preds = %6
%14 = add nuw nsw i64 %4, 1
%15 = icmp eq i64 %14, 101
br i1 %15, label %16, label %3
16: ; preds = %13
ret void
}