#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 asin(double);
double atan2(double, double);
double cos(double);
double sin(double);
void lmattoypr(double *r, double *a) {
  if (r[5])
    a[2] = atan2(r[2], r[5]);
  else
    a[2] = 3.14159265358979323846264338327950 * 0.5 * ((r[2] > 0) - (r[2] < 0));
  if (r[7])
    a[0] = atan2(r[6], -r[7]);
  else
    a[0] = 3.14159265358979323846264338327950 * 0.5 * ((r[6] > 0) - (r[7] < 0));
  a[1] = asin(r[8]);
  if (cos(a[1]) * sin(a[0]) * r[6] < 0)
    a[1] = 3.14159265358979323846264338327950 - a[1];
}


x86 assembly (clang, -O0):
<lmattoypr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1171 <lmattoypr+0x31>
jp     1171 <lmattoypr+0x31>
jmp    1196 <lmattoypr+0x56>
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x28(%rax),%xmm1
call   1030 <atan2@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
jmp    11de <lmattoypr+0x9e>
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x8(%rbp),%rcx
xorps  %xmm0,%xmm0
ucomisd 0x10(%rcx),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe2f(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11ff <lmattoypr+0xbf>
jp     11ff <lmattoypr+0xbf>
jmp    123a <lmattoypr+0xfa>
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x38(%rax),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
call   1030 <atan2@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1281 <lmattoypr+0x141>
mov    -0x8(%rbp),%rax
movsd  0x30(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x8(%rbp),%rcx
xorps  %xmm0,%xmm0
ucomisd 0x38(%rcx),%xmm0
seta   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
cvtsi2sd %eax,%xmm1
movsd  0xd8b(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x40(%rax),%xmm0
call   1050 <asin@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1060 <cos@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1040 <sin@plt>
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x30(%rax),%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    12f1 <lmattoypr+0x1b1>
mov    -0x10(%rbp),%rax
movsd  0xd25(%rip),%xmm0
subsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lmattoypr>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  0x10(%rdi),%xmm0
movsd  0x28(%rdi),%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jne    1160 <lmattoypr+0x20>
jnp    1167 <lmattoypr+0x27>
call   1030 <atan2@plt>
jmp    118a <lmattoypr+0x4a>
xor    %eax,%eax
ucomisd %xmm2,%xmm0
seta   %al
xor    %ecx,%ecx
ucomisd %xmm0,%xmm2
seta   %cl
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe76(%rip),%xmm0
movsd  %xmm0,0x10(%r14)
movsd  0x30(%rbx),%xmm0
movsd  0x38(%rbx),%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
jne    11a6 <lmattoypr+0x66>
jnp    11b5 <lmattoypr+0x75>
xorpd  0xe62(%rip),%xmm1
call   1030 <atan2@plt>
jmp    11d8 <lmattoypr+0x98>
xor    %eax,%eax
ucomisd %xmm2,%xmm0
seta   %al
xor    %ecx,%ecx
ucomisd %xmm1,%xmm2
seta   %cl
sub    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe28(%rip),%xmm0
movsd  %xmm0,(%r14)
movsd  0x40(%rbx),%xmm0
call   1050 <asin@plt>
movsd  %xmm0,0x8(%r14)
call   1060 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  (%r14),%xmm0
call   1040 <sin@plt>
mulsd  (%rsp),%xmm0
mulsd  0x30(%rbx),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jbe    1229 <lmattoypr+0xe9>
movsd  0xdeb(%rip),%xmm0
subsd  0x8(%r14),%xmm0
movsd  %xmm0,0x8(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @lmattoypr(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 5
%7 = load double, double* %6
%8 = fcmp une double %7, 0.000000e+00
br i1 %8, label %9, label %19
9: ; preds = %2
%10 = load double*, double** %3
%11 = getelementptr inbounds double, double* %10, i64 2
%12 = load double, double* %11
%13 = load double*, double** %3
%14 = getelementptr inbounds double, double* %13, i64 5
%15 = load double, double* %14
%16 = call double @atan2(double %12, double %15)
%17 = load double*, double** %4
%18 = getelementptr inbounds double, double* %17, i64 2
store double %16, double* %18
br label %35
19: ; preds = %2
%20 = load double*, double** %3
%21 = getelementptr inbounds double, double* %20, i64 2
%22 = load double, double* %21
%23 = fcmp ogt double %22, 0.000000e+00
%24 = zext i1 %23 to i32
%25 = load double*, double** %3
%26 = getelementptr inbounds double, double* %25, i64 2
%27 = load double, double* %26
%28 = fcmp olt double %27, 0.000000e+00
%29 = zext i1 %28 to i32
%30 = sub nsw i32 %24, %29
%31 = sitofp i32 %30 to double
%32 = fmul double 0x3FF921FB54442D18, %31
%33 = load double*, double** %4
%34 = getelementptr inbounds double, double* %33, i64 2
store double %32, double* %34
br label %35
35: ; preds = %19, %9
%36 = load double*, double** %3
%37 = getelementptr inbounds double, double* %36, i64 7
%38 = load double, double* %37
%39 = fcmp une double %38, 0.000000e+00
br i1 %39, label %40, label %51
40: ; preds = %35
%41 = load double*, double** %3
%42 = getelementptr inbounds double, double* %41, i64 6
%43 = load double, double* %42
%44 = load double*, double** %3
%45 = getelementptr inbounds double, double* %44, i64 7
%46 = load double, double* %45
%47 = fneg double %46
%48 = call double @atan2(double %43, double %47)
%49 = load double*, double** %4
%50 = getelementptr inbounds double, double* %49, i64 0
store double %48, double* %50
br label %67
51: ; preds = %35
%52 = load double*, double** %3
%53 = getelementptr inbounds double, double* %52, i64 6
%54 = load double, double* %53
%55 = fcmp ogt double %54, 0.000000e+00
%56 = zext i1 %55 to i32
%57 = load double*, double** %3
%58 = getelementptr inbounds double, double* %57, i64 7
%59 = load double, double* %58
%60 = fcmp olt double %59, 0.000000e+00
%61 = zext i1 %60 to i32
%62 = sub nsw i32 %56, %61
%63 = sitofp i32 %62 to double
%64 = fmul double 0x3FF921FB54442D18, %63
%65 = load double*, double** %4
%66 = getelementptr inbounds double, double* %65, i64 0
store double %64, double* %66
br label %67
67: ; preds = %51, %40
%68 = load double*, double** %3
%69 = getelementptr inbounds double, double* %68, i64 8
%70 = load double, double* %69
%71 = call double @asin(double %70)
%72 = load double*, double** %4
%73 = getelementptr inbounds double, double* %72, i64 1
store double %71, double* %73
%74 = load double*, double** %4
%75 = getelementptr inbounds double, double* %74, i64 1
%76 = load double, double* %75
%77 = call double @cos(double %76)
%78 = load double*, double** %4
%79 = getelementptr inbounds double, double* %78, i64 0
%80 = load double, double* %79
%81 = call double @sin(double %80)
%82 = fmul double %77, %81
%83 = load double*, double** %3
%84 = getelementptr inbounds double, double* %83, i64 6
%85 = load double, double* %84
%86 = fmul double %82, %85
%87 = fcmp olt double %86, 0.000000e+00
br i1 %87, label %88, label %95
88: ; preds = %67
%89 = load double*, double** %4
%90 = getelementptr inbounds double, double* %89, i64 1
%91 = load double, double* %90
%92 = fsub double 0x400921FB54442D18, %91
%93 = load double*, double** %4
%94 = getelementptr inbounds double, double* %93, i64 1
store double %92, double* %94
br label %95
95: ; preds = %88, %67
ret void
}

LLVM IR (-O2):
define void @lmattoypr(double* nocapture %0, double* nocapture %1) {
%3 = getelementptr inbounds double, double* %0, i64 5
%4 = load double, double* %3
%5 = fcmp une double %4, 0.000000e+00
%6 = getelementptr inbounds double, double* %0, i64 2
%7 = load double, double* %6
br i1 %5, label %8, label %10
8: ; preds = %2
%9 = tail call double @atan2(double %7, double %4)
br label %18
10: ; preds = %2
%11 = fcmp ogt double %7, 0.000000e+00
%12 = zext i1 %11 to i32
%13 = fcmp olt double %7, 0.000000e+00
%14 = sext i1 %13 to i32
%15 = add nsw i32 %14, %12
%16 = sitofp i32 %15 to double
%17 = fmul double %16, 0x3FF921FB54442D18
br label %18
18: ; preds = %10, %8
%19 = phi double [ %9, %8 ], [ %17, %10 ]
%20 = getelementptr inbounds double, double* %1, i64 2
store double %19, double* %20
%21 = getelementptr inbounds double, double* %0, i64 7
%22 = load double, double* %21
%23 = fcmp une double %22, 0.000000e+00
%24 = getelementptr inbounds double, double* %0, i64 6
%25 = load double, double* %24
br i1 %23, label %26, label %29
26: ; preds = %18
%27 = fneg double %22
%28 = tail call double @atan2(double %25, double %27)
br label %37
29: ; preds = %18
%30 = fcmp ogt double %25, 0.000000e+00
%31 = zext i1 %30 to i32
%32 = fcmp olt double %22, 0.000000e+00
%33 = sext i1 %32 to i32
%34 = add nsw i32 %31, %33
%35 = sitofp i32 %34 to double
%36 = fmul double %35, 0x3FF921FB54442D18
br label %37
37: ; preds = %29, %26
%38 = phi double [ %36, %29 ], [ %28, %26 ]
store double %38, double* %1
%39 = getelementptr inbounds double, double* %0, i64 8
%40 = load double, double* %39
%41 = tail call double @asin(double %40)
%42 = getelementptr inbounds double, double* %1, i64 1
store double %41, double* %42
%43 = tail call double @cos(double %41)
%44 = load double, double* %1
%45 = tail call double @sin(double %44)
%46 = fmul double %43, %45
%47 = getelementptr inbounds double, double* %0, i64 6
%48 = load double, double* %47
%49 = fmul double %46, %48
%50 = fcmp olt double %49, 0.000000e+00
br i1 %50, label %51, label %54
51: ; preds = %37
%52 = load double, double* %42
%53 = fsub double 0x400921FB54442D18, %52
store double %53, double* %42
br label %54
54: ; preds = %51, %37
ret void
}