void GradientModulus2D_tensor2D(float *gradient_modulus,
                                float *gradient_argument,
                                float *derivative_along_X1,
                                float *derivative_along_Y1,
                                float *derivative_along_X2,
                                float *derivative_along_Y2, int length,
                                int type) {
  register int i;
  register float *norme = gradient_modulus;
  register float *argu = gradient_argument;
  register float *gx1 = derivative_along_X1;
  register float *gy1 = derivative_along_Y1;
  register float *gx2 = derivative_along_X2;
  register float *gy2 = derivative_along_Y2;
  register int index_max_vp;
  float **wt_tensor;
  float **v;
  float *w;
  double *rv1;
  {
    int z;
    wt_tensor = (float **)malloc(2 * sizeof(float *));
    for (z = 0; z < 2; z++)
      wt_tensor[z] = (float *)malloc(2 * sizeof(float));
    v = (float **)malloc(2 * sizeof(float *));
    for (z = 0; z < 2; z++)
      v[z] = (float *)malloc(2 * sizeof(float));
    w = (float *)malloc(2 * sizeof(float));
    rv1 = (double *)malloc(2 * sizeof(double));
  }
  for (i = 0; i < length; i++, norme++, argu++, gx1++, gy1++, gx2++, gy2++) {
    wt_tensor[0][0] = *gx1;
    wt_tensor[0][1] = *gx2;
    wt_tensor[1][0] = *gy1;
    wt_tensor[1][1] = *gy2;
    dsvd(wt_tensor, 2, 2, w, v, rv1);
    if (type == 1) {
      if (w[0] > w[1]) {
        *norme = w[0];
        index_max_vp = 0;
      } else {
        *norme = w[1];
        index_max_vp = 1;
      }
    } else {
      if (w[0] < w[1]) {
        *norme = w[0];
        index_max_vp = 0;
      } else {
        *norme = w[1];
        index_max_vp = 1;
      }
    }
    *gx1 = (*norme) * wt_tensor[0][index_max_vp];
    *gy1 = (*norme) * wt_tensor[1][index_max_vp];
    if ((*norme) > 0.000001)
      *argu = (float)atan2(*gy1, *gx1);
    else
      *argu = 0.0;
  }
  {
    int z;
    for (z = 0; z < 2; z++) {
      free((void *)wt_tensor[z]);
      free((void *)v[z]);
    }
    free(w);
    free(rv1);
  }
}


