#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 getDouble();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ splitDouble(char **, double);
int main() {
  char sides[2][9];
  double num1;
  printf("Enter double string (MAX 12 CHARS) > ");
  num1 = getDouble();
  printf("num1 = %f\n", num1);
  splitDouble(sides, num1);
  printf("lhs = %s\n", sides[0]);
  printf("rhs = %s\n", sides[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getDouble@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
lea    0xec1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
call   1050 <splitDouble@plt>
lea    -0x20(%rbp),%rsi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
add    $0x9,%rsi
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getDouble@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xecf(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
movsd  0x8(%rsp),%xmm0
call   1050 <splitDouble@plt>
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x19(%rsp),%rsi
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Enter double string (MAX 12 CHARS) > \00"
@.str.1 = [11 x i8] c"num1 = %f\0A\00"
@.str.2 = [10 x i8] c"lhs = %s\0A\00"
@.str.3 = [10 x i8] c"rhs = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x [9 x i8]]
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%5 = call double (...) @getDouble()
store double %5, double* %3
%6 = load double, double* %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), double %6)
%8 = getelementptr inbounds [2 x [9 x i8]], [2 x [9 x i8]]* %2, i64 0, i64 0
%9 = bitcast [9 x i8]* %8 to i8**
%10 = load double, double* %3
%11 = call i32 @splitDouble(i8** %9, double %10)
%12 = getelementptr inbounds [2 x [9 x i8]], [2 x [9 x i8]]* %2, i64 0, i64 0
%13 = getelementptr inbounds [9 x i8], [9 x i8]* %12, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [2 x [9 x i8]], [2 x [9 x i8]]* %2, i64 0, i64 1
%16 = getelementptr inbounds [9 x i8], [9 x i8]* %15, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"Enter double string (MAX 12 CHARS) > \00"
@.str.1 = [11 x i8] c"num1 = %f\0A\00"
@.str.2 = [10 x i8] c"lhs = %s\0A\00"
@.str.3 = [10 x i8] c"rhs = %s\0A\00"
define i32 @main() {
%1 = alloca [2 x [9 x i8]]
%2 = getelementptr inbounds [2 x [9 x i8]], [2 x [9 x i8]]* %1, i64 0, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%4 = tail call double (...) @getDouble()
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), double %4)
%6 = bitcast [2 x [9 x i8]]* %1 to i8**
%7 = call i32 @splitDouble(i8** %6, double %4)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%9 = getelementptr inbounds [2 x [9 x i8]], [2 x [9 x i8]]* %1, i64 0, i64 1, i64 0
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8* %9)
ret i32 0
}