#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 *, ...);
int /*<<< orphan*/ scanf(char *, double *, ...);
int /*<<< orphan*/ sphericalWeightedAverage4(int, double **, double *,
                                             double *);
main() {
  double pt[2][4], t;
  double weight[2];
  double mean[4];
  while (1) {
    printf("Enter A: ");
    scanf("%lf %lf %lf %lf", &(pt[0][0]), &(pt[0][1]), &(pt[0][2]),
          &(pt[0][3]));
    printf("Enter B: ");
    scanf("%lf %lf %lf %lf", &(pt[1][0]), &(pt[1][1]), &(pt[1][2]),
          &(pt[1][3]));
    printf("Enter t: ");
    scanf("%lf", &t);
    weight[0] = 1 - t;
    weight[1] = t;
    sphericalWeightedAverage4(2, pt, weight, mean);
    printf("mean = %lf %lf %lf %lf\n", mean[0], mean[1], mean[2], mean[3]);
    printf("\n\n\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    -0x50(%rbp),%rdx
add    $0x8,%rdx
mov    %rdx,-0xe8(%rbp)
lea    -0x50(%rbp),%rcx
add    $0x10,%rcx
mov    %rcx,-0xe0(%rbp)
lea    -0x50(%rbp),%r8
add    $0x18,%r8
mov    %r8,-0xd8(%rbp)
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x50(%rbp),%rsi
add    $0x20,%rsi
mov    %rsi,-0xd0(%rbp)
lea    -0x50(%rbp),%rdx
add    $0x20,%rdx
mov    %rdx,-0xc8(%rbp)
add    $0x8,%rdx
mov    %rdx,-0xc0(%rbp)
lea    -0x50(%rbp),%rcx
add    $0x20,%rcx
mov    %rcx,-0xb8(%rbp)
add    $0x10,%rcx
mov    %rcx,-0xb0(%rbp)
lea    -0x50(%rbp),%r8
add    $0x20,%r8
mov    %r8,-0xa8(%rbp)
add    $0x18,%r8
mov    %r8,-0xa0(%rbp)
lea    0xe11(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe01(%rip),%rdi
lea    -0x58(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movsd  0xdd0(%rip),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
lea    -0x50(%rbp),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x90(%rbp),%rcx
mov    $0x2,%edi
call   1040 <sphericalWeightedAverage4@plt>
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x80(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm3
lea    0xdb0(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
lea    0xdba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1142 <main+0x12>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
lea    0xeba(%rip),%r12
lea    0x40(%rsp),%r13
lea    0x10(%rsp),%rbx
lea    0x20(%rsp),%rbp
lea    0xec8(%rip),%r14
lea    0xed9(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
lea    0x48(%rsp),%rdx
lea    0x50(%rsp),%rcx
lea    0x58(%rsp),%r8
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe71(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
lea    0x60(%rsp),%rsi
lea    0x68(%rsp),%rdx
lea    0x70(%rsp),%rcx
lea    0x78(%rsp),%r8
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe4f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe33(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
movsd  0x8(%rsp),%xmm0
movsd  0xdfb(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x18(%rsp)
mov    $0x2,%edi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   1050 <sphericalWeightedAverage4@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
movsd  0x30(%rsp),%xmm2
movsd  0x38(%rsp),%xmm3
mov    %r14,%rdi
mov    $0x4,%al
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
jmp    1180 <main+0x40>

LLVM IR (-O0):
@.str = [10 x i8] c"Enter A: \00"
@.str.1 = [16 x i8] c"%lf %lf %lf %lf\00"
@.str.2 = [10 x i8] c"Enter B: \00"
@.str.3 = [10 x i8] c"Enter t: \00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [24 x i8] c"mean = %lf %lf %lf %lf\0A\00"
@.str.6 = [4 x i8] c"\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x [4 x double]]
%3 = alloca double
%4 = alloca [2 x double]
%5 = alloca [4 x double]
store i32 0, i32* %1
br label %6
6: ; preds = %0, %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %2, i64 0, i64 0
%9 = getelementptr inbounds [4 x double], [4 x double]* %8, i64 0, i64 0
%10 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %2, i64 0, i64 0
%11 = getelementptr inbounds [4 x double], [4 x double]* %10, i64 0, i64 1
%12 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %2, i64 0, i64 0
%13 = getelementptr inbounds [4 x double], [4 x double]* %12, i64 0, i64 2
%14 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %2, i64 0, i64 0
%15 = getelementptr inbounds [4 x double], [4 x double]* %14, i64 0, i64 3
%16 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double* %9, double* %11, double* %13, double* %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%18 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %2, i64 0, i64 1
%19 = getelementptr inbounds [4 x double], [4 x double]* %18, i64 0, i64 0
%20 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %2, i64 0, i64 1
%21 = getelementptr inbounds [4 x double], [4 x double]* %20, i64 0, i64 1
%22 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %2, i64 0, i64 1
%23 = getelementptr inbounds [4 x double], [4 x double]* %22, i64 0, i64 2
%24 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %2, i64 0, i64 1
%25 = getelementptr inbounds [4 x double], [4 x double]* %24, i64 0, i64 3
%26 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double* %19, double* %21, double* %23, double* %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%28 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %3)
%29 = load double, double* %3
%30 = fsub double 1.000000e+00, %29
%31 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
store double %30, double* %31
%32 = load double, double* %3
%33 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 1
store double %32, double* %33
%34 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %2, i64 0, i64 0
%35 = bitcast [4 x double]* %34 to double**
%36 = getelementptr inbounds [2 x double], [2 x double]* %4, i64 0, i64 0
%37 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 0
%38 = call i32 @sphericalWeightedAverage4(i32 2, double** %35, double* %36, double* %37)
%39 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 0
%40 = load double, double* %39
%41 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 1
%42 = load double, double* %41
%43 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 2
%44 = load double, double* %43
%45 = getelementptr inbounds [4 x double], [4 x double]* %5, i64 0, i64 3
%46 = load double, double* %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), double %40, double %42, double %44, double %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %6
}

LLVM IR (-O2):
@.str = [10 x i8] c"Enter A: \00"
@.str.1 = [16 x i8] c"%lf %lf %lf %lf\00"
@.str.2 = [10 x i8] c"Enter B: \00"
@.str.3 = [10 x i8] c"Enter t: \00"
@.str.4 = [4 x i8] c"%lf\00"
@.str.5 = [24 x i8] c"mean = %lf %lf %lf %lf\0A\00"
@str = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca [2 x [4 x double]]
%2 = alloca double
%3 = alloca [2 x double]
%4 = alloca [4 x double]
%5 = bitcast [2 x [4 x double]]* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = bitcast [2 x double]* %3 to i8*
%8 = bitcast [4 x double]* %4 to i8*
%9 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %1, i64 0, i64 0, i64 0
%10 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %1, i64 0, i64 0, i64 1
%11 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %1, i64 0, i64 0, i64 2
%12 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %1, i64 0, i64 0, i64 3
%13 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %1, i64 0, i64 1, i64 0
%14 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %1, i64 0, i64 1, i64 1
%15 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %1, i64 0, i64 1, i64 2
%16 = getelementptr inbounds [2 x [4 x double]], [2 x [4 x double]]* %1, i64 0, i64 1, i64 3
%17 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 0
%18 = getelementptr inbounds [2 x double], [2 x double]* %3, i64 0, i64 1
%19 = bitcast [2 x [4 x double]]* %1 to double**
%20 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 0
%21 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 1
%22 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 2
%23 = getelementptr inbounds [4 x double], [4 x double]* %4, i64 0, i64 3
br label %24
24: ; preds = %24, %0
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%26 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double* %9, double* %10, double* %11, double* %12)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%28 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double* %13, double* %14, double* %15, double* %16)
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 (i8*, double*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), double* %2)
%31 = load double, double* %2
%32 = fsub double 1.000000e+00, %31
store double %32, double* %17
store double %31, double* %18
%33 = call i32 @sphericalWeightedAverage4(i32 2, double** %19, double* %17, double* %20)
%34 = load double, double* %20
%35 = load double, double* %21
%36 = load double, double* %22
%37 = load double, double* %23
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0), double %34, double %35, double %36, double %37)
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
br label %24
}