#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 M_PI;
int quadrant(float a) {
  if (a >= 0) {
    if (a < M_PI / 2.0) {
      return 1;
    } else {
      return 2;
    }
  } else {
    if (a < -M_PI / 2.0) {
      return 3;
    } else {
      return 4;
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<quadrant>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     115c <quadrant+0x5c>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
mov    0x2ebe(%rip),%rax
movsd  (%rax),%xmm0
movsd  0xeca(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    1150 <quadrant+0x50>
movl   $0x1,-0x4(%rbp)
jmp    11b0 <quadrant+0xb0>
movl   $0x2,-0x4(%rbp)
jmp    11b0 <quadrant+0xb0>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
mov    0x2e7c(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe71(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jbe    11a9 <quadrant+0xa9>
movl   $0x3,-0x4(%rbp)
jmp    11b0 <quadrant+0xb0>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<quadrant>:
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
mov    0x2ed7(%rip),%rax
movsd  (%rax),%xmm1
jae    1130 <quadrant+0x30>
mulsd  0xee9(%rip),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
mov    $0x4,%eax
sub    %ecx,%eax
ret
mulsd  0xec8(%rip),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
mov    $0x2,%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define i32 @quadrant(float %0) {
%2 = alloca i32
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fcmp oge float %4, 0.000000e+00
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load float, float* %3
%8 = fpext float %7 to double
%9 = load double, double* @M_PI
%10 = fdiv double %9, 2.000000e+00
%11 = fcmp olt double %8, %10
br i1 %11, label %12, label %13
12: ; preds = %6
store i32 1, i32* %2
br label %23
13: ; preds = %6
store i32 2, i32* %2
br label %23
14: ; preds = %1
%15 = load float, float* %3
%16 = fpext float %15 to double
%17 = load double, double* @M_PI
%18 = fneg double %17
%19 = fdiv double %18, 2.000000e+00
%20 = fcmp olt double %16, %19
br i1 %20, label %21, label %22
21: ; preds = %14
store i32 3, i32* %2
br label %23
22: ; preds = %14
store i32 4, i32* %2
br label %23
23: ; preds = %22, %21, %13, %12
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define i32 @quadrant(float %0) {
%2 = fcmp ult float %0, 0.000000e+00
%3 = fpext float %0 to double
%4 = load double, double* @M_PI
br i1 %2, label %9, label %5
5: ; preds = %1
%6 = fmul double %4, 5.000000e-01
%7 = fcmp ogt double %6, %3
%8 = select i1 %7, i32 1, i32 2
br label %13
9: ; preds = %1
%10 = fmul double %4, -5.000000e-01
%11 = fcmp ogt double %10, %3
%12 = select i1 %11, i32 3, i32 4
br label %13
13: ; preds = %9, %5
%14 = phi i32 [ %8, %5 ], [ %12, %9 ]
ret i32 %14
}