#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 feet;
  double fractionalFoot = modf(rawFeet, &feet);
  if (ftPtr) {
    printf("Storing %f to the address of %p\n", feet, ftPtr);
    *ftPtr = feet;
  }
  double inches = fractionalFoot * 12.0;
  if (inPtr) {
    printf("Storing %.2f to 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    -0x28(%rbp),%rdi
call   1040 <modf@plt>
movsd  %xmm0,-0x30(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     118a <metersToFeetAndInches+0x6a>
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rsi
lea    0xe9b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
cvttsd2si -0x28(%rbp),%rax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movsd  0xe76(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     11cb <metersToFeetAndInches+0xab>
movsd  -0x38(%rbp),%xmm0
mov    -0x18(%rbp),%rsi
lea    0xe7a(%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   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
mulsd  0xecb(%rip),%xmm0
lea    0x10(%rsp),%rdi
call   1040 <modf@plt>
movsd  %xmm0,(%rsp)
test   %rbx,%rbx
je     116f <metersToFeetAndInches+0x4f>
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
lea    0xeb4(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%al
call   1030 <printf@plt>
cvttsd2si 0x8(%rsp),%rax
mov    %eax,(%rbx)
test   %r14,%r14
je     11a1 <metersToFeetAndInches+0x81>
movsd  (%rsp),%xmm0
mulsd  0xe87(%rip),%xmm0
movsd  %xmm0,(%rsp)
lea    0xea4(%rip),%rdi
mov    %r14,%rsi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  (%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [33 x i8] c"Storing %f to the address of %p\0A\00"
@.str.1 = [28 x i8] c"Storing %.2f to 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 %13, label %9
9: ; preds = %3
%10 = load double, double* %4
%11 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), double %10, i32* %1)
%12 = fptoui double %10 to i32
store i32 %12, i32* %1
br label %13
13: ; preds = %9, %3
%14 = fmul double %7, 1.200000e+01
%15 = icmp eq double* %2, null
br i1 %15, label %18, label %16
16: ; preds = %13
%17 = tail call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), double %14, double* %2)
store double %14, double* %2
br label %18
18: ; preds = %16, %13
ret void
}