int const_magnetic_field(double x, double y, double z, double t, double *bx,
                         double *by, double *bz, void *data) {
  int stat = 1;
  if (!data)
    return 0;
  *bx = ((double *)data)[0];
  *by = ((double *)data)[1];
  *bz = ((double *)data)[2];
  return stat;
}


x86 assembly (clang, -O0):
<const_magnetic_field>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    %rcx,-0x48(%rbp)
movl   $0x1,-0x4c(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1146 <const_magnetic_field+0x46>
movl   $0x0,-0x4(%rbp)
jmp    117e <const_magnetic_field+0x7e>
mov    -0x48(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x48(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x4c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<const_magnetic_field>:
test   %rcx,%rcx
je     1125 <const_magnetic_field+0x25>
movsd  (%rcx),%xmm0
movsd  %xmm0,(%rdi)
movsd  0x8(%rcx),%xmm0
movsd  %xmm0,(%rsi)
movsd  0x10(%rcx),%xmm0
movsd  %xmm0,(%rdx)
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @const_magnetic_field(double %0, double %1, double %2, double %3, double* %4, double* %5, double* %6, i8* %7) {
%9 = alloca i32
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca i8*
%18 = alloca i32
store double %0, double* %10
store double %1, double* %11
store double %2, double* %12
store double %3, double* %13
store double* %4, double** %14
store double* %5, double** %15
store double* %6, double** %16
store i8* %7, i8** %17
store i32 1, i32* %18
%19 = load i8*, i8** %17
%20 = icmp ne i8* %19, null
br i1 %20, label %22, label %21
21: ; preds = %8
store i32 0, i32* %9
br label %39
22: ; preds = %8
%23 = load i8*, i8** %17
%24 = bitcast i8* %23 to double*
%25 = getelementptr inbounds double, double* %24, i64 0
%26 = load double, double* %25
%27 = load double*, double** %14
store double %26, double* %27
%28 = load i8*, i8** %17
%29 = bitcast i8* %28 to double*
%30 = getelementptr inbounds double, double* %29, i64 1
%31 = load double, double* %30
%32 = load double*, double** %15
store double %31, double* %32
%33 = load i8*, i8** %17
%34 = bitcast i8* %33 to double*
%35 = getelementptr inbounds double, double* %34, i64 2
%36 = load double, double* %35
%37 = load double*, double** %16
store double %36, double* %37
%38 = load i32, i32* %18
store i32 %38, i32* %9
br label %39
39: ; preds = %22, %21
%40 = load i32, i32* %9
ret i32 %40
}

LLVM IR (-O2):
define i32 @const_magnetic_field(double %0, double %1, double %2, double %3, double* nocapture writeonly %4, double* nocapture writeonly %5, double* nocapture writeonly %6, i8* %7) {
%9 = icmp eq i8* %7, null
br i1 %9, label %19, label %10
10: ; preds = %8
%11 = bitcast i8* %7 to double*
%12 = load double, double* %11
store double %12, double* %4
%13 = getelementptr inbounds i8, i8* %7, i64 8
%14 = bitcast i8* %13 to double*
%15 = load double, double* %14
store double %15, double* %5
%16 = getelementptr inbounds i8, i8* %7, i64 16
%17 = bitcast i8* %16 to double*
%18 = load double, double* %17
store double %18, double* %6
br label %19
19: ; preds = %8, %10
%20 = phi i32 [ 1, %10 ], [ 0, %8 ]
ret i32 %20
}