x86 assembly (clang, -O0):
<GradientModulus2D_tensor2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,-0x78(%rbp)
movl   $0x0,-0x94(%rbp)
cmpl   $0x2,-0x94(%rbp)
jge    11ee <GradientModulus2D_tensor2D+0xae>
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rdx
mov    -0x78(%rbp),%rax
movslq -0x94(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    11b1 <GradientModulus2D_tensor2D+0x71>
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,-0x80(%rbp)
movl   $0x0,-0x94(%rbp)
cmpl   $0x2,-0x94(%rbp)
jge    1243 <GradientModulus2D_tensor2D+0x103>
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rdx
mov    -0x80(%rbp),%rax
movslq -0x94(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1206 <GradientModulus2D_tensor2D+0xc6>
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x88(%rbp)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,-0x90(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    0x10(%rbp),%eax
jge    14a3 <GradientModulus2D_tensor2D+0x363>
mov    -0x50(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x78(%rbp),%rax
mov    (%rax),%rax
movss  %xmm0,(%rax)
mov    -0x60(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x78(%rbp),%rax
mov    (%rax),%rax
movss  %xmm0,0x4(%rax)
mov    -0x58(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x78(%rbp),%rax
mov    0x8(%rax),%rax
movss  %xmm0,(%rax)
mov    -0x68(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x78(%rbp),%rax
mov    0x8(%rax),%rax
movss  %xmm0,0x4(%rax)
mov    -0x78(%rbp),%rdi
mov    -0x88(%rbp),%rcx
mov    -0x80(%rbp),%r8
mov    -0x90(%rbp),%r9
mov    $0x2,%edx
mov    %edx,%esi
mov    $0x0,%al
call   1060 <dsvd@plt>
cmpl   $0x1,0x18(%rbp)
jne    1351 <GradientModulus2D_tensor2D+0x211>
mov    -0x88(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x88(%rbp),%rax
ucomiss 0x4(%rax),%xmm0
jbe    1331 <GradientModulus2D_tensor2D+0x1f1>
mov    -0x88(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x40(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x0,-0x6c(%rbp)
jmp    134c <GradientModulus2D_tensor2D+0x20c>
mov    -0x88(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x40(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x1,-0x6c(%rbp)
jmp    13b0 <GradientModulus2D_tensor2D+0x270>
mov    -0x88(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x88(%rbp),%rax
movss  0x4(%rax),%xmm0
ucomiss %xmm1,%xmm0
jbe    1390 <GradientModulus2D_tensor2D+0x250>
mov    -0x88(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x40(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x0,-0x6c(%rbp)
jmp    13ab <GradientModulus2D_tensor2D+0x26b>
mov    -0x88(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x40(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x1,-0x6c(%rbp)
jmp    13b0 <GradientModulus2D_tensor2D+0x270>
mov    -0x40(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x78(%rbp),%rax
mov    (%rax),%rax
movslq -0x6c(%rbp),%rcx
mulss  (%rax,%rcx,4),%xmm0
mov    -0x50(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x78(%rbp),%rax
mov    0x8(%rax),%rax
movslq -0x6c(%rbp),%rcx
mulss  (%rax,%rcx,4),%xmm0
mov    -0x58(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xbfb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    143d <GradientModulus2D_tensor2D+0x2fd>
mov    -0x58(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x50(%rbp),%rax
movss  (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
call   1040 <atan2@plt>
cvtsd2ss %xmm0,%xmm0
mov    -0x48(%rbp),%rax
movss  %xmm0,(%rax)
jmp    1448 <GradientModulus2D_tensor2D+0x308>
mov    -0x48(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
jmp    144d <GradientModulus2D_tensor2D+0x30d>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x40(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x40(%rbp)
mov    -0x48(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x50(%rbp)
mov    -0x58(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x58(%rbp)
mov    -0x60(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x60(%rbp)
mov    -0x68(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x68(%rbp)
jmp    126c <GradientModulus2D_tensor2D+0x12c>
movl   $0x0,-0x98(%rbp)
cmpl   $0x2,-0x98(%rbp)
jge    14f6 <GradientModulus2D_tensor2D+0x3b6>
mov    -0x78(%rbp),%rax
movslq -0x98(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x80(%rbp),%rax
movslq -0x98(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x98(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x98(%rbp)
jmp    14ad <GradientModulus2D_tensor2D+0x36d>
mov    -0x88(%rbp),%rdi
call   1030 <free@plt>
mov    -0x90(%rbp),%rdi
call   1030 <free@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GradientModulus2D_tensor2D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,0x50(%rsp)
mov    %r8,0x48(%rsp)
mov    %rcx,0x40(%rsp)
mov    %rdx,0x8(%rsp)
mov    %rsi,0x38(%rsp)
mov    %rdi,0x30(%rsp)
mov    0x98(%rsp),%eax
mov    %eax,0x14(%rsp)
mov    0x90(%rsp),%r13d
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    %rax,(%rbx)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%r12
mov    %rax,0x8(%rbx)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,%rbp
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,0x0(%rbp)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rbp,0x20(%rsp)
mov    %rax,0x8(%rbp)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,0x18(%rsp)
test   %r13d,%r13d
jle    1342 <GradientModulus2D_tensor2D+0x202>
add    $0xffffffff,%r13d
mov    %r13,0x28(%rsp)
xor    %r13d,%r13d
mov    0x40(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rax
movss  (%rax,%r13,4),%xmm0
movss  %xmm0,(%r15)
mov    0x48(%rsp),%rax
movss  (%rax,%r13,4),%xmm0
movss  %xmm0,0x4(%r15)
movss  0x0(%rbp,%r13,4),%xmm0
movss  %xmm0,(%r12)
mov    0x50(%rsp),%rax
movss  (%rax,%r13,4),%xmm0
movss  %xmm0,0x4(%r12)
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
mov    %r14,%rcx
mov    0x20(%rsp),%r8
mov    0x18(%rsp),%r9
xor    %eax,%eax
call   1060 <dsvd@plt>
movss  (%r14),%xmm0
movss  0x4(%r14),%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %al
xor    %ecx,%ecx
ucomiss %xmm1,%xmm0
seta   %cl
cmpl   $0x1,0x14(%rsp)
cmove  %ecx,%eax
test   %al,%al
jne    12ab <GradientModulus2D_tensor2D+0x16b>
movaps %xmm1,%xmm0
xor    $0x1,%al
movzbl %al,%eax
mov    0x30(%rsp),%rdx
movss  %xmm0,(%rdx,%r13,4)
mov    (%rbx),%rcx
mulss  (%rcx,%rax,4),%xmm0
mov    0x8(%rsp),%rcx
movss  %xmm0,(%rcx,%r13,4)
movss  (%rdx,%r13,4),%xmm0
mov    0x8(%rbx),%rcx
mulss  (%rcx,%rax,4),%xmm0
movss  %xmm0,0x0(%rbp,%r13,4)
movss  (%rdx,%r13,4),%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm1,%xmm2
xorps  %xmm1,%xmm1
ucomisd 0xd04(%rip),%xmm2
jbe    131d <GradientModulus2D_tensor2D+0x1dd>
cvtss2sd %xmm0,%xmm0
mov    0x8(%rsp),%rax
movss  (%rax,%r13,4),%xmm1
cvtss2sd %xmm1,%xmm1
call   1040 <atan2@plt>
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
mov    0x38(%rsp),%rax
movss  %xmm1,(%rax,%r13,4)
cmp    %r13d,0x28(%rsp)
je     133f <GradientModulus2D_tensor2D+0x1ff>
mov    (%rbx),%r15
mov    0x8(%rbx),%r12
add    $0x1,%r13
jmp    1220 <GradientModulus2D_tensor2D+0xe0>
mov    (%rbx),%r15
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x20(%rsp),%rbp
mov    0x0(%rbp),%rdi
call   1030 <free@plt>
mov    0x8(%rbx),%rdi
call   1030 <free@plt>
mov    0x8(%rbp),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @GradientModulus2D_tensor2D(float* %0, float* %1, float* %2, float* %3, float* %4, float* %5, i32 %6, i32 %7) {
%9 = alloca float*
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
%13 = alloca float*
%14 = alloca float*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca float*
%19 = alloca float*
%20 = alloca float*
%21 = alloca float*
%22 = alloca float*
%23 = alloca float*
%24 = alloca i32
%25 = alloca float**
%26 = alloca float**
%27 = alloca float*
%28 = alloca double*
%29 = alloca i32
%30 = alloca i32
store float* %0, float** %9
store float* %1, float** %10
store float* %2, float** %11
store float* %3, float** %12
store float* %4, float** %13
store float* %5, float** %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%31 = load float*, float** %9
store float* %31, float** %18
%32 = load float*, float** %10
store float* %32, float** %19
%33 = load float*, float** %11
store float* %33, float** %20
%34 = load float*, float** %12
store float* %34, float** %21
%35 = load float*, float** %13
store float* %35, float** %22
%36 = load float*, float** %14
store float* %36, float** %23
%37 = call i8* @malloc(i64 16)
%38 = bitcast i8* %37 to float**
store float** %38, float*** %25
store i32 0, i32* %29
br label %39
39: ; preds = %49, %8
%40 = load i32, i32* %29
%41 = icmp slt i32 %40, 2
br i1 %41, label %42, label %52
42: ; preds = %39
%43 = call i8* @malloc(i64 8)
%44 = bitcast i8* %43 to float*
%45 = load float**, float*** %25
%46 = load i32, i32* %29
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds float*, float** %45, i64 %47
store float* %44, float** %48
br label %49
49: ; preds = %42
%50 = load i32, i32* %29
%51 = add nsw i32 %50, 1
store i32 %51, i32* %29
br label %39
52: ; preds = %39
%53 = call i8* @malloc(i64 16)
%54 = bitcast i8* %53 to float**
store float** %54, float*** %26
store i32 0, i32* %29
br label %55
55: ; preds = %65, %52
%56 = load i32, i32* %29
%57 = icmp slt i32 %56, 2
br i1 %57, label %58, label %68
58: ; preds = %55
%59 = call i8* @malloc(i64 8)
%60 = bitcast i8* %59 to float*
%61 = load float**, float*** %26
%62 = load i32, i32* %29
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds float*, float** %61, i64 %63
store float* %60, float** %64
br label %65
65: ; preds = %58
%66 = load i32, i32* %29
%67 = add nsw i32 %66, 1
store i32 %67, i32* %29
br label %55
68: ; preds = %55
%69 = call i8* @malloc(i64 8)
%70 = bitcast i8* %69 to float*
store float* %70, float** %27
%71 = call i8* @malloc(i64 16)
%72 = bitcast i8* %71 to double*
store double* %72, double** %28
store i32 0, i32* %17
br label %73
73: ; preds = %187, %68
%74 = load i32, i32* %17
%75 = load i32, i32* %15
%76 = icmp slt i32 %74, %75
br i1 %76, label %77, label %202
77: ; preds = %73
%78 = load float*, float** %20
%79 = load float, float* %78
%80 = load float**, float*** %25
%81 = getelementptr inbounds float*, float** %80, i64 0
%82 = load float*, float** %81
%83 = getelementptr inbounds float, float* %82, i64 0
store float %79, float* %83
%84 = load float*, float** %22
%85 = load float, float* %84
%86 = load float**, float*** %25
%87 = getelementptr inbounds float*, float** %86, i64 0
%88 = load float*, float** %87
%89 = getelementptr inbounds float, float* %88, i64 1
store float %85, float* %89
%90 = load float*, float** %21
%91 = load float, float* %90
%92 = load float**, float*** %25
%93 = getelementptr inbounds float*, float** %92, i64 1
%94 = load float*, float** %93
%95 = getelementptr inbounds float, float* %94, i64 0
store float %91, float* %95
%96 = load float*, float** %23
%97 = load float, float* %96
%98 = load float**, float*** %25
%99 = getelementptr inbounds float*, float** %98, i64 1
%100 = load float*, float** %99
%101 = getelementptr inbounds float, float* %100, i64 1
store float %97, float* %101
%102 = load float**, float*** %25
%103 = load float*, float** %27
%104 = load float**, float*** %26
%105 = load double*, double** %28
%106 = call i32 (float**, i32, i32, float*, float**, double*, ...) bitcast (i32 (...)* @dsvd to i32 (float**, i32, i32, float*, float**, double*, ...)*)(float** %102, i32 2, i32 2, float* %103, float** %104, double* %105)
%107 = load i32, i32* %16
%108 = icmp eq i32 %107, 1
br i1 %108, label %109, label %128
109: ; preds = %77
%110 = load float*, float** %27
%111 = getelementptr inbounds float, float* %110, i64 0
%112 = load float, float* %111
%113 = load float*, float** %27
%114 = getelementptr inbounds float, float* %113, i64 1
%115 = load float, float* %114
%116 = fcmp ogt float %112, %115
br i1 %116, label %117, label %122
117: ; preds = %109
%118 = load float*, float** %27
%119 = getelementptr inbounds float, float* %118, i64 0
%120 = load float, float* %119
%121 = load float*, float** %18
store float %120, float* %121
store i32 0, i32* %24
br label %127
122: ; preds = %109
%123 = load float*, float** %27
%124 = getelementptr inbounds float, float* %123, i64 1
%125 = load float, float* %124
%126 = load float*, float** %18
store float %125, float* %126
store i32 1, i32* %24
br label %127
127: ; preds = %122, %117
br label %147
128: ; preds = %77
%129 = load float*, float** %27
%130 = getelementptr inbounds float, float* %129, i64 0
%131 = load float, float* %130
%132 = load float*, float** %27
%133 = getelementptr inbounds float, float* %132, i64 1
%134 = load float, float* %133
%135 = fcmp olt float %131, %134
br i1 %135, label %136, label %141
136: ; preds = %128
%137 = load float*, float** %27
%138 = getelementptr inbounds float, float* %137, i64 0
%139 = load float, float* %138
%140 = load float*, float** %18
store float %139, float* %140
store i32 0, i32* %24
br label %146
141: ; preds = %128
%142 = load float*, float** %27
%143 = getelementptr inbounds float, float* %142, i64 1
%144 = load float, float* %143
%145 = load float*, float** %18
store float %144, float* %145
store i32 1, i32* %24
br label %146
146: ; preds = %141, %136
br label %147
147: ; preds = %146, %127
%148 = load float*, float** %18
%149 = load float, float* %148
%150 = load float**, float*** %25
%151 = getelementptr inbounds float*, float** %150, i64 0
%152 = load float*, float** %151
%153 = load i32, i32* %24
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds float, float* %152, i64 %154
%156 = load float, float* %155
%157 = fmul float %149, %156
%158 = load float*, float** %20
store float %157, float* %158
%159 = load float*, float** %18
%160 = load float, float* %159
%161 = load float**, float*** %25
%162 = getelementptr inbounds float*, float** %161, i64 1
%163 = load float*, float** %162
%164 = load i32, i32* %24
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds float, float* %163, i64 %165
%167 = load float, float* %166
%168 = fmul float %160, %167
%169 = load float*, float** %21
store float %168, float* %169
%170 = load float*, float** %18
%171 = load float, float* %170
%172 = fpext float %171 to double
%173 = fcmp ogt double %172, 0x3EB0C6F7A0B5ED8D
br i1 %173, label %174, label %184
174: ; preds = %147
%175 = load float*, float** %21
%176 = load float, float* %175
%177 = fpext float %176 to double
%178 = load float*, float** %20
%179 = load float, float* %178
%180 = fpext float %179 to double
%181 = call double @atan2(double %177, double %180)
%182 = fptrunc double %181 to float
%183 = load float*, float** %19
store float %182, float* %183
br label %186
184: ; preds = %147
%185 = load float*, float** %19
store float 0.000000e+00, float* %185
br label %186
186: ; preds = %184, %174
br label %187
187: ; preds = %186
%188 = load i32, i32* %17
%189 = add nsw i32 %188, 1
store i32 %189, i32* %17
%190 = load float*, float** %18
%191 = getelementptr inbounds float, float* %190, i32 1
store float* %191, float** %18
%192 = load float*, float** %19
%193 = getelementptr inbounds float, float* %192, i32 1
store float* %193, float** %19
%194 = load float*, float** %20
%195 = getelementptr inbounds float, float* %194, i32 1
store float* %195, float** %20
%196 = load float*, float** %21
%197 = getelementptr inbounds float, float* %196, i32 1
store float* %197, float** %21
%198 = load float*, float** %22
%199 = getelementptr inbounds float, float* %198, i32 1
store float* %199, float** %22
%200 = load float*, float** %23
%201 = getelementptr inbounds float, float* %200, i32 1
store float* %201, float** %23
br label %73
202: ; preds = %73
store i32 0, i32* %30
br label %203
203: ; preds = %219, %202
%204 = load i32, i32* %30
%205 = icmp slt i32 %204, 2
br i1 %205, label %206, label %222
206: ; preds = %203
%207 = load float**, float*** %25
%208 = load i32, i32* %30
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds float*, float** %207, i64 %209
%211 = load float*, float** %210
%212 = bitcast float* %211 to i8*
%213 = load float**, float*** %26
%214 = load i32, i32* %30
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds float*, float** %213, i64 %215
%217 = load float*, float** %216
%218 = bitcast float* %217 to i8*
br label %219
219: ; preds = %206
%220 = load i32, i32* %30
%221 = add nsw i32 %220, 1
store i32 %221, i32* %30
br label %203
222: ; preds = %203
%223 = load float*, float** %27
%224 = bitcast float* %223 to i8*
%225 = load double*, double** %28
%226 = bitcast double* %225 to i8*
ret void
}

LLVM IR (-O2):
define void @GradientModulus2D_tensor2D(float* nocapture %0, float* nocapture writeonly %1, float* nocapture %2, float* nocapture %3, float* nocapture %4, float* nocapture %5, i32 %6, i32 %7) {
%9 = tail call dereferenceable_or_null(16) i8* @malloc(i64 16)
%10 = bitcast i8* %9 to float**
%11 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%12 = bitcast i8* %9 to i8**
store i8* %11, i8** %12
%13 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%14 = getelementptr inbounds float*, float** %10, i64 1
%15 = bitcast float** %14 to i8**
store i8* %13, i8** %15
%16 = tail call dereferenceable_or_null(16) i8* @malloc(i64 16)
%17 = bitcast i8* %16 to float**
%18 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%19 = bitcast i8* %16 to i8**
store i8* %18, i8** %19
%20 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%21 = getelementptr inbounds float*, float** %17, i64 1
%22 = bitcast float** %21 to i8**
store i8* %20, i8** %22
%23 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%24 = bitcast i8* %23 to float*
%25 = tail call dereferenceable_or_null(16) i8* @malloc(i64 16)
%26 = bitcast i8* %25 to double*
%27 = icmp sgt i32 %6, 0
br i1 %27, label %28, label %35
28: ; preds = %8
%29 = bitcast i8* %13 to float*
%30 = bitcast i8* %11 to float*
%31 = icmp eq i32 %7, 1
%32 = getelementptr inbounds float, float* %24, i64 1
br label %40
33: ; preds = %83
%34 = load i8*, i8** %12
br label %35
35: ; preds = %33, %8
%36 = phi i8* [ %34, %33 ], [ %11, %8 ]
tail call void @free(i8* %36)
%37 = load i8*, i8** %19
tail call void @free(i8* %37)
%38 = load i8*, i8** %15
tail call void @free(i8* %38)
%39 = load i8*, i8** %22
tail call void @free(i8* %39)
tail call void @free(i8* %23)
tail call void @free(i8* %25)
ret void
40: ; preds = %87, %28
%41 = phi float* [ %29, %28 ], [ %95, %87 ]
%42 = phi float* [ %30, %28 ], [ %94, %87 ]
%43 = phi i32 [ 0, %28 ], [ %85, %87 ]
%44 = phi float* [ %0, %28 ], [ %93, %87 ]
%45 = phi float* [ %1, %28 ], [ %92, %87 ]
%46 = phi float* [ %2, %28 ], [ %91, %87 ]
%47 = phi float* [ %5, %28 ], [ %88, %87 ]
%48 = phi float* [ %4, %28 ], [ %89, %87 ]
%49 = phi float* [ %3, %28 ], [ %90, %87 ]
%50 = load float, float* %46
store float %50, float* %42
%51 = load float, float* %48
%52 = getelementptr inbounds float, float* %42, i64 1
store float %51, float* %52
%53 = load float, float* %49
store float %53, float* %41
%54 = load float, float* %47
%55 = getelementptr inbounds float, float* %41, i64 1
store float %54, float* %55
%56 = tail call i32 (float**, i32, i32, float*, float**, double*, ...) bitcast (i32 (...)* @dsvd to i32 (float**, i32, i32, float*, float**, double*, ...)*)(float** %10, i32 2, i32 2, float* %24, float** %17, double* %26)
%57 = load float, float* %24
%58 = load float, float* %32
%59 = fcmp olt float %57, %58
%60 = fcmp ogt float %57, %58
%61 = select i1 %31, i1 %60, i1 %59
%62 = select i1 %61, float %57, float %58
%63 = xor i1 %61, true
%64 = zext i1 %63 to i64
store float %62, float* %44
%65 = load float*, float** %10
%66 = getelementptr inbounds float, float* %65, i64 %64
%67 = load float, float* %66
%68 = fmul float %62, %67
store float %68, float* %46
%69 = load float, float* %44
%70 = load float*, float** %14
%71 = getelementptr inbounds float, float* %70, i64 %64
%72 = load float, float* %71
%73 = fmul float %69, %72
store float %73, float* %49
%74 = load float, float* %44
%75 = fpext float %74 to double
%76 = fcmp ogt double %75, 0x3EB0C6F7A0B5ED8D
br i1 %76, label %77, label %83
77: ; preds = %40
%78 = fpext float %73 to double
%79 = load float, float* %46
%80 = fpext float %79 to double
%81 = tail call double @atan2(double %78, double %80)
%82 = fptrunc double %81 to float
br label %83
83: ; preds = %40, %77
%84 = phi float [ %82, %77 ], [ 0.000000e+00, %40 ]
store float %84, float* %45
%85 = add nuw nsw i32 %43, 1
%86 = icmp eq i32 %85, %6
br i1 %86, label %33, label %87
87: ; preds = %83
%88 = getelementptr inbounds float, float* %47, i64 1
%89 = getelementptr inbounds float, float* %48, i64 1
%90 = getelementptr inbounds float, float* %49, i64 1
%91 = getelementptr inbounds float, float* %46, i64 1
%92 = getelementptr inbounds float, float* %45, i64 1
%93 = getelementptr inbounds float, float* %44, i64 1
%94 = load float*, float** %10
%95 = load float*, float** %14
br label %40
}