#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 atan2(double, double);
double sqrt(double);
int dtop2(double xo, double yo, double *r, double *t) {
  static double rtod = 57.29577951308232;
  *r = sqrt(xo * xo + yo * yo);
  if (xo != 0.0)
    *t = atan2(yo, xo) * rtod;
  else {
    if (yo < 0.0)
      *t = -90.0;
    else if (yo > 0.0)
      *t = 90.0;
    else
      *t = 0.0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<dtop2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1180 <dtop2+0x60>
jp     1180 <dtop2+0x60>
jmp    11a4 <dtop2+0x84>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
call   1030 <atan2@plt>
mulsd  0x2e99(%rip),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1203 <dtop2+0xe3>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11c7 <dtop2+0xa7>
mov    -0x20(%rbp),%rax
movsd  0xe4a(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    11fe <dtop2+0xde>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    11ee <dtop2+0xce>
mov    -0x20(%rbp),%rax
movsd  0xe1b(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    11f9 <dtop2+0xd9>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
jmp    11fe <dtop2+0xde>
jmp    1203 <dtop2+0xe3>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dtop2>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movapd %xmm0,%xmm3
movapd %xmm1,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jb     1151 <dtop2+0x31>
sqrtsd %xmm0,%xmm0
jmp    1172 <dtop2+0x52>
movsd  %xmm1,0x10(%rsp)
movsd  %xmm3,0x8(%rsp)
call   1040 <sqrt@plt>
xorpd  %xmm2,%xmm2
movsd  0x8(%rsp),%xmm3
movsd  0x10(%rsp),%xmm1
movsd  %xmm0,(%rbx)
ucomisd %xmm2,%xmm3
jne    117e <dtop2+0x5e>
jnp    1195 <dtop2+0x75>
movapd %xmm1,%xmm0
movapd %xmm3,%xmm1
call   1030 <atan2@plt>
mulsd  0xe7d(%rip),%xmm0
jmp    11ba <dtop2+0x9a>
xorpd  %xmm2,%xmm2
ucomisd %xmm1,%xmm2
jbe    11a9 <dtop2+0x89>
movsd  0xe59(%rip),%xmm0
jmp    11ba <dtop2+0x9a>
cmpltsd %xmm1,%xmm2
movsd  0xe52(%rip),%xmm0
andpd  %xmm2,%xmm0
movsd  %xmm0,(%r14)
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@dtop2.rtod = internal global double 0x404CA5DC1A63C1F8
define i32 @dtop2(double %0, double %1, double* %2, double* %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double*
%8 = alloca double*
store double %0, double* %5
store double %1, double* %6
store double* %2, double** %7
store double* %3, double** %8
%9 = load double, double* %5
%10 = load double, double* %5
%11 = load double, double* %6
%12 = load double, double* %6
%13 = fmul double %11, %12
%14 = call double @llvm.fmuladd.f64(double %9, double %10, double %13)
%15 = call double @sqrt(double %14)
%16 = load double*, double** %7
store double %15, double* %16
%17 = load double, double* %5
%18 = fcmp une double %17, 0.000000e+00
br i1 %18, label %19, label %26
19: ; preds = %4
%20 = load double, double* %6
%21 = load double, double* %5
%22 = call double @atan2(double %20, double %21)
%23 = load double, double* @dtop2.rtod
%24 = fmul double %22, %23
%25 = load double*, double** %8
store double %24, double* %25
br label %40
26: ; preds = %4
%27 = load double, double* %6
%28 = fcmp olt double %27, 0.000000e+00
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = load double*, double** %8
store double -9.000000e+01, double* %30
br label %39
31: ; preds = %26
%32 = load double, double* %6
%33 = fcmp ogt double %32, 0.000000e+00
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = load double*, double** %8
store double 9.000000e+01, double* %35
br label %38
36: ; preds = %31
%37 = load double*, double** %8
store double 0.000000e+00, double* %37
br label %38
38: ; preds = %36, %34
br label %39
39: ; preds = %38, %29
br label %40
40: ; preds = %39, %19
ret i32 0
}

LLVM IR (-O2):
define i32 @dtop2(double %0, double %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = fmul double %1, %1
%6 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %5)
%7 = tail call double @sqrt(double %6)
store double %7, double* %2
%8 = fcmp une double %0, 0.000000e+00
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = tail call double @atan2(double %1, double %0)
%11 = fmul double %10, 0x404CA5DC1A63C1F8
br label %17
12: ; preds = %4
%13 = fcmp olt double %1, 0.000000e+00
br i1 %13, label %17, label %14
14: ; preds = %12
%15 = fcmp ogt double %1, 0.000000e+00
%16 = select i1 %15, double 9.000000e+01, double 0.000000e+00
br label %17
17: ; preds = %14, %12, %9
%18 = phi double [ %11, %9 ], [ -9.000000e+01, %12 ], [ %16, %14 ]
store double %18, double* %3
ret i32 0
}