#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*/ vecset(int, double *, double);
void dx_dz_fill(int i, double xx1, double xx2, double z[3], double dx_dz[9]) {
  vecset(9, dx_dz, 0.0);
  dx_dz[3 * i + i] = -z[i] * xx1;
  for (int j = 0; j < 3; j++) {
    if (j == i)
      continue;
    dx_dz[3 * i + j] = -z[j] * xx1 * xx2;
    dx_dz[3 * j + j] = -z[i] * xx1;
  }
  return;
}


x86 assembly (clang, -O0):
<dx_dz_fill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
mov    $0x9,%edi
xorps  %xmm0,%xmm0
call   1030 <vecset@plt>
mov    -0x20(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x28(%rbp),%rax
imul   $0x3,-0x4(%rbp),%ecx
add    -0x4(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3,-0x2c(%rbp)
jge    1227 <dx_dz_fill+0x117>
mov    -0x2c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jne    119c <dx_dz_fill+0x8c>
jmp    1219 <dx_dz_fill+0x109>
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mov    -0x28(%rbp),%rax
imul   $0x3,-0x4(%rbp),%ecx
add    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
movslq -0x4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x10(%rbp),%xmm0
mov    -0x28(%rbp),%rax
imul   $0x3,-0x2c(%rbp),%ecx
add    -0x2c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1181 <dx_dz_fill+0x71>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dx_dz_fill>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
mov    %edi,%ebp
xorps  %xmm0,%xmm0
mov    $0x9,%edi
mov    %rdx,%rsi
call   1030 <vecset@plt>
movsd  0x8(%rsp),%xmm3
movsd  (%rsp),%xmm2
movslq %ebp,%rax
movsd  (%r14,%rax,8),%xmm0
xorpd  0xea9(%rip),%xmm0
mulsd  %xmm2,%xmm0
lea    (%rax,%rax,2),%ecx
lea    0x0(,%rax,4),%edx
movslq %edx,%rdx
movsd  %xmm0,(%rbx,%rdx,8)
movslq %ecx,%rcx
test   %eax,%eax
je     11a9 <dx_dz_fill+0x99>
movsd  (%r14),%xmm0
movapd 0xe7f(%rip),%xmm1
xorpd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,(%rbx,%rcx,8)
movsd  (%r14,%rax,8),%xmm0
xorpd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,(%rbx)
cmp    $0x1,%eax
je     11e1 <dx_dz_fill+0xd1>
movsd  0x8(%r14),%xmm0
movapd 0xe49(%rip),%xmm1
xorpd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x8(%rbx,%rcx,8)
movsd  (%r14,%rax,8),%xmm0
xorpd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x20(%rbx)
cmp    $0x2,%eax
je     1214 <dx_dz_fill+0x104>
movsd  0x10(%r14),%xmm0
movapd 0xe11(%rip),%xmm1
xorpd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,0x10(%rbx,%rcx,8)
movsd  (%r14,%rax,8),%xmm0
xorpd  %xmm1,%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x40(%rbx)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @dx_dz_fill(i32 %0, double %1, double %2, double* %3, double* %4) {
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
store i32 %0, i32* %6
store double %1, double* %7
store double %2, double* %8
store double* %3, double** %9
store double* %4, double** %10
%12 = load double*, double** %10
%13 = call i32 @vecset(i32 9, double* %12, double 0.000000e+00)
%14 = load double*, double** %9
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds double, double* %14, i64 %16
%18 = load double, double* %17
%19 = fneg double %18
%20 = load double, double* %7
%21 = fmul double %19, %20
%22 = load double*, double** %10
%23 = load i32, i32* %6
%24 = mul nsw i32 3, %23
%25 = load i32, i32* %6
%26 = add nsw i32 %24, %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds double, double* %22, i64 %27
store double %21, double* %28
store i32 0, i32* %11
br label %29
29: ; preds = %70, %5
%30 = load i32, i32* %11
%31 = icmp slt i32 %30, 3
br i1 %31, label %32, label %73
32: ; preds = %29
%33 = load i32, i32* %11
%34 = load i32, i32* %6
%35 = icmp eq i32 %33, %34
br i1 %35, label %36, label %37
36: ; preds = %32
br label %70
37: ; preds = %32
%38 = load double*, double** %9
%39 = load i32, i32* %11
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
%42 = load double, double* %41
%43 = fneg double %42
%44 = load double, double* %7
%45 = fmul double %43, %44
%46 = load double, double* %8
%47 = fmul double %45, %46
%48 = load double*, double** %10
%49 = load i32, i32* %6
%50 = mul nsw i32 3, %49
%51 = load i32, i32* %11
%52 = add nsw i32 %50, %51
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %48, i64 %53
store double %47, double* %54
%55 = load double*, double** %9
%56 = load i32, i32* %6
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds double, double* %55, i64 %57
%59 = load double, double* %58
%60 = fneg double %59
%61 = load double, double* %7
%62 = fmul double %60, %61
%63 = load double*, double** %10
%64 = load i32, i32* %11
%65 = mul nsw i32 3, %64
%66 = load i32, i32* %11
%67 = add nsw i32 %65, %66
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds double, double* %63, i64 %68
store double %62, double* %69
br label %70
70: ; preds = %37, %36
%71 = load i32, i32* %11
%72 = add nsw i32 %71, 1
store i32 %72, i32* %11
br label %29
73: ; preds = %29
ret void
}

LLVM IR (-O2):
define void @dx_dz_fill(i32 %0, double %1, double %2, double* nocapture %3, double* %4) {
%6 = tail call i32 @vecset(i32 9, double* %4, double 0.000000e+00)
%7 = sext i32 %0 to i64
%8 = getelementptr inbounds double, double* %3, i64 %7
%9 = load double, double* %8
%10 = fneg double %9
%11 = fmul double %10, %1
%12 = mul nsw i32 %0, 3
%13 = shl nsw i32 %0, 2
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %4, i64 %14
store double %11, double* %15
%16 = sext i32 %12 to i64
%17 = icmp eq i32 %0, 0
br i1 %17, label %28, label %18
18: ; preds = %5
%19 = load double, double* %3
%20 = fneg double %19
%21 = fmul double %20, %1
%22 = fmul double %21, %2
%23 = getelementptr inbounds double, double* %4, i64 %16
store double %22, double* %23
%24 = load double, double* %8
%25 = fneg double %24
%26 = fmul double %25, %1
store double %26, double* %4
%27 = icmp eq i32 %0, 1
br i1 %27, label %41, label %28
28: ; preds = %5, %18
%29 = getelementptr inbounds double, double* %3, i64 1
%30 = load double, double* %29
%31 = fneg double %30
%32 = fmul double %31, %1
%33 = fmul double %32, %2
%34 = add nsw i64 %16, 1
%35 = getelementptr inbounds double, double* %4, i64 %34
store double %33, double* %35
%36 = load double, double* %8
%37 = fneg double %36
%38 = fmul double %37, %1
%39 = getelementptr inbounds double, double* %4, i64 4
store double %38, double* %39
%40 = icmp eq i32 %0, 2
br i1 %40, label %53, label %41
41: ; preds = %18, %28
%42 = getelementptr inbounds double, double* %3, i64 2
%43 = load double, double* %42
%44 = fneg double %43
%45 = fmul double %44, %1
%46 = fmul double %45, %2
%47 = add nsw i64 %16, 2
%48 = getelementptr inbounds double, double* %4, i64 %47
store double %46, double* %48
%49 = load double, double* %8
%50 = fneg double %49
%51 = fmul double %50, %1
%52 = getelementptr inbounds double, double* %4, i64 8
store double %51, double* %52
br label %53
53: ; preds = %41, %28
ret void
}