#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*/ cartesianToPolar(double, double, double *, double *);
double modf(double, double *);
int /*<<< orphan*/ printf(char *, double, double, ...);
int main(int argc, const char *argv[]) {
  double pi = 3.14;
  double integerPart;
  double fractionPart;
  fractionPart = modf(pi, &integerPart);
  printf("integerPart = %.0f, fractionPart = %.2f\n", integerPart,
         fractionPart);
  double x = 3.0;
  double y = 4.0;
  double radius;
  double angle;
  cartesianToPolar(x, y, &radius, &angle);
  printf("(%.2f, %.2f) becomes (%.2f radians, %.2f)\n", x, y, radius, angle);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xec2(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    -0x20(%rbp),%rdi
call   1040 <modf@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xea1(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0xe82(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe6d(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
lea    -0x40(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1050 <cartesianToPolar@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm3
lea    0xe77(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movsd  0xec4(%rip),%xmm0
lea    0x10(%rsp),%rdi
call   1040 <modf@plt>
movaps %xmm0,%xmm1
movsd  0x10(%rsp),%xmm0
lea    0xec2(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  0xea3(%rip),%xmm0
movsd  0xea3(%rip),%xmm1
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1050 <cartesianToPolar@plt>
movsd  0x8(%rsp),%xmm2
movsd  (%rsp),%xmm3
lea    0xeb5(%rip),%rdi
movsd  0xe74(%rip),%xmm0
movsd  0xe74(%rip),%xmm1
mov    $0x4,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"integerPart = %.0f, fractionPart = %.2f\0A\00"
@.str.1 = [43 x i8] c"(%.2f, %.2f) becomes (%.2f radians, %.2f)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 3.140000e+00, double* %6
%13 = load double, double* %6
%14 = call double @modf(double %13, double* %7)
store double %14, double* %8
%15 = load double, double* %7
%16 = load double, double* %8
%17 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), double %15, double %16)
store double 3.000000e+00, double* %9
store double 4.000000e+00, double* %10
%18 = load double, double* %9
%19 = load double, double* %10
%20 = call i32 @cartesianToPolar(double %18, double %19, double* %11, double* %12)
%21 = load double, double* %9
%22 = load double, double* %10
%23 = load double, double* %11
%24 = load double, double* %12
%25 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), double %21, double %22, double %23, double %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"integerPart = %.0f, fractionPart = %.2f\0A\00"
@.str.1 = [43 x i8] c"(%.2f, %.2f) becomes (%.2f radians, %.2f)\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = bitcast double* %3 to i8*
%7 = call double @modf(double 3.140000e+00, double* %3)
%8 = load double, double* %3
%9 = tail call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), double %8, double %7)
%10 = bitcast double* %4 to i8*
%11 = bitcast double* %5 to i8*
%12 = call i32 @cartesianToPolar(double 3.000000e+00, double 4.000000e+00, double* %4, double* %5)
%13 = load double, double* %4
%14 = load double, double* %5
%15 = call i32 (i8*, double, double, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), double 3.000000e+00, double 4.000000e+00, double %13, double %14)
ret i32 0
}