#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 M_PI;
scalar_t__ RAND_MAX;
float exp(float);
int generate_gaussian_number(int /*<<< orphan*/, int /*<<< orphan*/);
float pow(float, int);
scalar_t__ rand();
int /*<<< orphan*/ round(float);
float sqrt(float);
int conn_marking_gaussian_3D(int *conn_buffer, short *external_cell,
                             int global_cell_id, int local_nw_size, int nw_size,
                             double probability, int core_id) {
  int total_amount_connections = 0, sender_cell;
  float mean = 0, deviation = 1.0, scale = 20;
  float gaussian_probability;
  float rndm;
  int base_3D = ((int)(pow(nw_size, 0.33333))) + 1;
  int base_3D_squared = base_3D * base_3D;
  int my_x = global_cell_id / base_3D_squared;
  int my_y = (global_cell_id % base_3D_squared) / base_3D;
  int my_z = (global_cell_id % base_3D_squared) % base_3D;
  int sender_x, sender_y, sender_z;
  float average_connections = nw_size * probability;
  if (probability == 0)
    total_amount_connections = 0;
  else
    total_amount_connections = generate_gaussian_number(
        round(average_connections * 0.9), round(average_connections * 1.1));
  float const1 = 2.5 / (deviation * sqrt(2 * M_PI));
  float const2 = -(1 / (2 * pow(deviation, 2)));
  float distance_3D = 0.0;
  int connections_found = 0;
  while (connections_found < total_amount_connections) {
    for (sender_cell = 0; sender_cell < nw_size; sender_cell++) {
      if (connections_found >= total_amount_connections)
        break;
      if (sender_cell == global_cell_id)
        ;
      else if (conn_buffer[sender_cell])
        ;
      else {
        sender_x = sender_cell / base_3D_squared;
        sender_y = (sender_cell % base_3D_squared) / base_3D;
        sender_z = (sender_cell % base_3D_squared) % base_3D;
        distance_3D = (sqrt(pow(my_x - sender_x, 2) + pow(my_y - sender_y, 2) +
                            pow(my_z - sender_z, 2))) /
                      scale;
        gaussian_probability =
            const1 * exp(pow(distance_3D - mean, 2) * const2);
        rndm = ((float)rand()) / ((float)RAND_MAX);
        if (rndm <= gaussian_probability) {
          conn_buffer[sender_cell]++;
          connections_found++;
          if ((sender_cell / local_nw_size) != core_id)
            external_cell[sender_cell] = 1;
        }
      }
    }
  }
  return connections_found;
}


