#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 */
int /*<<< orphan*/ modf(float, double *);
float round_off_heading_float(float n, float m) {
  float n_10, m_10, unbounded_rounded;
  double ip;
  double ip2;
  modf((n * 10.0), &ip);
  n_10 = (float)ip;
  modf((m * 10.0), &ip);
  m_10 = (float)ip;
  if (n_10 < 0.0) {
    modf((m_10 / 2.0), &ip2);
    modf(((n_10 - ip2) / m_10), &ip);
    unbounded_rounded = (float)(m_10 * ip);
  } else {
    modf((m_10 / 2.0), &ip2);
    modf(((n_10 + ip2) / m_10), &ip);
    unbounded_rounded = (float)(m_10 * ip);
  }
  return (float)(unbounded_rounded / 10.0);
}


x86 assembly (clang, -O0):
<round_off_heading_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xecd(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    -0x20(%rbp),%rdi
call   1030 <modf@plt>
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9d(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    -0x20(%rbp),%rdi
call   1030 <modf@plt>
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    11fe <round_off_heading_float+0xee>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe5f(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    -0x28(%rbp),%rdi
call   1030 <modf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
subsd  -0x28(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    -0x20(%rbp),%rdi
call   1030 <modf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    125f <round_off_heading_float+0x14f>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdf9(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    -0x28(%rbp),%rdi
call   1030 <modf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  -0x28(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    -0x20(%rbp),%rdi
call   1030 <modf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd90(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_off_heading_float>:
push   %rbx
sub    $0x30,%rsp
movss  %xmm1,0x10(%rsp)
mulss  0xedd(%rip),%xmm0
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <modf@plt>
movsd  0x18(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,0x8(%rsp)
movss  0x10(%rsp),%xmm0
mulss  0xeb2(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <modf@plt>
movsd  0x18(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
movss  %xmm1,0x24(%rsp)
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
movss  0xe83(%rip),%xmm0
mulss  %xmm1,%xmm0
lea    0x28(%rsp),%rdi
call   1030 <modf@plt>
xorps  %xmm0,%xmm0
ucomiss 0x8(%rsp),%xmm0
movss  0x24(%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  0x28(%rsp),%xmm0
jbe    11b4 <round_off_heading_float+0xa4>
xorpd  0xe5c(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    %rbx,%rdi
movsd  %xmm1,0x8(%rsp)
call   1030 <modf@plt>
movsd  0x8(%rsp),%xmm0
mulsd  0x18(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
divss  0xe18(%rip),%xmm0
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define float @round_off_heading_float(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca double
%9 = alloca double
store float %0, float* %3
store float %1, float* %4
%10 = load float, float* %3
%11 = fpext float %10 to double
%12 = fmul double %11, 1.000000e+01
%13 = fptrunc double %12 to float
%14 = call i32 @modf(float %13, double* %8)
%15 = load double, double* %8
%16 = fptrunc double %15 to float
store float %16, float* %5
%17 = load float, float* %4
%18 = fpext float %17 to double
%19 = fmul double %18, 1.000000e+01
%20 = fptrunc double %19 to float
%21 = call i32 @modf(float %20, double* %8)
%22 = load double, double* %8
%23 = fptrunc double %22 to float
store float %23, float* %6
%24 = load float, float* %5
%25 = fpext float %24 to double
%26 = fcmp olt double %25, 0.000000e+00
br i1 %26, label %27, label %47
27: ; preds = %2
%28 = load float, float* %6
%29 = fpext float %28 to double
%30 = fdiv double %29, 2.000000e+00
%31 = fptrunc double %30 to float
%32 = call i32 @modf(float %31, double* %9)
%33 = load float, float* %5
%34 = fpext float %33 to double
%35 = load double, double* %9
%36 = fsub double %34, %35
%37 = load float, float* %6
%38 = fpext float %37 to double
%39 = fdiv double %36, %38
%40 = fptrunc double %39 to float
%41 = call i32 @modf(float %40, double* %8)
%42 = load float, float* %6
%43 = fpext float %42 to double
%44 = load double, double* %8
%45 = fmul double %43, %44
%46 = fptrunc double %45 to float
store float %46, float* %7
br label %67
47: ; preds = %2
%48 = load float, float* %6
%49 = fpext float %48 to double
%50 = fdiv double %49, 2.000000e+00
%51 = fptrunc double %50 to float
%52 = call i32 @modf(float %51, double* %9)
%53 = load float, float* %5
%54 = fpext float %53 to double
%55 = load double, double* %9
%56 = fadd double %54, %55
%57 = load float, float* %6
%58 = fpext float %57 to double
%59 = fdiv double %56, %58
%60 = fptrunc double %59 to float
%61 = call i32 @modf(float %60, double* %8)
%62 = load float, float* %6
%63 = fpext float %62 to double
%64 = load double, double* %8
%65 = fmul double %63, %64
%66 = fptrunc double %65 to float
store float %66, float* %7
br label %67
67: ; preds = %47, %27
%68 = load float, float* %7
%69 = fpext float %68 to double
%70 = fdiv double %69, 1.000000e+01
%71 = fptrunc double %70 to float
ret float %71
}

LLVM IR (-O2):
define float @round_off_heading_float(float %0, float %1) {
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %3 to i8*
%6 = bitcast double* %4 to i8*
%7 = fmul float %0, 1.000000e+01
%8 = call i32 @modf(float %7, double* %3)
%9 = load double, double* %3
%10 = fptrunc double %9 to float
%11 = fmul float %1, 1.000000e+01
%12 = call i32 @modf(float %11, double* %3)
%13 = load double, double* %3
%14 = fptrunc double %13 to float
%15 = fpext float %10 to double
%16 = fcmp olt float %10, 0.000000e+00
%17 = fpext float %14 to double
%18 = fmul float %14, 5.000000e-01
%19 = call i32 @modf(float %18, double* %4)
%20 = load double, double* %4
%21 = fneg double %20
%22 = select i1 %16, double %21, double %20
%23 = fadd double %22, %15
%24 = fdiv double %23, %17
%25 = fptrunc double %24 to float
%26 = call i32 @modf(float %25, double* %3)
%27 = load double, double* %3
%28 = fmul double %27, %17
%29 = fptrunc double %28 to float
%30 = fdiv float %29, 1.000000e+01
ret float %30
}