#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 FP_Atan(float);
scalar_t__ FP_Cmp(float, float);
float __addsf3(float, float);
float __subsf3(float, float);
float FP_Atan2(float y, float x) {
  float answer, r;
  r = y / x;
  answer = FP_Atan(r);
  if (FP_Cmp(x, (float)0.0) < 0) {
    if (FP_Cmp(y, (float)0.0) > 0)
      answer = __addsf3(answer, ((float)3.1415926));
    else
      answer = __subsf3(answer, ((float)3.1415926));
  }
  return answer;
}


x86 assembly (clang, -O0):
<FP_Atan2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
call   1030 <FP_Atan@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
call   1050 <FP_Cmp@plt>
cmp    $0x0,%rax
jge    11d6 <FP_Atan2+0x96>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
call   1050 <FP_Cmp@plt>
cmp    $0x0,%rax
jle    11ba <FP_Atan2+0x7a>
movss  -0xc(%rbp),%xmm0
movss  0xe55(%rip),%xmm1
call   1060 <__addsf3@plt>
movss  %xmm0,-0xc(%rbp)
jmp    11d1 <FP_Atan2+0x91>
movss  -0xc(%rbp),%xmm0
movss  0xe39(%rip),%xmm1
call   1040 <__subsf3@plt>
movss  %xmm0,-0xc(%rbp)
jmp    11d6 <FP_Atan2+0x96>
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FP_Atan2>:
sub    $0x18,%rsp
movss  %xmm1,0x14(%rsp)
movss  %xmm0,0x10(%rsp)
divss  %xmm1,%xmm0
call   1030 <FP_Atan@plt>
movss  %xmm0,0xc(%rsp)
xorps  %xmm1,%xmm1
movss  0x14(%rsp),%xmm0
call   1050 <FP_Cmp@plt>
test   %rax,%rax
js     117d <FP_Atan2+0x3d>
movss  0xc(%rsp),%xmm0
add    $0x18,%rsp
ret
xorps  %xmm1,%xmm1
movss  0x10(%rsp),%xmm0
call   1050 <FP_Cmp@plt>
movss  0xe6d(%rip),%xmm1
test   %rax,%rax
jle    11a7 <FP_Atan2+0x67>
movss  0xc(%rsp),%xmm0
add    $0x18,%rsp
jmp    1060 <__addsf3@plt>
movss  0xc(%rsp),%xmm0
add    $0x18,%rsp
jmp    1040 <__subsf3@plt>

LLVM IR (-O0):
define float @FP_Atan2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %3
store float %1, float* %4
%7 = load float, float* %3
%8 = load float, float* %4
%9 = fdiv float %7, %8
store float %9, float* %6
%10 = load float, float* %6
%11 = call float @FP_Atan(float %10)
store float %11, float* %5
%12 = load float, float* %4
%13 = call i64 @FP_Cmp(float %12, float 0.000000e+00)
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %26
15: ; preds = %2
%16 = load float, float* %3
%17 = call i64 @FP_Cmp(float %16, float 0.000000e+00)
%18 = icmp sgt i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load float, float* %5
%21 = call float @__addsf3(float %20, float 0x400921FB40000000)
store float %21, float* %5
br label %25
22: ; preds = %15
%23 = load float, float* %5
%24 = call float @__subsf3(float %23, float 0x400921FB40000000)
store float %24, float* %5
br label %25
25: ; preds = %22, %19
br label %26
26: ; preds = %25, %2
%27 = load float, float* %5
ret float %27
}

LLVM IR (-O2):
define float @FP_Atan2(float %0, float %1) {
%3 = fdiv float %0, %1
%4 = tail call float @FP_Atan(float %3)
%5 = tail call i64 @FP_Cmp(float %1, float 0.000000e+00)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = tail call i64 @FP_Cmp(float %0, float 0.000000e+00)
%9 = icmp sgt i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call float @__addsf3(float %4, float 0x400921FB40000000)
br label %14
12: ; preds = %7
%13 = tail call float @__subsf3(float %4, float 0x400921FB40000000)
br label %14
14: ; preds = %10, %12, %2
%15 = phi float [ %11, %10 ], [ %13, %12 ], [ %4, %2 ]
ret float %15
}