#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 activationFunc(int /*<<< orphan*/);
int /*<<< orphan*/ wsum(double *, double *, int);
void recognize(double **neurons, double *image, double *result,
               int rec_images_num, int data_dim) {
  int i;
  for (i = 0; i < rec_images_num; i++) {
    result[i] = activationFunc(wsum(neurons[i], image, data_dim));
  }
}


x86 assembly (clang, -O0):
<recognize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1188 <recognize+0x68>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1040 <wsum@plt>
mov    %eax,%edi
call   1030 <activationFunc@plt>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1142 <recognize+0x22>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recognize>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %ecx,%ecx
jle    1166 <recognize+0x46>
mov    %r8d,%r14d
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%r13
mov    %ecx,%ebp
xor    %ebx,%ebx
nop
mov    0x0(%r13,%rbx,8),%rdi
mov    %r12,%rsi
mov    %r14d,%edx
call   1040 <wsum@plt>
mov    %eax,%edi
call   1030 <activationFunc@plt>
movsd  %xmm0,(%r15,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <recognize+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @recognize(double** nocapture %0, double* %1, double* nocapture writeonly %2, i32 %3, i32 %4) {
%6 = icmp sgt i32 %3, 0
br i1 %6, label %7, label %18
7: ; preds = %5
%8 = zext i32 %3 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ 0, %7 ], [ %16, %9 ]
%11 = getelementptr inbounds double*, double** %0, i64 %10
%12 = load double*, double** %11
%13 = tail call i32 @wsum(double* %12, double* %1, i32 %4)
%14 = tail call double @activationFunc(i32 %13)
%15 = getelementptr inbounds double, double* %2, i64 %10
store double %14, double* %15
%16 = add nuw nsw i64 %10, 1
%17 = icmp eq i64 %16, %8
br i1 %17, label %18, label %9
18: ; preds = %9, %5
ret void
}