#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 */
double log10(double);
int texture_feature_entropy(double ***glcm, int n_object, double *entropy) {
  unsigned int i = 0, j = 0, k = 0;
  for (i = 0; i < n_object; i++) {
    for (j = 0; j < 256; j++) {
      for (k = 0; k < 256; k++) {
        entropy[i] += glcm[i][j][k] * log10(glcm[i][j][k] + 0.000000001);
      }
    }
    entropy[i] = -1.0 * entropy[i];
  }
  return 1;
}


x86 assembly (clang, -O0):
<texture_feature_entropy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1229 <texture_feature_entropy+0x119>
movl   $0x0,-0x20(%rbp)
cmpl   $0x100,-0x20(%rbp)
jae    11fb <texture_feature_entropy+0xeb>
movl   $0x0,-0x24(%rbp)
cmpl   $0x100,-0x24(%rbp)
jae    11e8 <texture_feature_entropy+0xd8>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    -0x24(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,8),%rax
mov    -0x24(%rbp),%ecx
movsd  0xe59(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
call   1030 <log10@plt>
movaps %xmm0,%xmm2
movsd  -0x30(%rbp),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1166 <texture_feature_entropy+0x56>
jmp    11ed <texture_feature_entropy+0xdd>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1152 <texture_feature_entropy+0x42>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movsd  0xdf6(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113f <texture_feature_entropy+0x2f>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<texture_feature_entropy>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
je     11c9 <texture_feature_entropy+0xb9>
mov    %rdx,%r12
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
movsd  0xeca(%rip),%xmm1
cs nopw 0x0(%rax,%rax,1)
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rax
mov    (%rax,%r13,8),%rax
movsd  (%rax,%rbp,8),%xmm0
movsd  %xmm0,(%rsp)
addsd  %xmm1,%xmm0
call   1030 <log10@plt>
movsd  0xe7d(%rip),%xmm1
mulsd  (%rsp),%xmm0
addsd  (%r12,%rbx,8),%xmm0
movsd  %xmm0,(%r12,%rbx,8)
add    $0x1,%rbp
cmp    $0x100,%rbp
jne    1160 <texture_feature_entropy+0x50>
add    $0x1,%r13
cmp    $0x100,%r13
jne    1150 <texture_feature_entropy+0x40>
xorpd  0xe5a(%rip),%xmm0
movlpd %xmm0,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %r15,%rbx
jne    1140 <texture_feature_entropy+0x30>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @texture_feature_entropy(double*** %0, i32 %1, double* %2) {
%4 = alloca double***
%5 = alloca i32
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store double*** %0, double**** %4
store i32 %1, i32* %5
store double* %2, double** %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %7
br label %10
10: ; preds = %75, %3
%11 = load i32, i32* %7
%12 = load i32, i32* %5
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %78
14: ; preds = %10
store i32 0, i32* %8
br label %15
15: ; preds = %61, %14
%16 = load i32, i32* %8
%17 = icmp ult i32 %16, 256
br i1 %17, label %18, label %64
18: ; preds = %15
store i32 0, i32* %9
br label %19
19: ; preds = %57, %18
%20 = load i32, i32* %9
%21 = icmp ult i32 %20, 256
br i1 %21, label %22, label %60
22: ; preds = %19
%23 = load double***, double**** %4
%24 = load i32, i32* %7
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds double**, double*** %23, i64 %25
%27 = load double**, double*** %26
%28 = load i32, i32* %8
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds double*, double** %27, i64 %29
%31 = load double*, double** %30
%32 = load i32, i32* %9
%33 = zext i32 %32 to i64
%34 = getelementptr inbounds double, double* %31, i64 %33
%35 = load double, double* %34
%36 = load double***, double**** %4
%37 = load i32, i32* %7
%38 = zext i32 %37 to i64
%39 = getelementptr inbounds double**, double*** %36, i64 %38
%40 = load double**, double*** %39
%41 = load i32, i32* %8
%42 = zext i32 %41 to i64
%43 = getelementptr inbounds double*, double** %40, i64 %42
%44 = load double*, double** %43
%45 = load i32, i32* %9
%46 = zext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
%48 = load double, double* %47
%49 = fadd double %48, 1.000000e-09
%50 = call double @log10(double %49)
%51 = load double*, double** %6
%52 = load i32, i32* %7
%53 = zext i32 %52 to i64
%54 = getelementptr inbounds double, double* %51, i64 %53
%55 = load double, double* %54
%56 = call double @llvm.fmuladd.f64(double %35, double %50, double %55)
store double %56, double* %54
br label %57
57: ; preds = %22
%58 = load i32, i32* %9
%59 = add i32 %58, 1
store i32 %59, i32* %9
br label %19
60: ; preds = %19
br label %61
61: ; preds = %60
%62 = load i32, i32* %8
%63 = add i32 %62, 1
store i32 %63, i32* %8
br label %15
64: ; preds = %15
%65 = load double*, double** %6
%66 = load i32, i32* %7
%67 = zext i32 %66 to i64
%68 = getelementptr inbounds double, double* %65, i64 %67
%69 = load double, double* %68
%70 = fmul double -1.000000e+00, %69
%71 = load double*, double** %6
%72 = load i32, i32* %7
%73 = zext i32 %72 to i64
%74 = getelementptr inbounds double, double* %71, i64 %73
store double %70, double* %74
br label %75
75: ; preds = %64
%76 = load i32, i32* %7
%77 = add i32 %76, 1
store i32 %77, i32* %7
br label %10
78: ; preds = %10
ret i32 1
}

LLVM IR (-O2):
define i32 @texture_feature_entropy(double*** nocapture %0, i32 %1, double* nocapture %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %33, label %5
5: ; preds = %3
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %29
%8 = phi i64 [ 0, %5 ], [ %31, %29 ]
%9 = getelementptr inbounds double**, double*** %0, i64 %8
%10 = getelementptr inbounds double, double* %2, i64 %8
br label %11
11: ; preds = %7, %26
%12 = phi i64 [ 0, %7 ], [ %27, %26 ]
br label %13
13: ; preds = %11, %13
%14 = phi i64 [ 0, %11 ], [ %24, %13 ]
%15 = load double**, double*** %9
%16 = getelementptr inbounds double*, double** %15, i64 %12
%17 = load double*, double** %16
%18 = getelementptr inbounds double, double* %17, i64 %14
%19 = load double, double* %18
%20 = fadd double %19, 1.000000e-09
%21 = tail call double @log10(double %20)
%22 = load double, double* %10
%23 = tail call double @llvm.fmuladd.f64(double %19, double %21, double %22)
store double %23, double* %10
%24 = add nuw nsw i64 %14, 1
%25 = icmp eq i64 %24, 256
br i1 %25, label %26, label %13
26: ; preds = %13
%27 = add nuw nsw i64 %12, 1
%28 = icmp eq i64 %27, 256
br i1 %28, label %29, label %11
29: ; preds = %26
%30 = fneg double %23
store double %30, double* %10
%31 = add nuw nsw i64 %8, 1
%32 = icmp eq i64 %31, %6
br i1 %32, label %33, label %7
33: ; preds = %29, %3
ret i32 1
}