#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*/ relax_ab(double *, int, int, int, double *, double *);
int /*<<< orphan*/ relax_atb(double *, int, int, int, double *, double *);
int /*<<< orphan*/ relax_bypax(double, double *, int, double, double *, int,
                               int);
int /*<<< orphan*/ relax_copy(double *, int, double *, int, int);
double relax_dot(double *, int, double *, int, int);
double sqrt(double);
double relax_cgmn_init(double *A, int m, int n, int stride, double *x,
                       double *b, double *res, double *dir, double *rlen2p) {
  relax_atb(A, m, n, stride, x, dir);
  relax_ab(A, m, n, stride, dir, res);
  relax_bypax(-1.0, res, 1, 1.0, b, 1, m);
  relax_copy(dir, 1, res, 1, m);
  *rlen2p = relax_dot(res, 1, res, 1, m);
  return sqrt(*rlen2p);
}


x86 assembly (clang, -O0):
<relax_cgmn_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    0x18(%rbp),%r9
call   1050 <relax_atb@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    0x18(%rbp),%r8
mov    0x10(%rbp),%r9
call   1060 <relax_ab@plt>
mov    0x10(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0xc(%rbp),%r8d
movsd  0xe2f(%rip),%xmm0
mov    $0x1,%ecx
movsd  0xe2a(%rip),%xmm1
mov    %ecx,%esi
call   1040 <relax_bypax@plt>
mov    0x18(%rbp),%rdi
mov    0x10(%rbp),%rdx
mov    -0xc(%rbp),%r8d
mov    $0x1,%ecx
mov    %ecx,%esi
call   1030 <relax_copy@plt>
mov    0x10(%rbp),%rdi
mov    0x10(%rbp),%rdx
mov    -0xc(%rbp),%r8d
mov    $0x1,%ecx
mov    %ecx,%esi
call   1070 <relax_dot@plt>
mov    0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    0x20(%rbp),%rax
movsd  (%rax),%xmm0
call   1080 <sqrt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<relax_cgmn_init>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x8(%rsp)
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %esi,%ebp
mov    %rdi,%r14
mov    0x60(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    0x50(%rsp),%rbx
mov    0x58(%rsp),%r15
mov    %r15,%r9
call   1050 <relax_atb@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %r13d,%edx
mov    %r12d,%ecx
mov    %r15,%r8
mov    %rbx,%r9
call   1060 <relax_ab@plt>
movsd  0xe48(%rip),%xmm0
movsd  0xe48(%rip),%xmm1
mov    %rbx,%rdi
mov    $0x1,%esi
mov    0x8(%rsp),%rdx
mov    $0x1,%ecx
mov    %ebp,%r8d
call   1040 <relax_bypax@plt>
mov    %r15,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    $0x1,%ecx
mov    %ebp,%r8d
call   1030 <relax_copy@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    $0x1,%ecx
mov    %ebp,%r8d
call   1070 <relax_dot@plt>
mov    0x10(%rsp),%rax
movsd  %xmm0,(%rax)
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1230 <relax_cgmn_init+0xd0>
sqrtsd %xmm0,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1080 <sqrt@plt>

LLVM IR (-O0):
define double @relax_cgmn_init(double* %0, i32 %1, i32 %2, i32 %3, double* %4, double* %5, double* %6, double* %7, double* %8) {
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
store double* %0, double** %10
store i32 %1, i32* %11
store i32 %2, i32* %12
store i32 %3, i32* %13
store double* %4, double** %14
store double* %5, double** %15
store double* %6, double** %16
store double* %7, double** %17
store double* %8, double** %18
%19 = load double*, double** %10
%20 = load i32, i32* %11
%21 = load i32, i32* %12
%22 = load i32, i32* %13
%23 = load double*, double** %14
%24 = load double*, double** %17
%25 = call i32 @relax_atb(double* %19, i32 %20, i32 %21, i32 %22, double* %23, double* %24)
%26 = load double*, double** %10
%27 = load i32, i32* %11
%28 = load i32, i32* %12
%29 = load i32, i32* %13
%30 = load double*, double** %17
%31 = load double*, double** %16
%32 = call i32 @relax_ab(double* %26, i32 %27, i32 %28, i32 %29, double* %30, double* %31)
%33 = load double*, double** %16
%34 = load double*, double** %15
%35 = load i32, i32* %11
%36 = call i32 @relax_bypax(double -1.000000e+00, double* %33, i32 1, double 1.000000e+00, double* %34, i32 1, i32 %35)
%37 = load double*, double** %17
%38 = load double*, double** %16
%39 = load i32, i32* %11
%40 = call i32 @relax_copy(double* %37, i32 1, double* %38, i32 1, i32 %39)
%41 = load double*, double** %16
%42 = load double*, double** %16
%43 = load i32, i32* %11
%44 = call double @relax_dot(double* %41, i32 1, double* %42, i32 1, i32 %43)
%45 = load double*, double** %18
store double %44, double* %45
%46 = load double*, double** %18
%47 = load double, double* %46
%48 = call double @sqrt(double %47)
ret double %48
}

LLVM IR (-O2):
define double @relax_cgmn_init(double* %0, i32 %1, i32 %2, i32 %3, double* %4, double* %5, double* %6, double* %7, double* nocapture writeonly %8) {
%10 = tail call i32 @relax_atb(double* %0, i32 %1, i32 %2, i32 %3, double* %4, double* %7)
%11 = tail call i32 @relax_ab(double* %0, i32 %1, i32 %2, i32 %3, double* %7, double* %6)
%12 = tail call i32 @relax_bypax(double -1.000000e+00, double* %6, i32 1, double 1.000000e+00, double* %5, i32 1, i32 %1)
%13 = tail call i32 @relax_copy(double* %7, i32 1, double* %6, i32 1, i32 %1)
%14 = tail call double @relax_dot(double* %6, i32 1, double* %6, i32 1, i32 %1)
store double %14, double* %8
%15 = tail call double @sqrt(double %14)
ret double %15
}