#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 sqrt(double);
void inithess_lower(double *L, int N, double fi, double fsval, double *dx) {
  int i, j, ct;
  double temp;
  if (fabs(fi) > fsval) {
    temp = fabs(fi);
  } else {
    temp = fsval;
  }
  temp = sqrt(temp);
  for (i = 0; i < N; ++i) {
    ct = i * N;
    L[ct + i] = temp * dx[i];
    for (j = 0; j < i; ++j) {
      L[ct + j] = 0;
    }
  }
}


x86 assembly (clang, -O0):
<inithess_lower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movaps 0xec7(%rip),%xmm1
pand   %xmm1,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1162 <inithess_lower+0x52>
movsd  -0x18(%rbp),%xmm0
movaps 0xeac(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    116c <inithess_lower+0x5c>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1030 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1205 <inithess_lower+0xf5>
mov    -0x2c(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x34(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11f2 <inithess_lower+0xe2>
mov    -0x8(%rbp),%rax
mov    -0x34(%rbp),%ecx
add    -0x30(%rbp),%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11c3 <inithess_lower+0xb3>
jmp    11f7 <inithess_lower+0xe7>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1182 <inithess_lower+0x72>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inithess_lower>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdx,%r14
mov    %esi,%ebx
mov    %rdi,%r15
andpd  0xec2(%rip),%xmm0
maxsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1159 <inithess_lower+0x39>
sqrtsd %xmm0,%xmm0
test   %ebx,%ebx
jg     1166 <inithess_lower+0x46>
jmp    12e1 <inithess_lower+0x1c1>
call   1040 <sqrt@plt>
test   %ebx,%ebx
jle    12e1 <inithess_lower+0x1c1>
movsd  (%r14),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%r15)
cmp    $0x1,%ebx
je     12e1 <inithess_lower+0x1c1>
mov    %ebx,%eax
mov    %rax,0x18(%rsp)
add    $0xffffffffffffffff,%rax
mov    %rax,0x20(%rsp)
mov    $0x1,%ebp
mov    %rbx,0x28(%rsp)
cmp    $0x2,%ebx
mov    %r15,0x8(%rsp)
mov    %r14,%rdx
je     129e <inithess_lower+0x17e>
mov    0x28(%rsp),%r12
lea    (%r12,%r12,1),%ecx
mov    0x18(%rsp),%rax
lea    0x0(,%rax,8),%rsi
mov    %rsi,0x50(%rsp)
shl    $0x4,%rax
mov    %rax,0x48(%rsp)
mov    0x20(%rsp),%rax
and    $0xfffffffffffffffe,%rax
neg    %rax
mov    %rax,0x40(%rsp)
mov    $0x1,%ebp
mov    $0x8,%r13d
mov    %ecx,0x14(%rsp)
mov    %ecx,%r14d
mov    0x8(%rsp),%rbx
movsd  %xmm0,0x38(%rsp)
mov    %rdx,0x30(%rsp)
mov    0x8(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movslq %r12d,%r12
movslq %r14d,%r14
movsd  (%rdx,%rbp,8),%xmm1
mulsd  %xmm0,%xmm1
lea    (%r12,%rbp,1),%rax
movsd  %xmm1,(%r15,%rax,8)
mov    0x50(%rsp),%rax
lea    (%rbx,%rax,1),%rdi
xor    %esi,%esi
mov    %r13,%rdx
call   1030 <memset@plt>
mov    0x30(%rsp),%rax
movsd  0x8(%rax,%rbp,8),%xmm0
mulsd  0x38(%rsp),%xmm0
lea    (%r14,%rbp,1),%rax
movsd  %xmm0,0x8(%r15,%rax,8)
lea    0x8(%r13),%rdx
add    0x48(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    0x30(%rsp),%rdx
movsd  0x38(%rsp),%xmm0
mov    0x14(%rsp),%eax
add    %eax,%r12d
add    $0x10,%r13
add    %eax,%r14d
mov    0x40(%rsp),%rax
add    %rbp,%rax
add    $0x2,%rax
add    $0x2,%rbp
cmp    $0x1,%rax
jne    1210 <inithess_lower+0xf0>
testb  $0x1,0x20(%rsp)
mov    0x8(%rsp),%rcx
mov    %rdx,%rax
mov    0x28(%rsp),%rdx
je     12e1 <inithess_lower+0x1c1>
imul   %ebp,%edx
mulsd  (%rax,%rbp,8),%xmm0
movslq %edx,%rax
add    %rbp,%rax
movsd  %xmm0,(%rcx,%rax,8)
lea    0x0(,%rbp,8),%rdx
mov    0x18(%rsp),%rax
imul   %rbp,%rax
lea    (%rcx,%rax,8),%rdi
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @inithess_lower(double* nocapture writeonly %0, i32 %1, double %2, double %3, double* nocapture %4) {
%6 = tail call double @llvm.fabs.f64(double %2)
%7 = fcmp ogt double %6, %3
%8 = select i1 %7, double %6, double %3
%9 = tail call double @sqrt(double %8)
%10 = icmp sgt i32 %1, 0
br i1 %10, label %11, label %70
11: ; preds = %5
%12 = zext i32 %1 to i64
%13 = load double, double* %4
%14 = fmul double %9, %13
store double %14, double* %0
%15 = icmp eq i32 %1, 1
br i1 %15, label %70, label %16
16: ; preds = %11
%17 = zext i32 %1 to i64
%18 = add nsw i64 %17, -1
%19 = and i64 %18, 1
%20 = icmp eq i32 %1, 2
br i1 %20, label %54, label %21
21: ; preds = %16
%22 = and i64 %18, -2
br label %23
23: ; preds = %23, %21
%24 = phi i64 [ 1, %21 ], [ %51, %23 ]
%25 = phi i64 [ 0, %21 ], [ %52, %23 ]
%26 = trunc i64 %24 to i32
%27 = mul nsw i32 %26, %1
%28 = getelementptr inbounds double, double* %4, i64 %24
%29 = load double, double* %28
%30 = fmul double %9, %29
%31 = sext i32 %27 to i64
%32 = add nsw i64 %24, %31
%33 = getelementptr inbounds double, double* %0, i64 %32
store double %30, double* %33
%34 = shl nuw nsw i64 %24, 3
%35 = mul nsw i64 %24, %12
%36 = getelementptr double, double* %0, i64 %35
%37 = bitcast double* %36 to i8*
%38 = add nuw nsw i64 %24, 1
%39 = trunc i64 %38 to i32
%40 = mul nsw i32 %39, %1
%41 = getelementptr inbounds double, double* %4, i64 %38
%42 = load double, double* %41
%43 = fmul double %9, %42
%44 = sext i32 %40 to i64
%45 = add nsw i64 %38, %44
%46 = getelementptr inbounds double, double* %0, i64 %45
store double %43, double* %46
%47 = shl nuw nsw i64 %38, 3
%48 = mul nsw i64 %38, %12
%49 = getelementptr double, double* %0, i64 %48
%50 = bitcast double* %49 to i8*
%51 = add nuw nsw i64 %24, 2
%52 = add i64 %25, 2
%53 = icmp eq i64 %52, %22
br i1 %53, label %54, label %23
54: ; preds = %23, %16
%55 = phi i64 [ 1, %16 ], [ %51, %23 ]
%56 = icmp eq i64 %19, 0
br i1 %56, label %70, label %57
57: ; preds = %54
%58 = trunc i64 %55 to i32
%59 = mul nsw i32 %58, %1
%60 = getelementptr inbounds double, double* %4, i64 %55
%61 = load double, double* %60
%62 = fmul double %9, %61
%63 = sext i32 %59 to i64
%64 = add nsw i64 %55, %63
%65 = getelementptr inbounds double, double* %0, i64 %64
store double %62, double* %65
%66 = shl nuw nsw i64 %55, 3
%67 = mul nsw i64 %55, %12
%68 = getelementptr double, double* %0, i64 %67
%69 = bitcast double* %68 to i8*
br label %70
70: ; preds = %57, %54, %11, %5
ret void
}