#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*/ exit(int);
int /*<<< orphan*/ printf(char *, float);
void CFloatBin(int *p, float target) {
  if (target >= 1) {
    printf("Error at 'CFloatBin'!! target is %.2f > 1.0\n", target);
    exit(1);
  }
  target *= 2;
  if (target == 1) {
    *p = 1;
  } else if (target > 1) {
    *p = 1;
    CFloatBin(++p, target - 1);
  } else {
    *p = 0;
    CFloatBin(++p, target);
  }
}


x86 assembly (clang, -O0):
<CFloatBin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xeb2(%rip),%xmm1
ucomiss %xmm1,%xmm0
jb     1172 <CFloatBin+0x42>
movss  -0xc(%rbp),%xmm0
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
movss  0xe8a(%rip),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xe6f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11af <CFloatBin+0x7f>
jp     11af <CFloatBin+0x7f>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
jmp    121b <CFloatBin+0xeb>
movss  -0xc(%rbp),%xmm0
movss  0xe44(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11f6 <CFloatBin+0xc6>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    %rdi,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xe18(%rip),%xmm1
subss  %xmm1,%xmm0
call   1030 <CFloatBin@plt>
jmp    1216 <CFloatBin+0xe6>
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    %rdi,-0x8(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <CFloatBin@plt>
jmp    121b <CFloatBin+0xeb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CFloatBin>:
push   %rax
ucomiss 0xed8(%rip),%xmm0
jae    1173 <CFloatBin+0x53>
movss  0xece(%rip),%xmm1
movss  0xeca(%rip),%xmm2
jmp    1153 <CFloatBin+0x33>
nopl   0x0(%rax)
movl   $0x1,(%rdi)
addss  %xmm2,%xmm0
add    $0x4,%rdi
ucomiss %xmm1,%xmm0
jae    1173 <CFloatBin+0x53>
addss  %xmm0,%xmm0
ucomiss %xmm1,%xmm0
jne    115e <CFloatBin+0x3e>
jnp    116b <CFloatBin+0x4b>
ucomiss %xmm1,%xmm0
ja     1140 <CFloatBin+0x20>
movl   $0x0,(%rdi)
jmp    114a <CFloatBin+0x2a>
movl   $0x1,(%rdi)
pop    %rax
ret
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"Error at 'CFloatBin'!! target is %.2f > 1.0\0A\00"
define void @CFloatBin(i32* %0, float %1) {
%3 = alloca i32*
%4 = alloca float
store i32* %0, i32** %3
store float %1, float* %4
%5 = load float, float* %4
%6 = fcmp oge float %5, 1.000000e+00
br i1 %6, label %7, label %11
7: ; preds = %2
%8 = load float, float* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), float %8)
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %2
%12 = load float, float* %4
%13 = fmul float %12, 2.000000e+00
store float %13, float* %4
%14 = load float, float* %4
%15 = fcmp oeq float %14, 1.000000e+00
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = load i32*, i32** %3
store i32 1, i32* %17
br label %33
18: ; preds = %11
%19 = load float, float* %4
%20 = fcmp ogt float %19, 1.000000e+00
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32*, i32** %3
store i32 1, i32* %22
%23 = load i32*, i32** %3
%24 = getelementptr inbounds i32, i32* %23, i32 1
store i32* %24, i32** %3
%25 = load float, float* %4
%26 = fsub float %25, 1.000000e+00
br label %32
27: ; preds = %18
%28 = load i32*, i32** %3
store i32 0, i32* %28
%29 = load i32*, i32** %3
%30 = getelementptr inbounds i32, i32* %29, i32 1
store i32* %30, i32** %3
%31 = load float, float* %4
br label %32
32: ; preds = %27, %21
br label %33
33: ; preds = %32, %16
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"Error at 'CFloatBin'!! target is %.2f > 1.0\0A\00"
define void @CFloatBin(i32* %0, float %1) {
%3 = fcmp ult float %1, 1.000000e+00
br i1 %3, label %8, label %4
4: ; preds = %18, %2
%5 = phi float [ %1, %2 ], [ %19, %18 ]
%6 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), float %5)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2, %18
%9 = phi float [ %19, %18 ], [ %1, %2 ]
%10 = phi i32* [ %20, %18 ], [ %0, %2 ]
%11 = fmul float %9, 2.000000e+00
%12 = fcmp oeq float %11, 1.000000e+00
br i1 %12, label %13, label %14
13: ; preds = %8
store i32 1, i32* %10
ret void
14: ; preds = %8
%15 = fcmp ogt float %11, 1.000000e+00
br i1 %15, label %16, label %22
16: ; preds = %14
store i32 1, i32* %10
%17 = fadd float %11, -1.000000e+00
br label %18
18: ; preds = %16, %22
%19 = phi float [ %17, %16 ], [ %11, %22 ]
%20 = getelementptr inbounds i32, i32* %10, i64 1
%21 = fcmp ult float %19, 1.000000e+00
br i1 %21, label %8, label %4
22: ; preds = %14
store i32 0, i32* %10
br label %18
}