#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 modulo(float, int);
float modulo360(float num, int type) {
  float res;
  res = modulo(num, 360);
  if (res > -0.001 && res < 0.001) {
    switch (type) {
    case 0:
      return (0.);
    default:
      return (360.);
    }
  }
  return (res);
}


x86 assembly (clang, -O0):
<modulo360>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
mov    $0x168,%edi
call   1030 <modulo@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xebb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1199 <modulo360+0x89>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xea8(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1199 <modulo360+0x89>
mov    -0xc(%rbp),%eax
test   %eax,%eax
jne    1187 <modulo360+0x77>
jmp    117a <modulo360+0x6a>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11a3 <modulo360+0x93>
movss  0xe81(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11a3 <modulo360+0x93>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modulo360>:
push   %rbx
mov    %edi,%ebx
mov    $0x168,%edi
call   1030 <modulo@plt>
cvtss2sd %xmm0,%xmm2
xorps  %xmm1,%xmm1
test   %ebx,%ebx
je     1130 <modulo360+0x20>
movss  0xed0(%rip),%xmm1
movsd  0xed0(%rip),%xmm3
ucomisd %xmm2,%xmm3
ja     1141 <modulo360+0x31>
movaps %xmm0,%xmm1
ucomisd 0xec7(%rip),%xmm2
ja     114e <modulo360+0x3e>
movaps %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define float @modulo360(float %0, i32 %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca i32
%6 = alloca float
store float %0, float* %4
store i32 %1, i32* %5
%7 = load float, float* %4
%8 = call float @modulo(float %7, i32 360)
store float %8, float* %6
%9 = load float, float* %6
%10 = fpext float %9 to double
%11 = fcmp ogt double %10, -1.000000e-03
br i1 %11, label %12, label %20
12: ; preds = %2
%13 = load float, float* %6
%14 = fpext float %13 to double
%15 = fcmp olt double %14, 1.000000e-03
br i1 %15, label %16, label %20
16: ; preds = %12
%17 = load i32, i32* %5
switch i32 %17, label %19 [
i32 0, label %18
]
18: ; preds = %16
store float 0.000000e+00, float* %3
br label %22
19: ; preds = %16
store float 3.600000e+02, float* %3
br label %22
20: ; preds = %12, %2
%21 = load float, float* %6
store float %21, float* %3
br label %22
22: ; preds = %20, %19, %18
%23 = load float, float* %3
ret float %23
}

LLVM IR (-O2):
define float @modulo360(float %0, i32 %1) {
%3 = tail call float @modulo(float %0, i32 360)
%4 = fpext float %3 to double
%5 = fcmp ogt double %4, -1.000000e-03
%6 = fcmp olt double %4, 1.000000e-03
%7 = and i1 %5, %6
%8 = icmp eq i32 %1, 0
%9 = select i1 %8, float 0.000000e+00, float 3.600000e+02
%10 = select i1 %7, float %9, float %3
ret float %10
}