#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 Calculate_Vision_Function(int, int, double **, struct factory *);
double pow(double, int);
void Calculate_Probality_Function(double (*probalityTable)[100 + 1],
                                  double (*pheromone)[100 + 1],
                                  double (*distance)[100 + 1],
                                  struct factory *factoryInfo) {
  int i, j;
  for (i = 0; i < 100 + 1; i++) {
    for (j = 0; j < 100 + 1; j++) {
      if (i != j) {
        probalityTable[i][j] =
            pow(pheromone[i][j], 1) *
            pow(Calculate_Vision_Function(i, j, distance, factoryInfo), 2);
      }
    }
  }
}


x86 assembly (clang, -O0):
<Calculate_Probality_Function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x65,-0x24(%rbp)
jge    11fa <Calculate_Probality_Function+0xda>
movl   $0x0,-0x28(%rbp)
cmpl   $0x65,-0x28(%rbp)
jge    11e7 <Calculate_Probality_Function+0xc7>
mov    -0x24(%rbp),%eax
cmp    -0x28(%rbp),%eax
je     11d4 <Calculate_Probality_Function+0xb4>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
imul   $0x328,%rcx,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    $0x1,%edi
call   1040 <pow@plt>
movsd  %xmm0,-0x30(%rbp)
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <Calculate_Vision_Function@plt>
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
imul   $0x328,%rcx,%rcx
add    %rcx,%rax
movslq -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    11d9 <Calculate_Probality_Function+0xb9>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1150 <Calculate_Probality_Function+0x30>
jmp    11ec <Calculate_Probality_Function+0xcc>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113f <Calculate_Probality_Function+0x1f>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Calculate_Probality_Function>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
xor    %ebx,%ebx
jmp    1158 <Calculate_Probality_Function+0x38>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
add    $0x328,%r13
add    $0x328,%r12
cmp    $0x65,%rbx
je     11ab <Calculate_Probality_Function+0x8b>
xor    %ebp,%ebp
jmp    116a <Calculate_Probality_Function+0x4a>
nopl   0x0(%rax)
add    $0x1,%rbp
cmp    $0x65,%rbp
je     1140 <Calculate_Probality_Function+0x20>
cmp    %rbp,%rbx
je     1160 <Calculate_Probality_Function+0x40>
movsd  (%r12,%rbp,8),%xmm0
mov    $0x1,%edi
call   1040 <pow@plt>
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <Calculate_Vision_Function@plt>
mov    $0x2,%edi
call   1040 <pow@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,0x0(%r13,%rbp,8)
jmp    1160 <Calculate_Probality_Function+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.factory = type { i32 }
define void @Calculate_Probality_Function([101 x double]* %0, [101 x double]* %1, [101 x double]* %2, %struct.factory* %3) {
%5 = alloca [101 x double]*
%6 = alloca [101 x double]*
%7 = alloca [101 x double]*
%8 = alloca %struct.factory*
%9 = alloca i32
%10 = alloca i32
store [101 x double]* %0, [101 x double]** %5
store [101 x double]* %1, [101 x double]** %6
store [101 x double]* %2, [101 x double]** %7
store %struct.factory* %3, %struct.factory** %8
store i32 0, i32* %9
br label %11
11: ; preds = %52, %4
%12 = load i32, i32* %9
%13 = icmp slt i32 %12, 101
br i1 %13, label %14, label %55
14: ; preds = %11
store i32 0, i32* %10
br label %15
15: ; preds = %48, %14
%16 = load i32, i32* %10
%17 = icmp slt i32 %16, 101
br i1 %17, label %18, label %51
18: ; preds = %15
%19 = load i32, i32* %9
%20 = load i32, i32* %10
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %47
22: ; preds = %18
%23 = load [101 x double]*, [101 x double]** %6
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [101 x double], [101 x double]* %23, i64 %25
%27 = load i32, i32* %10
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [101 x double], [101 x double]* %26, i64 0, i64 %28
%30 = load double, double* %29
%31 = call double @pow(double %30, i32 1)
%32 = load i32, i32* %9
%33 = load i32, i32* %10
%34 = load [101 x double]*, [101 x double]** %7
%35 = bitcast [101 x double]* %34 to double**
%36 = load %struct.factory*, %struct.factory** %8
%37 = call double @Calculate_Vision_Function(i32 %32, i32 %33, double** %35, %struct.factory* %36)
%38 = call double @pow(double %37, i32 2)
%39 = fmul double %31, %38
%40 = load [101 x double]*, [101 x double]** %5
%41 = load i32, i32* %9
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds [101 x double], [101 x double]* %40, i64 %42
%44 = load i32, i32* %10
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [101 x double], [101 x double]* %43, i64 0, i64 %45
store double %39, double* %46
br label %47
47: ; preds = %22, %18
br label %48
48: ; preds = %47
%49 = load i32, i32* %10
%50 = add nsw i32 %49, 1
store i32 %50, i32* %10
br label %15
51: ; preds = %15
br label %52
52: ; preds = %51
%53 = load i32, i32* %9
%54 = add nsw i32 %53, 1
store i32 %54, i32* %9
br label %11
55: ; preds = %11
ret void
}

LLVM IR (-O2):
%struct.factory = type { i32 }
define void @Calculate_Probality_Function([101 x double]* nocapture writeonly %0, [101 x double]* nocapture %1, [101 x double]* %2, %struct.factory* %3) {
%5 = bitcast [101 x double]* %2 to double**
br label %6
6: ; preds = %4, %24
%7 = phi i64 [ 0, %4 ], [ %25, %24 ]
%8 = trunc i64 %7 to i32
br label %9
9: ; preds = %6, %21
%10 = phi i64 [ 0, %6 ], [ %22, %21 ]
%11 = icmp eq i64 %7, %10
br i1 %11, label %21, label %12
12: ; preds = %9
%13 = getelementptr inbounds [101 x double], [101 x double]* %1, i64 %7, i64 %10
%14 = load double, double* %13
%15 = tail call double @pow(double %14, i32 1)
%16 = trunc i64 %10 to i32
%17 = tail call double @Calculate_Vision_Function(i32 %8, i32 %16, double** %5, %struct.factory* %3)
%18 = tail call double @pow(double %17, i32 2)
%19 = fmul double %15, %18
%20 = getelementptr inbounds [101 x double], [101 x double]* %0, i64 %7, i64 %10
store double %19, double* %20
br label %21
21: ; preds = %9, %12
%22 = add nuw nsw i64 %10, 1
%23 = icmp eq i64 %22, 101
br i1 %23, label %24, label %9
24: ; preds = %21
%25 = add nuw nsw i64 %7, 1
%26 = icmp eq i64 %25, 101
br i1 %26, label %27, label %6
27: ; preds = %24
ret void
}