#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 pow(double, double);
int NonlinearDAE_f(int *iwork, double *rwork, int nPoints, double t, double *x,
                   double *f) {
  int i, j;
  double a = rwork[0], p = rwork[1];
  for (i = 0; i < nPoints; i++) {
    for (j = 0; j < 3; j++) {
      f[i * 3 + j] =
          -a * pow((((f[i * 3 + j]) > (0.0)) ? (f[i * 3 + j]) : (0.0)), p);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<NonlinearDAE_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1229 <NonlinearDAE_f+0x119>
movl   $0x0,-0x38(%rbp)
cmpl   $0x3,-0x38(%rbp)
jge    1216 <NonlinearDAE_f+0x106>
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x30(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11cd <NonlinearDAE_f+0xbd>
mov    -0x30(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    11da <NonlinearDAE_f+0xca>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
jmp    11da <NonlinearDAE_f+0xca>
movsd  -0x58(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1165 <NonlinearDAE_f+0x55>
jmp    121b <NonlinearDAE_f+0x10b>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1152 <NonlinearDAE_f+0x42>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NonlinearDAE_f>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
test   %edx,%edx
jle    11cc <NonlinearDAE_f+0xbc>
mov    %r8,%r15
movsd  0x8(%rsi),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsi),%xmm0
xorpd  0xec5(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
mov    %edx,%eax
shl    $0x3,%rax
lea    (%rax,%rax,2),%r14
xor    %ebx,%ebx
nopl   (%rax)
movsd  (%r15,%rbx,1),%xmm0
xorpd  %xmm1,%xmm1
maxsd  %xmm1,%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <pow@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r15,%rbx,1)
movsd  0x8(%r15,%rbx,1),%xmm0
maxsd  0xe8c(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <pow@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%r15,%rbx,1)
movsd  0x10(%r15,%rbx,1),%xmm0
maxsd  0xe65(%rip),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <pow@plt>
mulsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x10(%r15,%rbx,1)
add    $0x18,%rbx
cmp    %rbx,%r14
jne    1150 <NonlinearDAE_f+0x40>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @NonlinearDAE_f(i32* %0, double* %1, i32 %2, double %3, double* %4, double* %5) {
%7 = alloca i32*
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca double
store i32* %0, i32** %7
store double* %1, double** %8
store i32 %2, i32* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%17 = load double*, double** %8
%18 = getelementptr inbounds double, double* %17, i64 0
%19 = load double, double* %18
store double %19, double* %15
%20 = load double*, double** %8
%21 = getelementptr inbounds double, double* %20, i64 1
%22 = load double, double* %21
store double %22, double* %16
store i32 0, i32* %13
br label %23
23: ; preds = %69, %6
%24 = load i32, i32* %13
%25 = load i32, i32* %9
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %72
27: ; preds = %23
store i32 0, i32* %14
br label %28
28: ; preds = %65, %27
%29 = load i32, i32* %14
%30 = icmp slt i32 %29, 3
br i1 %30, label %31, label %68
31: ; preds = %28
%32 = load double, double* %15
%33 = fneg double %32
%34 = load double*, double** %12
%35 = load i32, i32* %13
%36 = mul nsw i32 %35, 3
%37 = load i32, i32* %14
%38 = add nsw i32 %36, %37
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds double, double* %34, i64 %39
%41 = load double, double* %40
%42 = fcmp ogt double %41, 0.000000e+00
br i1 %42, label %43, label %52
43: ; preds = %31
%44 = load double*, double** %12
%45 = load i32, i32* %13
%46 = mul nsw i32 %45, 3
%47 = load i32, i32* %14
%48 = add nsw i32 %46, %47
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %44, i64 %49
%51 = load double, double* %50
br label %53
52: ; preds = %31
br label %53
53: ; preds = %52, %43
%54 = phi double [ %51, %43 ], [ 0.000000e+00, %52 ]
%55 = load double, double* %16
%56 = call double @pow(double %54, double %55)
%57 = fmul double %33, %56
%58 = load double*, double** %12
%59 = load i32, i32* %13
%60 = mul nsw i32 %59, 3
%61 = load i32, i32* %14
%62 = add nsw i32 %60, %61
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds double, double* %58, i64 %63
store double %57, double* %64
br label %65
65: ; preds = %53
%66 = load i32, i32* %14
%67 = add nsw i32 %66, 1
store i32 %67, i32* %14
br label %28
68: ; preds = %28
br label %69
69: ; preds = %68
%70 = load i32, i32* %13
%71 = add nsw i32 %70, 1
store i32 %71, i32* %13
br label %23
72: ; preds = %23
ret i32 0
}

LLVM IR (-O2):
define i32 @NonlinearDAE_f(i32* nocapture readnone %0, double* nocapture %1, i32 %2, double %3, double* nocapture readnone %4, double* nocapture %5) {
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = icmp sgt i32 %2, 0
br i1 %9, label %10, label %39
10: ; preds = %6
%11 = load double, double* %1
%12 = fneg double %11
%13 = zext i32 %2 to i64
br label %14
14: ; preds = %10, %14
%15 = phi i64 [ 0, %10 ], [ %37, %14 ]
%16 = mul nuw nsw i64 %15, 3
%17 = getelementptr inbounds double, double* %5, i64 %16
%18 = load double, double* %17
%19 = fcmp ogt double %18, 0.000000e+00
%20 = select i1 %19, double %18, double 0.000000e+00
%21 = tail call double @pow(double %20, double %8)
%22 = fmul double %21, %12
store double %22, double* %17
%23 = add nuw nsw i64 %16, 1
%24 = getelementptr inbounds double, double* %5, i64 %23
%25 = load double, double* %24
%26 = fcmp ogt double %25, 0.000000e+00
%27 = select i1 %26, double %25, double 0.000000e+00
%28 = tail call double @pow(double %27, double %8)
%29 = fmul double %28, %12
store double %29, double* %24
%30 = add nuw nsw i64 %16, 2
%31 = getelementptr inbounds double, double* %5, i64 %30
%32 = load double, double* %31
%33 = fcmp ogt double %32, 0.000000e+00
%34 = select i1 %33, double %32, double 0.000000e+00
%35 = tail call double @pow(double %34, double %8)
%36 = fmul double %35, %12
store double %36, double* %31
%37 = add nuw nsw i64 %15, 1
%38 = icmp eq i64 %37, %13
br i1 %38, label %39, label %14
39: ; preds = %14, %6
ret i32 0
}