#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*/ float_to_frac(float, int *, int *);
int /*<<< orphan*/ printf(char *, float, int, int);
void float_to_frac_test(void) {
  int a, b;
  float x;
  x = (float)4 / 3;
  float_to_frac(x, &a, &b);
  printf("%f = %d / %d\n", x, a, b);
  x = (float)16 / 9;
  float_to_frac(x, &a, &b);
  printf("%f = %d / %d\n", x, a, b);
}


x86 assembly (clang, -O0):
<float_to_frac_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  0xed4(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <float_to_frac@plt>
movss  -0xc(%rbp),%xmm0
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
movss  0xe9a(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <float_to_frac@plt>
movss  -0xc(%rbp),%xmm0
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_to_frac_test>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movss  0xecf(%rip),%xmm0
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%r14
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <float_to_frac@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xeb3(%rip),%rbx
mov    %rbx,%rdi
movss  0xea0(%rip),%xmm0
call   1030 <printf@plt>
movss  0xe97(%rip),%xmm0
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <float_to_frac@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %rbx,%rdi
movss  0xe79(%rip),%xmm0
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%f = %d / %d\0A\00"
define void @float_to_frac_test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
store float 0x3FF5555560000000, float* %3
%4 = load float, float* %3
%5 = call i32 @float_to_frac(float %4, i32* %1, i32* %2)
%6 = load float, float* %3
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), float %6, i32 %7, i32 %8)
store float 0x3FFC71C720000000, float* %3
%10 = load float, float* %3
%11 = call i32 @float_to_frac(float %10, i32* %1, i32* %2)
%12 = load float, float* %3
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), float %12, i32 %13, i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%f = %d / %d\0A\00"
define void @float_to_frac_test() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @float_to_frac(float 0x3FF5555560000000, i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), float 0x3FF5555560000000, i32 %6, i32 %7)
%9 = call i32 @float_to_frac(float 0x3FFC71C720000000, i32* %1, i32* %2)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), float 0x3FFC71C720000000, i32 %10, i32 %11)
ret void
}