#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*/ printf(char *, ...);
void double_add_sub(double *r1, double *r2, double *r3) {
  printf("\n");
  printf("DOUBLE_ADD_SUB:\n");
  printf("  Input R1 = %f.\n", *r1);
  printf("  Input R2 = %f.\n", *r2);
  *r3 = *r1 + *r2;
  printf("  Output R3 = %f.\n", *r3);
}


x86 assembly (clang, -O0):
<double_add_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xef6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xec2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xebe(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xea2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<double_add_sub>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xee8(%rip),%rdi
call   1040 <puts@plt>
movsd  (%rbx),%xmm0
lea    0xea1(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  (%r15),%xmm0
lea    0xea0(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
movsd  (%rbx),%xmm0
addsd  (%r15),%xmm0
movsd  %xmm0,(%r14)
lea    0xe96(%rip),%rdi
mov    $0x1,%al
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [17 x i8] c"DOUBLE_ADD_SUB:\0A\00"
@.str.2 = [18 x i8] c" Input R1 = %f.\0A\00"
@.str.3 = [18 x i8] c" Input R2 = %f.\0A\00"
@.str.4 = [19 x i8] c" Output R3 = %f.\0A\00"
define void @double_add_sub(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%9 = load double*, double** %4
%10 = load double, double* %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %10)
%12 = load double*, double** %5
%13 = load double, double* %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), double %13)
%15 = load double*, double** %4
%16 = load double, double* %15
%17 = load double*, double** %5
%18 = load double, double* %17
%19 = fadd double %16, %18
%20 = load double*, double** %6
store double %19, double* %20
%21 = load double*, double** %6
%22 = load double, double* %21
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %22)
ret void
}

LLVM IR (-O2):
@.str.2 = [18 x i8] c" Input R1 = %f.\0A\00"
@.str.3 = [18 x i8] c" Input R2 = %f.\0A\00"
@.str.4 = [19 x i8] c" Output R3 = %f.\0A\00"
@str = [16 x i8] c"DOUBLE_ADD_SUB:\00"
define void @double_add_sub(double* nocapture %0, double* nocapture %1, double* nocapture writeonly %2) {
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%6 = load double, double* %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), double %6)
%8 = load double, double* %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), double %8)
%10 = load double, double* %0
%11 = load double, double* %1
%12 = fadd double %10, %11
store double %12, double* %2
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), double %12)
ret void
}