#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 fn(int, double *, int);
int /*<<< orphan*/ printf(char *, double);
void fn_main() {
  double a[] = {1, 2, 3, 4, 5};
  printf("%f\n", fn(2, a, 4));
}


x86 assembly (clang, -O0):
<fn_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1050 <memset@plt>
movsd  0xed0(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xebb(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xea6(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe91(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe7c(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x30(%rbp),%rsi
mov    $0x2,%edi
mov    $0x4,%edx
call   1030 <fn@plt>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_main>:
sub    $0x28,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
movaps 0xeda(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x4014000000000000,%rax
mov    %rax,0x20(%rsp)
mov    %rsp,%rsi
mov    $0x2,%edi
mov    $0x4,%edx
call   1030 <fn@plt>
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
define void @fn_main() {
%1 = alloca [5 x double]
%2 = bitcast [5 x double]* %1 to i8*
%3 = bitcast i8* %2 to [5 x double]*
%4 = getelementptr inbounds [5 x double], [5 x double]* %3, i32 0, i32 0
store double 1.000000e+00, double* %4
%5 = getelementptr inbounds [5 x double], [5 x double]* %3, i32 0, i32 1
store double 2.000000e+00, double* %5
%6 = getelementptr inbounds [5 x double], [5 x double]* %3, i32 0, i32 2
store double 3.000000e+00, double* %6
%7 = getelementptr inbounds [5 x double], [5 x double]* %3, i32 0, i32 3
store double 4.000000e+00, double* %7
%8 = getelementptr inbounds [5 x double], [5 x double]* %3, i32 0, i32 4
store double 5.000000e+00, double* %8
%9 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%10 = call double @fn(i32 2, double* %9, i32 4)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %10)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define void @fn_main() {
%1 = alloca [5 x double]
%2 = bitcast [5 x double]* %1 to i8*
%3 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 0
%4 = bitcast [5 x double]* %1 to <2 x double>*
store <2 x double> <double 1.000000e+00, double 2.000000e+00>, <2 x double>* %4
%5 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 2
%6 = bitcast double* %5 to <2 x double>*
store <2 x double> <double 3.000000e+00, double 4.000000e+00>, <2 x double>* %6
%7 = getelementptr inbounds [5 x double], [5 x double]* %1, i64 0, i64 4
store double 5.000000e+00, double* %7
%8 = call double @fn(i32 2, double* %3, i32 4)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %8)
ret void
}