#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 sqrt(double);
void slvsm2(double **u, double **rhs) {
  void fill0(double **u, int n);
  double disc, fact, h = 0.5;
  fill0(u, 3);
  fact = 2.0 / (h * h);
  disc = sqrt(fact * fact + rhs[2][2]);
  u[2][2] = -rhs[2][2] / (fact + disc);
}


x86 assembly (clang, -O0):
<slvsm2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xed0(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1030 <fill0@plt>
movsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
movsd  0xea3(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsd  0x10(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movsd  0x10(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
movsd  %xmm0,0x10(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slvsm2>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    $0x3,%esi
call   1030 <fill0@plt>
mov    0x10(%rbx),%rax
movsd  0x10(%rax),%xmm0
addsd  0xebb(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1155 <slvsm2+0x35>
sqrtsd %xmm0,%xmm0
jmp    115a <slvsm2+0x3a>
call   1040 <sqrt@plt>
mov    0x10(%rbx),%rax
movsd  0x10(%rax),%xmm1
xorpd  0xea5(%rip),%xmm1
addsd  0xe95(%rip),%xmm0
divsd  %xmm0,%xmm1
mov    0x10(%r14),%rax
movsd  %xmm1,0x10(%rax)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @slvsm2(double** %0, double** %1) {
%3 = alloca double**
%4 = alloca double**
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double** %0, double*** %3
store double** %1, double*** %4
store double 5.000000e-01, double* %7
%8 = load double**, double*** %3
%9 = load double, double* %7
%10 = load double, double* %7
%11 = fmul double %9, %10
%12 = fdiv double 2.000000e+00, %11
store double %12, double* %6
%13 = load double, double* %6
%14 = load double, double* %6
%15 = load double**, double*** %4
%16 = getelementptr inbounds double*, double** %15, i64 2
%17 = load double*, double** %16
%18 = getelementptr inbounds double, double* %17, i64 2
%19 = load double, double* %18
%20 = call double @llvm.fmuladd.f64(double %13, double %14, double %19)
%21 = call double @sqrt(double %20)
store double %21, double* %5
%22 = load double**, double*** %4
%23 = getelementptr inbounds double*, double** %22, i64 2
%24 = load double*, double** %23
%25 = getelementptr inbounds double, double* %24, i64 2
%26 = load double, double* %25
%27 = fneg double %26
%28 = load double, double* %6
%29 = load double, double* %5
%30 = fadd double %28, %29
%31 = fdiv double %27, %30
%32 = load double**, double*** %3
%33 = getelementptr inbounds double*, double** %32, i64 2
%34 = load double*, double** %33
%35 = getelementptr inbounds double, double* %34, i64 2
store double %31, double* %35
ret void
}

LLVM IR (-O2):
define void @slvsm2(double** %0, double** nocapture %1) {
tail call void @fill0(double** %0, i32 3)
%3 = getelementptr inbounds double*, double** %1, i64 2
%4 = load double*, double** %3
%5 = getelementptr inbounds double, double* %4, i64 2
%6 = load double, double* %5
%7 = fadd double %6, 6.400000e+01
%8 = tail call double @sqrt(double %7)
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 2
%11 = load double, double* %10
%12 = fneg double %11
%13 = fadd double %8, 8.000000e+00
%14 = fdiv double %12, %13
%15 = getelementptr inbounds double*, double** %0, i64 2
%16 = load double*, double** %15
%17 = getelementptr inbounds double, double* %16, i64 2
store double %14, double* %17
ret void
}