x86 assembly (clang, -O0):
<conn_marking_gaussian_3D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  0xe67(%rip),%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  0xe56(%rip),%xmm0
movss  %xmm0,-0x40(%rbp)
cvtsi2ssl -0x1c(%rbp),%xmm0
xor    %edi,%edi
call   1050 <pow@plt>
cvttss2si %xmm0,%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
imul   -0x4c(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x50(%rbp)
mov    %eax,-0x54(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x50(%rbp)
mov    %edx,%eax
cltd
idivl  -0x4c(%rbp)
mov    %eax,-0x58(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x50(%rbp)
mov    %edx,%eax
cltd
idivl  -0x4c(%rbp)
mov    %edx,-0x5c(%rbp)
cvtsi2sdl -0x1c(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x6c(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1230 <conn_marking_gaussian_3D+0xd0>
jp     1230 <conn_marking_gaussian_3D+0xd0>
movl   $0x0,-0x30(%rbp)
jmp    127c <conn_marking_gaussian_3D+0x11c>
movss  -0x6c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdd7(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <round@plt>
mov    %eax,-0x80(%rbp)
movss  -0x6c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdae(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <round@plt>
mov    -0x80(%rbp),%edi
mov    %eax,%esi
call   1030 <generate_gaussian_number@plt>
mov    %eax,-0x30(%rbp)
movss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x84(%rbp)
ff
mov    0x2d58(%rip),%rax
mov    (%rax),%eax
shl    $0x1,%eax
cvtsi2ss %eax,%xmm0
call   1070 <sqrt@plt>
movaps %xmm0,%xmm1
movss  -0x84(%rbp),%xmm0
ff
mulss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd67(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x70(%rbp)
movss  -0x3c(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
movss  0xd2b(%rip),%xmm1
mulss  %xmm0,%xmm1
movss  0xd1b(%rip),%xmm0
divss  %xmm1,%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x74(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    14db <conn_marking_gaussian_3D+0x37b>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    14d6 <conn_marking_gaussian_3D+0x376>
mov    -0x7c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jl     133e <conn_marking_gaussian_3D+0x1de>
jmp    14d6 <conn_marking_gaussian_3D+0x376>
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    134f <conn_marking_gaussian_3D+0x1ef>
jmp    14c3 <conn_marking_gaussian_3D+0x363>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     1366 <conn_marking_gaussian_3D+0x206>
jmp    14be <conn_marking_gaussian_3D+0x35e>
mov    -0x34(%rbp),%eax
cltd
idivl  -0x50(%rbp)
mov    %eax,-0x60(%rbp)
mov    -0x34(%rbp),%eax
cltd
idivl  -0x50(%rbp)
mov    %edx,%eax
cltd
idivl  -0x4c(%rbp)
mov    %eax,-0x64(%rbp)
mov    -0x34(%rbp),%eax
cltd
idivl  -0x50(%rbp)
mov    %edx,%eax
cltd
idivl  -0x4c(%rbp)
mov    %edx,-0x68(%rbp)
mov    -0x54(%rbp),%eax
sub    -0x60(%rbp),%eax
cvtsi2ss %eax,%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
movss  %xmm0,-0x90(%rbp)
ff
mov    -0x58(%rbp),%eax
sub    -0x64(%rbp),%eax
cvtsi2ss %eax,%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x90(%rbp),%xmm0
ff
addss  %xmm1,%xmm0
movss  %xmm0,-0x8c(%rbp)
ff
mov    -0x5c(%rbp),%eax
sub    -0x68(%rbp),%eax
cvtsi2ss %eax,%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movss  -0x8c(%rbp),%xmm0
ff
addss  %xmm1,%xmm0
call   1070 <sqrt@plt>
divss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x78(%rbp)
movss  -0x70(%rbp),%xmm0
movss  %xmm0,-0x88(%rbp)
ff
movss  -0x78(%rbp),%xmm0
subss  -0x38(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mulss  -0x74(%rbp),%xmm0
call   1040 <exp@plt>
movaps %xmm0,%xmm1
movss  -0x88(%rbp),%xmm0
ff
mulss  %xmm1,%xmm0
movss  %xmm0,-0x44(%rbp)
mov    $0x0,%al
call   1080 <rand@plt>
cvtsi2ss %rax,%xmm0
mov    0x2b85(%rip),%rax
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x48(%rbp),%xmm1
movss  -0x44(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     14b9 <conn_marking_gaussian_3D+0x359>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
add    $0x1,%edx
mov    %edx,(%rax,%rcx,4)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x34(%rbp),%eax
cltd
idivl  -0x18(%rbp)
cmp    -0x2c(%rbp),%eax
je     14b4 <conn_marking_gaussian_3D+0x354>
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movw   $0x1,(%rax,%rcx,2)
jmp    14b9 <conn_marking_gaussian_3D+0x359>
jmp    14be <conn_marking_gaussian_3D+0x35e>
jmp    14c3 <conn_marking_gaussian_3D+0x363>
jmp    14c8 <conn_marking_gaussian_3D+0x368>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1321 <conn_marking_gaussian_3D+0x1c1>
jmp    130e <conn_marking_gaussian_3D+0x1ae>
mov    -0x7c(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conn_marking_gaussian_3D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9d,0x28(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %ecx,0x24(%rsp)
mov    %edx,%r13d
mov    %rsi,0x48(%rsp)
mov    %rdi,%r14
mov    %r8d,0x14(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %r8d,%xmm0
xor    %ebx,%ebx
xor    %edi,%edi
call   1050 <pow@plt>
movsd  0x8(%rsp),%xmm1
cvttss2si %xmm0,%ecx
add    $0x1,%ecx
mov    %ecx,%esi
imul   %ecx,%esi
mov    %r13d,%eax
cltd
mov    %esi,0x40(%rsp)
idiv   %esi
mov    %eax,0x3c(%rsp)
mov    %edx,%eax
cltd
mov    %ecx,0x44(%rsp)
idiv   %ecx
mov    %eax,0x38(%rsp)
mov    %edx,0x34(%rsp)
xorps  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jne    11da <conn_marking_gaussian_3D+0x7a>
jnp    1231 <conn_marking_gaussian_3D+0xd1>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x14(%rsp),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xe00(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <round@plt>
mov    %eax,%ebp
movsd  0x8(%rsp),%xmm0
mulsd  0xdeb(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <round@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <generate_gaussian_number@plt>
mov    %eax,%ebx
mov    0x2db0(%rip),%rax
mov    (%rax),%eax
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
xorpd  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1252 <conn_marking_gaussian_3D+0xf2>
sqrtss %xmm0,%xmm0
jmp    1257 <conn_marking_gaussian_3D+0xf7>
call   1070 <sqrt@plt>
movss  %xmm0,0x8(%rsp)
movss  0xdaf(%rip),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
test   %ebx,%ebx
jle    141b <conn_marking_gaussian_3D+0x2bb>
movss  0xd91(%rip),%xmm1
divss  0x8(%rsp),%xmm1
movss  %xmm1,0x30(%rsp)
addss  %xmm0,%xmm0
movss  0xd81(%rip),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x2c(%rsp)
mov    %r13d,%eax
movslq 0x14(%rsp),%r12
xor    %r13d,%r13d
mov    %r14,0x50(%rsp)
mov    %rax,0x18(%rsp)
jmp    12c9 <conn_marking_gaussian_3D+0x169>
nopl   0x0(%rax,%rax,1)
cmp    %ebx,%r13d
jge    141e <conn_marking_gaussian_3D+0x2be>
cmpl   $0x0,0x14(%rsp)
jle    12c0 <conn_marking_gaussian_3D+0x160>
cmp    %ebx,%r13d
jge    12c0 <conn_marking_gaussian_3D+0x160>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
cmp    %rbp,%rax
je     1400 <conn_marking_gaussian_3D+0x2a0>
cmpl   $0x0,(%r14,%rbp,4)
jne    1400 <conn_marking_gaussian_3D+0x2a0>
mov    %ebp,%eax
xor    %edx,%edx
divl   0x40(%rsp)
mov    %eax,%ecx
mov    %edx,%eax
cltd
idivl  0x44(%rsp)
mov    %eax,%r15d
mov    %edx,%r14d
mov    0x3c(%rsp),%eax
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
movss  %xmm0,0x8(%rsp)
mov    0x38(%rsp),%eax
sub    %r15d,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
addss  0x8(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
mov    0x34(%rsp),%eax
sub    %r14d,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
addss  0x8(%rsp),%xmm0
ucomiss 0xcaf(%rip),%xmm0
jb     1379 <conn_marking_gaussian_3D+0x219>
sqrtss %xmm0,%xmm0
jmp    137e <conn_marking_gaussian_3D+0x21e>
call   1070 <sqrt@plt>
divss  0xc96(%rip),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mulss  0x2c(%rsp),%xmm0
call   1040 <exp@plt>
mulss  0x30(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1080 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
mov    0x2c23(%rip),%rax
xorps  %xmm1,%xmm1
cvtsi2ssq (%rax),%xmm1
divss  %xmm1,%xmm0
movss  0x8(%rsp),%xmm1
ucomiss %xmm0,%xmm1
mov    0x50(%rsp),%r14
jb     13fa <conn_marking_gaussian_3D+0x29a>
addl   $0x1,(%r14,%rbp,4)
add    $0x1,%r13d
mov    %ebp,%eax
cltd
idivl  0x24(%rsp)
cmp    0x28(%rsp),%eax
je     13fa <conn_marking_gaussian_3D+0x29a>
mov    0x48(%rsp),%rax
movw   $0x1,(%rax,%rbp,2)
mov    0x18(%rsp),%rax
nop
add    $0x1,%rbp
cmp    %r12,%rbp
jge    12c0 <conn_marking_gaussian_3D+0x160>
cmp    %ebx,%r13d
jl     12e0 <conn_marking_gaussian_3D+0x180>
jmp    12c0 <conn_marking_gaussian_3D+0x160>
xor    %r13d,%r13d
mov    %r13d,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global i32 0
@RAND_MAX = global i64 0
define i32 @conn_marking_gaussian_3D(i32* %0, i16* %1, i32 %2, i32 %3, i32 %4, double %5, i32 %6) {
%8 = alloca i32*
%9 = alloca i16*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca double
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float
%21 = alloca float
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca float
%31 = alloca float
%32 = alloca float
%33 = alloca float
%34 = alloca i32
store i32* %0, i32** %8
store i16* %1, i16** %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store double %5, double* %13
store i32 %6, i32* %14
store i32 0, i32* %15
store float 0.000000e+00, float* %17
store float 1.000000e+00, float* %18
store float 2.000000e+01, float* %19
%35 = load i32, i32* %12
%36 = sitofp i32 %35 to float
%37 = call float @pow(float %36, i32 0)
%38 = fptosi float %37 to i32
%39 = add nsw i32 %38, 1
store i32 %39, i32* %22
%40 = load i32, i32* %22
%41 = load i32, i32* %22
%42 = mul nsw i32 %40, %41
store i32 %42, i32* %23
%43 = load i32, i32* %10
%44 = load i32, i32* %23
%45 = sdiv i32 %43, %44
store i32 %45, i32* %24
%46 = load i32, i32* %10
%47 = load i32, i32* %23
%48 = srem i32 %46, %47
%49 = load i32, i32* %22
%50 = sdiv i32 %48, %49
store i32 %50, i32* %25
%51 = load i32, i32* %10
%52 = load i32, i32* %23
%53 = srem i32 %51, %52
%54 = load i32, i32* %22
%55 = srem i32 %53, %54
store i32 %55, i32* %26
%56 = load i32, i32* %12
%57 = sitofp i32 %56 to double
%58 = load double, double* %13
%59 = fmul double %57, %58
%60 = fptrunc double %59 to float
store float %60, float* %30
%61 = load double, double* %13
%62 = fcmp oeq double %61, 0.000000e+00
br i1 %62, label %63, label %64
63: ; preds = %7
store i32 0, i32* %15
br label %76
64: ; preds = %7
%65 = load float, float* %30
%66 = fpext float %65 to double
%67 = fmul double %66, 9.000000e-01
%68 = fptrunc double %67 to float
%69 = call i32 @round(float %68)
%70 = load float, float* %30
%71 = fpext float %70 to double
%72 = fmul double %71, 1.100000e+00
%73 = fptrunc double %72 to float
%74 = call i32 @round(float %73)
%75 = call i32 @generate_gaussian_number(i32 %69, i32 %74)
store i32 %75, i32* %15
br label %76
76: ; preds = %64, %63
%77 = load float, float* %18
%78 = load i32, i32* @M_PI
%79 = mul nsw i32 2, %78
%80 = sitofp i32 %79 to float
%81 = call float @sqrt(float %80)
%82 = fmul float %77, %81
%83 = fpext float %82 to double
%84 = fdiv double 2.500000e+00, %83
%85 = fptrunc double %84 to float
store float %85, float* %31
%86 = load float, float* %18
%87 = call float @pow(float %86, i32 2)
%88 = fmul float 2.000000e+00, %87
%89 = fdiv float 1.000000e+00, %88
%90 = fneg float %89
store float %90, float* %32
store float 0.000000e+00, float* %33
store i32 0, i32* %34
br label %91
91: ; preds = %195, %76
%92 = load i32, i32* %34
%93 = load i32, i32* %15
%94 = icmp slt i32 %92, %93
br i1 %94, label %95, label %196
95: ; preds = %91
store i32 0, i32* %16
br label %96
96: ; preds = %192, %95
%97 = load i32, i32* %16
%98 = load i32, i32* %12
%99 = icmp slt i32 %97, %98
br i1 %99, label %100, label %195
100: ; preds = %96
%101 = load i32, i32* %34
%102 = load i32, i32* %15
%103 = icmp sge i32 %101, %102
br i1 %103, label %104, label %105
104: ; preds = %100
br label %195
105: ; preds = %100
%106 = load i32, i32* %16
%107 = load i32, i32* %10
%108 = icmp eq i32 %106, %107
br i1 %108, label %109, label %110
109: ; preds = %105
br label %191
110: ; preds = %105
%111 = load i32*, i32** %8
%112 = load i32, i32* %16
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds i32, i32* %111, i64 %113
%115 = load i32, i32* %114
%116 = icmp ne i32 %115, 0
br i1 %116, label %117, label %118
117: ; preds = %110
br label %190
118: ; preds = %110
%119 = load i32, i32* %16
%120 = load i32, i32* %23
%121 = sdiv i32 %119, %120
store i32 %121, i32* %27
%122 = load i32, i32* %16
%123 = load i32, i32* %23
%124 = srem i32 %122, %123
%125 = load i32, i32* %22
%126 = sdiv i32 %124, %125
store i32 %126, i32* %28
%127 = load i32, i32* %16
%128 = load i32, i32* %23
%129 = srem i32 %127, %128
%130 = load i32, i32* %22
%131 = srem i32 %129, %130
store i32 %131, i32* %29
%132 = load i32, i32* %24
%133 = load i32, i32* %27
%134 = sub nsw i32 %132, %133
%135 = sitofp i32 %134 to float
%136 = call float @pow(float %135, i32 2)
%137 = load i32, i32* %25
%138 = load i32, i32* %28
%139 = sub nsw i32 %137, %138
%140 = sitofp i32 %139 to float
%141 = call float @pow(float %140, i32 2)
%142 = fadd float %136, %141
%143 = load i32, i32* %26
%144 = load i32, i32* %29
%145 = sub nsw i32 %143, %144
%146 = sitofp i32 %145 to float
%147 = call float @pow(float %146, i32 2)
%148 = fadd float %142, %147
%149 = call float @sqrt(float %148)
%150 = load float, float* %19
%151 = fdiv float %149, %150
store float %151, float* %33
%152 = load float, float* %31
%153 = load float, float* %33
%154 = load float, float* %17
%155 = fsub float %153, %154
%156 = call float @pow(float %155, i32 2)
%157 = load float, float* %32
%158 = fmul float %156, %157
%159 = call float @exp(float %158)
%160 = fmul float %152, %159
store float %160, float* %20
%161 = call i64 (...) @rand()
%162 = sitofp i64 %161 to float
%163 = load i64, i64* @RAND_MAX
%164 = sitofp i64 %163 to float
%165 = fdiv float %162, %164
store float %165, float* %21
%166 = load float, float* %21
%167 = load float, float* %20
%168 = fcmp ole float %166, %167
br i1 %168, label %169, label %189
169: ; preds = %118
%170 = load i32*, i32** %8
%171 = load i32, i32* %16
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds i32, i32* %170, i64 %172
%174 = load i32, i32* %173
%175 = add nsw i32 %174, 1
store i32 %175, i32* %173
%176 = load i32, i32* %34
%177 = add nsw i32 %176, 1
store i32 %177, i32* %34
%178 = load i32, i32* %16
%179 = load i32, i32* %11
%180 = sdiv i32 %178, %179
%181 = load i32, i32* %14
%182 = icmp ne i32 %180, %181
br i1 %182, label %183, label %188
183: ; preds = %169
%184 = load i16*, i16** %9
%185 = load i32, i32* %16
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds i16, i16* %184, i64 %186
store i16 1, i16* %187
br label %188
188: ; preds = %183, %169
br label %189
189: ; preds = %188, %118
br label %190
190: ; preds = %189, %117
br label %191
191: ; preds = %190, %109
br label %192
192: ; preds = %191
%193 = load i32, i32* %16
%194 = add nsw i32 %193, 1
store i32 %194, i32* %16
br label %96
195: ; preds = %104, %96
br label %91
196: ; preds = %91
%197 = load i32, i32* %34
ret i32 %197
}

LLVM IR (-O2):
@M_PI = global i32 0
@RAND_MAX = global i64 0
define i32 @conn_marking_gaussian_3D(i32* nocapture %0, i16* nocapture writeonly %1, i32 %2, i32 %3, i32 %4, double %5, i32 %6) {
%8 = sitofp i32 %4 to float
%9 = tail call float @pow(float %8, i32 0)
%10 = fptosi float %9 to i32
%11 = add nsw i32 %10, 1
%12 = mul nsw i32 %11, %11
%13 = sdiv i32 %2, %12
%14 = srem i32 %2, %12
%15 = sdiv i32 %14, %11
%16 = srem i32 %14, %11
%17 = fcmp oeq double %5, 0.000000e+00
br i1 %17, label %30, label %18
18: ; preds = %7
%19 = sitofp i32 %4 to double
%20 = fmul double %19, %5
%21 = fptrunc double %20 to float
%22 = fpext float %21 to double
%23 = fmul double %22, 9.000000e-01
%24 = fptrunc double %23 to float
%25 = tail call i32 @round(float %24)
%26 = fmul double %22, 1.100000e+00
%27 = fptrunc double %26 to float
%28 = tail call i32 @round(float %27)
%29 = tail call i32 @generate_gaussian_number(i32 %25, i32 %28)
br label %30
30: ; preds = %7, %18
%31 = phi i32 [ %29, %18 ], [ 0, %7 ]
%32 = load i32, i32* @M_PI
%33 = shl nsw i32 %32, 1
%34 = sitofp i32 %33 to float
%35 = tail call float @sqrt(float %34)
%36 = fdiv float 2.500000e+00, %35
%37 = tail call float @pow(float 1.000000e+00, i32 2)
%38 = fmul float %37, 2.000000e+00
%39 = fdiv float -1.000000e+00, %38
%40 = icmp sgt i32 %31, 0
br i1 %40, label %41, label %103
41: ; preds = %30
%42 = icmp sgt i32 %4, 0
%43 = zext i32 %2 to i64
%44 = sext i32 %4 to i64
br label %48
45: ; preds = %97, %48
%46 = phi i32 [ %49, %48 ], [ %98, %97 ]
%47 = icmp slt i32 %46, %31
br i1 %47, label %48, label %103
48: ; preds = %41, %45
%49 = phi i32 [ 0, %41 ], [ %46, %45 ]
%50 = icmp slt i32 %49, %31
%51 = select i1 %42, i1 %50, i1 false
br i1 %51, label %52, label %45
52: ; preds = %48, %97
%53 = phi i64 [ %99, %97 ], [ 0, %48 ]
%54 = phi i32 [ %98, %97 ], [ %49, %48 ]
%55 = icmp eq i64 %53, %43
br i1 %55, label %97, label %56
56: ; preds = %52
%57 = getelementptr inbounds i32, i32* %0, i64 %53
%58 = load i32, i32* %57
%59 = icmp eq i32 %58, 0
br i1 %59, label %60, label %97
60: ; preds = %56
%61 = trunc i64 %53 to i32
%62 = udiv i32 %61, %12
%63 = urem i32 %61, %12
%64 = sdiv i32 %63, %11
%65 = srem i32 %63, %11
%66 = sub nsw i32 %13, %62
%67 = sitofp i32 %66 to float
%68 = tail call float @pow(float %67, i32 2)
%69 = sub nsw i32 %15, %64
%70 = sitofp i32 %69 to float
%71 = tail call float @pow(float %70, i32 2)
%72 = fadd float %68, %71
%73 = sub nsw i32 %16, %65
%74 = sitofp i32 %73 to float
%75 = tail call float @pow(float %74, i32 2)
%76 = fadd float %72, %75
%77 = tail call float @sqrt(float %76)
%78 = fdiv float %77, 2.000000e+01
%79 = tail call float @pow(float %78, i32 2)
%80 = fmul float %39, %79
%81 = tail call float @exp(float %80)
%82 = fmul float %36, %81
%83 = tail call i64 (...) @rand()
%84 = sitofp i64 %83 to float
%85 = load i64, i64* @RAND_MAX
%86 = sitofp i64 %85 to float
%87 = fdiv float %84, %86
%88 = fcmp ugt float %87, %82
br i1 %88, label %97, label %89
89: ; preds = %60
%90 = load i32, i32* %57
%91 = add nsw i32 %90, 1
store i32 %91, i32* %57
%92 = add nsw i32 %54, 1
%93 = sdiv i32 %61, %3
%94 = icmp eq i32 %93, %6
br i1 %94, label %97, label %95
95: ; preds = %89
%96 = getelementptr inbounds i16, i16* %1, i64 %53
store i16 1, i16* %96
br label %97
97: ; preds = %52, %60, %95, %89, %56
%98 = phi i32 [ %54, %52 ], [ %54, %56 ], [ %92, %95 ], [ %92, %89 ], [ %54, %60 ]
%99 = add nuw nsw i64 %53, 1
%100 = icmp slt i64 %99, %44
%101 = icmp slt i32 %98, %31
%102 = select i1 %100, i1 %101, i1 false
br i1 %102, label %52, label %45
103: ; preds = %45, %30
%104 = phi i32 [ 0, %30 ], [ %46, %45 ]
ret i32 %104
}