#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 */
float atan2(float, float);
int initangle(float dx, float dy) {
  float a, b;
  if (dx == 0.0) {
    if (dy >= 0.0)
      return 90;
    else
      return 270;
  }
  if (dy == 0.0) {
    if (dx >= 0.0)
      return 0;
    else
      return 180;
  }
  a = atan2(dy, dx);
  b = 180.0 / 3.141592653588 * a;
  return (int)b;
}


x86 assembly (clang, -O0):
<initangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    116c <initangle+0x5c>
jp     116c <initangle+0x5c>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1160 <initangle+0x50>
movl   $0x5a,-0x4(%rbp)
jmp    11f0 <initangle+0xe0>
movl   $0x10e,-0x4(%rbp)
jmp    11f0 <initangle+0xe0>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11b6 <initangle+0xa6>
jp     11b6 <initangle+0xa6>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     11aa <initangle+0x9a>
movl   $0x0,-0x4(%rbp)
jmp    11f0 <initangle+0xe0>
movl   $0xb4,-0x4(%rbp)
jmp    11f0 <initangle+0xe0>
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <atan2@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe25(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
cvttss2si -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initangle>:
movaps %xmm0,%xmm2
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
jne    112e <initangle+0x1e>
jp     112e <initangle+0x1e>
ucomiss %xmm0,%xmm1
mov    $0x10e,%ecx
mov    $0x5a,%eax
cmovb  %ecx,%eax
ret
ucomiss %xmm0,%xmm1
jne    1146 <initangle+0x36>
jp     1146 <initangle+0x36>
xor    %ecx,%ecx
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm2
mov    $0xb4,%eax
cmovae %ecx,%eax
ret
push   %rax
movaps %xmm1,%xmm0
movaps %xmm2,%xmm1
call   1030 <atan2@plt>
cvtss2sd %xmm0,%xmm0
mulsd  0xea2(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvttss2si %xmm0,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @initangle(float %0, float %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
store float %0, float* %4
store float %1, float* %5
%8 = load float, float* %4
%9 = fpext float %8 to double
%10 = fcmp oeq double %9, 0.000000e+00
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load float, float* %5
%13 = fpext float %12 to double
%14 = fcmp oge double %13, 0.000000e+00
br i1 %14, label %15, label %16
15: ; preds = %11
store i32 90, i32* %3
br label %37
16: ; preds = %11
store i32 270, i32* %3
br label %37
17: ; preds = %2
%18 = load float, float* %5
%19 = fpext float %18 to double
%20 = fcmp oeq double %19, 0.000000e+00
br i1 %20, label %21, label %27
21: ; preds = %17
%22 = load float, float* %4
%23 = fpext float %22 to double
%24 = fcmp oge double %23, 0.000000e+00
br i1 %24, label %25, label %26
25: ; preds = %21
store i32 0, i32* %3
br label %37
26: ; preds = %21
store i32 180, i32* %3
br label %37
27: ; preds = %17
%28 = load float, float* %5
%29 = load float, float* %4
%30 = call float @atan2(float %28, float %29)
store float %30, float* %6
%31 = load float, float* %6
%32 = fpext float %31 to double
%33 = fmul double 0x404CA5DC1A63D3F3, %32
%34 = fptrunc double %33 to float
store float %34, float* %7
%35 = load float, float* %7
%36 = fptosi float %35 to i32
store i32 %36, i32* %3
br label %37
37: ; preds = %27, %26, %25, %16, %15
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
define i32 @initangle(float %0, float %1) {
%3 = fcmp oeq float %0, 0.000000e+00
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = fcmp ult float %1, 0.000000e+00
%6 = select i1 %5, i32 270, i32 90
br label %18
7: ; preds = %2
%8 = fcmp oeq float %1, 0.000000e+00
br i1 %8, label %9, label %12
9: ; preds = %7
%10 = fcmp ult float %0, 0.000000e+00
%11 = select i1 %10, i32 180, i32 0
br label %18
12: ; preds = %7
%13 = tail call float @atan2(float %1, float %0)
%14 = fpext float %13 to double
%15 = fmul double %14, 0x404CA5DC1A63D3F3
%16 = fptrunc double %15 to float
%17 = fptosi float %16 to i32
br label %18
18: ; preds = %9, %4, %12
%19 = phi i32 [ %17, %12 ], [ %6, %4 ], [ %11, %9 ]
ret i32 %19
}