// File: /workspace/github_c_makefile_star2_O2/google[P]multichase/multiload.c
// Function: load_stream_triad
static void load_stream_triad(per_thread_t *t) {
#define LOOP_OPS 3
#define LOOP_ALIGN 16
  uint64_t load_loop, load_bites;
  register uint64_t N, i;
  register double *a;
  register double *b;
  register double *c;
  register double *tmp;

  load_loop =
      t->x.load_total_memory -
      (LOOP_OPS * LOOP_ALIGN);  // subract to allow aligning count/addresses
  load_loop = (load_loop / LOOP_OPS) &
              ~(LOOP_ALIGN - 1);  // divide by 3 buffers and align byte count on
                                  // LOOP_ALIGN byte multiple
  N = load_loop / sizeof(double);
  load_bites = N * sizeof(double) * LOOP_OPS;
  size_t aa = (((size_t)t->x.load_arena + LOOP_ALIGN) &
               ~(LOOP_ALIGN));  // align on 16 byte address
  a = (double *)aa;
  b = a + N;
  c = b + N;
  if (verbosity > 1) {
    printf(
        "load_arena=%p, load_total_memory=0x%lX, load_loop=0x%lX, N=0x%lX, "
        "a=%p, b=%p, c=%p\n",
        (char *)t->x.load_arena, t->x.load_total_memory, load_loop, N, a, b, c);
  }

  LOAD_MEMORY_INIT_MIBPS
  do {
    tmp = a;
    a = b;
    b = c;
    c = tmp;

    for (i = 0; i < N; ++i) {
      a[i] = b[i] + c[i];
    }
    LOAD_MEMORY_SAMPLE_MIBPS
  } while (1);
#undef LOOP_OPS
#undef LOOP_ALIGN
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0xa8(%rdi), %rsi
movq %rdi, (%rsp)
movq 0xb0(%rdi), %rcx
leaq -0x30(%rcx), %rax
pushq $0x3
popq %rdi
xorl %edx, %edx
divq %rdi
movabsq $0x7ffffffffffffff0, %r14 # imm = 0x7FFFFFFFFFFFFFF0
andq %rax, %r14
leaq 0x10(%rsi), %r15
andq $-0x11, %r15
leaq (%r15,%r14), %r12
leaq (%r12,%r14), %r13
cmpl $0x2, 0x105e2d(%rip)    # 0x50e340
jl 0x408539
movq %r14, %r8
shrq $0x3, %r8
leaq 0xcc08d(%rip), %rdi     # 0x4d45b0
movq %rcx, %rdx
movq %r14, %rcx
movq %r15, %r9
xorl %eax, %eax
pushq %r13
pushq %r12
callq 0x415070
popq %rcx
popq %rdx
leaq (%r14,%r14,2), %rax
movq %rax, 0x8(%rsp)
pushq $-0x1
popq %rbx
callq 0x403630
movq %rbx, %rdx
movq 0xcaabb(%rip), %xmm1    # 0x4d3010
movq %rax, %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd 0xcaaba(%rip), %xmm0    # 0x4d3020
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
movapd %xmm1, 0x10(%rsp)
movq %r13, %rax
xorl %ebx, %ebx
movq (%rsp), %rcx
movq %r15, %r13
movq %r12, %r15
movq %rax, %r12
xorl %eax, %eax
cmpq %rax, %r14
je 0x4085aa
movsd (%r12,%rax), %xmm0
addsd (%r13,%rax), %xmm0
movsd %xmm0, (%r15,%rax)
addq $0x8, %rax
jmp 0x40858c
incq %rbx
movq 0xc8(%rcx), %rbp
movq %r13, %rax
cmpq %rbp, %rdx
je 0x408581
cmpq $0x0, 0x8(%rcx)
movq %r13, %rax
jne 0x408581
callq 0x403630
movq %rax, %xmm0
movq 0xcaa38(%rip), %xmm1    # 0x4d3010
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movdqa %xmm1, %xmm3
movapd 0xcaa38(%rip), %xmm2    # 0x4d3020
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
subsd 0x10(%rsp), %xmm1
imulq 0x8(%rsp), %rbx
movq %rbx, %xmm0
punpckldq %xmm3, %xmm0    # xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
mulsd 0xcaa23(%rip), %xmm2    # 0x4d3048
movsd 0xcaa43(%rip), %xmm0    # 0x4d3070
mulsd %xmm0, %xmm1
mulsd %xmm0, %xmm1
divsd %xmm1, %xmm2
cvttsd2si %xmm2, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
subsd 0xcaa2b(%rip), %xmm2    # 0x4d3078
cvttsd2si %xmm2, %rdx
andq %rcx, %rdx
orq %rax, %rdx
movq (%rsp), %rax
lock
addq %rdx, 0x8(%rax)
callq 0x403630
movq 0xca9a2(%rip), %xmm1    # 0x4d3010
movq %rbp, %rdx
jmp 0x408555