#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 umath_double_normalize_in_2pi(double);
int umath_double_normalize_quadrant(double x) {
  x = umath_double_normalize_in_2pi(x);
  if (x < (3.14159265) / 2.0)
    return 1;
  else if (x < (3.14159265))
    return 2;
  else if (x < (3.14159265) / 2.0 * 3.0)
    return 3;
  else
    return 4;
}


x86 assembly (clang, -O0):
<umath_double_normalize_quadrant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <umath_double_normalize_in_2pi@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  0xecc(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    114b <umath_double_normalize_quadrant+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1190 <umath_double_normalize_quadrant+0x80>
movsd  0xeb5(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    116a <umath_double_normalize_quadrant+0x5a>
movl   $0x2,-0x4(%rbp)
jmp    1190 <umath_double_normalize_quadrant+0x80>
movsd  0xe9e(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1189 <umath_double_normalize_quadrant+0x79>
movl   $0x3,-0x4(%rbp)
jmp    1190 <umath_double_normalize_quadrant+0x80>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umath_double_normalize_quadrant>:
push   %rax
call   1030 <umath_double_normalize_in_2pi@plt>
mov    $0x1,%eax
movsd  0xedd(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1154 <umath_double_normalize_quadrant+0x44>
mov    $0x2,%eax
movsd  0xed2(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1154 <umath_double_normalize_quadrant+0x44>
movsd  0xecc(%rip),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
mov    $0x4,%eax
sub    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @umath_double_normalize_quadrant(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = call double @umath_double_normalize_in_2pi(double %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = fcmp olt double %6, 0x3FF921FB53C8D4F1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 1, i32* %2
br label %18
9: ; preds = %1
%10 = load double, double* %3
%11 = fcmp olt double %10, 0x400921FB53C8D4F1
br i1 %11, label %12, label %13
12: ; preds = %9
store i32 2, i32* %2
br label %18
13: ; preds = %9
%14 = load double, double* %3
%15 = fcmp olt double %14, 0x4012D97C7ED69FB5
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 3, i32* %2
br label %18
17: ; preds = %13
store i32 4, i32* %2
br label %18
18: ; preds = %17, %16, %12, %8
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @umath_double_normalize_quadrant(double %0) {
%2 = tail call double @umath_double_normalize_in_2pi(double %0)
%3 = fcmp olt double %2, 0x3FF921FB53C8D4F1
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = fcmp olt double %2, 0x400921FB53C8D4F1
br i1 %5, label %9, label %6
6: ; preds = %4
%7 = fcmp olt double %2, 0x4012D97C7ED69FB5
%8 = select i1 %7, i32 3, i32 4
br label %9
9: ; preds = %6, %4, %1
%10 = phi i32 [ 1, %1 ], [ 2, %4 ], [ %8, %6 ]
ret i32 %10
}