#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 fabs(double);
double stub1(double, double, double);
double Norm_c(double *a, int Dim, double *X, double *Y, double t,
              double (*f)(double tt, double x1, double x2)) {
  int m;
  double norm = 0.;
  double tmp;
  for (m = 0; m < Dim; m++) {
    tmp = fabs(a[m] - (*f)(t, X[m], Y[m]));
    if (tmp > norm) {
      norm = tmp;
    }
  }
  return norm;
}


x86 assembly (clang, -O0):
<Norm_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bb <Norm_c+0xbb>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x30(%rbp),%rax
movsd  -0x28(%rbp),%xmm0
mov    -0x18(%rbp),%rcx
movslq -0x34(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm1
mov    -0x20(%rbp),%rcx
movslq -0x34(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm2
call   *%rax
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  %xmm1,%xmm0
movaps 0xe7b(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    11a8 <Norm_c+0xa8>
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    11ad <Norm_c+0xad>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    112f <Norm_c+0x2f>
movsd  -0x40(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Norm_c>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
test   %esi,%esi
jle    117d <Norm_c+0x7d>
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
mov    %rdi,%r13
mov    %esi,%ebx
xorpd  %xmm2,%xmm2
xor    %ebp,%ebp
movsd  %xmm0,(%rsp)
nopl   0x0(%rax,%rax,1)
movsd  %xmm2,0x8(%rsp)
movsd  0x0(%r13,%rbp,8),%xmm0
movaps %xmm0,0x10(%rsp)
movsd  (%r12,%rbp,8),%xmm1
movsd  (%r15,%rbp,8),%xmm2
movsd  (%rsp),%xmm0
call   *%r14
movapd 0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
andpd  0xe98(%rip),%xmm1
maxsd  0x8(%rsp),%xmm1
add    $0x1,%rbp
movapd %xmm1,%xmm2
cmp    %rbp,%rbx
jne    1130 <Norm_c+0x30>
jmp    1181 <Norm_c+0x81>
xorpd  %xmm1,%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @Norm_c(double* %0, i32 %1, double* %2, double* %3, double %4, double (double, double, double)* %5) {
%7 = alloca double*
%8 = alloca i32
%9 = alloca double*
%10 = alloca double*
%11 = alloca double
%12 = alloca double (double, double, double)*
%13 = alloca i32
%14 = alloca double
%15 = alloca double
store double* %0, double** %7
store i32 %1, i32* %8
store double* %2, double** %9
store double* %3, double** %10
store double %4, double* %11
store double (double, double, double)* %5, double (double, double, double)** %12
store double 0.000000e+00, double* %14
store i32 0, i32* %13
br label %16
16: ; preds = %47, %6
%17 = load i32, i32* %13
%18 = load i32, i32* %8
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %50
20: ; preds = %16
%21 = load double*, double** %7
%22 = load i32, i32* %13
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = load double (double, double, double)*, double (double, double, double)** %12
%27 = load double, double* %11
%28 = load double*, double** %9
%29 = load i32, i32* %13
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
%32 = load double, double* %31
%33 = load double*, double** %10
%34 = load i32, i32* %13
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
%38 = call double %26(double %27, double %32, double %37)
%39 = fsub double %25, %38
%40 = call double @llvm.fabs.f64(double %39)
store double %40, double* %15
%41 = load double, double* %15
%42 = load double, double* %14
%43 = fcmp ogt double %41, %42
br i1 %43, label %44, label %46
44: ; preds = %20
%45 = load double, double* %15
store double %45, double* %14
br label %46
46: ; preds = %44, %20
br label %47
47: ; preds = %46
%48 = load i32, i32* %13
%49 = add nsw i32 %48, 1
store i32 %49, i32* %13
br label %16
50: ; preds = %16
%51 = load double, double* %14
ret double %51
}

LLVM IR (-O2):
define double @Norm_c(double* nocapture %0, i32 %1, double* nocapture %2, double* nocapture %3, double %4, double (double, double, double)* nocapture %5) {
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %26
8: ; preds = %6
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %8, %10
%11 = phi i64 [ 0, %8 ], [ %24, %10 ]
%12 = phi double [ 0.000000e+00, %8 ], [ %23, %10 ]
%13 = getelementptr inbounds double, double* %0, i64 %11
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %2, i64 %11
%16 = load double, double* %15
%17 = getelementptr inbounds double, double* %3, i64 %11
%18 = load double, double* %17
%19 = tail call double %5(double %4, double %16, double %18)
%20 = fsub double %14, %19
%21 = tail call double @llvm.fabs.f64(double %20)
%22 = fcmp ogt double %21, %12
%23 = select i1 %22, double %21, double %12
%24 = add nuw nsw i64 %11, 1
%25 = icmp eq i64 %24, %9
br i1 %25, label %26, label %10
26: ; preds = %10, %6
%27 = phi double [ 0.000000e+00, %6 ], [ %23, %10 ]
ret double %27
}