#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 modf(double, double *);
int /*<<< orphan*/ printf(char *, double, ...);
void metersToFeetAndInches(double meters, unsigned int *ftPtr, double *inPtr) {
  double rawFeet = meters * 3.281;
  double fractionalFoot;
  double feet;
  fractionalFoot = modf(rawFeet, &feet);
  if (ftPtr) {
    printf("Storing %u to the address %p\n", (unsigned int)feet, ftPtr);
    *ftPtr = feet;
  }
  double inches = fractionalFoot * 12.0;
  if (inPtr) {
    printf("Storing %.2f to the address %p\n", inches, inPtr);
    *inPtr = inches;
  }
}


x86 assembly (clang, -O0):
<metersToFeetAndInches>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movsd  0xec3(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    -0x30(%rbp),%rdi
call   1040 <modf@plt>
movsd  %xmm0,-0x28(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1192 <metersToFeetAndInches+0x72>
cvttsd2si -0x30(%rbp),%rax
mov    %eax,%eax
cvtsi2sd %rax,%xmm0
mov    -0x10(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cvttsd2si -0x30(%rbp),%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movsd  0xe6e(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11d3 <metersToFeetAndInches+0xb3>
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rsi
lea    0xe6f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<metersToFeetAndInches>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mulsd  0xec9(%rip),%xmm0
lea    0x8(%rsp),%rdi
call   1040 <modf@plt>
movsd  %xmm0,(%rsp)
test   %rbx,%rbx
je     1171 <metersToFeetAndInches+0x51>
cvttsd2si 0x8(%rsp),%r15
mov    %r15d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
lea    0xeac(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%al
call   1030 <printf@plt>
mov    %r15d,(%rbx)
test   %r14,%r14
je     11a3 <metersToFeetAndInches+0x83>
movsd  (%rsp),%xmm0
mulsd  0xe85(%rip),%xmm0
movsd  %xmm0,(%rsp)
lea    0xe9f(%rip),%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Storing %u to the address %p\0A\00"
@.str.1 = [32 x i8] c"Storing %.2f to the address %p\0A\00"
define void @metersToFeetAndInches(double %0, i32* %1, double* %2) {
%4 = alloca double
%5 = alloca i32*
%6 = alloca double*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %4
store i32* %1, i32** %5
store double* %2, double** %6
%11 = load double, double* %4
%12 = fmul double %11, 3.281000e+00
store double %12, double* %7
%13 = load double, double* %7
%14 = call double @modf(double %13, double* %9)
store double %14, double* %8
%15 = load i32*, i32** %5
%16 = icmp ne i32* %15, null
br i1 %16, label %17, label %26
17: ; preds = %3
%18 = load double, double* %9
%19 = fptoui double %18 to i32
%20 = uitofp i32 %19 to double
%21 = load i32*, i32** %5
%22 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double %20, i32* %21)
%23 = load double, double* %9
%24 = fptoui double %23 to i32
%25 = load i32*, i32** %5
store i32 %24, i32* %25
br label %26
26: ; preds = %17, %3
%27 = load double, double* %8
%28 = fmul double %27, 1.200000e+01
store double %28, double* %10
%29 = load double*, double** %6
%30 = icmp ne double* %29, null
br i1 %30, label %31, label %37
31: ; preds = %26
%32 = load double, double* %10
%33 = load double*, double** %6
%34 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), double %32, double* %33)
%35 = load double, double* %10
%36 = load double*, double** %6
store double %35, double* %36
br label %37
37: ; preds = %31, %26
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"Storing %u to the address %p\0A\00"
@.str.1 = [32 x i8] c"Storing %.2f to the address %p\0A\00"
define void @metersToFeetAndInches(double %0, i32* %1, double* %2) {
%4 = alloca double
%5 = fmul double %0, 3.281000e+00
%6 = bitcast double* %4 to i8*
%7 = call double @modf(double %5, double* %4)
%8 = icmp eq i32* %1, null
br i1 %8, label %14, label %9
9: ; preds = %3
%10 = load double, double* %4
%11 = fptoui double %10 to i32
%12 = uitofp i32 %11 to double
%13 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double %12, i32* %1)
store i32 %11, i32* %1
br label %14
14: ; preds = %9, %3
%15 = fmul double %7, 1.200000e+01
%16 = icmp eq double* %2, null
br i1 %16, label %19, label %17
17: ; preds = %14
%18 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), double %15, double* %2)
store double %15, double* %2
br label %19
19: ; preds = %17, %14
ret void
}