#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 /*<<< orphan*/ actFun(double *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
void testAcfun() {
  double arr[4] = {0, 2, 3, 4};
  actFun((double *)arr, 4);
  if (arr[0] == 0.5) {
    printf("Activition function works fine\n");
  } else {
    fprintf(stderr, "Problem with Activition function\n");
  }
}


x86 assembly (clang, -O0):
<testAcfun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
call   1050 <actFun@plt>
movsd  -0x20(%rbp),%xmm0
movsd  0xe81(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11a0 <testAcfun+0x70>
jp     11a0 <testAcfun+0x70>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
jmp    11b5 <testAcfun+0x85>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testAcfun>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
call   1050 <actFun@plt>
movsd  (%rsp),%xmm0
ucomisd 0xe9b(%rip),%xmm0
jne    117a <testAcfun+0x4a>
jp     117a <testAcfun+0x4a>
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
add    $0x28,%rsp
ret
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
lea    0xea6(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.testAcfun.arr = [4 x double] [double 0.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00]
@.str = [32 x i8] c"Activition function works fine\0A\00"
@stderr = global i32 0
@.str.1 = [34 x i8] c"Problem with Activition function\0A\00"
define void @testAcfun() {
%1 = alloca [4 x double]
%2 = bitcast [4 x double]* %1 to i8*
%3 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 0
%4 = call i32 @actFun(double* %3, i32 4)
%5 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 0
%6 = load double, double* %5
%7 = fcmp oeq double %6, 5.000000e-01
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %13
10: ; preds = %0
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %10, %8
ret void
}

LLVM IR (-O2):
@__const.testAcfun.arr = [4 x double] [double 0.000000e+00, double 2.000000e+00, double 3.000000e+00, double 4.000000e+00]
@stderr = global i32 0
@.str.1 = [34 x i8] c"Problem with Activition function\0A\00"
@str = [31 x i8] c"Activition function works fine\00"
define void @testAcfun() {
%1 = alloca [4 x double]
%2 = bitcast [4 x double]* %1 to i8*
%3 = getelementptr inbounds [4 x double], [4 x double]* %1, i64 0, i64 0
%4 = call i32 @actFun(double* %3, i32 4)
%5 = load double, double* %3
%6 = fcmp oeq double %5, 5.000000e-01
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
br label %12
9: ; preds = %0
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %9, %7
ret void
}